Skip to content

Commit

Permalink
Revert "Bump Go to 1.17, use golangci-lint instead of make lint, deve…
Browse files Browse the repository at this point in the history
…lop v2 module (#106)" (#111)

This reverts commit bd08ed9.
  • Loading branch information
pdecks committed Dec 13, 2022
1 parent e8bac75 commit aeaff44
Show file tree
Hide file tree
Showing 146 changed files with 29 additions and 12,967 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/pre-commit.yml

This file was deleted.

7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ jobs:
- name: Set Up Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
go-version: '1.14.6'
- run: mkdir -p $GOPATH/bin
- run: wget "https://github.com/protocolbuffers/protobuf/releases/download/v${{ matrix.protoc-version }}/protoc-${{ matrix.protoc-version }}-linux-x86_64.zip" -O /tmp/protoc.zip
- run: unzip /tmp/protoc.zip -d /tmp
- run: sudo mv /tmp/bin/protoc /usr/local/bin/protoc
- run: sudo mv /tmp/include/google /usr/local/include/google
- name: Generate Testdata
run: make testdata
- name: Run Tests
run: make tests

- name: Lint
run: make lint tests
26 changes: 0 additions & 26 deletions .golangci.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .pre-commit-config.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ PROTOC_VER := $(shell protoc --version | cut -d' ' -f2)
.PHONY: bootstrap
bootstrap: testdata # set up the project for development

.PHONY: lint
lint: # lints the package for common code smells
set -e; for f in `find . -name "*.go" -not -name "*.pb.go"`; do \
out=`gofmt -s -d $$f`; \
test -z "$$out" || (echo $$out && exit 1); \
done
which golint || go get -u golang.org/x/lint/golint
golint -set_exit_status ./...
go vet -all

.PHONY: quick
quick: testdata # runs all tests without the race detector or coverage
ifeq ($(PROTOC_VER), 3.17.0)
Expand Down
14 changes: 6 additions & 8 deletions artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ var (
artifactTpl = template.Must(template.New("foo").Parse("{{ . }}"))
)

const fName = "foo"

func TestGeneratorFile_ProtoFile(t *testing.T) {
t.Parallel()

Expand All @@ -27,7 +25,7 @@ func TestGeneratorFile_ProtoFile(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, pb)

f.Name = fName
f.Name = "foo"
pb, err = f.ProtoFile()
assert.NoError(t, err)
assert.Equal(t, f.Name, pb.GetName())
Expand All @@ -49,7 +47,7 @@ func TestGeneratorTemplateFile_ProtoFile(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, pb)

f.Name = fName
f.Name = "foo"
pb, err = f.ProtoFile()
assert.Error(t, err)
assert.Nil(t, pb)
Expand All @@ -73,7 +71,7 @@ func TestGeneratorAppend_ProtoFile(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, pb)

f.FileName = fName
f.FileName = "foo"
pb, err = f.ProtoFile()
assert.NoError(t, err)
assert.Empty(t, pb.GetName())
Expand All @@ -95,7 +93,7 @@ func TestGeneratorTemplateAppend_ProtoFile(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, pb)

f.FileName = fName
f.FileName = "foo"
pb, err = f.ProtoFile()
assert.Error(t, err)
assert.Nil(t, pb)
Expand All @@ -120,7 +118,7 @@ func TestGeneratorInjection_ProtoFile(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, pb)

f.FileName = fName
f.FileName = "foo"
pb, err = f.ProtoFile()
assert.NoError(t, err)
assert.Equal(t, f.FileName, pb.GetName())
Expand All @@ -144,7 +142,7 @@ func TestGeneratorTemplateInjection_ProtoFile(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, pb)

f.FileName = fName
f.FileName = "foo"
pb, err = f.ProtoFile()
assert.Error(t, err)
assert.Nil(t, pb)
Expand Down
3 changes: 2 additions & 1 deletion field_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ func dummyOneOfField(synthetic bool) *field {
m := dummyMsg()
o := dummyOneof()
str := descriptor.FieldDescriptorProto_TYPE_STRING
var oIndex int32 = 1
var oIndex int32
oIndex = 1
f := &field{desc: &descriptor.FieldDescriptorProto{
Name: proto.String("field"),
Type: &str,
Expand Down
5 changes: 3 additions & 2 deletions field_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ func TestMapT_Key(t *testing.T) {

type mockT struct {
FieldType
i []File
f Field
i []File
f Field
err error
}

func (t *mockT) Imports() []File { return t.i }
Expand Down
8 changes: 4 additions & 4 deletions lang/go/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (c context) Name(node pgs.Node) pgs.Name {
return c.PackageName(en)
case ChildEntity: // Message or Enum types, which may be nested
if p, ok := en.Parent().(pgs.Message); ok {
return joinChild(c.Name(p), en.Name())
return pgs.Name(joinChild(c.Name(p), en.Name()))
}
return PGGUpperCamelCase(en.Name())
case pgs.Field: // field names cannot conflict with other generated methods
Expand All @@ -31,9 +31,9 @@ func (c context) Name(node pgs.Node) pgs.Name {
return replaceProtected(PGGUpperCamelCase(en.Name()))
case pgs.EnumValue: // EnumValue are prefixed with the enum name
if _, ok := en.Enum().Parent().(pgs.File); ok {
return joinNames(c.Name(en.Enum()), en.Name())
return pgs.Name(joinNames(c.Name(en.Enum()), en.Name()))
}
return joinNames(c.Name(en.Enum().Parent()), en.Name())
return pgs.Name(joinNames(c.Name(en.Enum().Parent()), en.Name()))
case pgs.Service: // always return the server name
return c.ServerName(en)
case pgs.Entity: // any other entity should be just upper-camel-cased
Expand All @@ -44,7 +44,7 @@ func (c context) Name(node pgs.Node) pgs.Name {
}

func (c context) OneofOption(field pgs.Field) pgs.Name {
n := joinNames(c.Name(field.Message()), c.Name(field))
n := pgs.Name(joinNames(c.Name(field.Message()), c.Name(field)))

for _, msg := range field.Message().Messages() {
if c.Name(msg) == n {
Expand Down
1 change: 0 additions & 1 deletion lang/go/type_name_p2_presence_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//go:build !proto3_presence
// +build !proto3_presence

package pgsgo
Expand Down
2 changes: 1 addition & 1 deletion method.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ func (m *method) childAtPath(path []int32) Entity {

func (m *method) addSourceCodeInfo(info SourceCodeInfo) { m.info = info }

var _ Method = (*method)(nil)
var m Method = (*method)(nil)

0 comments on commit aeaff44

Please sign in to comment.