Closed ioncebotari closed 5 years ago
On the basis of this error:
go: cannot determine module path for source directory /home/centos (outside GOPATH, no import comments)
I would recommend trying to set the ansible variable GO111MODULE
to "off"
(please don't forget the quotes).
Looking at the packages more specifically I can see that glide
and dep
both don't support modules... I may be able to add package-specific module configuration in the coming days - that would allow somebody to disable module support for such cases. These ones do make sense because they are an earlier implementation of modules, so I'll make that happen regardless - it's a good move.
I've got a small local prototype which adds optional configuration for GOPROXY
and GO111MODULES
for individual packages declared in the go get
tasks - I just need to test and triage it, but it'll allow me to turn modules on by default and selectively disable modules for a given package which matches your use case in the automated tests 🙂
That's a gap I've had for a while, but I think this is an elegant solution - not everybody is adopting or will adopt modules and that is completely fair in these cases or others. It's one part of the toolchain that doesn't really need adoption by a package, as much as I would recommend it.
By setting the go_get
item to include modules
as either true
or false
, it will use a different installation task.
go_get:
- name: btcd
url: github.com/btcsuite/btcd
- name: glide
url: github.com/Masterminds/glide
modules: false
- name: dep
url: github.com/golang/dep
modules: false
Thank you, @fubarhouse , for your efforts! I've tested setting the global variable "GO111MODULES" to "off" and it worked fine. Tomorrow I'll test how the fine-grained controls work for the modules
I'll close this one then. If need be feel free to re-open it 🙂
I'm using this code in my main.yaml file to install Go and a few packages on a Centos 7 VM on AWS: `# Generic settings for the GO language
When installing them, I get the following error:
{ "changed": false, "cmd": [ "/usr/local/go/bin/go", "get", "-u", "github.com/btcsuite/btcd" ], "delta": "0:00:00.022888", "end": "2019-09-19 14:46:14.964598", "item": { "name": "btcd", "url": "github.com/btcsuite/btcd" }, "msg": "non-zero return code", "rc": 1, "start": "2019-09-19 14:46:14.941710", "stderr": "go: cannot determine module path for source directory /home/centos (outside GOPATH, no import comments)", "stderr_lines": [ "go: cannot determine module path for source directory /home/centos (outside GOPATH, no import comments)" ], "stdout": "" }
For all the three packages. How can I fix this?