bazelbuild / buildtools

A bazel BUILD file formatter and editor
Apache License 2.0
1.02k stars 417 forks source link

Go module compatibility #967

Open linzhp opened 3 years ago

linzhp commented 3 years ago

Go modules requires all v2 and later major versions to have import paths ending with /v2 etc: https://blog.golang.org/v2-go-modules.

However, f2aed9ee205d62d45c55cfabbfd26342f8526862 added go.mod file to this repository without changing the import path. In addition, the tags should be in the format of v4.0.1. As a result, neither Go proxy and or go get is able to find the semver, and still resolves to psuedo-version:

$ go get github.com/bazelbuild/buildtools@4.0.1
go: github.com/bazelbuild/buildtools 4.0.1 => v0.0.0-20210227132407-f2aed9ee205d
pmbethe09 commented 3 years ago

interesting. So as I understand it, a Go module version, like v2 or v4 indicates a breaking API change to the previous version. buildifier/buildozer has had no such change. So as far as Go is concerned, our API is still a v1.

We have been using release tags like 4.0.0 to lockstep with https://github.com/bazelbuild/bazel but are not the same as Go module tags.

@vladmos I am not sure what the right way forward is.

vladmos commented 3 years ago

I think there have been some breaking changes, but they have nothing to do with the binaries versions (that just mach Bazel versions now). It's possible to have a breaking change between versions, for example, 4.1.2. and 4.1.3. Maybe it makes sense to version the current state as "v1" and then bump in independently of binaries/Bazel versions when an incompatible change actually happens?