I made a mistake described here. Unfortunately that question is wrongly closed as "duplicate", and the proposed question is actually not same as mime.
Let me rephrase my question in another way: as a module author, how can I remove a module from Go's "sumsdb" so that mistake like described can be fixed.
Original question pasted below for reference.
EDIT: this question was closed by moderator, but it is NOT answered by the given uri, which gives a different error message:
Why does go get fail with "invalid version: unknown revision"?
I'll rephrase my questions:
I removed tag v1.0.0
from a commit, and tagged another commit. Now I found that the repository is not usable anymore. To verify: you may just do the following:
- Clone https://github.com/xrfang/hap
- cd into the
example
directory, then rungo build .
This problem not only happens on my PC, but on anyone trying to use the above repo.
I wonder if the problem will disappear over time (as cache expires?) or I have to do something? If it will heal itself, I wonder how long is the cache valid time? If not, I would like to know how to fix that. I hope not using things like GOPRIVATE, as this repo is going to be public (open source).
original post:
I write a http argument parsing tool, and put it at github.com/xrfang/hap
. The git log is:
* d8cee08 2022-02-14 | implemented http.Handler interface (HEAD -> master, tag: v1.0.0, origin/master, origin/HEAD) [xrfang]
* 171dc29 2022-02-10 | updated go.mod for example [xrfang]
* d2cea3c 2022-02-09 | added example [xrfang]
* 202d959 2022-02-09 | bug fix in error handling [xrfang]
* ... ...
Problem is, previouly, I tagged commit d2cea3c
as v1.0.0. Later I found it not optimal and added some new code. The new code is NOT compatible with v1.0.0, so I should make it v2.0.0. However, as this tool is newly written and I am the only user. I think it is stupid to make it v2.0.0. So I just removed and retagged v1.0.0 to the latest commit d8cee08
.
The problem is, go complained that the version is not "authentic". I then removed go.sum, and did go clean -modcache
, go get -u
, go mod tidy
, to no avail. The last try is:
$ go get -u
# example
./main.go:30:11: at.Init undefined (type apiTest has no field or method Init)
./main.go:39:2: undefined: hap.Register
My questions are:
How does Go manage its repository? I previously found that after I updated my module and push it to github, the example often fail to compile, unless I use
replace
in go.mod, or just wait for a while (e.g. 30 minute). It seems that there is a central "look up table" which is updated periodically and hence oftem lags behind while modules update?How to fix my current problem of a re-tagged version?
CodePudding user response:
Your understanding is correct as also described in the question you linked.
Either
- Publish v2.0.0
- Live with GOPRIVATE
- Publish v1.1.0