I encountered the following problem when trying to get a package that was required by my project:
go: gitlab.xxx.cn/uyy/zzz@v0.0.76: reading gitlab.xxx.cn/uyy/zzz/go.mod at
revision v0.0.76: unknown revision v0.0.76
I had tried a lot of ways that can be found on the internet to solve it, such as setting GO111MODULES to on, adding private repository to GOPRIVATE, but it still as it was, and finally, I used a method that was mentioned in this article(golang.cafe/blog/how-to…) to make sure the git configuration was appropriate for private repositories, and congratulations, it works! so here is what i did,
git config --global url."ssh://git@gitlab.xxx.cn:uyy".insteadOf "https://gitlab.xxx.cn/uyy"
Go get uses the git under the hood to fetch the dependencies required by your project, in this way, git downloads the library using your local public key file that's uploaded to your gitlab ssh settings.