-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
typecheck: support Go 1.20 #3420
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
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
@ldez Can you provide some insight into what causes these |
We have some documentation work to do because this is a very common question. In short If something breaks in a version bump it's most likely because the code uses some kind of feature that's not supported in the go version |
Apologies for the ping, you're totally right. My confusion arises because my project consumes golang-ci lint by building it ourselves. We produce a container image with a specific version of Go that we want to test on, then use |
Yeah I can undertand the confusion. Thanks for the extra info. I did a quick local test with go1.20, building
Are you able to reproduce this locally yourself? |
Hmm, yep, I can repeat those steps and get those results (with no errors, because I've fixed those three gosec findings) when running locally: $ where golangci-lint
/home/aaron/.local/share/go/bin/golangci-lint
$ strings /home/aaron/.local/share/go/bin/golangci-lint | grep 'go1\.20rc1' | head -n1
go1.20rc1
$ golangci-lint run ./... But doing the same exact thing inside the container results in an error related to the netip package: $ BOULDER_TOOLS_TAG=go1.20rc1_2022-12-14 docker-compose run boulder which golangci-lint
<snip>
/usr/local/bin/golangci-lint
$ BOULDER_TOOLS_TAG=go1.20rc1_2022-12-14 docker-compose run boulder strings /usr/local/bin/golangci-lint | grep 'go1\.20rc1'
<snip>
go1.20rc1
$ BOULDER_TOOLS_TAG=go1.20rc1_2022-12-14 docker-compose run boulder /usr/local/bin/golangci-lint run ./...
<snip>
ERRO [runner] Panic: buildir: package "netip" (isInitialPkg: false, needAnalyzeSource: true): in net/netip.AddrFromSlice: cannot convert Load <[]byte> t0 ([]byte) to [4]byte: goroutine 8525 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
/root/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:102 +0x155
panic({0x14fe300, 0xc00141e810})
/usr/local/go/src/runtime/panic.go:884 +0x213
honnef.co/go/tools/go/ir.emitConv(0xc0030b0b40, {0x19396c8, 0xc004068a80}, {0x192cbb0?, 0xc0064fc720}, {0x192c2a0, 0xc00ade4140})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/emit.go:293 +0xd29
honnef.co/go/tools/go/ir.(*builder).expr0(0xc00364da28, 0xc0030b0b40, {0x192ff70?, 0xc00ade4140?}, {0x7, {0x192cbb0, 0xc0064fc720}, {0x0, 0x0}})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:610 +0x5d7
honnef.co/go/tools/go/ir.(*builder).expr(0x192cd40?, 0xc0030b0b40, {0x192ff70, 0xc00ade4140})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:566 +0x1fa
honnef.co/go/tools/go/ir.(*builder).emitCallArgs(0x192cd40?, 0xc0030b0b40, 0xc00a090000, 0xc00ade4180, {0x0?, 0x0, 0x8b80c7?})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:975 +0x135
honnef.co/go/tools/go/ir.(*builder).setCall(0x1567e20?, 0xc0030b0b40, 0xc00ade4180, 0xc003797c68)
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:1037 +0x8e
honnef.co/go/tools/go/ir.(*builder).expr0(0xc00364da28, 0xc0030b0b40, {0x192ff70?, 0xc00ade4180?}, {0x7, {0x192cca0, 0xc00928fe30}, {0x0, 0x0}})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:623 +0x218e
honnef.co/go/tools/go/ir.(*builder).expr(0xc00364ce78?, 0xc0030b0b40, {0x192ff70, 0xc00ade4180})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:566 +0x1fa
honnef.co/go/tools/go/ir.(*builder).stmt(0xc0030b0b40?, 0xc0030b0b40, {0x19304b0?, 0xc0060273a0?})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2291 +0x194c
honnef.co/go/tools/go/ir.(*builder).stmtList(...)
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:855
honnef.co/go/tools/go/ir.(*builder).switchStmt(0xc00364d308?, 0xc0030b0b40, 0xc00b0a77d0, 0x0)
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:1366 +0x19a5
honnef.co/go/tools/go/ir.(*builder).stmt(0x20?, 0xc0030b0b40, {0x1930600?, 0xc00b0a77d0?})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2365 +0x121c
honnef.co/go/tools/go/ir.(*builder).stmtList(0x8bea45?, 0xc00364d4f8?, {0xc006027560?, 0x2, 0x8c0650?})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:855 +0x45
honnef.co/go/tools/go/ir.(*builder).stmt(0xc0030b0b40?, 0xc0030b0b40, {0x192ff10?, 0xc00b0a7800?})
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2338 +0x9b9
honnef.co/go/tools/go/ir.(*builder).buildFunction(0xc00364da28, 0xc0030b0b40)
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2450 +0x3d7
honnef.co/go/tools/go/ir.(*builder).buildFuncDecl(0x0?, 0xc00584d4d0, 0xc00b0a7830)
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2488 +0x19b
honnef.co/go/tools/go/ir.(*Package).build(0xc00584d4d0)
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2594 +0xc16
sync.(*Once).doSlow(0xc0040aa000?, 0xc005d40730?)
/usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:65
honnef.co/go/tools/go/ir.(*Package).Build(...)
/root/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2512
honnef.co/go/tools/internal/passes/buildir.run(0xc00f231860)
/root/go/pkg/mod/honnef.co/go/[email protected]/internal/passes/buildir/buildir.go:86 +0x368
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0050fd300)
/root/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:188 +0x9d6
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
/root/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:106 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc002932ff0, {0x16c9b40, 0x7}, 0xc0032ef748)
/root/go/pkg/mod/github.com/golangci/[email protected]/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc00097e780?)
/root/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:105 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0050fd300)
/root/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
/root/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "netip" (isInitialPkg: false, needAnalyzeSource: true): in net/netip.AddrFromSlice: cannot convert Load <[]byte> t0 ([]byte) to [4]byte
ERRO Running error: 1 error occurred:
* can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "netip" (isInitialPkg: false, needAnalyzeSource: true): in net/netip.AddrFromSlice: cannot convert Load <[]byte> t0 ([]byte) to [4]byte Anyway, it seems likely this isn't strictly a golangci-lint issue at this point, it's likely more closely related to our container environment. Thanks for your help, and let me know if you've got any ideas! |
Additional notes (in case they provide any additional details):
Output from the last command: root@8243eca418db:/home/ubuntu/Desktop/zerolog# golangci-lint run ./...
ERRO [runner] Panic: buildir: package "netip" (isInitialPkg: false, needAnalyzeSource: true): in net/netip.AddrFromSlice: cannot convert Load <[]byte> t0 ([]byte) to [4]byte: goroutine 1673 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:102 +0x155
panic({0x14fd300, 0xc003570ee0})
/usr/local/go/src/runtime/panic.go:884 +0x213
honnef.co/go/tools/go/ir.emitConv(0xc0024db7c0, {0x19386c8, 0xc0028df620}, {0x192bbb0?, 0xc00b142c30}, {0x192b2a0, 0xc011ba8180})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/emit.go:293 +0xd29
honnef.co/go/tools/go/ir.(*builder).expr0(0xc000023a28, 0xc0024db7c0, {0x192ef70?, 0xc011ba8180?}, {0x7, {0x192bbb0, 0xc00b142c30}, {0x0, 0x0}})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:610 +0x5d7
honnef.co/go/tools/go/ir.(*builder).expr(0x192bd40?, 0xc0024db7c0, {0x192ef70, 0xc011ba8180})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:566 +0x1fa
honnef.co/go/tools/go/ir.(*builder).emitCallArgs(0x192bd40?, 0xc0024db7c0, 0xc0014d8000, 0xc011ba81c0, {0x0?, 0x0, 0x8b80a7?})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:975 +0x135
honnef.co/go/tools/go/ir.(*builder).setCall(0x1566e20?, 0xc0024db7c0, 0xc011ba81c0, 0xc0028d1ee8)
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:1037 +0x8e
honnef.co/go/tools/go/ir.(*builder).expr0(0xc000023a28, 0xc0024db7c0, {0x192ef70?, 0xc011ba81c0?}, {0x7, {0x192bca0, 0xc00aac91f0}, {0x0, 0x0}})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:623 +0x218e
honnef.co/go/tools/go/ir.(*builder).expr(0xc000022e78?, 0xc0024db7c0, {0x192ef70, 0xc011ba81c0})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:566 +0x1fa
honnef.co/go/tools/go/ir.(*builder).stmt(0xc0024db7c0?, 0xc0024db7c0, {0x192f4b0?, 0xc0081a3d80?})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2291 +0x194c
honnef.co/go/tools/go/ir.(*builder).stmtList(...)
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:855
honnef.co/go/tools/go/ir.(*builder).switchStmt(0x22770a0?, 0xc0024db7c0, 0xc0018025a0, 0x0)
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:1366 +0x19a5
honnef.co/go/tools/go/ir.(*builder).stmt(0x20?, 0xc0024db7c0, {0x192f600?, 0xc0018025a0?})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2365 +0x121c
honnef.co/go/tools/go/ir.(*builder).stmtList(0x8bea25?, 0xc0000234f8?, {0xc0081a3fc0?, 0x2, 0x8c0630?})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:855 +0x45
honnef.co/go/tools/go/ir.(*builder).stmt(0xc0024db7c0?, 0xc0024db7c0, {0x192ef10?, 0xc0018025d0?})
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2338 +0x9b9
honnef.co/go/tools/go/ir.(*builder).buildFunction(0xc000023a28, 0xc0024db7c0)
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2450 +0x3d7
honnef.co/go/tools/go/ir.(*builder).buildFuncDecl(0x0?, 0xc002414480, 0xc001802600)
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2488 +0x19b
honnef.co/go/tools/go/ir.(*Package).build(0xc002414480)
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2594 +0xc16
sync.(*Once).doSlow(0xc0039dc9a0?, 0xc004e60af0?)
/usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:65
honnef.co/go/tools/go/ir.(*Package).Build(...)
/go/pkg/mod/honnef.co/go/[email protected]/go/ir/builder.go:2512
honnef.co/go/tools/internal/passes/buildir.run(0xc002afef70)
/go/pkg/mod/honnef.co/go/[email protected]/internal/passes/buildir/buildir.go:86 +0x368
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0014dfc40)
/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:188 +0x9d6
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:106 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0011d09b0, {0x16c8b40, 0x7}, 0xc0018dc748)
/go/pkg/mod/github.com/golangci/[email protected]/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc0010a47e0?)
/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:105 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0014dfc40)
/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "netip" (isInitialPkg: false, needAnalyzeSource: true): in net/netip.AddrFromSlice: cannot convert Load <[]byte> t0 ([]byte) to [4]byte
ERRO Running error: 1 error occurred:
* can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "netip" (isInitialPkg: false, needAnalyzeSource: true): in net/netip.AddrFromSlice: cannot convert Load <[]byte> t0 ([]byte) to [4]byte |
@atc0005 I believe this is an issue that has been reported go-tools module and fixed [1]. |
I think this issue will start getting spam levels of interest now that go 1.20 is out |
thanks tons @ldez |
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck linter does not play nice with go 1.20[1] bump golangci-lint version to 1.51.2 [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
This required to work correctly with golang-1.20. Versions of golangci-lint prior to 1.50 would often crash/hang with golang-1.20 due to that version's addition of slice-to-array. See golangci/golangci-lint#3420
This required to work correctly with golang-1.20. Versions of golangci-lint prior to 1.50 would often crash/hang with golang-1.20 due to that version's addition of slice-to-array. See golangci/golangci-lint#3420
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
typecheck seems to not play nice with go 1.20[1]. with the current version of golangci-lint we are using. bump to latest release. [1] golangci/golangci-lint#3420 Signed-off-by: adrianc <[email protected]>
- add manual scanning of github keys, it is required since webfactory/ssh-agen `v0.8.0` S. https://github.com/webfactory/ssh-agent/releases - remove hard-coded golang version, always build with the one from `go.mod`. Note: it requires the checkout to be done *before* setting up the go action, otherwise the version cannot be determined, obviously - bump golangci-lint version to `v1.53.3`. `v1.50.*` is not compatible with golang `1.20`, s. golangci/golangci-lint#3420
Your feature request related to a problem? Please describe.
I tried to run linters that pass now, on go 1.20rc1, but some are failing suspiciously in typecheck.
For example, certain exported symbols in the same package show up as undeclared.
Another example, is it seems you have to add return after a panic now?
panic(fmt.Sprintf("TODO: fetchPromise.%s", method)) + return nil, nil
I stopped here
Describe the solution you'd like.
I would like to be able to test release candidates
Describe alternatives you've considered.
waiting
Additional context.
I installed go using
gimme 1.20rc1
and ranmake lint
on https://github.com/tetratelabs/wazeroThe text was updated successfully, but these errors were encountered: