alitto / pond

🔘 Minimalistic and High-performance goroutine worker pool written in Go
MIT License
1.43k stars 60 forks source link

add support go 1.17.x #15

Closed vay3t closed 2 years ago

vay3t commented 2 years ago

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.

alitto commented 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!

vay3t commented 2 years ago

go version

image

problem with clone

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? image

my env

image

alitto commented 2 years ago

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/

vay3t commented 2 years ago

it does exist. image

that is if it is not possible to import. image

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
alitto commented 2 years ago

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

vay3t commented 2 years ago

I greatly appreciate your help :)

look i got this image

file: image

alitto commented 2 years ago

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
vay3t commented 2 years ago

i installed module with go get and logs: image

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: image

but when I try to import from an external repository I get the following error image

my code: image

alitto commented 2 years ago

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:

vay3t commented 2 years ago

I understood everything. I was able to fix the problem. Sorry for the time I made you waste.

Fixed

alitto commented 2 years ago

I'm glad the issue is fixed :+1: . No worries! thanks to you for using the lib :slightly_smiling_face: