Closed tomcat1986 closed 1 year ago
@tomcat1986 I tested your Dockerfile and it fails with a different error:
dario@LAPTOP-Q38PUD8E:~/code/foo$ docker build .
[+] Building 37.8s (6/6) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 106B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/golang:1.18 3.1s
=> [auth] library/golang:pull token for registry-1.docker.io 0.0s
=> [1/2] FROM docker.io/library/golang:1.18@sha256:50c889275d26f816b5314fc99f55425fa76b18fcaf16af255f5d57f09e1f48da 31.3s
=> => resolve docker.io/library/golang:1.18@sha256:50c889275d26f816b5314fc99f55425fa76b18fcaf16af255f5d57f09e1f48da 0.0s
=> => sha256:bbeef03cda1f5d6c9e20c310c1c91382a6b0a1a2501c3436b28152f13896f082 55.03MB / 55.03MB 11.8s
=> => sha256:56261d0e6b05ece42650b14830960db5b42a9f23479d868256f91d96869ac0c2 10.88MB / 10.88MB 2.3s
=> => sha256:c37a56a6d65476eabfb50e74421f16f415093e2d1bdd7f83e8bbb4b1a3eb2109 7.12kB / 7.12kB 0.0s
=> => sha256:f049f75f014ee8fec2d4728b203c9cbee0502ce142aec030f874aa28359e25f1 5.16MB / 5.16MB 1.8s
=> => sha256:50c889275d26f816b5314fc99f55425fa76b18fcaf16af255f5d57f09e1f48da 2.36kB / 2.36kB 0.0s
=> => sha256:740324e52de766f230ad7113fac9028399d6e03af34883de625dc2230ef7927e 1.80kB / 1.80kB 0.0s
=> => sha256:9bd150679dbdb02d9d4df4457d54211d6ee719ca7bc77747a7be4cd99ae03988 54.58MB / 54.58MB 13.8s
=> => sha256:bfcb68b5bd105d3f88a2c15354cff6c253bedc41d83c1da28b3d686c37cd9103 85.98MB / 85.98MB 19.3s
=> => sha256:06d0c5d18ef41fa1c2382bd2afd189a01ebfff4910b868879b6dcfeef46bc003 141.98MB / 141.98MB 27.2s
=> => extracting sha256:bbeef03cda1f5d6c9e20c310c1c91382a6b0a1a2501c3436b28152f13896f082 1.8s
=> => extracting sha256:f049f75f014ee8fec2d4728b203c9cbee0502ce142aec030f874aa28359e25f1 0.2s
=> => sha256:cc7973a07a5b4a44399c5d36fa142f37bb343bb123a3736357365fd9040ca38a 156B / 156B 14.1s
=> => extracting sha256:56261d0e6b05ece42650b14830960db5b42a9f23479d868256f91d96869ac0c2 0.2s
=> => extracting sha256:9bd150679dbdb02d9d4df4457d54211d6ee719ca7bc77747a7be4cd99ae03988 2.0s
=> => extracting sha256:bfcb68b5bd105d3f88a2c15354cff6c253bedc41d83c1da28b3d686c37cd9103 2.7s
=> => extracting sha256:06d0c5d18ef41fa1c2382bd2afd189a01ebfff4910b868879b6dcfeef46bc003 3.8s
=> => extracting sha256:cc7973a07a5b4a44399c5d36fa142f37bb343bb123a3736357365fd9040ca38a 0.0s
=> ERROR [2/2] RUN go get -u github.com/cosmtrek/air@latest 3.3s
------
> [2/2] RUN go get -u github.com/cosmtrek/air@latest:
#5 0.313 go: go.mod file not found in current directory or any parent directory.
#5 0.313 'go get' is no longer supported outside a module.
#5 0.313 To build and install a command, use 'go install' with a version,
#5 0.313 like 'go install example.com/cmd@latest'
#5 0.313 For more information, see https://golang.org/doc/go-get-install-deprecation
#5 0.313 or run 'go help get' or 'go help install'.
@imdario Thank you for trying it! After seeing your error statement and changed the code as follows, it worked!
before
RUN go get -u github.com/cosmtrek/air@latest
after
RUN go install github.com/cosmtrek/air@latest
go: github.com/imdario/mergo@v1.0.0: parsing go.mod:
module declares its path as: dario.cat/mergo
but was required as: github.com/imdario/mergo
what should we do?
update github.com/imdario/mergo
to dario.cat/mergo
in air
source code?
@pierreneter A workaround is to clone air
repository and run go install ./...
from it.
I had this error too trying to get Air just now. Reading this thread and a little more, I was able to install it with:
sudo GOBIN=/usr/local/bin/ go install github.com/cosmtrek/air@latest
Hi! I got the following error and it didn't work when I tried to build docker. I hypothesize that the error is due to a URL change in ver 1.0.0 of github.com/imdario/mergo, but I'm having trouble coming up with a solution... (https://github.com/imdario/mergo/releases/tag/v1.0.0)
Does anyone have a suggestion for a solution?
Dockerfile
build log