Comcast / gots

MPEG Transport Stream handling in Go
Other
305 stars 88 forks source link

Fix v2 module registration #171

Closed adamroach closed 2 years ago

adamroach commented 2 years ago

Using the newer v2 modules is effectively impossible without some rather baroque workarounds. See https://www.reddit.com/r/golang/comments/ty7vqc/importingusing_v2_of_a_github_repo/ for details. It would be nice if the module handling were adjusted to work properly.

LimitlessEarth commented 2 years ago

Hey Adam,

Ah, oops. There is a bit of history with this... we had tagged v2.x in the very early days of modules. Various contributors have come and gone, and it fell through the cracks.

Because we needed to deal with the v2 modules shenanigans we had tried to shore that up, and clearly not quite made it.

I find https://go.dev/blog/v2-go-modules kind of obnoxious and I thought we had followed the guidance.

To start development on v2 of github.com/googleapis/gax-go, we’ll create a new v2/ directory and copy our package into it.
...
Now, let’s create a v2 go.mod file by copying the current go.mod file and adding a v2/ suffix to the module path:
...
Note that the v2 version is treated as a separate module from the v0 / v1 versions: both may coexist in the same build. So, if your v2+ module has multiple packages, you should update them to use the new /v2 import path: otherwise, your v2+ module will depend on your v0 / v1 module. For example, to update all github.com/my/project references to github.com/my/project/v2, you can use find and sed:
...
Now we have a v2 module, but we want to experiment and make changes before publishing a release. Until we release v2.0.0 (or any version without a pre-release suffix), we can develop and make breaking changes as we decide on the new API. If we want users to be able to experiment with the new API before we officially make it stable, we can publish a v2 pre-release version:
...

So we are just left to try and roll forward and fix this. I appreciate you bring this to our attention, I wish we had known sooner.

I'd also encourage you to contribute if you so desire!

Can you give this a try again? I got mine to go with

$ go get github.com/Comcast/gots/v2/packet
go: downloading github.com/Comcast/gots/v2 v2.2.0
go: added github.com/Comcast/gots/v2 v2.2.0
adamroach commented 2 years ago

Thanks for the quick response! Yes, the latest commit fixes this, and I'm able to move to the v2 implementation smoothly.

I'd also encourage you to contribute if you so desire!

I'll definitely send a PR if I have any suggested code improvements; but I'm very much a beginner when it comes to MPEG-TS syntax and semantics. :)

LimitlessEarth commented 2 years ago

Closing!