genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0

format by linter

This commit is contained in:
Martin Geno 2017-06-22 20:36:11 +02:00
parent 99d62fcb47
commit 1e84ad95d6
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
11 changed files with 31 additions and 29 deletions

View File

@ -21,7 +21,7 @@ func tempPercent(value, max int) int {
// Function to calculate a partial radius, depending on a percentage value // Function to calculate a partial radius, depending on a percentage value
func tempProcessRadius(value, max, radius int) float64 { func tempProcessRadius(value, max, radius int) float64 {
return (1 - float64(value) / float64(max)) * float64(radius) * 2 * 3.14 return (1 - float64(value)/float64(max)) * float64(radius) * 2 * 3.14
} }
// Function to get the SVG, that shows the availability with a traffic light food labeling system for a given good // Function to get the SVG, that shows the availability with a traffic light food labeling system for a given good

View File

@ -22,7 +22,7 @@ func Read(r *http.Request, to interface{}) (err error) {
func Write(w http.ResponseWriter, data interface{}) { func Write(w http.ResponseWriter, data interface{}) {
js, err := json.Marshal(data) js, err := json.Marshal(data)
if err != nil { if err != nil {
http.Error(w, "failed to encode response: " + err.Error(), http.StatusInternalServerError) http.Error(w, "failed to encode response: "+err.Error(), http.StatusInternalServerError)
return return
} }
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")

View File

@ -14,7 +14,7 @@ func TestWorker(t *testing.T) {
runtime := 0 runtime := 0
w := NewWorker(time.Duration(5) * time.Millisecond, func() { w := NewWorker(time.Duration(5)*time.Millisecond, func() {
runtime = runtime + 1 runtime = runtime + 1
}) })
go w.Start() go w.Start()

View File

@ -28,8 +28,8 @@ func (d *Duration) UnmarshalTOML(dataInterface interface{}) error {
return fmt.Errorf("invalid duration: \"%s\"", data) return fmt.Errorf("invalid duration: \"%s\"", data)
} }
unit := data[len(data) - 1] unit := data[len(data)-1]
value, err := strconv.Atoi(string(data[:len(data) - 1])) value, err := strconv.Atoi(string(data[:len(data)-1]))
if err != nil { if err != nil {
return fmt.Errorf("unable to parse duration %s: %s", data, err) return fmt.Errorf("unable to parse duration %s: %s", data, err)
} }

View File

@ -8,7 +8,6 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
// Function to test UnmarshalTOML() // Function to test UnmarshalTOML()
func TestDuration(t *testing.T) { func TestDuration(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)

View File

@ -1 +1,2 @@
blub invalid structur of a config file
(should not be able unmarshal to the config struct )

View File

@ -6,8 +6,9 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/genofire/hs_master-kss-monolith/lib/log"
"sync" "sync"
"github.com/genofire/hs_master-kss-monolith/lib/log"
) )
// URL to the microservice, which manages permissions // URL to the microservice, which manages permissions

View File

@ -6,8 +6,9 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/genofire/hs_master-kss-monolith/lib/log"
"sync" "sync"
"github.com/genofire/hs_master-kss-monolith/lib/log"
) )
// URL to the microservice which manages the products (product catalogue) // URL to the microservice which manages the products (product catalogue)