MobilityData / gtfs-realtime-bindings

Language bindings generated from the GTFS Realtime protocol buffer spec for popular languages.
Apache License 2.0
370 stars 127 forks source link

Publish go module for golang bindings #116

Closed jameslinjl closed 1 year ago

jameslinjl commented 1 year ago

Publish the go module so that a semantic version can be assigned to the published module (current state of the world is that go.mod and go.sum will just reference the relevant commit hash... which definitely works, but it would be nicer to have a semantic version available).

Requires someone with write permissions to the repo to do this. Should be pretty straightforward, following: https://go.dev/blog/publishing-go-modules

jameslinjl commented 1 year ago

@isabelle-dr or @bdferris-v2 to find someone to help with this :)

jameslinjl commented 1 year ago

@isabelle-dr @bdferris-v2 Publishing the Go module requires permissions to tag and push tags for this repo.

If you think it makes sense for me to have these permissions, I'm happy to help do that. Someone with existing write permissions can also publish this module by running:

git tag golang/gtfs/v1.0.0
git push origin golang/gtfs/v1.0.0
GOPROXY=proxy.golang.org go list -m github.com/MobilityData/gtfs-realtime-bindings/golang/gtfs@v1.0.0

One should note the prefix of golang/gtfs/ per the golang reference documentation about packages that belong to a subdirectory within a larger repo (where the repo root path is github.com/MobilityData/gtfs-realtime-bindings): https://go.dev/ref/mod#vcs-version

If a module is defined in a subdirectory within the repository, that is, the module subdirectory portion of the module path is not empty, then each tag name must be prefixed with the module subdirectory, followed by a slash. For example, the module golang.org/x/tools/gopls is defined in the gopls subdirectory of the repository with root path golang.org/x/tools. The version v0.4.0 of that module must have the tag named gopls/v0.4.0 in that repository.

bdferris-v2 commented 1 year ago

Let me take a shot at publishing. I'll leave it up @isabelle-dr on the permissions question.

fredericsimard commented 1 year ago

@isabelle-dr If Brian is going to add the tag, he has the correct permissions to push it to the repo. Is this what you wanted me to check?

isabelle-dr commented 1 year ago

@fredericsimard are we also have the correct permissions to do it?

fredericsimard commented 1 year ago

@isabelle-dr Yes, you have those permissions just by being part of the Data Quality team, which has maintain rights on this repo. Same as Brian's.

bdferris-v2 commented 1 year ago

A few questions here:

1) What should the semantic version be? I know versioning has been ad-hoc across the different language bindings. I was wondering if anyone had a strong opinion here. 2) Just confirming that the tag will need to be golang/gtfs/vX.Y.Z because our go module is in a repo subdirectory, per discussion at https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories. Does that match your understanding?

isabelle-dr commented 1 year ago

Hello,

If I understand correctly, this is the first time we will publish a module for golang bindings. v0 is used for "initial unstable version", whereas v1 is used for "the first stable version" (source). So, maybe v1.0.0?

jameslinjl commented 1 year ago

What should the semantic version be? I know versioning has been ad-hoc across the different language bindings. I was wondering if anyone had a strong opinion here.

I would advocate for v1.0.0 for the semantic version.

Just confirming that the tag will need to be golang/gtfs/vX.Y.Z because our go module is in a repo subdirectory, per discussion at https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories. Does that match your understanding?

Yup! That matches my understanding and what I had written up previously here: https://github.com/MobilityData/gtfs-realtime-bindings/issues/116#issuecomment-1385851197

bdferris-v2 commented 1 year ago

Apologies I forgot about that comment.

For semantic version, would it be worthwhile pushing a v0 test release first to verify everything is working correctly before tagging a v1.0.0 release?

jameslinjl commented 1 year ago

@bdferris-v2 No worries - and I think pushing a v0 test release first is a good idea!

fredericsimard commented 1 year ago

Question: do we need to create an account for this like I did for Pypi? If so, I'll be able to do it once I get back from my errands, in roughly 2h from now, so 13:30 EST.

jameslinjl commented 1 year ago

To my understanding, no account is required for publishing go packages.

One can actually see the go package already here: https://pkg.go.dev/github.com/MobilityData/gtfs-realtime-bindings/golang/gtfs. The versioning is just using a commit hash versioned v0 for now (which should change once an appropriate version tagged is pushed and the package updates are pushed).

Some more information here: https://proxy.golang.org/

bdferris-v2 commented 1 year ago

As of about 30 seconds ago, we now have a tagged version v0.0.1

I've verified that

GOPROXY=proxy.golang.org go list -m github.com/MobilityData/gtfs-realtime-bindings/golang/gtfs@v0.0.1

seems to spit out something reasonable.

bdferris-v2 commented 1 year ago

Publishing of v0.0.1 seems successful. I'm going add a documentation update in #119 and then tag that as the v1.0.0 release.

bdferris-v2 commented 1 year ago

Publishing of v1.0.0 is now complete. I'm going to take the liberty of marking this bug as complete? Thanks for all your work on this @jameslinjl !