Closed gudvinr closed 3 years ago
I'm not quite sure how to fix this (go modules are somewhat new to me). I want to avoid copying everything in a new v2
subfolder - this is what I believe Git is for. If you have an easy fix, I would very much appreciate a pull request.
If you are referring to this https://blog.golang.org/v2-go-modules#TOC_4. I don't believe this is the suggested way of doing it. I have never seen a project with a v2 directory. I believe just appending /v2 to the URL in your go.mod should do it.
Examples: https://github.com/gocolly/colly https://github.com/grpc-ecosystem/grpc-gateway https://github.com/ahmdrz/goinsta
Also replacing github.com/Philipp15b/go-steam
with github.com/Philipp15b/go-steam/v2
in import path is necessary too.
etcd
is suffering from this too since they added go.mod
in v3.3 and didn't fix import path up until v3.5
Thank you both! @gudvinr You mean replacing the import path in every single file that uses it?
What do you both think about just using versions like 1.x
, removing version 2.0? It's a hack, but avoids a lot of ridiculously unnecessary work IMHO.
Thank you both! @gudvinr You mean replacing the import path in every single file that uses it?
That's correct
What do you both think about just using versions like 1.x, removing version 2.0
If v2 contains breaking changes, it'll break working code for v1 users after update. It should be safe to do so if it's not.
Right now there should be a little to no v2 users since go get
should pull v1 because v2.0.0 tag does not have a proper module.
In theory you only need to replace import path in the library itself. Right now v2 can only be fetched either for users who use older Go version or if person manages to get code from master branch.
If v2 contains backward incompatible changes it is not unnecessary work though and should be quite trivial to do from any text editor
Well technically v2 contains breaking changes against v1, but those changes were already a few years old at that point. I will merge #116 though.
@Philipp15b Hey, any word on merging this in?
Merged it now, thanks for the reminder.
@Philipp15b I also suggest you to add retraction for v2.0.0
and tag last commit with v2.0.1
or something like that.
It will instruct go tools to avoid v2.0.0
which contains malformed go.mod
anyway and v2.0.1
can be finally retrieved through go get
like you would usually do.
@gudvinr Thanks for the pointer. I have just released https://github.com/Philipp15b/go-steam/releases/tag/v2.0.1. Hopefully everything finally works as intended.
Hopefully everything finally works as intended.
pkg.go.dev now showing correct version:
Version: v2.0.1 Latest
Published: May 1, 2021
As per documention:
Since go-steam has
go.mod
file at git tagv2.0.0
it must havemodule github.com/Philipp15b/go-steam/v2
ingo.mod
and notmodule github.com/Philipp15b/go-steam
.Because of that it cannot be shown in htttps://pkg.go.dev/ for example.