bricks
bricks copied to clipboard
Fix current linter issues
Running make lint throws a lot of warnings. We probably want to fix/address them.
$ make lint
/Users/juliusfoitzik/go/bin/golangci-lint run
maintenance/log/handler.go:88:5: `noXid` is unused (deadcode)
var noXid = errors.New("no xid")
^
http/jsonapi/generator/generate_helper.go:16:7: `pkgRuntime` is unused (deadcode)
const pkgRuntime = "github.com/pace/bricks/http/jsonapi/runtime"
^
http/jsonapi/errors_test.go:53:18: Error return value of `json.Unmarshal` is not checked (errcheck)
json.Unmarshal(buffer.Bytes(), &output)
^
http/jsonapi/request.go:277:32: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errcheck)
json.NewEncoder(buf).Encode(data.Relationships[args[1]])
^
http/jsonapi/request.go:278:32: Error return value of `(*encoding/json.Decoder).Decode` is not checked (errcheck)
json.NewDecoder(buf).Decode(relationship)
^
http/jsonapi/request.go:305:32: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errcheck)
json.NewEncoder(buf).Encode(
^
http/jsonapi/request.go:308:32: Error return value of `(*encoding/json.Decoder).Decode` is not checked (errcheck)
json.NewDecoder(buf).Decode(relationship)
^
http/jsonapi/request_test.go:364:28: Error return value of `(*encoding/json.Encoder).Encode` is not checked (errcheck)
json.NewEncoder(in).Encode(payload)
^
http/jsonapi/request_test.go:1097:16: Error return value of `MarshalPayload` is not checked (errcheck)
MarshalPayload(out, testModel)
^
http/jsonapi/request_test.go:1104:27: Error return value of `MarshalOnePayloadEmbedded` is not checked (errcheck)
MarshalOnePayloadEmbedded(out, testModel())
^
http/jsonapi/request_test.go:1107:18: Error return value of `UnmarshalPayload` is not checked (errcheck)
UnmarshalPayload(out, blog)
^
http/jsonapi/response_test.go:30:16: Error return value of `MarshalPayload` is not checked (errcheck)
MarshalPayload(out1, book)
^
http/jsonapi/response_test.go:46:16: Error return value of `MarshalPayload` is not checked (errcheck)
MarshalPayload(out2, books)
^
http/jsonapi/runtime.go:83:18: Error return value of `r.instrumentCall` is not checked (errcheck)
r.instrumentCall(UnmarshalStart, UnmarshalStop, func() error {
^
maintenance/errors/raven/client.go:374:15: Error return value of `client.SetDSN` is not checked (errcheck)
client.SetDSN(os.Getenv("SENTRY_DSN"))
^
maintenance/errors/raven/client.go:956:9: Error return value of `io.Copy` is not checked (errcheck)
io.Copy(ioutil.Discard, res.Body)
^
maintenance/errors/raven/client.go:976:16: Error return value of `deflate.Write` is not checked (errcheck)
deflate.Write(packetJSON)
^
http/jsonapi/generator/generate_security.go:115:20: Error return value of `json.Unmarshal` is not checked (errcheck)
json.Unmarshal(data, &url)
^
http/transport/chainable_test.go:37:14: Error return value of `client.Get` is not checked (errcheck)
client.Get(server.URL + "/test001")
^
http/transport/chainable_test.go:42:13: Error return value of `client.Get` is not checked (errcheck)
client.Get(server.URL + "/test002")
^
http/transport/locale_round_tripper_test.go:35:15: Error return value of `lrt.RoundTrip` is not checked (errcheck)
lrt.RoundTrip(r.WithContext(locale.WithLocale(context.Background(), l)))
^
http/jsonapi/runtime/standart_params_test.go:100:14: Error return value of `db.DropTable` is not checked (errcheck)
db.DropTable(&TestModel{}, &orm.DropTableOptions{
^
maintenance/errors/raven/client.go:341:3: ineffectual assignment to `i` (ineffassign)
i++
^
http/jsonapi/runtime/standart_params_test.go:69:13: ineffectual assignment to `err` (ineffassign)
urlParams, err = runtime.ReadURLQueryParameters(r, mapper, &testValueSanitizer{})
^
http/jsonapi/runtime/standart_params_test.go:79:13: ineffectual assignment to `err` (ineffassign)
urlParams, err = runtime.ReadURLQueryParameters(r, mapper, &testValueSanitizer{})
^
http/jsonapi/runtime/standart_params_test.go:92:13: ineffectual assignment to `err` (ineffassign)
urlParams, err = runtime.ReadURLQueryParameters(r, mapper, &testValueSanitizer{})
^
maintenance/errors/raven/stacktrace.go:31:6: S1002: should omit comparison to bool constant, can be simplified to `frame.InApp` (gosimple)
if frame.InApp == true && frame.Module != "" && frame.Function != "" {
^
http/jsonapi/response_test.go:42:14: S1030: should use out1.String() instead of string(out1.Bytes()) (gosimple)
fmt.Println(string(out1.Bytes()))
^
http/longpoll/longpoll_test.go:17:41: S1024: should use time.Until instead of t.Sub(time.Now()) (gosimple)
assert.Equal(t, time.Millisecond*999, budget.Sub(time.Now()).Truncate(time.Millisecond))
^
http/longpoll/longpoll_test.go:29:35: S1024: should use time.Until instead of t.Sub(time.Now()) (gosimple)
assert.Equal(t, time.Second*59, budget.Sub(time.Now()).Truncate(time.Second))
^
maintenance/errors/context_test.go:21:19: lostcancel: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak (govet)
exceededContext, _ := context.WithTimeout(backgroundContext, time.Millisecond)
^
http/jsonapi/runtime/error.go:119:4: SA4006: this value of `ev` is never used (staticcheck)
ev = ev.Fields(*source)
^
http/jsonapi/request_test.go:205:7: type `FooStruct` is unused (unused)
make: *** [lint] Error 1