News for hackers. Stuff that matters.
Re:A new Go API for Protocol Buffers by dgellow on Monday March 02, 2020 @03:47PM (#22468768)
> The github.com/golang/protobuf module is APIv1.

> The google.golang.org/protobuf module is APIv2. We have taken advantage of the need to change the import path to switch to one that is not tied to a specific hosting provider.

That's such a weird choice, and will be quite confusing. Now every time you see protobuf being imported, you have to be sure to pay extra attention to the domain used, and correctly remember which one is v1 or v2. If only go modules established a clear way to differentiate API versions using the import path!

Re:A new Go API for Protocol Buffers by kardianos on Monday March 02, 2020 @05:12PM (#22469594)
The goal of issuing a major version is to create a separate package namespace so it can be imported concurrently to other major versions. By treating major versions as different packages, it creates efficiencies in VCS history and common namespace.

However, the goal is to create a new package name that can be concurrently imported with previous versions. Everything else is just method. Don't confuse the goal with the method.

Re:A new Go API for Protocol Buffers by cle on Monday March 02, 2020 @06:41PM (#22470336)
People care about versions. If it’s harder or more confusing to understand what version you’re on, that’s more than “just method”. Otherwise we’d just use UUIDs for package names and call it a day.
Re:A new Go API for Protocol Buffers by mirekrusin on Tuesday March 03, 2020 @03:01AM (#22472699)
Julia uses uuids masked with name.
Re:A new Go API for Protocol Buffers by icholy on Monday March 02, 2020 @04:19PM (#22469129)
> If only go modules established a clear way to differentiate API versions using the import path!

It did, they just chose not to follow it :/ I wonder what rsc thinks about this decisions

Re:A new Go API for Protocol Buffers by dgellow on Tuesday March 03, 2020 @05:05AM (#22473196)
I know, that sentence was meant to be ironic :)
Re:A new Go API for Protocol Buffers by Insanity on Monday March 02, 2020 @06:53PM (#22470419)
Rsc?
Re:A new Go API for Protocol Buffers by BarkMore on Monday March 02, 2020 @07:10PM (#22470533)
Re:A new Go API for Protocol Buffers by Insanity on Wednesday March 04, 2020 @05:12AM (#22482528)
Thanks!
Re:A new Go API for Protocol Buffers by alkonaut on Monday March 02, 2020 @05:34PM (#22469790)
Then you see the version imported being v1.X where X>20 and of course that makes it obvious that it’s v2?

Are version numbers 2.0 and higher explicitly banned?

Edit: found an explanation further down (spoiler: not a very good one but a very go one).

Re:A new Go API for Protocol Buffers by ethbro on Monday March 02, 2020 @08:48PM (#22471113)
It's Google.

Valid versions are in the 0 < x < 1.0 range.

Re:A new Go API for Protocol Buffers by jackielii on Tuesday March 03, 2020 @04:48AM (#22473133)
I believe this is discussed and decided quite early on: https://docs.google.com/document/d/19kfhro7-CnBdFqFk7l4_Hmwa...

>According to the Import Compatiability Rule for versioned Go, this implies that the new proto package must have a new import path. Since "github.com/protobuf/proto/v2" will incur great confusion with the proto2 syntax, we may take this time to use an import path like "google.golang.org/proto" (similar to how gRPC lives at "google.golang.org/grpc").

Re:A new Go API for Protocol Buffers by pdexter on Tuesday March 03, 2020 @06:18AM (#22473501)
Random question, but how did they get the source code highlighting in that doc?
Re:A new Go API for Protocol Buffers by konart on Tuesday March 03, 2020 @06:41AM (#22473597)
Code Blocks addong from G Suit Market (new doco -> addons -> Install -> Code Blocks)
Re:A new Go API for Protocol Buffers by DougBTX on Tuesday March 03, 2020 @02:20AM (#22472500)
They did get one benefit from this choice:

> the version number alone should be enough to unambiguously differentiate between APIv1 and APIv2.

...which is how version numbers normally work. They've made a big breaking change in a 1.X release, so it isn't semver, but that isn't the end of the world. It works around having to put the major version number in the import path too, so really it works like most other non-Go, non-semver, projects.

Re:A new Go API for Protocol Buffers by heydabop on Tuesday March 03, 2020 @12:05AM (#22471943)
I've seen many people append a version to the package name. So they could have done `protobuf.v2` (granted the original would be missing a version but still, at least this is more explicit)
Re:A new Go API for Protocol Buffers by giancarlostoro on Monday March 02, 2020 @04:20PM (#22469137)
Would be nice if they would just make packages.golang.org sorta how Python has PyPI, Rust has Crates.IO and so on... They can just redirect to relevant repos...