Skip to content

Commit

Permalink
Merge pull request #46 from mfridman/mf/update-plugin
Browse files Browse the repository at this point in the history
Upgrade dependencies and deprecated Go module
  • Loading branch information
mescanne authored Apr 4, 2024
2 parents 31a7e43 + 6a12ba6 commit 100bba8
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 45 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:

# Setup
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '^1.15'
go-version: '^1.16'
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install protoc
uses: arduino/setup-protoc@v1

Expand Down Expand Up @@ -55,9 +55,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '^1.16'
- name: Check code
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: go test -v
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

BQ_PLUGIN=bin/protoc-gen-bq-schema
GO_PLUGIN=bin/protoc-gen-go
PROTOC_GEN_GO_PKG=github.com/golang/protobuf/protoc-gen-go
PROTOC_GEN_GO_PKG=google.golang.org/protobuf/cmd/protoc-gen-go
GLOG_PKG=github.com/golang/glog
PROTO_SRC=bq_table.proto bq_field.proto
PROTO_GENFILES=protos/bq_table.pb.go protos/bq_field.pb.go
PROTO_PKG=github.com/golang/protobuf/proto
PKGMAP=Mgoogle/protobuf/descriptor.proto=$(PROTOC_GEN_GO_PKG)/descriptor
PROTO_PKG=google.golang.org/protobuf
PKGMAP=Mgoogle/protobuf/descriptor.proto=$(PROTO_PKG)/types/descriptorpb
EXAMPLES_PROTO=examples/foo.proto

install: $(BQ_PLUGIN)
Expand All @@ -28,7 +28,7 @@ $(BQ_PLUGIN): $(PROTO_GENFILES) goprotobuf glog
go build -o $@

$(PROTO_GENFILES): $(PROTO_SRC) $(GO_PLUGIN)
protoc -I. -Ivendor/protobuf --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP):protos $(PROTO_SRC)
protoc -I. -Ivendor/protobuf --plugin=$(GO_PLUGIN) --go_out=$(PKGMAP):protos --go_opt=paths=source_relative $(PROTO_SRC)

goprotobuf:
go get $(PROTO_PKG)
Expand All @@ -37,7 +37,6 @@ glog:
go get $(GLOG_PKG)

$(GO_PLUGIN):
go get $(PROTOC_GEN_GO_PKG)
go build -o $@ $(PROTOC_GEN_GO_PKG)

test: $(PROTO_SRC)
Expand All @@ -53,4 +52,4 @@ realclean: distclean
examples: $(BQ_PLUGIN)
protoc -I. -Ivendor/protobuf --plugin=$(BQ_PLUGIN) --bq-schema_out=examples $(EXAMPLES_PROTO)

.PHONY: goprotobuf glog
.PHONY: goprotobuf glog
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module github.com/GoogleCloudPlatform/protoc-gen-bq-schema

go 1.15
go 1.16

require (
github.com/golang/glog v1.0.0
github.com/golang/protobuf v1.5.2
google.golang.org/protobuf v1.31.0
github.com/golang/glog v1.2.0
google.golang.org/protobuf v1.33.0
)
15 changes: 6 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68=
github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (

"github.com/GoogleCloudPlatform/protoc-gen-bq-schema/pkg/converter"
"github.com/golang/glog"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
"google.golang.org/protobuf/proto"
plugin "google.golang.org/protobuf/types/pluginpb"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/converter/comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"
"strings"

"github.com/golang/protobuf/protoc-gen-go/descriptor"
descriptor "google.golang.org/protobuf/types/descriptorpb"
)

const (
Expand Down
8 changes: 3 additions & 5 deletions pkg/converter/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"path"
"sort"
"strings"

"github.com/GoogleCloudPlatform/protoc-gen-bq-schema/protos"
"github.com/golang/glog"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto"
descriptor "google.golang.org/protobuf/types/descriptorpb"
"google.golang.org/protobuf/types/pluginpb"
plugin "google.golang.org/protobuf/types/pluginpb"
)

var (
Expand Down Expand Up @@ -405,7 +403,7 @@ func Convert(req *plugin.CodeGeneratorRequest) (*plugin.CodeGeneratorResponse, e
}

res := &plugin.CodeGeneratorResponse{
SupportedFeatures: proto.Uint64(uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)),
SupportedFeatures: proto.Uint64(uint64(plugin.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)),
}
for _, file := range req.GetProtoFile() {
for msgIndex, msg := range file.GetMessageType() {
Expand All @@ -432,7 +430,7 @@ func Convert(req *plugin.CodeGeneratorRequest) (*plugin.CodeGeneratorResponse, e
// Returning a CodeGeneratorResponse containing either an error or the results of converting the given proto
func ConvertFrom(rd io.Reader) (*plugin.CodeGeneratorResponse, error) {
glog.V(1).Info("Reading code generation request")
input, err := ioutil.ReadAll(rd)
input, err := io.ReadAll(rd)
if err != nil {
glog.Error("Failed to read request:", err)
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/converter/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"reflect"
"testing"

plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
"google.golang.org/protobuf/encoding/prototext"
plugin "google.golang.org/protobuf/types/pluginpb"
)

// schema is an internal representation of generated BigQuery schema
Expand Down
14 changes: 7 additions & 7 deletions protos/bq_field.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions protos/bq_table.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 100bba8

Please sign in to comment.