Go Module Not Downloading Latest Minor Version
Asked Answered
I

1

5

I am using go version 1.13.1, and now I cannot update my dependecy module to the latest minor version using go mod, I made simple repo for learning dependency management on github.com/clavinjune/testng and made a project that depends on it called moduser.

The latest minor version of testng is v1.4.0

┌─[ ~/Public/testng ]─[ git:master ]
└─[ 22:09:19 ] $ git tag -l
v1.0.0
v1.1.0
v1.2.0
v1.3.0
v1.4.0

and moduser still using v1.3.0

┌─[ ~/Public/moduser ]
└─[ 22:09:06 ] $ go list -m all
moduser
github.com/clavinjune/testng v1.3.0

when I want to update the dependency I run this command

┌─[ ~/Public/moduser ]
└─[ 22:20:17 ] $ go get -v -u github.com/clavinjune/testng
┌─[ ~/Public/moduser ]
└─[ 22:20:28 ] $ go get -v -u github.com/clavinjune/testng@latest

But it doesn't downloading the v1.4.0.

Is there any wrong command that I run ?

Imprecate answered 13/10, 2019 at 15:23 Comment(7)
Have you pushed tag v1.4.0 to GitHub, or did you merely create it in your own local repository? (Note that go list -m all does not show v1.4.0 available!)Bangs
First thing that comes to mind: git tag only shows local tags; are you sure you pushed v1.4.0 ? See also github.com/golang/go/wiki/Modules#daily-workflowSchleiermacher
@Bangs yes i've pushed tag v1.4.0, now I realize I need to wait about 20 minutes after the new tag released. is that normal?Imprecate
I'm not sure what's normal, as I have not actually started using Go modules yet.Bangs
@Schleiermacher yes i've pushed it, thanks for the reading, gonna check it.Imprecate
It is pushed: github.com/ClavinJune/testng/tree/v1.4.0 However, and I am not sure wether that matters, but note the camel case in the owner name. Never had that before.Hainan
@MarkusWMahlberg the I think the github username is case insensitive, because I've tried with the exact username too and it still not works.Imprecate
T
11

If you are using the default public proxy (proxy.golang.org), it has a cache on the mapping from latest to a specific version.

If you want to fetch a specific version, you can either pass that version explicitly to go get:

go get -d github.com/clavinjune/[email protected]

or temporarily set GONOPROXY to bypass the cache:

GONOPROXY=github.com/clavinjune go get -d github.com/clavinjune/testng@latest
Teteak answered 12/3, 2020 at 19:37 Comment(1)
Nice trick @Teteak with GONOPROXY env var. This does the job for me.Karlotte

© 2022 - 2024 — McMap. All rights reserved.