bufbuild / buf

The best way of working with Protocol Buffers.
https://buf.build
Apache License 2.0
8.84k stars 264 forks source link

Installing buf v0.40.0 from source requires Go 1.16 #287

Closed Abhishekvrshny closed 3 years ago

Abhishekvrshny commented 3 years ago
❯ GO111MODULE=on GOBIN=/usr/local/bin go get \
  github.com/bufbuild/buf/cmd/buf \
  github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking \
  github.com/bufbuild/buf/cmd/protoc-gen-buf-lint
go: downloading github.com/bufbuild/buf v0.40.0
go: found github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking in github.com/bufbuild/buf v0.40.0
go: found github.com/bufbuild/buf/cmd/buf in github.com/bufbuild/buf v0.40.0
go: found github.com/bufbuild/buf/cmd/protoc-gen-buf-lint in github.com/bufbuild/buf v0.40.0
go: downloading github.com/bufbuild/buf v0.38.0
go: downloading github.com/jhump/protoreflect v1.8.2
go: downloading github.com/twitchtv/twirp v7.1.0+incompatible
go: downloading github.com/gofrs/flock v0.8.0
go: github.com/bufbuild/buf upgrade => v0.40.0
go: downloading google.golang.org/protobuf v1.25.1-0.20210303022638-839ce436895b
go: downloading github.com/golang/protobuf v1.4.4-0.20210303013846-acacf8158c9a
go: downloading google.golang.org/grpc v1.37.0-dev.0.20210309003715-fce74a94bdff
go: downloading github.com/jhump/protoreflect v1.8.3-0.20210302193947-8255811fc3c0
go: downloading google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
go: downloading github.com/twitchtv/twirp v7.1.1+incompatible
go: downloading github.com/spf13/cobra v1.1.3
go: downloading github.com/klauspost/compress v1.11.12
go: downloading golang.org/x/net v0.0.0-20210315170653-34ac3e1c2000
go: downloading golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005
# github.com/bufbuild/buf/internal/pkg/diff
../../../../pkg/mod/github.com/bufbuild/buf@v0.40.0/internal/pkg/diff/diff.go:130:15: undefined: os.CreateTemp
note: module requires Go 1.16
# github.com/bufbuild/buf/internal/pkg/ioextended
../../../../pkg/mod/github.com/bufbuild/buf@v0.40.0/internal/pkg/ioextended/ioextended.go:30:36: undefined: io.NopCloser
../../../../pkg/mod/github.com/bufbuild/buf@v0.40.0/internal/pkg/ioextended/ioextended.go:32:53: undefined: io.Discard
../../../../pkg/mod/github.com/bufbuild/buf@v0.40.0/internal/pkg/ioextended/ioextended.go:67:15: undefined: io.ReadAll
note: module requires Go 1.16
# github.com/bufbuild/buf/internal/pkg/tmp
../../../../pkg/mod/github.com/bufbuild/buf@v0.40.0/internal/pkg/tmp/tmp.go:50:15: undefined: os.CreateTemp
../../../../pkg/mod/github.com/bufbuild/buf@v0.40.0/internal/pkg/tmp/tmp.go:99:15: undefined: os.MkdirTemp
note: module requires Go 1.16
# github.com/bufbuild/buf/internal/pkg/transport/http/httpclient
../../../../pkg/mod/github.com/bufbuild/buf@v0.40.0/internal/pkg/transport/http/httpclient/httpclient.go:90:15: undefined: io.ReadAll
note: module requires Go 1.16
zerospiel commented 3 years ago

I think that this is not an issue because go.mod has a pretty obvious directive — go 1.16, that indicates the minimal required version to use the product.

Abhishekvrshny commented 3 years ago

The issue is that any breaking change should ideally go as a major release. Although, I understand that buf is still in pre-release, but backward compatibility is still good to have.

johanbrandhorst commented 3 years ago

Hi! We'll discuss internally what we want to do about this, but as a workaround you should be able to use the pre-built releases for now: https://github.com/bufbuild/buf/releases/tag/v0.40.0. The installation instructions recommend using one of the binary releases.

bufdev commented 3 years ago

This isn't a breaking change. Increasing the minimum required version to build a Golang library is something widely-done across the entire Golang community for the same major version.

We have never had a breaking change in buf across all 57 beta releases, and do not intend to break this streak, and this change doesn't represent a breakage. This is a common action performed across all Golang libraries.

While this isn't applicable here directly, it follows in the same vein as SemVer-managed upgrades: increasing the minimum required minor version of a dependency is acceptable, for example bumping github.com/foo/bar from 1.0 to 1.1. Even further, changing any dependency for a library is acceptable with Golang modules, as go.mod tracks this information and go handles any required downloads.

However, even further than this buf isn't actually a Golang library itself - it is just a binary you install. We recommend you install from the binaries. However, if you want to install from source, the minimum version to do so is now 1.16, the bumping of which is a common upgrade across the Golang community.