mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-29 12:17:48 +00:00
9712361eda
The genproto module incurs an unfortunate amount of dependency bloat since it has a relatively large set of transitive dependencies. Even though these are brought in as a weak dependency (i.e., there is no hard code dependency on genproto), it complicates dependency inspection since users need to vet modules that they may not actually be using. Avoid this weak dependency and instead rely on a dynamic check to ensure that a sufficiently new version of genproto is used. While it can't statically prevent old versions of genproto from being linked into a binary, it guarantees that it will panic at init with a helpful message on what's wrong. Change-Id: I2b5a9759a5cd4c4c57aced54278502b1b6352ba7 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/262679 Trust: Joe Tsai <thebrokentoaster@gmail.com> Reviewed-by: Damien Neil <dneil@google.com>
15 lines
443 B
Go
15 lines
443 B
Go
// Copyright 2020 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build weak_dependency
|
|
|
|
package weakdeps
|
|
|
|
import (
|
|
// Ensure that any program using "github.com/golang/protobuf"
|
|
// uses a version that wraps this module so that there is a
|
|
// unified view on what protobuf types are globally registered.
|
|
_ "github.com/golang/protobuf/proto"
|
|
)
|