Skip to content
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

go1.20 support #3414

Merged
merged 11 commits into from
Feb 2, 2023
Merged

go1.20 support #3414

merged 11 commits into from
Feb 2, 2023

Conversation

ldez
Copy link
Member

@ldez ldez commented Dec 12, 2022

This PR adds the support of go1.20.

Note for GitHub Action users: the Go version must be quoted ('1.20') otherwise it is interpreted as a float (1.2).

This PR is to evaluate and prepare golangci-lint to go1.20.

This PR will evolve during the beta and RC phases of go1.20.

Fixes #3420

@ldez ldez added the enhancement New feature or improvement label Dec 12, 2022
@ldez ldez changed the title WIP: preprare go1.20 WIP: prepare go1.20 Dec 12, 2022
@ldez ldez force-pushed the feat/go1.20 branch 2 times, most recently from f569933 to 24f1b8e Compare December 25, 2022 23:53
@ldez
Copy link
Member Author

ldez commented Dec 25, 2022

The behavior of go list has changed between go1.19 and go1.20:

$ go version
go version go1.19.4 linux/amd64

$ go list -e -json=Name,ImportPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,CgoFiles,CXXFiles,MF -export=true -- ./test/testdata/notcompiles/typecheck.go 
# command-line-arguments
test/testdata/notcompiles/typecheck.go:4:1: syntax error: non-declaration statement outside function body
{
        "Dir": "/home/ldez/sources/go/src/github.com/golangci/golangci-lint/test/testdata/notcompiles",
        "ImportPath": "command-line-arguments",
        "Name": "testdata",
        "GoFiles": [
                "typecheck.go"
        ]
}
$ go version
go version go1.20rc1 linux/amd64

$ go list -e -json=Name,ImportPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,CgoFiles,CXXFiles,MF -export=true -- ./test/testdata/notcompiles/typecheck.go 
{
        "Dir": "/home/ldez/sources/go/src/github.com/golangci/golangci-lint/test/testdata/notcompiles",
        "ImportPath": "command-line-arguments",
        "Name": "testdata",
        "GoFiles": [
                "typecheck.go"
        ],
        "Error": {
                "ImportStack": null,
                "Pos": "",
                "Err": "# command-line-arguments\ntest/testdata/notcompiles/typecheck.go:4:1: syntax error: non-declaration statement outside function body\n"
        }
}

Why this is important? because packages.Load() invokes go list internally.

As the error message has specific content the position is empty ("Pos": "",), so the report of this error is misleading.

Related to:

I created a fix but I think the impact on packages.Load() is an unexpected side effect of golang/go@0160412.

@ldez
Copy link
Member Author

ldez commented Dec 26, 2022

Running golangci-lint (v1.50.1) with go1.20 crashes the shell.
But the version related to my PR works.

The CI crashes because we test the previous version (v1.50.1).

I will fix that. Fixed

@ldez ldez force-pushed the feat/go1.20 branch 2 times, most recently from d0acebc to 6060eda Compare December 26, 2022 01:00
@ldez ldez changed the title WIP: prepare go1.20 Prepare go1.20 Dec 26, 2022
@ldez ldez changed the title Prepare go1.20 Prepare go1.20 support Dec 26, 2022
@ldez ldez mentioned this pull request Jan 13, 2023
4 tasks
@franchb
Copy link

franchb commented Jan 30, 2023

Confirm that this version resolves high memory consumption on my Go codebase, Go v1.20rc3

kklimonda-fn pushed a commit to fluxninja/aperture that referenced this pull request Feb 3, 2023
@ldez ldez mentioned this pull request Feb 5, 2023
4 tasks
@bouwerp
Copy link

bouwerp commented Feb 9, 2023

I still have the huuuuge memory usage with the 1.51 update... I'm running MacOS Monterey 12.6.3 on an Intel chip.

@ldez
Copy link
Member Author

ldez commented Feb 9, 2023

I'm running MacOS

I guess you are installing golangci-lint with brew, brew uses go1.19 instead of go1.20.
#3565 (comment)

So you have to use either our binaries or our Docker image or build/install golangci-lint with go1.20.

golangci-lint requires to be built with go1.20, without that golangci-lint cannot work with go1.20.

Note the latest version of golangci-lint is v1.51.1.

damyan added a commit to ironcore-dev/ipam that referenced this pull request Feb 17, 2023
damyan added a commit to ironcore-dev/ipam that referenced this pull request Feb 17, 2023
StephanSchmidt pushed a commit to inkmi/erro that referenced this pull request Feb 22, 2023
bobrik added a commit to cloudflare/ebpf_exporter that referenced this pull request Mar 4, 2023
squat added a commit to connylabs/model-tracking that referenced this pull request Mar 20, 2023
golangci-lint <= 1.50 does not support Go > 1.20 and will OOM. This PR
fixes the issue.

xref: golangci/golangci-lint#3414

Signed-off-by: Lucas Servén Marín <[email protected]>
SeigeC pushed a commit to SeigeC/golangci-lint that referenced this pull request Apr 4, 2023
Kesuaheli added a commit to cake4everyone/cake4everybot that referenced this pull request Apr 30, 2023
diafour added a commit to werf/werf that referenced this pull request May 29, 2023
…angci-lint#3414)

- ignore some errors, should refactor in the future

Signed-off-by: Ivan Mikheykin <[email protected]>
diafour added a commit to werf/werf that referenced this pull request May 29, 2023
- Add nolint:unused pragmas.
- Enable nolintlint linter.
- Add max-* settings to show all errors at once.
- update golangci-lint to 1.52.1 to support Go 1.20 (See golangci/golangci-lint#3414)
- ignore some errors, should refactor in the future

Signed-off-by: Ivan Mikheykin <[email protected]>
diafour added a commit to werf/werf that referenced this pull request May 29, 2023
- Add nolint:unused pragmas.
- Enable nolintlint linter.
- Add max-* settings to show all errors at once.
- update golangci-lint to 1.52.1 to support Go 1.20 (See golangci/golangci-lint#3414)
- ignore some errors, should refactor in the future

Signed-off-by: Ivan Mikheykin <[email protected]>
diafour added a commit to werf/werf that referenced this pull request May 29, 2023
- Add nolint:unused pragmas.
- Enable nolintlint linter.
- Add max-* settings to show all errors at once.
- update golangci-lint to 1.52.1 to support Go 1.20 (See golangci/golangci-lint#3414)
- ignore some errors, should refactor in the future

Signed-off-by: Ivan Mikheykin <[email protected]>
@ldez ldez added this to the v1.51 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typecheck: support Go 1.20
5 participants