diff --git a/.golangci.yml b/.golangci.yml index ad50dd7c2..59296f39b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,15 +1,136 @@ -# See https://golangci-lint.run/usage/configuration/#config-file for more information run: - timeout: 5m + go: "1.22" + modules-download-mode: readonly + timeout: 10m + linters: disable-all: true enable: - - gofmt - - golint - - goimports - fast: false + - bodyclose # checks whether HTTP response body is closed successfully. + - errcheck # finds unchecked errors + - errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error + - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13. + - exhaustive # check exhaustiveness of enum switch statements. + - exportloopref # checks for pointers to enclosing loop variables. + - forcetypeassert # finds forced type assertions. + - gci # gci controls Go package import order and makes it always deterministic. + - gocritic # provides diagnostics that check for bugs, performance and style issues. + - godot # check if comments end in a period. + - err113 # checks the errors handling expressions. + - goimports # check import statements are formatted according to the 'goimport' command + - gosec # inspects source code for security problems. + - gosimple # specializes in simplifying code. + - govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string. + - misspell # finds commonly misspelled English words in comments. + - nolintlint # reports ill-formed or insufficient nolint directives. + - revive # linter for Go. Drop-in replacement of golint. + - staticcheck # set of rules from staticcheck + - stylecheck # replacement for golint. + - unparam # reports unused function parameters. + - unused # checks Go code for unused constants, variables, functions and types. + - whitespace # detection of leading and trailing whitespace. + - typecheck # reports compilation errors + + - asciicheck # checks for non-ASCII identifiers + - bidichk # checks for dangerous unicode character sequences + - cyclop # calculates cyclomatic complexities of functions or packages + - dogsled # finds assignments/declarations with too many blank identifiers + - durationcheck # detect cases where two time.Duration values are being multiplied in possibly erroneous ways + - gocognit # calculates cognitive complexities of functions + - gofmt # checks for formatting + - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod. + - gomodguard # allow and block list linter for direct Go module dependencies. + - goprintffuncname # checks that printf-like functions are named with f at the end. + - importas # enforces consistent import aliases. + - ineffassign # detects when assignments to existing variables are not used. + - makezero # finds slice declarations with non-zero initial length. + - nakedret # finds naked returns in functions greater than a specified function length. + - nilerr # finds the code that returns nil even if it checks that the error is not nil. + - noctx # finds sending http request without context.Context. + - prealloc # finds slice declarations that could potentially be pre-allocated. + - predeclared # finds code that shadows one of Go's predeclared identifiers. + - promlinter # check Prometheus metrics naming via promlint. + - rowserrcheck # checks whether Err of rows is checked successfully. + - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed. + - tenv # detects using os.Setenv instead of t.Setenv since Go1.17. + - thelper # detects Go test helpers without t.Helper() call and checks the consistency of test helpers. + - unconvert # removes unnecessary type conversions. + - wastedassign # finds wasted assignment statements. + linters-settings: - gofmt: - simplify: false + govet: + enable: + - shadow + + gocritic: + enabled-tags: + - performance + + staticcheck: + checks: [ "all" ] + + stylecheck: + checks: [ "all" ] + + revive: + # see https://github.com/mgechev/revive#available-rules for details. + ignore-generated-header: true + severity: warning + directives: + - name: specify-disable-reason + arguments: + severity: "error" + rules: + - name: blank-imports + - name: context-as-argument + - name: context-keys-type + - name: dot-imports + - name: error-return + - name: error-strings + - name: error-naming + - name: exported + arguments: + - disableStutteringCheck + - name: if-return + - name: increment-decrement + - name: var-naming + - name: package-comments + - name: range + - name: receiver-naming + - name: time-naming + - name: indent-error-flow + - name: errorf + - name: empty-block + - name: superfluous-else + - name: unused-parameter + - name: unreachable-code + - name: redefines-builtin-id + - name: indent-error-flow + severity: warning + - name: add-constant + severity: warning + arguments: + - maxLitCount: "3" + allowStrs: '""' + allowInts: "0,1,2,3" + allowFloats: "0.0,0.,1.0,1.,2.0,2." + issues: - exclude-use-default: false + exclude-rules: + - path: '(.+)_test\.go' + linters: + - err113 + - gosec + - bodyclose + - path: '(.+)_test\.go' + linters: + - revive + text: "^add-constant:.*" + - path: 'app/config/settings/settings\.go' + linters: + - revive + text: "^add-constant:.*" + +output: + formats: + - format: line-number diff --git a/go.mod b/go.mod index 5d0036c9c..408cacc85 100644 --- a/go.mod +++ b/go.mod @@ -1,58 +1,108 @@ module github.com/hellofresh/janus -go 1.15 +go 1.22 require ( code.cloudfoundry.org/bytefmt v0.0.0-20180108190415-b31f603f5e1e contrib.go.opencensus.io/exporter/jaeger v0.2.1 contrib.go.opencensus.io/exporter/prometheus v0.3.0 - github.com/DataDog/datadog-go v0.0.0-20180330214955-e67964b4021a // indirect github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/asaskevich/govalidator v0.0.0-20171111151018-521b25f4b05f - github.com/bshuster-repo/logrus-logstash-hook v0.4.1 // indirect - github.com/cactus/go-statsd-client v3.1.1+incompatible // indirect github.com/cucumber/godog v0.10.0 github.com/cucumber/messages-go/v10 v10.0.3 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/felixge/httpsnoop v1.0.0 - github.com/fiam/gounidecode v0.0.0-20150629112515-8deddbd03fec // indirect github.com/fsnotify/fsnotify v1.4.9 github.com/go-chi/chi v3.3.2+incompatible github.com/go-redis/redis/v7 v7.4.0 github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e github.com/gofrs/uuid v3.3.0+incompatible github.com/google/go-github v17.0.0+incompatible - github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect github.com/hellofresh/health-go/v3 v3.2.0 github.com/hellofresh/logging-go v0.1.6 github.com/hellofresh/opencensus-go-extras v0.0.0-20191004131501-7bd94f603dcf github.com/hellofresh/stats-go v0.8.0 github.com/kelseyhightower/envconfig v1.3.0 - github.com/klauspost/compress v1.10.10 // indirect github.com/magiconair/properties v1.8.1 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/mapstructure v1.1.2 - github.com/onsi/ginkgo v1.13.0 // indirect github.com/opentracing/opentracing-go v1.2.0 github.com/rafaeljesus/retry-go v0.0.0-20171214204623-5981a380a879 github.com/rs/cors v1.4.0 github.com/sirupsen/logrus v1.7.0 github.com/spf13/cobra v1.0.0 - github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.7.1 github.com/stretchr/testify v1.6.1 github.com/tidwall/gjson v1.1.0 - github.com/tidwall/match v1.0.0 // indirect github.com/ulule/limiter/v3 v3.5.0 go.mongodb.org/mongo-driver v1.4.1 go.opencensus.io v0.23.0 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 golang.org/x/net v0.0.0-20201110031124-69a78807bb2b golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d +) + +require ( + github.com/DataDog/datadog-go v0.0.0-20180330214955-e67964b4021a // indirect + github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect + github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect + github.com/aws/aws-sdk-go v1.29.15 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bshuster-repo/logrus-logstash-hook v0.4.1 // indirect + github.com/cactus/go-statsd-client v3.1.1+incompatible // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/cucumber/gherkin-go/v11 v11.0.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fiam/gounidecode v0.0.0-20150629112515-8deddbd03fec // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/gogo/protobuf v1.3.1 // indirect + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + github.com/golang/protobuf v1.4.3 // indirect + github.com/golang/snappy v0.0.1 // indirect + github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect + github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect + github.com/hashicorp/go-immutable-radix v1.2.0 // indirect + github.com/hashicorp/go-memdb v1.2.1 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect + github.com/klauspost/compress v1.10.10 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/onsi/ginkgo v1.13.0 // indirect + github.com/onsi/gomega v1.10.1 // indirect + github.com/pelletier/go-toml v1.4.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.9.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.15.0 // indirect + github.com/prometheus/procfs v0.2.0 // indirect + github.com/prometheus/statsd_exporter v0.20.0 // indirect + github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect + github.com/spf13/afero v1.1.2 // indirect + github.com/spf13/cast v1.3.0 // indirect + github.com/spf13/jwalterweatherman v1.0.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + github.com/tidwall/match v1.0.0 // indirect + github.com/uber/jaeger-client-go v2.25.0+incompatible // indirect + github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect + github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc // indirect + golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect + golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e // indirect + golang.org/x/text v0.3.3 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/api v0.29.0 // indirect + google.golang.org/appengine v1.6.5 // indirect + google.golang.org/protobuf v1.25.0 // indirect + gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect gopkg.in/alexcesaro/statsd.v2 v2.0.0 // indirect gopkg.in/gemnasium/logrus-graylog-hook.v2 v2.0.6 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/ini.v1 v1.51.0 // indirect + gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect ) diff --git a/go.sum b/go.sum index 425c14854..7916c6588 100644 --- a/go.sum +++ b/go.sum @@ -80,7 +80,6 @@ github.com/cactus/go-statsd-client v3.1.1+incompatible/go.mod h1:cMRcwZDklk7hXp+ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -221,7 +220,6 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= @@ -533,7 +531,6 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3 github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -579,7 +576,6 @@ go.opencensus.io v0.10.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -664,13 +660,11 @@ golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= @@ -806,7 +800,6 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= @@ -852,7 +845,6 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=