-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This package cannot be easily constrained with go mod #291
Comments
Is it sufficient if I put a holder file in github.com/ugorji/go? e.g. github.com/ugorji/go/doc.go? There are many reasons why I have hesitated on #43 while keeping it open. The reasons are listed there and extremely compelling. I would rather fix this issue that bring out a big hammer. |
Very possibly, yes. I will not profess to be an expert on modules, but I do wonder if even adding a |
Some tools MAY have issues with empty packages. It may be more problematic if the package is a module root. To possibly help with this, we will use this doc.go to make this module root a real package with files. Updates #291
go modules have been a source of pain for me too. A big part of me is depending on folks who work with this a lot to help. I definitely appreciate your kicking the tires on it here. Is it possible to try out this change 5e5ed36 somehow, and see if it helps? Thanks. |
The doc.go wouldn't work. go tool doesn't support package names which are reserved words. Back to the drawing board. If you have any ideas, please share. |
…ames which are reserved keywords Updates #291
I spent the last day reading about go modules, and how it works. I also read Russ' initial documents about vgo. I have been trying to see if there is anything I can do to help this. What seems clear to me, is that we are supporting go modules as designed. The go tool still has issues to resolve in its module support, but there isn't much we can do here to solve it.
https://golang.org/cmd/go/#hdr-Defining_a_module
https://research.swtch.com/vgo-module
You actually see this in https://github.com/gammazero/nexus , where there is no .go file in the repo root, but all packages are sub-directories in here. This is a pattern that has been common for go packages for a very long time - where you would see packages like github.com/user/go-pkg/pkg. Because of these, there is nothing I can really do to alleviate this issue. The main issue is that we introduced a breaking change. But even #43 does not resolve that, as #43 basically is about changing the import/package path, which means that no current user knows about this "new" package. It effectively splinters the ecosystem, of which we already have 2311 packages depending on this (as seen in https://godoc.org/github.com/ugorji/go/codec?importers and at bottom of https://godoc.org/github.com/ugorji/go/codec ). When I slowly parse through your messages above, what I can see is that you are dependent on a package which is broken by our change, and go module support doesn't allow you to constrain its dependency to a specific commit of go. This is a go tool issue. I really think you should open this issue with the go tool, and let them dig into this. You have a very clear reproducer and detailed bug report for them. My own issue alone is defined by #290 (Breaking change). It's extremely unfortunate oversight and my bad for that one. We will leave that open to see who else is affected before making a change. I will close this one now. Please let me know if you think different. @dcarbone ^^ |
Take this simple example code:
Here is the go.mod file produced:
and the go.sum:
With modules, this fails to build due to the breaking API change done here.
The typical way to try to address this would be to do something like this:
go mod edit -replace github.com/ugorji/[email protected]=github.com/ugorji/[email protected]
This adds the following line to the go.mod file:
replace github.com/ugorji/go v1.1.4 => github.com/ugorji/go v1.1.2
and after running
go vendor
orgo tidy
, the sum file is updated:You'll notice, however, that v1.1.4 is still in there.
When you attempt to
go build
, you see this error:This can be "fixed" by manually adding the following replace statements (this list is incomplete, as you've committed more to master since I gave up this):
and manually adding this to the
require
block:Once done, you can now build the code.
This is not a penultimate solution, however, because the next time you run
go get
for any other dep, the line added to the mod file is removed.This would not be a big issue if it were not for the BC issue introduced by a70535d, and I believe this could be solved given the implementation of #43.
The text was updated successfully, but these errors were encountered: