still confused on how to use Go modules

1,074 views
Skip to first unread message

T L

unread,
Mar 9, 2019, 3:16:04 PM3/9/19
to golang-nuts
I have library package: https://github.com/go-gfx/go-skia
I set its module path as "go101.org/go-skia". (see the go.mod file)

Then I created a new app project.
In its "go.mod" file, I added the following line:


Then I run "go build", it outputted:

$ go build
go: finding github.com/go-gfx/go-skia latest
go: errors parsing go.mod:
/home/user/Desktop/ttt/go.mod:3: invalid module version "latest": unrecognized import path "go101.org/go-skia" (https fetch: Get https://go101.org/go-skia?go-get=1: dial tcp 216.239.36.21:443: i/o timeout)

Why does it connect to "go101.org"? After all, I have replace the package path to "github.com" already.

And, how should I add the replace line in "go.mod' file? "latest" is not a valid module version?

then I run "go mod tidy", it outputted:

$ go mod tidy
go: downloading github.com/go-gfx/go-skia v0.0.0-20190309194705-3a2f2f5bee30
go: extracting github.com/go-gfx/go-skia v0.0.0-20190309194705-3a2f2f5bee30
go: finding github.com/veandco/go-sdl2 v0.0.0-00010101000000-000000000000
go: finding github.com/chsc/gogl v0.0.0-00010101000000-000000000000
go: finding github.com/go-gl/gl v0.0.0-00010101000000-000000000000
go: github.com/chsc/go...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: github.com/veandco/go-...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: github.com/go-gl/g...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: error loading module requirements
$
$ go build
go: finding github.com/go-gfx/go-skia latest
go: finding github.com/go-gl/gl v0.0.0-00010101000000-000000000000
go: finding github.com/chsc/gogl v0.0.0-00010101000000-000000000000
go: finding github.com/veandco/go-sdl2 v0.0.0-00010101000000-000000000000
go: github.com/chsc/go...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: github.com/go-gl/g...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: github.com/veandco/go-...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: error loading module requirements

How should I do to use this library package?



Message has been deleted
Message has been deleted

T L

unread,
Mar 10, 2019, 12:43:04 AM3/10/19
to golang-nuts
The full output of "go build -work -x":

$ go build -work -x
WORK=/tmp/go-build859561395
mkdir -p /home/user/go/pkg/mod/cache/vcs # git2 https://github.com/go-gfx/go-skia
# lock /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0.lock# /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0 for git2 https://github.com/go-gfx/go-skia
cd /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0; git ls-remote -q https://github.com/go-gfx/go-skia
18.089s # cd /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0; git ls-remote -q https://github.com/go-gfx/go-skia
go: finding github.com/go-gfx/go-skia latest
cd /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 3a2f2f5bee305beb195071de9c3954d8fc3ffced
0.002s # cd /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 3a2f2f5bee305beb195071de9c3954d8fc3ffced
cd /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0; git cat-file blob 3a2f2f5bee305beb195071de9c3954d8fc3ffced:go.mod
0.002s # cd /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0; git cat-file blob 3a2f2f5bee305beb195071de9c3954d8fc3ffced:go.mod
cd /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0; git tag -l
0.002s # cd /home/user/go/pkg/mod/cache/vcs/35051762d59be6e239edf386d0402f0d24ad0955066059e37c164d0c8e313bd0; git tag -l
mkdir -p /home/user/go/pkg/mod/cache/vcs # git2 https://github.com/veandco/go-sdl2
# lock /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b.lockmkdir -p /home/user/go/pkg/mod/cache/vcs # git2 https://github.com/chsc/gogl
# lock /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156.lock# /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b for git2 https://github.com/veandco/go-sdl2
# /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156 for git2 https://github.com/chsc/gogl
go: finding github.com/veandco/go-sdl2 v0.0.0-00010101000000-000000000000
cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
go: finding github.com/chsc/gogl v0.0.0-00010101000000-000000000000
cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
mkdir -p /home/user/go/pkg/mod/cache/vcs # git2 https://github.com/go-gl/gl
# lock /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29.lock# /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29 for git2 https://github.com/go-gl/gl
go: finding github.com/go-gl/gl v0.0.0-00010101000000-000000000000
cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
0.003s # cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git tag -l
0.008s # cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
0.009s # cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git tag -l
cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git tag -l
0.007s # cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git tag -l
cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git ls-remote -q https://github.com/veandco/go-sdl2
0.002s # cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git tag -l
cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git ls-remote -q https://github.com/go-gl/gl
0.002s # cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git tag -l
cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git ls-remote -q https://github.com/chsc/gogl
17.207s # cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git ls-remote -q https://github.com/go-gl/gl
cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git fetch -f https://github.com/go-gl/gl 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
18.290s # cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git ls-remote -q https://github.com/veandco/go-sdl2
cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git fetch -f https://github.com/veandco/go-sdl2 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
18.721s # cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git ls-remote -q https://github.com/chsc/gogl
cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git fetch -f https://github.com/chsc/gogl 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
18.274s # cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git fetch -f https://github.com/go-gl/gl 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
0.005s # cd /home/user/go/pkg/mod/cache/vcs/a66bc2b029aca7c99ed3302b0a89e8e783cf85dda193789904a464e84143ee29; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
17.376s # cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git fetch -f https://github.com/veandco/go-sdl2 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
0.005s # cd /home/user/go/pkg/mod/cache/vcs/cd2eb5440c8023d6abf95ef9a9807e9f24e19a934becc7b722a63062a2a2c49b; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
18.477s # cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git fetch -f https://github.com/chsc/gogl 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
0.004s # cd /home/user/go/pkg/mod/cache/vcs/5a4a0d0887d90935c07027c70c55484ac1cdd6fa95c0b8a066e5e190a52b5156; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 000000000000
go: error loading module requirements

T L

unread,
Mar 10, 2019, 1:52:55 AM3/10/19
to golang-nuts
I would admit I made a mistake here, by putting some unnecessary dependencies
But I also think they are not fatal harmful for the library users. Am I right?


On Saturday, March 9, 2019 at 4:16:04 PM UTC-4, T L wrote:
I have library package: https://github.com/go-gfx/go-skia
I set its module path as "go101.org/go-skia". (see the go.mod file)

Then I created a new app project.
In its "go.mod" file, I added the following line:


Then I run "go build", it outputted:

$ go build
go: finding github.com/go-gfx/go-skia latest
go: errors parsing go.mod:
/home/user/Desktop/ttt/go.mod:3: invalid module version "latest": unrecognized import path "go101.org/go-skia" (https fetch: Get https://go101.org/go-skia?go-get=1: dial tcp 216.239.36.21:443: i/o timeout)

Why does it connect to "go101.org"? After all, I have replace the package path to "github.com" already.

And, how should I add the replace line in "go.mod' file? "latest" is not a valid module version?

then I run "go mod tidy", it outputted:

$ go mod tidy
go: downloading github.com/go-gfx/go-skia v0.0.0-20190309194705-3a2f2f5bee30
go: extracting github.com/go-gfx/go-skia v0.0.0-20190309194705-3a2f2f5bee30
go: finding github.com/veandco/go-sdl2 v0.0.0-00010101000000-000000000000
go: finding github.com/chsc/gogl v0.0.0-00010101000000-000000000000
go: finding github.com/go-gl/gl v0.0.0-00010101000000-000000000000
go: github.com/chsc/go...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000

go: github.com/go-gl/g...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: error loading module requirements
$
$ go build
go: finding github.com/go-gfx/go-skia latest
go: finding github.com/go-gl/gl v0.0.0-00010101000000-000000000000
go: finding github.com/chsc/gogl v0.0.0-00010101000000-000000000000
go: finding github.com/veandco/go-sdl2 v0.0.0-00010101000000-000000000000
go: github.com/chsc/go...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: github.com/go-gl/g...@v0.0.0-00010101000000-000000000000: unknown revision 000000000000

go: error loading module requirements

T L

unread,
Mar 10, 2019, 12:21:01 PM3/10/19
to golang-nuts
I removed the unnecessary dependencies in go.mod and uploaded the repo to another place.
It can be imported now.
Reply all
Reply to author
Forward
0 new messages