Skip to content

Commit b635089

Browse files
authored
all: remove deprecated protobuf dependencies (ethereum#30232)
The package `github.com/golang/protobuf/proto` is deprecated in favor `google.golang.org/protobuf/proto`. We should update the codes to recommended package. Signed-off-by: Icarus Wu <[email protected]>
1 parent dad8f23 commit b635089

File tree

7 files changed

+10
-12
lines changed

7 files changed

+10
-12
lines changed

.golangci.yml

-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ issues:
6464
text: 'SA1019: "golang.org/x/crypto/openpgp" is deprecated: this package is unmaintained except for security fixes.'
6565
- path: core/vm/contracts.go
6666
text: 'SA1019: "golang.org/x/crypto/ripemd160" is deprecated: RIPEMD-160 is a legacy hash and should not be used for new applications.'
67-
- path: accounts/usbwallet/trezor.go
68-
text: 'SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead.'
69-
- path: accounts/usbwallet/trezor/
70-
text: 'SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead.'
7167
exclude:
7268
- 'SA1019: event.TypeMux is deprecated: use Feed'
7369
- 'SA1019: strings.Title is deprecated'

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ clean:
4242
devtools:
4343
env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
4444
env GOBIN= go install github.com/fjl/gencodec@latest
45-
env GOBIN= go install github.com/golang/protobuf/protoc-gen-go@latest
45+
env GOBIN= go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
4646
env GOBIN= go install ./cmd/abigen
4747
@type "solc" 2> /dev/null || echo 'Please install solc'
4848
@type "protoc" 2> /dev/null || echo 'Please install protoc'

accounts/usbwallet/trezor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
"github.com/ethereum/go-ethereum/common/hexutil"
3434
"github.com/ethereum/go-ethereum/core/types"
3535
"github.com/ethereum/go-ethereum/log"
36-
"github.com/golang/protobuf/proto"
36+
"google.golang.org/protobuf/proto"
3737
)
3838

3939
// ErrTrezorPINNeeded is returned if opening the trezor requires a PIN code. In

accounts/usbwallet/trezor/trezor.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
// - Download the latest protoc https://github.com/protocolbuffers/protobuf/releases
4040
// - Build with the usual `./configure && make` and ensure it's on your $PATH
4141
// - Delete all the .proto and .pb.go files, pull in fresh ones from Trezor
42-
// - Grab the latest Go plugin `go get -u github.com/golang/protobuf/protoc-gen-go`
43-
// - Vendor in the latest Go plugin `govendor fetch github.com/golang/protobuf/...`
42+
// - Grab the latest Go plugin `go get -u google.golang.org/protobuf/cmd/protoc-gen-go`
43+
// - Vendor in the latest Go plugin `govendor fetch google.golang.org/protobuf/...`
4444

4545
//go:generate protoc -I/usr/local/include:. --go_out=paths=source_relative:. messages.proto messages-common.proto messages-management.proto messages-ethereum.proto
4646

@@ -50,7 +50,7 @@ package trezor
5050
import (
5151
"reflect"
5252

53-
"github.com/golang/protobuf/proto"
53+
"google.golang.org/protobuf/proto"
5454
)
5555

5656
// Type returns the protocol buffer type number of a specific message. If the

build/tools/tools.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ package tools
2222
import (
2323
// Tool imports for go:generate.
2424
_ "github.com/fjl/gencodec"
25-
_ "github.com/golang/protobuf/protoc-gen-go"
2625
_ "golang.org/x/tools/cmd/stringer"
26+
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
2727
)

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ require (
3131
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff
3232
github.com/gofrs/flock v0.8.1
3333
github.com/golang-jwt/jwt/v4 v4.5.0
34-
github.com/golang/protobuf v1.5.4
3534
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
3635
github.com/google/gofuzz v1.2.0
3736
github.com/google/uuid v1.3.0
@@ -74,7 +73,7 @@ require (
7473
golang.org/x/text v0.14.0
7574
golang.org/x/time v0.5.0
7675
golang.org/x/tools v0.20.0
77-
google.golang.org/protobuf v1.33.0
76+
google.golang.org/protobuf v1.34.2
7877
gopkg.in/natefinch/lumberjack.v2 v2.2.1
7978
gopkg.in/yaml.v3 v3.0.1
8079
)
@@ -112,6 +111,7 @@ require (
112111
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
113112
github.com/goccy/go-json v0.10.2 // indirect
114113
github.com/gogo/protobuf v1.3.2 // indirect
114+
github.com/golang/protobuf v1.5.4 // indirect
115115
github.com/google/go-querystring v1.1.0 // indirect
116116
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
117117
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
842842
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
843843
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
844844
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
845+
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
846+
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
845847
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
846848
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
847849
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

0 commit comments

Comments
 (0)