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

go version based alpine release and is behind latest go version leading to undefined typecheck lint errors #2832

Closed
pfiaux opened this issue Jul 25, 2023 · 1 comment · Fixed by #2903
Labels
bug Something isn't working

Comments

@pfiaux
Copy link

pfiaux commented Jul 25, 2023

Describe the bug
The go version at the time of writing is

$ go version
go version go1.19.9 linux/amd64

which is behind 1.20.6.
golangci-lint uses go as far as I know for some of it's analysis. So using go 1.20.x features will lead to lint errors
if the available go version in megalinter is 1.19.

Looks like alpine 3.17 is on 1.19: https://pkgs.alpinelinux.org/packages?name=go&branch=v3.17&repo=&arch=&maintainer=

  • 3.18 is on 1.20.5
  • edge is on 1.20.6

To Reproduce
Steps to reproduce the behavior:

  1. Enable the golangci-lint linter
  2. Write go code that uses a language feature in 1.20 but not in 1.19 for example time.DateOnly (time: add DateTime, DateOnly, TimeOnly format constants golang/go#52746)
  3. Linter will fail with undefined: time.DateOnly (typecheck)

Expected behavior
I would like to align the go version to the version I'm using in my build stack so that the linter does not warn me that values which exist are undefined.

Some people consider 1.19.x as stable while 1.20.x is latest, so it's not technically wrong perhaps only not easily visible. So technically both are correct and there's no 1 size fits all here. Short to having an option to specify and install a specific version of go before linting (which would probably not be great performance wise) or bundling multiple versions of go (which is not great size wise).

I figured it's good to document this quirk via an issue but I understand the constrains and that there's no easy solution (IMHO fine to close it as a wontfix in that case) as a work around since my setup involves creating a new image with megalinter as a base image i could solve this by installing a different go version there.

@pfiaux pfiaux added the bug Something isn't working label Jul 25, 2023
nvuillam added a commit that referenced this issue Aug 21, 2023
@nvuillam
Copy link
Member

@pfiaux you're right, let's try to upgrade to 3.11.4-alpine3.18 base python image :)

nvuillam added a commit that referenced this issue Aug 21, 2023
sanmai-NL pushed a commit to sanmai-NL/megalinter that referenced this issue Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants