Skip to content

1.33.0 to 1.35.0 upgrade fail #1640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
esinek opened this issue Jan 10, 2021 · 16 comments · Fixed by #1642
Closed
3 tasks done

1.33.0 to 1.35.0 upgrade fail #1640

esinek opened this issue Jan 10, 2021 · 16 comments · Fixed by #1642
Labels
bug Something isn't working dependencies Relates to an upstream dependency

Comments

@esinek
Copy link

esinek commented Jan 10, 2021

Thank you for creating the issue!

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.33.0 built from b90551c on 2020-11-23T05:15:36Z
Config file
$ cat .golangci.yml
run:
  concurrency: 4
  deadline: 15m
  issues-exit-code: 1
  tests: true
  skip-dirs:
    - vendor
    - tools
  modules-download-mode: vendor
output:
  format: colored-line-number
  print-issued-lines: true
  print-linter-name: true
linters-settings:
  errcheck:
    check-type-assertions: true
    check-blank: true
  govet:
    check-shadowing: false
  golint:
    min-confidence: 0.8
  gofmt:
    simplify: true
  goimports:
    local-prefixes: github.com/org/project,stash
  gocyclo:
    min-complexity: 60
  maligned:
    suggest-new: true
  dupl:
    threshold: 100
  goconst:
    min-len: 3
    min-occurrences: 3
  depguard:
    list-type: blacklist
    include-go-root: false
    packages:
      - github.com/sirupsen/logrus
  misspell:
    locale: US
    ignore-words:
      - processs
      - cancelled
  lll:
    line-length: 140
    tab-width: 1
  unused:
    check-exported: false
  unparam:
    check-exported: false
  nakedret:
    max-func-lines: 30
  prealloc:
    simple: true
    range-loops: true
    for-loops: false
  gocritic:
    enabled-checks:
      - argOrder
      - badCond
      - boolExprSimplify
      - builtinShadow
      - caseOrder
      - codegenComment
      - commentedOutImport
      - defaultCaseOrder
      - deprecatedComment
      - dupArg
      - dupBranchBody
      - dupCase
      - dupSubExpr
      - emptyFallthrough
      - equalFold
      - exitAfterDefer
      - flagDeref
      - flagName
      - hexLiteral
      - indexAlloc
      - initClause
      - methodExprCall
      - nilValReturn
      - octalLiteral
      - offBy1
      - ptrToRefParam
      - rangeExprCopy
      - regexpMust
      - stringXbytes
      - switchTrue
      - typeAssertChain
      - typeSwitchVar
      - typeUnparen
      - underef
      - unlabelStmt
      - unlambda
      - unnecessaryBlock
      - unslice
      - valSwap
      - weakCond
      - yodaStyleExpr
      - commentFormatting
      - emptyStringTest
      - assignOp
      - captLocal
      - sloppyLen
      - sloppyReassign
      - importShadow
linters:
  enable-all: true
  disable:
    - unused
    - dupl
    - gochecknoglobals
    - goconst
    - lll
    - maligned
    - scopelint
    - unparam
    - godox
    - funlen
    - whitespace
    - dogsled
    - gocognit
    - wsl
    - gomnd
    - godot
    - nestif
    - goerr113
    - gofumpt
    - exhaustive
    - nlreturn
    - gci
    - wrapcheck
    - errorlint
    - exhaustivestruct
    - paralleltest
issues:
  exclude:
    - abcdef
  exclude-rules:
    - path: _test\.go,testhelper.go
      linters:
        - gocyclo
        - errcheck
        - dupl
        - gosec
        - golint
    - path: model/containerdetail\.go
      text: "don't use underscores in Go names"
      linters:
        - golint
    - path: model/containerdetail\.go
      text: "ST1003:"
      linters:
        - stylecheck
    - path: internal/hmac/
      text: "weak cryptographic primitive"
      linters:
        - gosec
    - path: zplgfa.go
      linters:
        - staticcheck
        - errcheck
        - gocritic
    - path: order/process/ordershipper/bizlogic.go
      linters:
        - gocyclo
    - linters:
        - stylecheck
      text: "ST1000:"
    - linters:
        - stylecheck
      text: "ST1005:"
    - linters:
        - gosimple
      text: "S1025:"
  exclude-use-default: false
  max-issues-per-linter: 0
  max-same-issues: 0
  new: false
Go environment
$ go version && go env
+ go version
go version go1.15.6 linux/amd64
+ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/go/src/stash.mycompany.com/myproject/myrepo/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build719648724=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
+ golangci-lint cache clean
+ golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /go/src/stash.mycompany.com/myproject/myrepo /go/src/stash.mycompany.com/myproject /go/src/stash.mycompany.com /go/src /go / /root]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 35 linters: [asciicheck bodyclose deadcode depguard errcheck exportloopref gochecknoinits gocritic gocyclo gofmt goheader goimports golint gomodguard goprintffuncname gosec gosimple govet ineffassign interfacer misspell nakedret noctx nolintlint prealloc rowserrcheck sqlclosecheck staticcheck structcheck stylecheck testpackage tparallel typecheck unconvert varcheck]"
level=info msg="[loader] Go packages loading at mode 575 (exports_file|files|imports|name|compiled_files|deps|types_sizes) took 3m4.733744406s"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 587.482425ms"
level=info msg="[linters context/goanalysis] analyzers took 34m27.156952216s with top 10 stages: buildir: 6m42.218514408s, buildssa: 5m31.474221648s, the_only_name: 2m31.457721374s, interfacer: 1m49.544045281s, unconvert: 1m45.025659095s, goimports: 1m6.280134605s, gosec: 51.174513109s, gocritic: 47.211919613s, fact_purity: 38.552202083s, gofmt: 38.339591429s"
level=info msg="[runner/skip dirs] Skipped 5 issues from dir tools/cmd/lazyloadingvalidator by pattern tools"
level=info msg="[runner/skip dirs] Skipped 143 issues from dir tools/cmd/codegen by pattern tools"
level=info msg="[runner/skip dirs] Skipped 32 issues from dir tools/cmd/codemerge by pattern tools"
level=info msg="[runner] Issues before processing: 3900, after processing: 0"
level=info msg="[runner] Processors filtering stat (out/in): cgo: 3900/3900, filename_unadjuster: 3900/3900, skip_files: 3900/3900, skip_dirs: 3654/3900, exclude-rules: 1/3625, identifier_marker: 3625/3625, autogenerated_exclude: 3625/3654, path_prettifier: 3900/3900, exclude: 3625/3625, nolint: 0/1"
level=info msg="[runner] processing took 358.348775ms with stages: path_prettifier: 185.591449ms, identifier_marker: 69.644988ms, autogenerated_exclude: 51.265857ms, exclude-rules: 25.75456ms, skip_dirs: 14.09445ms, exclude: 8.197272ms, nolint: 2.517812ms, cgo: 734.174µs, filename_unadjuster: 542.695µs, max_same_issues: 1.49µs, uniq_by_line: 915ns, skip_files: 520ns, path_shortener: 482ns, source_code: 384ns, diff: 375ns, max_from_linter: 368ns, sort_results: 313ns, severity-rules: 305ns, max_per_file_from_linter: 233ns, path_prefixer: 133ns"
level=info msg="[runner] linters took 2m40.546575132s with stages: goanalysis_metalinter: 2m40.188116541s"
level=info msg="File cache stats: 4654 entries of total size 39.4MiB"
level=info msg="Memory: 3306 samples, avg is 833.2MB, max is 2449.3MB"
level=info msg="Execution took 5m45.891142429s"

I'm seeing issues with version 1.35.0 that do not exist with version 1.33.0

First, the version of golangci linter that works...
Here's the excerpt in the Jenkins script

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0
golangci-lint --version

... and here's the output

+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
+ go env GOPATH
+ sh -s -- -b /go/bin v1.33.0
golangci/golangci-lint info checking GitHub for tag 'v1.33.0'
golangci/golangci-lint info found version: 1.33.0 for v1.33.0/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
+ golangci-lint --version
golangci-lint has version 1.33.0 built from b90551c on 2020-11-23T05:15:36Z

Next, the version of the linter that fails...
Here's the excerpt in the Jenkins script

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.35.0
golangci-lint --version

... and here's the output

+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
+ go env GOPATH
+ sh -s -- -b /go/bin v1.35.0
golangci/golangci-lint info checking GitHub for tag 'v1.35.0'
golangci/golangci-lint info found version: 1.35.0 for v1.35.0/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
+ golangci-lint --version
panic: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -- std]: exit status 1: go: stash.mycompany.com/vendoredproject/vendoredrepo/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/2efd0d78293636a358aad6d74d172395d03bfaafcf9da951e7cd4ee0adf65559: exit status 128:
	fatal: could not read Username for 'https://stash.mycompany.com': terminal prompts disabled


goroutine 1 [running]:
github.com/daixiang0/gci/pkg/gci.init.0()
	/home/runner/go/pkg/mod/github.com/daixiang0/[email protected]/pkg/gci/gci.go:41 +0x106

The above two CI runs were exactly the same except the change from version 1.33.0 to 1.35.0 (I used the Jenkins Job Replay and modified the one character and clicked "RUN")
Note that when I run 1.35.0 on my local Mac against my project it works fine. I'm only getting the above error when running it in Jenkins
Let me know if need more info

@esinek esinek added the bug Something isn't working label Jan 10, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 10, 2021

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@SVilgelm
Copy link
Member

Here is my attempt on clean system:

21-01-10 12:41 % docker run --rm -it golang bash
Unable to find image 'golang:latest' locally
latest: Pulling from library/golang
6c33745f49b4: Pull complete 
ef072fc32a84: Pull complete 
c0afb8e68e0b: Pull complete 
d599c07d28e6: Pull complete 
c616e0dda35f: Pull complete 
2e68d0e3d3c7: Pull complete 
4dea2301be07: Pull complete 
Digest: sha256:c47d6c4ee25e34c97f3b1a92923a913e266a2b4b95731e8f5aa9065ca9e7c7fc
Status: Downloaded newer image for golang:latest
root@135451366d56:/go# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.35.0
golangci/golangci-lint info checking GitHub for tag 'v1.35.0'
golangci/golangci-lint info found version: 1.35.0 for v1.35.0/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
root@135451366d56:/go# golangci-lint --version
golangci-lint has version 1.35.0 built from 1e5ba1e on 2021-01-08T02:12:28Z
root@135451366d56:/go# 

@SVilgelm
Copy link
Member

I think this is the main reason: fatal: could not read Username for 'https://stash.mycompany.com': terminal prompts disabled
Probably you need to properly configure the access to the private git repository. I'm doing like this in IBM:

git config --global url."https://${GHE_TOKEN}:[email protected]/".insteadOf "https://github.ibm.com/"

@esinek
Copy link
Author

esinek commented Jan 10, 2021

Thanks - that seems a likely culprit since I have that setting in my local .gitconfig. Now I need to set it up in the CI image.
But that doesn't explain why it worked in 1.33.0 by not in 1.35.0.
And, if the following is set in the the config file, it shouldn't try to access the vendored repo, right?

  modules-download-mode: vendor

@SVilgelm
Copy link
Member

Maybe there are some changes, or new linters. It will be great if you can debug it.

@esinek
Copy link
Author

esinek commented Jan 10, 2021

TL;DR:

  • 1.33.0: success
  • 1.33.1: failure
  • 1.33.2: success
  • 1.34.0: failure
  • 1.34.1: failure

Details:

+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
+ go env GOPATH
+ sh -s -- -b /go/bin v1.33.0
golangci/golangci-lint info checking GitHub for tag 'v1.33.0'
golangci/golangci-lint info found version: 1.33.0 for v1.33.0/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
+ golangci-lint --version
golangci-lint has version 1.33.0 built from b90551c on 2020-11-23T05:15:36Z
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
+ go env GOPATH
+ sh -s -- -b /go/bin v1.33.1
golangci/golangci-lint info checking GitHub for tag 'v1.33.1'
golangci/golangci-lint info found version: 1.33.1 for v1.33.1/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
+ golangci-lint --version
panic: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -- std]: exit status 1: go: stash.mycompany.com/vendoredproject/vendoredrepo/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/2efd0d78293636a358aad6d74d172395d03bfaafcf9da951e7cd4ee0adf65559: exit status 128:
	fatal: could not read Username for 'https://stash.mycompany.com': terminal prompts disabled


goroutine 1 [running]:
github.com/daixiang0/gci/pkg/gci.init.0()
	/home/runner/go/pkg/mod/github.com/daixiang0/[email protected]/pkg/gci/gci.go:41 +0x106
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
+ go env GOPATH
+ sh -s -- -b /go/bin v1.33.2
golangci/golangci-lint info checking GitHub for tag 'v1.33.2'
golangci/golangci-lint info found version: 1.33.2 for v1.33.2/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
+ golangci-lint --version
golangci-lint has version 1.33.2 built from b90551c on 2020-12-28T15:56:25Z
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
+ go env GOPATH
+ sh -s -- -b /go/bin v1.34.0
golangci/golangci-lint info checking GitHub for tag 'v1.34.0'
golangci/golangci-lint info found version: 1.34.0 for v1.34.0/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
+ golangci-lint --version
panic: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -- std]: exit status 1: go: stash.mycompany.com/vendoredproject/vendoredrepo/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/2efd0d78293636a358aad6d74d172395d03bfaafcf9da951e7cd4ee0adf65559: exit status 128:
	fatal: could not read Username for 'https://stash.mycompany.com': terminal prompts disabled


goroutine 1 [running]:
github.com/daixiang0/gci/pkg/gci.init.0()
	/home/runner/go/pkg/mod/github.com/daixiang0/[email protected]/pkg/gci/gci.go:41 +0x106
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
+ go env GOPATH
+ sh -s -- -b /go/bin v1.34.1
golangci/golangci-lint info checking GitHub for tag 'v1.34.1'
golangci/golangci-lint info found version: 1.34.1 for v1.34.1/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
+ golangci-lint --version
panic: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -- std]: exit status 1: go: stash.mycompany.com/vendoredproject/vendoredrepo/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/2efd0d78293636a358aad6d74d172395d03bfaafcf9da951e7cd4ee0adf65559: exit status 128:
	fatal: could not read Username for 'https://stash.mycompany.com': terminal prompts disabled


goroutine 1 [running]:
github.com/daixiang0/gci/pkg/gci.init.0()
	/home/runner/go/pkg/mod/github.com/daixiang0/[email protected]/pkg/gci/gci.go:41 +0x106

@ldez ldez added question Further information is requested bug Something isn't working and removed bug Something isn't working question Further information is requested labels Jan 10, 2021
@ldez
Copy link
Member

ldez commented Jan 10, 2021

@ldez
Copy link
Member

ldez commented Jan 10, 2021

It's because you are vendoring your dependencies.

packages.Load doesn't know this constraint so I try you use standard go module behavior.

So you have several solutions:

@esinek
Copy link
Author

esinek commented Jan 10, 2021

gci is already disabled in my config (see config in original post above)
I've opened an issue in gci repo
daixiang0/gci#28
Thanks

@ldez
Copy link
Member

ldez commented Jan 10, 2021

gci is already disabled in my config

yes, it's because of init(), even if the linter is disabled the init is called.

@ldez
Copy link
Member

ldez commented Jan 10, 2021

I really recommend trying a private go proxy instead of playing with vendor

@ldez
Copy link
Member

ldez commented Jan 10, 2021

I created a PR to fix the problem in gci daixiang0/gci#29

@ldez ldez added the dependencies Relates to an upstream dependency label Jan 10, 2021
@SVilgelm
Copy link
Member

@esinek @ldez I will release the v1.35.2, so @esinek can test it on the CI

@SVilgelm
Copy link
Member

@esinek the v1.35.2 release is created, could you please test it?

@esinek
Copy link
Author

esinek commented Jan 11, 2021

It worked. Thanks for the quick turnaround all

+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
+ go env GOPATH
+ sh -s -- -b /go/bin v1.35.2
golangci/golangci-lint info checking GitHub for tag 'v1.35.2'
golangci/golangci-lint info found version: 1.35.2 for v1.35.2/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
+ golangci-lint --version
golangci-lint has version 1.35.2 built from 1da5701 on 2021-01-11T02:54:03Z

@SVilgelm
Copy link
Member

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Relates to an upstream dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants