Can’t get latest package version with modules

74 views
Skip to first unread message

Christophe Meessen

unread,
Sep 30, 2019, 5:01:17 AM9/30/19
to golang-nuts
I have a small go program to test a third party package stored on github.
I’m using go1.13.1 with no GOPATH defined. Code is in ~/go/src.

When I first tried to compile the program, there was an error in the third party package. I submitted a pull request to fix it and the manager merged it.

The problem I’m facing now is that I can’t get go to use the newest version of the package.

If I remove the require line in the go.mod file and do a go get, or go get -u, or go get -u <package>, I always get the older package although go prints the message "go: finding github.com/XXX/go-YYY latest". It’s definitely not the latest.
I’m stuck now and don’t know how to download the really latest version of the package. 

I guess I’m not supposed to manually clean the go cache (~/go/src/mod/github.com/XXX/go-YYY@...), or am I ?

Christophe Meessen

unread,
Sep 30, 2019, 5:12:02 AM9/30/19
to golang-nuts
Note that the third party package has no tags.

Christophe Meessen

unread,
Sep 30, 2019, 5:17:11 AM9/30/19
to golang-nuts
Solved the issue with the command:


Is there another way  ?

Le lundi 30 septembre 2019 11:01:17 UTC+2, Christophe Meessen a écrit :

Christophe Meessen

unread,
Oct 1, 2019, 2:59:55 AM10/1/19
to golang-nuts
When GOPATH is defined (~/go),


doesn’t work. I get the error message:

    go: cannot use path@version syntax in GOPATH mode

This is with go1.13.1.

Does this mean that GOPATH must be undefined to use modules with 1.13.1 ? I thought that with go1.13 modules was used everywhere.
The rules are non-intuitive and not explicit.

Andrew Pillar

unread,
Oct 1, 2019, 3:29:25 AM10/1/19
to Christophe Meessen, golang-nuts
>Thank you all. For schema migration i am looking for similar tool like flyway.

I created a simple migration tool called mgrt [1], which operates on pure SQL
scripts that are defined by the user. It has support for MySQL, SQLite and
PostgreSQL. Give it a try if you're looking for a simple migration tool that
just uses plain SQL under the hood. It's written in Go, so building it won't be
too hard.

[1] - https://github.com/andrewpillar/mgrt

Christophe Meessen

unread,
Oct 1, 2019, 3:48:35 AM10/1/19
to golang-nuts
I finally understood. The GOPATH definition is not relevant here. It is the presence of the go.mod file that determines if the module mode is in application. With go1.13, without go.mod file, the old GOPATH mode is in application.

The go.mod file is create by "go mod init [package name]". When present, a "go get" will download and install all dependencies.

Sorry for the noise.
Reply all
Reply to author
Forward
0 new messages