Closed vay3t closed 2 years ago
Hey @vay3t! could you provide the logs you are getting when running go get github.com/alitto/pond
?
I tried it and seems to be working with go 1.17.3, here's what I'm seeing:
$ go version
go version go1.17.3 linux/amd64
$ go get github.com/alitto/pond
go: downloading github.com/alitto/pond v1.5.1
go get: added github.com/alitto/pond v1.5.1
Thanks!
strangely I do not create the directory of the library, but I installed a library recently and it installed correctly. do you know of any necessary configuration?
Ahh I think I know what's going on. Since this library uses Go modules, its source code is downloaded to a different directory, not to go/src
but go/pkg/mod
.
Could you check whether it's in that directory? E.g.: ls ~/go/pkg/mod/github.com/alitto/
it does exist.
that is if it is not possible to import.
debugging go get
$ go get -u -v -n -a -x github.com/alitto/pond
package github.com/alitto/pond
imports github.com/alitto/pond: import cycle not allowed
Could you show me the contents of /home/vay3t/dev/multithread-go/go.mod
? That file defines the name of the module you are developing and it seems it has the same name as the pond library github.com/alitto/pond
. You could try changing it to something like github.com/vay3t/multithread-go
I greatly appreciate your help :)
look i got this
file:
Ahh I think that's due to the name of the module in go.mod
, please change that file to have this content:
module github.com/vay3t/multithread-go
go 1.17
i installed module with go get and logs:
a solution was to download the module with git clone, place it in the corresponding directory and run the example from there, which works without problems:
but when I try to import from an external repository I get the following error
my code:
You'll need to change the contents of the file /home/vay3t/dev/multithread-go/go.mod
to be:
module github.com/vay3t/multithread-go
go 1.17
To give more context, when you create a go.mod
file under the multithread-go
directory, you are effectively creating a new Go module there, so all *.go
files within that directory (such as main.go) will be part of this new module. The first line in the go.mod
defines the absolute name of your module (module {module-name}
), which cannot be the same as one of its dependencies, because that would mean there's a module that depends on itself (an import cycle, as the error message prints out). So the solution is to change the module name to something other than github.com/alitto/pond
:slightly_smiling_face:
I understood everything. I was able to fix the problem. Sorry for the time I made you waste.
Fixed
I'm glad the issue is fixed :+1: . No worries! thanks to you for using the lib :slightly_smiling_face:
I have tried to download the module using go get URL, but I have not been able to, I suspect that the version of go 1.17.2 that is the one I currently occupy is placing a restriction for something that the repository is missing.