Getting different result between local and CI (docker) running #3400
-
Welcome
Description of the problemWhen I am running the golangci-lint in the CI pipeline, the results shows 0 issues (after fixing all of them...) but when I am running it locally I get issues (which not showed before at all...) So my question is why am I getting different results between running locally and CI running? Version of golangci-lint$ golangci-lint --version
golangci-lint has version v1.43.0 Configuration file$ cat .golangci.yml
I dont have this file Go environment$ go version && go env
go version go1.18.3 darwin/arm64
GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/matanmarciano/Library/Caches/go-build"
GOENV="/Users/matanmarciano/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/matanmarciano/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/matanmarciano/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/matanmarciano/projects/maestro/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0z/qyf6g6zd501g1c50t_qnn8n80000gq/T/go-build3719761746=/tmp/go-build -gno-record-gcc-switches -fno-common" Verbose output of running$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/matanmarciano/projects/maestro /Users/matanmarciano/projects /Users/matanmarciano /Users /]
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]
INFO [loader] Go packages loading at mode 575 (deps|exports_file|name|types_sizes|compiled_files|files|imports) took 2.731127209s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 15.802ms
INFO [linters context/goanalysis] analyzers took 71.797423ms with top 10 stages: buildtag: 3.366708ms, typecheck: 1.960375ms, isgenerated: 1.499499ms, testinggoroutine: 1.360789ms, typedness: 1.290549ms, SA4014: 1.278459ms, fact_purity: 1.224667ms, structcheck: 1.21479ms, S1031: 1.160499ms, nilness: 1.119543ms
INFO [runner/max_same_issues] 27/30 issues with text "undeclared name: `faker`" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 11/14 issues with text "undeclared name: `multierror`" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 6/9 issues with text "undeclared name: `validator`" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 5/8 issues with text "_m.Called undefined (type *MockAllTenants has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 5/8 issues with text "\"github.com/bxcodec/faker/v3\" imported but not used" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 4/7 issues with text "_m.Called undefined (type *MockUpdater has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 3/6 issues with text "mock.AssertExpectations undefined (type *MockDeleter has no field or method AssertExpectations)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 3/6 issues with text "_m.Called undefined (type *MockDeleter has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 3/6 issues with text "undeclared name: `retryablehttp`" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "mock.AssertExpectations undefined (type *MockCreator has no field or method AssertExpectations)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "_m.Called undefined (type *MockCreator has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "_m.Called undefined (type *MockDeploymentHistory has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "\"github.com/hashicorp/go-multierror\" imported but not used" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "_m.Called undefined (type *MockAllSroVersions has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "_m.Called undefined (type *MockRolloutHTTPClient has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "cfg.Config undefined (type *configuration has no field or method Config)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "mock.AssertExpectations undefined (type *MockUpdater has no field or method AssertExpectations)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 2/5 issues with text "_m.Called undefined (type *MockDeployer has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "domain.CreatedBy undefined (type Domain has no field or method CreatedBy)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "_m.Called undefined (type *MockAllDomains has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "domain.UpdatedBy undefined (type Domain has no field or method UpdatedBy)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "sroInstance.DeletedAt undefined (type SROInstance has no field or method DeletedAt)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "sroInstance.CreatedBy undefined (type SROInstance has no field or method CreatedBy)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "sroInstance.DeletedBy undefined (type SROInstance has no field or method DeletedBy)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "sroInstance.UpdatedBy undefined (type SROInstance has no field or method UpdatedBy)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "domain.DeletedAt undefined (type Domain has no field or method DeletedAt)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "domain.CreatedAt undefined (type Domain has no field or method CreatedAt)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "domain.UpdatedAt undefined (type Domain has no field or method UpdatedAt)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "sroInstance.UpdatedAt undefined (type SROInstance has no field or method UpdatedAt)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "sroInstance.CreatedAt undefined (type SROInstance has no field or method CreatedAt)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "_m.Called undefined (type *MockAllSroInstances has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "domain.DeletedBy undefined (type Domain has no field or method DeletedBy)" were hidden, use --max-same-issues
INFO [runner/max_from_linter] 224/274 issues from linter typecheck were hidden, use --max-issues-per-linter
INFO [runner] Issues before processing: 51750, after processing: 50
INFO [runner] Processors filtering stat (out/in): max_from_linter: 50/274, severity-rules: 50/50, path_prefixer: 50/50, path_prettifier: 51750/51750, identifier_marker: 51750/51750, exclude: 51750/51750, nolint: 51750/51750, max_same_issues: 274/373, path_shortener: 50/50, exclude-rules: 51750/51750, uniq_by_line: 373/51750, source_code: 50/50, sort_results: 50/50, cgo: 51750/51750, filename_unadjuster: 51750/51750, skip_files: 51750/51750, max_per_file_from_linter: 373/373, skip_dirs: 51750/51750, autogenerated_exclude: 51750/51750, diff: 373/373
INFO [runner] processing took 1.988891162s with stages: exclude-rules: 1.286642083s, identifier_marker: 643.974334ms, path_prettifier: 24.030832ms, nolint: 18.897625ms, skip_dirs: 5.967042ms, cgo: 2.792208ms, autogenerated_exclude: 1.896833ms, filename_unadjuster: 1.642291ms, uniq_by_line: 1.564874ms, max_same_issues: 897.334µs, source_code: 559µs, max_per_file_from_linter: 11.207µs, max_from_linter: 9.959µs, path_shortener: 4.584µs, skip_files: 333ns, sort_results: 249ns, severity-rules: 208ns, path_prefixer: 83ns, exclude: 42ns, diff: 41ns
INFO [runner] linters took 7.752097583s with stages: goanalysis_metalinter: 5.763026375s
internal/test/test_runner.go:29:2: dbUrlValue declared but not used (typecheck)
dbUrlValue := os.Getenv(dbUrl)
^
internal/test/test_runner.go:61:9: cannot use &(assertWrapper literal) (value of type *assertWrapper) as Assert value in return statement (typecheck)
return &assertWrapper{
^
services/deployment/config/config.go:24:20: c.Config undefined (type *configuration has no field or method Config) (typecheck)
return http.Url(c.Config().StringOrDefault(ConfigKeyRolloutUrl, "http://******"))
^
services/deployment/config/config.go:28:39: cfg.MaestroServiceName undefined (type *configuration has no field or method MaestroServiceName) (typecheck)
getter := config.ConfigGetterFor(cfg.MaestroServiceName())
^
services/deployment/config/config.go:32:28: cfg.Config undefined (type *configuration has no field or method Config) (typecheck)
MaxIdleConns: cfg.Config().IntOrDefault(getter(webapp.MaxIdleConnsKeyMask), webapp.DefaultMaxConns),
^
services/deployment/config/config.go:33:28: cfg.Config undefined (type *configuration has no field or method Config) (typecheck)
MaxConnsPerHost: cfg.Config().IntOrDefault(getter(webapp.MaxConnsPerHostKeyMask), webapp.DefaultMaxConns),
^
services/deployment/config/config.go:34:28: cfg.Config undefined (type *configuration has no field or method Config) (typecheck)
MaxIdleConnsPerHost: cfg.Config().IntOrDefault(getter(webapp.MaxConnsPerHostKeyMask), webapp.DefaultMaxConns),
^
internal/meta/version.go:17:25: undeclared name: `version` (typecheck)
func CurrentVersion() (*version.Version, error) {
^
internal/meta/version.go:20:25: undeclared name: `version` (typecheck)
currentVersion, err := version.NewVersion(fullVersionString)
^
internal/meta/version.go:6:2: "github.com/hashicorp/go-version" imported but not used (typecheck)
"github.com/hashicorp/go-version"
^
services/deployment/instance_nomad_templates/mock_AllInstanceNomadTemplate.go:29:12: _m.Called undefined (type *MockAllInstanceNomadTemplate has no field or method Called) (typecheck)
ret := _m.Called(ctx, globalTenantID, sroEnvironment)
^
services/deployment/instance_nomad_templates/mock_AllInstanceNomadTemplate.go:77:12: _m.Called undefined (type *MockAllInstanceNomadTemplate has no field or method Called) (typecheck)
ret := _m.Called(ctx, globalTenantID, sroEnvironment, component)
^
services/deployment/instance_nomad_templates/mock_AllInstanceNomadTemplate.go:129:26: mock.AssertExpectations undefined (type *MockAllInstanceNomadTemplate has no field or method AssertExpectations) (typecheck)
t.Cleanup(func() { mock.AssertExpectations(t) })
^
services/deployment/instance_nomad_templates/test_helpers.go:29:9: undeclared name: `faker` (typecheck)
err := faker.SetRandomNumberBoundaries(1, 10000)
^
services/deployment/instance_nomad_templates/test_helpers.go:31:2: undeclared name: `faker` (typecheck)
faker.SetGenerateUniqueValues(true)
^
services/deployment/instance_nomad_templates/test_helpers.go:32:8: undeclared name: `faker` (typecheck)
err = faker.FakeData(&instanceNomadTemplateDetails)
^
services/deployment/instance_nomad_templates/test_helpers.go:4:2: "github.com/bxcodec/faker/v3" imported but not used (typecheck)
"github.com/bxcodec/faker/v3"
^
services/deploystatusupdater/pipeline.go:33:4: p.Start undefined (type *statusUpdatePipeline has no field or method Start) (typecheck)
p.Start = time.Now()
^
services/deploystatusupdater/pipeline.go:85:7: p.TotalProcessed undefined (type *statusUpdatePipeline has no field or method TotalProcessed) (typecheck)
p.TotalProcessed += 1
^
services/deploystatusupdater/pipeline.go:167:7: p.TotalUpdated undefined (type *statusUpdatePipeline has no field or method TotalUpdated) (typecheck)
p.TotalUpdated += 1
^
internal/clients/client_registry.go:96:21: undeclared name: `cleanhttp` (typecheck)
pooledTransport := cleanhttp.DefaultPooledTransport()
^
internal/clients/clientregistry_client.go:39:21: invalid operation: cannot compare c.httpClient == nil (operator == not defined on untyped nil) (typecheck)
if c.httpClient == nil {
^
internal/clients/clientregistry_client.go:74:21: invalid operation: cannot compare c.httpClient != nil (operator != not defined on untyped nil) (typecheck)
if c.httpClient != nil {
^
internal/clients/deployment.go:56:21: undeclared name: `cleanhttp` (typecheck)
pooledTransport := cleanhttp.DefaultPooledTransport()
^
internal/clients/mock_ClientRegistryHTTPClient.go:33:12: _m.Called undefined (type *MockClientRegistryHTTPClient has no field or method Called) (typecheck)
ret := _m.Called(globalTenantID, sroEnvironment, ctx)
^
internal/clients/mock_ClientRegistryHTTPClient.go:89:26: mock.AssertExpectations undefined (type *MockClientRegistryHTTPClient has no field or method AssertExpectations) (typecheck)
t.Cleanup(func() { mock.AssertExpectations(t) })
^
internal/clients/mock_HTTPClientFactory.go:31:12: _m.Called undefined (type *MockHTTPClientFactory has no field or method Called) (typecheck)
ret := _m.Called(ctx, baseUrl, urlPath, httpMethod, body)
^
internal/clients/mock_HTTPClientFactory.go:81:12: _m.Called undefined (type *MockHTTPClientFactory has no field or method Called) (typecheck)
ret := _m.Called(baseUrl)
^
internal/clients/mock_HTTPClientFactory.go:129:26: mock.AssertExpectations undefined (type *MockHTTPClientFactory has no field or method AssertExpectations) (typecheck)
t.Cleanup(func() { mock.AssertExpectations(t) })
^
internal/clients/clientregistry_client_test.go:51:14: mockFactory.On undefined (type *MockHTTPClientFactory has no field or method On) (typecheck)
mockFactory.On("DoAuthenticatedReq", test.AnyContext, urlPath, types.MustParsePath(fmt.Sprintf("/tenant/%d/sro/%s", globalTenantID, sroEnvironment.String())), http.MethodGet, "").Return(expectedResponse, nil)
^
internal/clients/client_registry.go:11:2: "github.com/hashicorp/go-cleanhttp" imported but not used (typecheck)
"github.com/hashicorp/go-cleanhttp"
^
internal/clients/deployment.go:10:2: "github.com/hashicorp/go-cleanhttp" imported but not used (typecheck)
"github.com/hashicorp/go-cleanhttp"
^
internal/db/audit.go:75:30: missing type in composite literal (typecheck)
stmt.AddClause(clause.Set{{Column: clause.Column{Name: sd.Field.DBName}, Value: deletedBy}})
^
internal/db/db.go:130:19: a.Session undefined (type *ApplicationDatabase has no field or method Session) (typecheck)
DB: a.Session(config),
^
internal/db/db_middleware.go:27:17: session.Transaction undefined (type *ApplicationDatabase has no field or method Transaction) (typecheck)
err := session.Transaction(func(tx *gorm.DB) error {
^
internal/db/nullable_types.go:35:5: n.Valid undefined (type *NullInt32 has no field or method Valid) (typecheck)
n.Valid = false
^
internal/db/nullable_types.go:38:30: n.Int32 undefined (type *NullInt32 has no field or method Int32) (typecheck)
err := json.Unmarshal(b, &n.Int32)
^
internal/db/nullable_types.go:41:5: n.Valid undefined (type *NullInt32 has no field or method Valid) (typecheck)
n.Valid = true
^
internal/db/nullable_types.go:78:5: n.Valid undefined (type *NullString has no field or method Valid) (typecheck)
n.Valid = false
^
internal/db/nullable_types.go:81:30: n.String undefined (type *NullString has no field or method String) (typecheck)
err := json.Unmarshal(b, &n.String)
^
internal/db/nullable_types.go:84:5: n.Valid undefined (type *NullString has no field or method Valid) (typecheck)
n.Valid = true
^
internal/db/nullable_types.go:121:5: n.Valid undefined (type *NullBool has no field or method Valid) (typecheck)
n.Valid = false
^
internal/db/nullable_types.go:124:30: n.Bool undefined (type *NullBool has no field or method Bool) (typecheck)
err := json.Unmarshal(b, &n.Bool)
^
internal/db/nullable_types.go:127:5: n.Valid undefined (type *NullBool has no field or method Valid) (typecheck)
n.Valid = true
^
internal/db/nullable_types_test.go:29:55: target.FieldWithPointerWithNullValue.Valid undefined (type *NullInt32 has no field or method Valid) (typecheck)
assert.False(t, target.FieldWithPointerWithNullValue.Valid)
^
internal/db/nullabletypes/sql_nulltime.go:14:5: nt.Time undefined (type *NullTime has no field or method Time) (typecheck)
nt.Time, nt.Valid = value.(time.Time)
^
internal/db/nullabletypes/sql_nulltime.go:37:6: nt.Valid undefined (type *NullTime has no field or method Valid) (typecheck)
nt.Valid = false
^
internal/db/nullabletypes/sql_nulltime.go:40:31: nt.Time undefined (type *NullTime has no field or method Time) (typecheck)
err := json.Unmarshal(b, &nt.Time)
^
internal/db/nullabletypes/sql_nulltime.go:43:6: nt.Valid undefined (type *NullTime has no field or method Valid) (typecheck)
nt.Valid = true
^
internal/webapp/api/baseUrl.go:11:41: b.WithPath undefined (type BaseUrl has no field or method WithPath) (typecheck)
return types.LogAndIgnore.IfErrorUrl(b.WithPath(path))
^
INFO File cache stats: 19 entries of total size 61.4KiB
INFO Memory: 107 samples, avg is 224.1MB, max is 301.4MB
INFO Execution took 10.526854084s Code example or link to a public repository// add your code here |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
We are seeing a similar issue to the following. This should not be happening since the spec says (my emphasis):
|
Beta Was this translation helpful? Give feedback.
-
I got the same problem, have you got the solution? |
Beta Was this translation helpful? Give feedback.
-
My issue turned out to be different Go versions locally vs in the CI and the library we were referencing only supported Go 1.18. Local was Go 1.18 (no issues), but CI was Go 1.17 (typecheck errors). I found it by trying to run
|
Beta Was this translation helpful? Give feedback.
-
Facing same issue.
In the contaner:
Numbers inside docker are very strange. My host machine runs with MacOS Ventura v13.4 |
Beta Was this translation helpful? Give feedback.
-
Hi Guys! Any news so far? Linter 1.55.2 |
Beta Was this translation helpful? Give feedback.
Well, I solved it by making sure:
So I believe (1) should solve your issue.