Skip to content

Commit

Permalink
Update proto lib to google.golang.org/protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaznocha committed Apr 10, 2021
1 parent e50f948 commit 0cf5db9
Show file tree
Hide file tree
Showing 150 changed files with 35,053 additions and 10,584 deletions.
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ module github.com/ckaznocha/protoc-gen-lint

go 1.11

require (
github.com/golang/protobuf v0.0.0-20161117033126-8ee79997227b
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
)
require google.golang.org/protobuf v1.26.0
12 changes: 8 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
github.com/golang/protobuf v0.0.0-20161117033126-8ee79997227b h1:fE/yi9pibxGEc0gSJuEShcsBXE2d5FW3OudsjE9tKzQ=
github.com/golang/protobuf v0.0.0-20161117033126-8ee79997227b/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
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=
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 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
4 changes: 2 additions & 2 deletions linter/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"io"

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

const (
Expand Down Expand Up @@ -47,7 +47,7 @@ var linterErrors = []errorDescription{ // nolint:gochecknoglobals // Global enum
}

type Config struct {
ProtoFile *descriptor.FileDescriptorProto
ProtoFile *descriptorpb.FileDescriptorProto
OutFile io.WriteCloser
SortImports bool
}
Expand Down
4 changes: 2 additions & 2 deletions linter/protoBufError.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package linter

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

type protoBufError struct {
errorString string
Expand All @@ -9,7 +9,7 @@ type protoBufError struct {
}

func (p *protoBufError) getSourceLineNumber(
protoSource *descriptor.SourceCodeInfo,
protoSource *descriptorpb.SourceCodeInfo,
) (line, col int32) {
p.path = append(p.path, pathMessageName)
sourceLen := len(p.path)
Expand Down
14 changes: 7 additions & 7 deletions linter/protoBuffErrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package linter
import (
"sort"

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

type protoBufErrors []*protoBufError
Expand All @@ -16,7 +16,7 @@ func (p *protoBufErrors) lintProtoMessage(
pathIndex int32,
pathType int32,
parentPath []int32,
protoMessage *descriptor.DescriptorProto,
protoMessage *descriptorpb.DescriptorProto,
) {
path := append(
parentPath,
Expand Down Expand Up @@ -48,7 +48,7 @@ func (p *protoBufErrors) lintProtoMessage(
func (p *protoBufErrors) lintProtoField(
pathIndex int32,
parentPath []int32,
messageField *descriptor.FieldDescriptorProto,
messageField *descriptorpb.FieldDescriptorProto,
) {
path := append(
parentPath,
Expand All @@ -69,7 +69,7 @@ func (p *protoBufErrors) lintProtoEnumType(
pathIndex int32,
pathType int32,
parentPath []int32,
protoEnum *descriptor.EnumDescriptorProto,
protoEnum *descriptorpb.EnumDescriptorProto,
) {
path := append(
parentPath,
Expand All @@ -93,7 +93,7 @@ func (p *protoBufErrors) lintProtoEnumType(
func (p *protoBufErrors) lintProtoEnumValue(
pathIndex int32,
parentPath []int32,
enumVal *descriptor.EnumValueDescriptorProto,
enumVal *descriptorpb.EnumValueDescriptorProto,
) {
path := append(
parentPath,
Expand All @@ -112,7 +112,7 @@ func (p *protoBufErrors) lintProtoEnumValue(

func (p *protoBufErrors) lintProtoService(
pathIndex int32,
protoService *descriptor.ServiceDescriptorProto,
protoService *descriptorpb.ServiceDescriptorProto,
) {
path := []int32{
pathService,
Expand All @@ -135,7 +135,7 @@ func (p *protoBufErrors) lintProtoService(
func (p *protoBufErrors) lintProtoRPCMethod(
pathIndex int32,
parentPath []int32,
serviceMethod *descriptor.MethodDescriptorProto,
serviceMethod *descriptorpb.MethodDescriptorProto,
) {
path := append(
parentPath,
Expand Down
25 changes: 13 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"strings"

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

"github.com/ckaznocha/protoc-gen-lint/linter"
)
Expand All @@ -16,24 +16,23 @@ import (
// to enable checking, whether the proto file imports are sorted alphabetically.
const SortImports = "sort_imports"

func panicOnError(err error) {
if err != nil {
panic(err)
}
}

func main() {
var (
totalErrors int
generatorRequest protoc.CodeGeneratorRequest
generatorRequest pluginpb.CodeGeneratorRequest
parameters struct {
SortImports bool
}
)

data, err := ioutil.ReadAll(os.Stdin)
panicOnError(err)
panicOnError(proto.Unmarshal(data, &generatorRequest))
if err != nil {
panic(err)
}

if err := proto.Unmarshal(data, &generatorRequest); err != nil {
panic(err)
}

for _, p := range strings.Split(generatorRequest.GetParameter(), ",") {
switch strings.TrimSpace(p) {
Expand All @@ -53,7 +52,9 @@ func main() {
OutFile: os.Stderr,
SortImports: parameters.SortImports,
})
panicOnError(err)
if err != nil {
panic(err)
}

totalErrors += numErrors
}
Expand Down
43 changes: 0 additions & 43 deletions vendor/github.com/golang/protobuf/proto/Makefile

This file was deleted.

Loading

0 comments on commit 0cf5db9

Please sign in to comment.