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 get command fails #2567

Closed
rozagerardo opened this issue Jun 2, 2020 · 5 comments
Closed

go get command fails #2567

rozagerardo opened this issue Jun 2, 2020 · 5 comments

Comments

@rozagerardo
Copy link

I've been trying to run the go get command locally (on a new project), but it fails with a go get: error loading module requirements message.

  1. I tried using go get -u goa.design/goa/v3 as indicated here with GO111MODULE=on

  2. env GO111MODULE=on go get -u goa.design/goa/v3/...@v3 as indicated in github (with this I get a no matching versions for query "v3" message)

  3. using docker :

FROM golang:latest as builder
WORKDIR /go/src/base/path/project
COPY . .
ENV GO111MODULE=on
RUN go get -u goa.design/goa/v3
RUN go get -u goa.design/goa/v3/...
RUN goa gen base/path/project/design
RUN go get
RUN CGO_ENABLED=0 GOOS=linux go build -o project-svc cmd/main/main.go cmd/main/http.go

and it's still failing on the go get step.
I locally use:

$ goa version
Goa version v3.0.9
$ go version
go version go1.12.7 windows/amd64
@raphael
Copy link
Member

raphael commented Jun 3, 2020

Hello, the commands without qualified version need to be run within a Go module (i.e. the folder or one of its parent needs to have a go.mod file). The commands with the version can be run anywhere (as long as Go modules are enabled obviously). Here are a couple of working examples:

  • With a Go module:
mkdir project
cd project
go mod init project
go get go get -u goa.design/goa/v3
go get go get -u goa.design/goa/v3/...
  • Globally:
env GO111MODULE=on go get -u goa.design/goa/v3@v3
env GO111MODULE=on go get -u goa.design/goa/v3/...@v3

@rozagerardo
Copy link
Author

rozagerardo commented Jun 3, 2020

thanks for the quick response @raphael I appreciate it.

Yes, I followed the instructions in the Goa site, creating the go module and so on, but it is still not working. A few months ago I could do everything without problems, now I'm working on a new project and following the same steps I can't succeed to get it working.

At first (a few weeks ago) I thought it was a temporary issue with a dependency, but this still persists.

I ran the steps you mentioned above, let me show you the full output:

WORK@DESKTOP-XYZ MINGW64 ~/Projects/test-temp
$ go version
go version go1.12.7 windows/amd64

WORK@DESKTOP-XYZ MINGW64 ~/Projects/test-temp
$ mkdir project

WORK@DESKTOP-XYZ MINGW64 ~/Projects/test-temp
$ cd project

WORK@DESKTOP-XYZ MINGW64 ~/Projects/test-temp/project
$ go mod init project
go: creating new go.mod: module project

WORK@DESKTOP-XYZ MINGW64 ~/Projects/test-temp/project
$ go get -u goa.design/goa/v3
go: finding github.com/manveru/gobdd latest
go: finding github.com/manveru/faker latest
go: finding github.com/dimfeld/httppath latest
go: finding github.com/google/gxui latest
go: finding github.com/gopherjs/gopherjs latest
go: finding gopkg.in/check.v1 latest
go: finding github.com/asaskevich/govalidator latest
go: finding github.com/globalsign/mgo latest
go: finding golang.org/x/sys latest
go: finding github.com/zach-klippenstein/goregen latest
go: finding golang.org/x/crypto latest
go: finding golang.org/x/net latest
go: finding golang.org/x/sync latest
go: finding github.com/PuerkitoBio/urlesc latest
go: finding golang.org/x/tools latest
go: finding github.com/cncf/udpa/go latest
go: finding golang.org/x/oauth2 latest
go: finding google.golang.org/genproto latest
go: finding golang.org/x/xerrors latest
go: finding github.com/gobuffalo/gitgen latest
go: finding github.com/xdg/scram latest
go: finding github.com/golang/glog latest
go: finding golang.org/x/exp latest
go: finding golang.org/x/lint latest
go: finding github.com/golang/groupcache latest
go: finding github.com/go-gl/glfw/v3.3/glfw latest
go: finding github.com/coreos/pkg latest
go: finding github.com/armon/consul-api latest
go: finding golang.org/x/image latest
go: finding github.com/tmc/grpc-websocket-proxy latest
go: finding github.com/serenize/snaker latest
go: finding github.com/google/pprof latest
go: finding github.com/chzyer/test latest
go: finding gopkg.in/tomb.v1 latest
go: finding github.com/BurntSushi/xgb latest
go: finding github.com/ianlancetaylor/demangle latest
go: finding gopkg.in/yaml.v3 latest
go: finding github.com/sourcegraph/annotate latest
go: finding golang.org/x/time latest
go: finding golang.org/x/mobile latest
go: finding github.com/modern-go/concurrent latest
go: github.com/coreos/bbolt@v1.3.4: parsing go.mod: unexpected module path "go.etcd.io/bbolt"
go: finding github.com/sourcegraph/syntaxhighlight latest
go: finding github.com/mwitkow/go-conntrack latest
go: finding github.com/hashicorp/consul/sdk v0.1.1
go: finding github.com/dgryski/go-sip13 latest
go: finding github.com/coreos/go-systemd latest
go: gopkg.in/fsnotify.v1@v1.4.9: go.mod has non-....v1 module path "github.com/fsnotify/fsnotify" at revision v1.4.9
go: github.com/coreos/go-systemd@v0.0.0-20200602090505-b51e752dd1c9: go.mod has post-v0 module path "github.com/coreos/go-systemd/v22" at revision b51e752dd1c9
go get: error loading module requirements

Even though this last command fails at different stages (I don't have a lot of experience with go, but I suppose it fetches dependencies asynchronously, which would explain it).

I'd assume that the problem is in my local env, but the fact that it's also failing using docker makes me think the issue might be related to something else.

BTW, I didn't include the mod init command in the docker commands I mentioned before because the go.mod (and go.sum) files were included in the copied resources; I also tried removing those and creating the module as part of the process, but I was still getting the same go get: error loading module requirements error.

I also tried in a different environment (a workmate's laptop) and I got the same issue.

Can you try running the commands from a clean environment (a docker container probably) to double-check you can't reproduce this?

Thanks once more for the support 👍

@raphael
Copy link
Member

raphael commented Jun 6, 2020

I am not able to reproduce this issue with Go 1.4, running in a new container:

[root@ee6a0417a9b1 /]# mkdir project
[root@ee6a0417a9b1 /]# cd project
[root@ee6a0417a9b1 project]# go mod init project
go: creating new go.mod: module project
[root@ee6a0417a9b1 project]# go get -u goa.design/goa/v3
go: downloading goa.design/goa v1.4.3
go: downloading goa.design/goa/v3 v3.1.3
go: downloading goa.design/goa v2.1.3+incompatible
go: goa.design/goa/v3 upgrade => v3.1.3
[root@ee6a0417a9b1 project]# go get -u goa.design/goa/v3/...
go: downloading github.com/sergi/go-diff v1.1.0
go: downloading google.golang.org/grpc v1.28.0
go: downloading github.com/golang/protobuf v1.3.5
go: downloading github.com/zach-klippenstein/goregen v0.0.0-20160303162051-795b5e3961ea
go: downloading golang.org/x/tools v0.0.0-20200313205530-4303120df7d8
go: downloading github.com/dimfeld/httptreemux/v5 v5.0.2
go: downloading github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598
go: downloading github.com/gorilla/websocket v1.4.1
go: downloading google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
go: downloading golang.org/x/net v0.0.0-20200226121028-0de0cce0169b
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f
go: downloading golang.org/x/text v0.3.2
go: downloading golang.org/x/mod v0.2.0
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: github.com/pkg/errors upgrade => v0.9.1
go: github.com/golang/protobuf upgrade => v1.4.2
go: google.golang.org/grpc upgrade => v1.29.1
go: golang.org/x/mod upgrade => v0.3.0
go: google.golang.org/genproto upgrade => v0.0.0-20200605102947-12044bf5ea91
go: golang.org/x/net upgrade => v0.0.0-20200602114024-627f9648deb9
go: golang.org/x/xerrors upgrade => v0.0.0-20191204190536-9bdfabe68543
go: gopkg.in/yaml.v2 upgrade => v2.3.0
go: golang.org/x/sys upgrade => v0.0.0-20200602225109-6fdc65e7d980
go: golang.org/x/tools upgrade => v0.0.0-20200606014950-c42cb6316fb6
go: golang.org/x/text upgrade => v0.3.2
go: github.com/dimfeld/httptreemux/v5 upgrade => v5.2.2
go: github.com/gorilla/websocket upgrade => v1.4.2
go: downloading google.golang.org/grpc v1.29.1
go: downloading github.com/golang/protobuf v1.4.2
go: downloading golang.org/x/tools v0.0.0-20200606014950-c42cb6316fb6
go: downloading gopkg.in/yaml.v2 v2.3.0
go: downloading google.golang.org/protobuf v1.24.0
go: downloading google.golang.org/genproto v0.0.0-20200605102947-12044bf5ea91
go: downloading github.com/dimfeld/httptreemux/v5 v5.2.2
go: downloading golang.org/x/net v0.0.0-20200602114024-627f9648deb9
go: downloading golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980
go: downloading github.com/gorilla/websocket v1.4.2
go: downloading golang.org/x/mod v0.3.0
go: google.golang.org/protobuf upgrade => v1.24.0
[root@ee6a0417a9b1 project]# go version
go version go1.14.4 linux/amd64

Maybe try to upgrade your version of Go?

@rozagerardo
Copy link
Author

Sorry for the delay @raphael. I upgraded Go and the issue was gone, I couldn't reproduce it anymore.
I still don't understand why it was also failing using docker, but well...if it is in fact related to the go version, then we might want to update the goa 'Getting Started' guide:
https://goa.design/learn/getting-started/
Of course, it's also possible that this was caused by a corrupted local configuration.
Closing the issue now 👍

@raphael
Copy link
Member

raphael commented Jun 14, 2020

Thank you for the update. Others have reported the same issue in the past. The list of dependencies defers when the problem happens, for example github.com/coreos/go-systemd gets added which is not a dependency (direct or indirect) of Goa. It seems to be the same set of additional dependencies too, really not sure what's causing it.

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

No branches or pull requests

2 participants