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

Air doesn't work with errors related to github.com/imdario/mergo #435

Closed
tomcat1986 opened this issue Jun 21, 2023 · 5 comments · Fixed by #440
Closed

Air doesn't work with errors related to github.com/imdario/mergo #435

tomcat1986 opened this issue Jun 21, 2023 · 5 comments · Fixed by #440

Comments

@tomcat1986
Copy link

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

FROM golang:1.18
︙
RUN go get -u github.com/cosmtrek/air@latest
︙

build log

[myapp 6/6] RUN go get -u github.com/cosmtrek/air@latest:
#0 11.66 go: downloading github.com/cosmtrek/air v1.44.0
#0 43.69 go: downloading github.com/creack/pty v1.1.18
#0 43.70 go: downloading github.com/fatih/color v1.14.1
#0 43.70 go: downloading github.com/fsnotify/fsnotify v1.6.0
#0 43.71 go: downloading github.com/gohugoio/hugo v0.111.3
#0 47.82 go: downloading github.com/imdario/mergo v0.3.13
#0 47.82 go: downloading github.com/pelletier/go-toml v1.9.5
#0 47.97 go: downloading github.com/fatih/color v1.15.0
#0 48.06 go: downloading golang.org/x/sys v0.5.0
#0 48.27 go: downloading github.com/imdario/mergo v1.0.0
#0 49.22 go: downloading github.com/mattn/go-colorable v0.1.13
#0 49.35 go: downloading github.com/mattn/go-isatty v0.0.17
#0 49.42 go: downloading github.com/gohugoio/hugo v0.114.0
#0 49.59 go: downloading golang.org/x/sys v0.9.0
#0 54.52 go: downloading github.com/mattn/go-isatty v0.0.19
#0 54.79 go: downloading github.com/bep/godartsass v0.16.0
#0 54.79 go: downloading github.com/bep/golibsass v1.1.0
#0 55.18 go: downloading github.com/pelletier/go-toml/v2 v2.0.6
#0 55.18 go: downloading github.com/spf13/afero v1.9.3
#0 56.06 go: downloading github.com/bep/godartsass v1.2.0
#0 56.14 go: downloading github.com/bep/golibsass v1.1.1
#0 56.14 go: downloading github.com/spf13/afero v1.9.5
#0 56.14 go: downloading github.com/pelletier/go-toml/v2 v2.0.8
#0 56.17 go: downloading github.com/tdewolff/parse/v2 v2.6.5
#0 56.64 go: downloading golang.org/x/text v0.7.0
#0 62.85 go: downloading github.com/tdewolff/parse/v2 v2.6.6
#0 63.18 go: downloading github.com/tdewolff/parse v2.3.4+incompatible
#0 63.45 go: downloading github.com/cli/safeexec v1.0.0
#0 63.55 go: downloading golang.org/x/text v0.10.0
#0 69.55 go: downloading github.com/cli/safeexec v1.0.1
#0 69.59 go: downloading google.golang.org/protobuf v1.28.1
#0 71.20 go: downloading google.golang.org/protobuf v1.30.0
#0 104.6 go: github.com/imdario/mergo@v1.0.0: parsing go.mod:
#0 104.6 	module declares its path as: dario.cat/mergo
#0 104.6 	        but was required as: github.com/imdario/mergo
------
failed to solve: executor failed running [/bin/sh -c go get -u github.com/cosmtrek/air@latest]: exit code: 1
@darccio
Copy link

darccio commented Jun 24, 2023

@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'.

@tomcat1986
Copy link
Author

tomcat1986 commented Jun 25, 2023

@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

@pierreneter
Copy link
Contributor

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?

@darccio
Copy link

darccio commented Jul 5, 2023

@pierreneter A workaround is to clone air repository and run go install ./... from it.

@Pryority
Copy link

Pryority commented Jul 6, 2023

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   

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.

4 participants