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

Invalid go version '1.22.0': must match format 1.23 #1163

Open
sakshi099 opened this issue Sep 13, 2024 · 1 comment · May be fixed by #1183
Open

Invalid go version '1.22.0': must match format 1.23 #1163

sakshi099 opened this issue Sep 13, 2024 · 1 comment · May be fixed by #1183

Comments

@sakshi099
Copy link

Describe the Bug
Encountering an error when attempting to install : github.com/golang-migrate/migrate/v4/cmd/migrate@latest (in github.com/golang-migrate/migrate/[email protected]) , while no such issue exists with version v4.17.1 . Using Go version 1.19.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Current docker file :
    FROM golang:1.19-alpine
    RUN apk add --no-cache git
    RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest

Expected Behavior
Expecting to successfully install and use version github.com/golang-migrate/migrate/[email protected]

Migrate Version
e.g. v4.18.1
Obtained by running: migrate -version

Go Version
e.g. go version go1.19 - alpine

Stacktrace

RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
#8 2.634 go: downloading github.com/golang-migrate/migrate/v4 v4.18.1
#8 2.751 go: downloading github.com/golang-migrate/migrate v3.5.4+incompatible
#8 2.785 go: github.com/golang-migrate/migrate/v4/cmd/migrate@latest (in github.com/golang-migrate/migrate/[email protected]): go.mod:3: invalid go version '1.22.0': must match format 1.23
#8 2.785 go.mod:5: unknown directive: toolchain
#8 ERROR: process "/bin/sh -c go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest" did not complete successfully: exit code: 1
@joschi joschi linked a pull request Oct 6, 2024 that will close this issue
@joschi
Copy link
Contributor

joschi commented Oct 6, 2024

Go 1.19 is a bit old and isn't supported upstream anymore (see also https://endoflife.date/go). 😅

#8 2.785 go.mod:5: unknown directive: toolchain

Toolchains have been added in Go 1.21: https://go.dev/doc/toolchain

Could you update your Docker base image to a newer version of Go?

For example, golang:1.23-alpine is working fine without any issue:

❯ cat Dockerfile 
FROM golang:1.23-alpine
RUN apk add --no-cache git
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest

❯ docker build -t migrate:issue-1163 .
[+] Building 14.1s (7/7) FINISHED                                                                                                                       docker:orbstack
 => [internal] load build definition from Dockerfile                                                                                                               0.0s
 => => transferring dockerfile: 215B                                                                                                                               0.0s
 => [internal] load metadata for docker.io/library/golang:1.23-alpine                                                                                              2.1s
 => [internal] load .dockerignore                                                                                                                                  0.1s
 => => transferring context: 2B                                                                                                                                    0.0s
 => [1/3] FROM docker.io/library/golang:1.23-alpine@sha256:9dd2625a1ff2859b8d8b01d8f7822c0f528942fe56cfe7a1e7c38d3b8d72d679                                        5.0s
 => => resolve docker.io/library/golang:1.23-alpine@sha256:9dd2625a1ff2859b8d8b01d8f7822c0f528942fe56cfe7a1e7c38d3b8d72d679                                        0.0s
 => => sha256:50b3750afda1ed5c34a5153357a453f4928aa99e9f60005309772f320263a9ea 127B / 127B                                                                         0.6s
 => => sha256:9dd2625a1ff2859b8d8b01d8f7822c0f528942fe56cfe7a1e7c38d3b8d72d679 10.29kB / 10.29kB                                                                   0.0s
 => => sha256:d09b01969f17ae40dac8697672fb51454c296bf7a1c82d7db1963807f83c0e87 1.92kB / 1.92kB                                                                     0.0s
 => => sha256:70f8e088093d3974e2de5305d2004010815216a5972fc4e8a3fb65b8a8e8622d 2.11kB / 2.11kB                                                                     0.0s
 => => sha256:55b35a11ae5eab5f9885f480b702f14893ab21d2d29f58cd678d35d2fde98e27 293.52kB / 293.52kB                                                                 0.2s
 => => sha256:a37a00ec5f007d0ae73647c82b7d81d98a44fb7d073d06e633d656bca79db62a 70.64MB / 70.64MB                                                                   2.0s
 => => extracting sha256:55b35a11ae5eab5f9885f480b702f14893ab21d2d29f58cd678d35d2fde98e27                                                                          0.1s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                                                                           0.6s
 => => extracting sha256:a37a00ec5f007d0ae73647c82b7d81d98a44fb7d073d06e633d656bca79db62a                                                                          2.6s
 => => extracting sha256:50b3750afda1ed5c34a5153357a453f4928aa99e9f60005309772f320263a9ea                                                                          0.0s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                          0.0s
 => [2/3] RUN apk add --no-cache git                                                                                                                               1.6s
 => [3/3] RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest                                                                  5.0s 
 => exporting to image                                                                                                                                             0.2s 
 => => exporting layers                                                                                                                                            0.2s 
 => => writing image sha256:088bda516bc7620f742b67003de5c4a2879abb8577e79f895cd5ae488a6dfb7a                                                                       0.0s 
 => => naming to docker.io/library/migrate:issue-1163                                                                                                              0.0s 

❯ docker run --rm migrate:issue-1163 migrate -version
dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants