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.21 support #3933

Closed
2 tasks done
ldez opened this issue Jun 29, 2023 · 14 comments
Closed
2 tasks done

go1.21 support #3933

ldez opened this issue Jun 29, 2023 · 14 comments
Labels
enhancement New feature or improvement

Comments

@ldez
Copy link
Member

ldez commented Jun 29, 2023

Update

2023-08-11

go1.21 is now officially fully supported since v1.54.1.

2023-08-10

The problems with ruleguard/gocritic are fixed.
A new release will happen quickly.

2023-08-09

go1.21 is now officially supported since v1.54.0 but there are still problems:


Is golangci-lint support go1.21?

No, and yes.

Basically, golangci-lint supports Go versions lower or equal to the Go version used to build it.

Go version (build) Supported Go versions (code) Not supported Go versions (code)
go1.20 <= go1.20 (go1.20, go1.19, etc.) > go1.20 (go1.21, go1.22, etc.)
go1.19 <= go1.19 (go1.19, go1.18, etc.) > go1.19 (go1.20, go1.21, etc.)

The current binaries from the releases page and the Docker images have been built with go1.20 and will be built with go1.20 as long as go1.21 is not GA.
So those binaries/images don't support go1.21.

https://golangci-lint.run/usage/faq/#which-go-versions-are-supported

In addition, of the Go version used to build it, some linters could need to be updated to support newer versions of Go, and internal pieces of golangci-lint could also need to be updated.

You can follow the PR #3922 to see the progress on this topic.


Sponsoring is a good way to sustain open source maintainers: sponsor me

@ldez
Copy link
Member Author

ldez commented Aug 8, 2023

go1.21 has been released.

But currently ruleguard (a "rule" inside go-critic) doesn't work with go1.21.
quasilyte/go-ruleguard#449

We have several solutions:

  • fix ruleguard (the best but not trivial)
  • disable ruleguard inside go-critic for go1.21 (can be complex)
  • disable ruleguard inside golangci-lint for go1.21 (not trivial but I think it's possible)
  • disable ruleguard inside golangci-lint
  • disable go-critic inside golangci-lint for go1.21 (the worst but easy, I think we don't need to do that)

@andig
Copy link

andig commented Aug 8, 2023

In terms of a quick fix and limited-effort band-aid it sounds as if

disable ruleguard inside golangci-lint

might be the best option right now as long a fixing the root cause is not possible?

@ldez
Copy link
Member Author

ldez commented Aug 8, 2023

I also think this is the best move: #3922 (comment)

@cornelk
Copy link

cornelk commented Aug 8, 2023

gci needs to be upgraded by daixiang0/gci#163 to support the new packages

@CubicrootXYZ
Copy link

go 1.21 adds a new toolchain directive to the go.mod. This currently throws an error:

level=error msg="Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: errors parsing go.mod:\n/builds/xxxxxx/go.mod:5: unknown directive: toolchain\n"

@ldez
Copy link
Member Author

ldez commented Aug 9, 2023

The go.mod structure inside x/mod has been updated in v0.11.0
https://github.com/golang/mod/blob/62c7e578f1a7275d934c99dd48715525bd52b17e/modfile/rule.go#L40

x/mod has been updated to v0.11.0 inside golangci-lint: #3943

@LKaemmerling
Copy link

LKaemmerling commented Aug 9, 2023

Collegue of @CubicrootXYZ here, yep this is correct, but there was no new release since then. So golangci-lint v1.53.3 was released on 15. June; the MR you refer to is from 09.July

@ldez
Copy link
Member Author

ldez commented Aug 9, 2023

So golangci-lint v1.53.3 was released on 15. June; the MR you refer to is from 09.July

Yes, I explained that in the issue description: #3933 (comment)

My previous answer was just facts related to the comment.

@kikihakiem
Copy link

kikihakiem commented Aug 9, 2023

I have an issue with golangci-lint after I upgraded to go1.21. This is the command I used to install from source and run the linter:

$ go1.21.0 install github.com/golangci/golangci-lint/cmd/golangci-lint@master
$ golangci-lint run

And this is the error message:

WARN [runner] Can't run linter goanalysis_metalinter: buildssa: failed to load package : could not load export data: no export data for "log/slog" 
ERRO Running error: 1 error occurred:
        * can't run linter goanalysis_metalinter: buildssa: failed to load package : could not load export data: no export data for "log/slog"

It was working fine before the upgrade. Please note that the slog package was imported from golang.org/x/exp/slog.
If this issue is not related to golangci-lint, what could be the cause of it? Could you please shed some light?

@ldez
Copy link
Member Author

ldez commented Aug 9, 2023

can you provide a reproducible example?

If you are facing a problem related to Go1.21, the best way to contribute is to open a new issue and provide the following information:

golangci-lint --version
cat .golangci.yml
go version && go env
golangci-lint cache clean
golangci-lint run -v

And a code example or link to a public repository.

@nhatthm

This comment was marked as off-topic.

@ldez
Copy link
Member Author

ldez commented Aug 11, 2023

go1.21 is now officially fully supported since v1.54.1.


Sponsoring is a good way to sustain open source maintainers: sponsor me

@ldez ldez closed this as completed Aug 11, 2023
@ldez ldez unpinned this issue Aug 11, 2023
oliver-goetz added a commit to gardener/gardener that referenced this issue Aug 14, 2023
oliver-goetz added a commit to gardener/gardener that referenced this issue Aug 14, 2023
gardener-prow bot pushed a commit to gardener/gardener that referenced this issue Aug 16, 2023
* Bump golang from 1.20.7 to 1.21.0

Bumps golang from 1.20.7 to 1.21.0.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update to `golangci@v1.54.1`

For Go 1.21 support: golangci/golangci-lint#3933

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: oliver-goetz <o.goetz@sap.com>
briantopping pushed a commit to briantopping/gardener that referenced this issue Aug 22, 2023
* Bump golang from 1.20.7 to 1.21.0

Bumps golang from 1.20.7 to 1.21.0.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update to `golangci@v1.54.1`

For Go 1.21 support: golangci/golangci-lint#3933

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: oliver-goetz <o.goetz@sap.com>
nickytd pushed a commit to nickytd/gardener that referenced this issue Sep 11, 2023
* Bump golang from 1.20.7 to 1.21.0

Bumps golang from 1.20.7 to 1.21.0.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update to `golangci@v1.54.1`

For Go 1.21 support: golangci/golangci-lint#3933

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: oliver-goetz <o.goetz@sap.com>
angaz added a commit to angaz/nixpkgs that referenced this issue Oct 9, 2023
golangci-lint supports Go versions lower or equal
to the Go version used to build it.

More info: golangci/golangci-lint#3933
yayayayaka pushed a commit to NixOS/nixpkgs that referenced this issue Oct 20, 2023
golangci-lint supports Go versions lower or equal
to the Go version used to build it.

More info: golangci/golangci-lint#3933
SuperSandro2000 pushed a commit to SuperSandro2000/nixpkgs that referenced this issue Oct 20, 2023
golangci-lint supports Go versions lower or equal
to the Go version used to build it.

More info: golangci/golangci-lint#3933
SuperSandro2000 pushed a commit to SuperSandro2000/nixpkgs that referenced this issue Oct 20, 2023
golangci-lint supports Go versions lower or equal
to the Go version used to build it.

More info: golangci/golangci-lint#3933
SuperSandro2000 pushed a commit to SuperSandro2000/nixpkgs that referenced this issue Oct 21, 2023
golangci-lint supports Go versions lower or equal
to the Go version used to build it.

More info: golangci/golangci-lint#3933
SuperSandro2000 pushed a commit to SuperSandro2000/nixpkgs that referenced this issue Oct 23, 2023
golangci-lint supports Go versions lower or equal
to the Go version used to build it.

More info: golangci/golangci-lint#3933
@ramseyjiang

This comment was marked as off-topic.

@Antonboom

This comment was marked as off-topic.

rdimitrov added a commit to theupdateframework/go-tuf that referenced this issue Jan 19, 2024
Fixes the issues we observe with go 1.21. 

Reference: golangci/golangci-lint#3933

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
rdimitrov added a commit to theupdateframework/go-tuf that referenced this issue Jan 19, 2024
Update tests.yml bumping golangci-lint

Fixes the issues we observe with go 1.21. 

Reference: golangci/golangci-lint#3933

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
kommendorkapten added a commit to theupdateframework/go-tuf that referenced this issue Jan 24, 2024
* chore: fixes the CI status badge and updates the README.md file (#569)

* Update README.md

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* Apply Joshua's feedback

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* Update README.md

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

---------

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* chore(deps): bump securesystemslib from 0.30.0 to 0.31.0 (#570)

Bumps [securesystemslib](https://github.com/secure-systems-lab/securesystemslib) from 0.30.0 to 0.31.0.
- [Release notes](https://github.com/secure-systems-lab/securesystemslib/releases)
- [Changelog](https://github.com/secure-systems-lab/securesystemslib/blob/main/CHANGELOG.md)
- [Commits](secure-systems-lab/securesystemslib@v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: securesystemslib
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: add Marvin Drees to the list of go-tuf maintainers (#571)

* chore(deps): bump actions/setup-python from 4.7.1 to 5.0.0 (#572)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.7.1 to 5.0.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@65d7f2d...0a5c615)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: enable grouping of minor and patch updates. (#580)

Enable grouping of minor and patch updates.
Enable automerge.

Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>

* fix: update tests.yml bumping golangci-lint (#582)

Update tests.yml bumping golangci-lint

Fixes the issues we observe with go 1.21. 

Reference: golangci/golangci-lint#3933

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* chore(deps): bump actions/setup-go from 4.1.0 to 5.0.0 (#573)

Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.1.0 to 5.0.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@93397be...0c52d54)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>

* chore(deps): bump github/codeql-action from 2 to 3 (#574)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>

* chore(deps): bump golang.org/x/crypto from 0.16.0 to 0.17.0 (#575)

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.16.0 to 0.17.0.
- [Commits](golang/crypto@v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>

* chore(deps): bump golang.org/x/term from 0.15.0 to 0.16.0 (#577)

Bumps [golang.org/x/term](https://github.com/golang/term) from 0.15.0 to 0.16.0.
- [Commits](golang/term@v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump the minor-patch group with 2 updates (#581)

Bumps the minor-patch group with 2 updates: [github.com/secure-systems-lab/go-securesystemslib](https://github.com/secure-systems-lab/go-securesystemslib) and [golang.org/x/crypto](https://github.com/golang/crypto).


Updates `github.com/secure-systems-lab/go-securesystemslib` from 0.7.0 to 0.8.0
- [Release notes](https://github.com/secure-systems-lab/go-securesystemslib/releases)
- [Commits](secure-systems-lab/go-securesystemslib@v0.7.0...v0.8.0)

Updates `golang.org/x/crypto` from 0.17.0 to 0.18.0
- [Commits](golang/crypto@v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: github.com/secure-systems-lab/go-securesystemslib
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-patch
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

---------

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

No branches or pull requests

9 participants