You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have 1.20 code (as expressed in go.mod).
Tried testing inside golang:1.22-alpine Container:
FROM golang:1.22-alpine AS build
ENV CGO_ENABLED=0
WORKDIR /app
COPY go.* ./
RUN --mount=type=cache,target=/root/go/pkg/mod go mod download
COPY . ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go build -o /service cmd/*.go
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go test ./... -v
Same happens with golang:1.21-alpine.
What did you see happen?
go build works fine. go test fails with:
go: updates to go.mod needed; to update it:
Aside from the very obscured reason why it needs to be updated - it only happens if I choose 1.21 or 1.22 Golang.
I was under the impression that 1.20 code should build/test with newer versions.
What did you expect to see?
It should build/test using 1.21/1.22 without any change to go.mod.
The text was updated successfully, but these errors were encountered:
this is working as intended, starting 1.21 go started enforcing minimum go versions like any other dependency.
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
Don't you think it would be better to state that compat. change then in the error message?
Why not then in this case replace go: updates to go.mod needed; to update it: with e.g.:
go: Version in go.mod (1.20) does not match Version of executable (1.21).
Upgrade go.mod to version 1.21.
Exact Go Version matching is enforced from Go 1.21 onward.
Go version
go version go1.22.0 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I have 1.20 code (as expressed in
go.mod
).Tried testing inside
golang:1.22-alpine
Container:Same happens with
golang:1.21-alpine
.What did you see happen?
go build
works fine.go test
fails with:Aside from the very obscured reason why it needs to be updated - it only happens if I choose 1.21 or 1.22 Golang.
I was under the impression that 1.20 code should build/test with newer versions.
What did you expect to see?
It should build/test using 1.21/1.22 without any change to
go.mod
.The text was updated successfully, but these errors were encountered: