diff --git a/Makefile b/Makefile index 5a56d4233df..7401925c3ac 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,10 @@ endif # All .go files that are not auto-generated and should be auto-formatted and linted. ALL_SRC = $(shell find . -name '*.go' \ - -not -name 'doc.go' \ -not -name '_*' \ -not -name '.*' \ -not -name 'mocks*' \ - -not -name 'model.pb.go' \ - -not -name 'model_test.pb.go' \ - -not -name 'storage_test.pb.go' \ + -not -name '*.pb.go' \ -not -path './vendor/*' \ -not -path '*/mocks/*' \ -not -path '*/*-gen/*' \ @@ -166,18 +163,20 @@ goleak: .PHONY: fmt fmt: - ./scripts/import-order-cleanup.sh inplace + @echo Running import-order-cleanup on ALL_SRC ... + @./scripts/import-order-cleanup.py -o inplace -t $(ALL_SRC) @echo Running gofmt on ALL_SRC ... @$(GOFMT) -e -s -l -w $(ALL_SRC) @echo Running gofumpt on ALL_SRC ... @$(GOFUMPT) -e -l -w $(ALL_SRC) - ./scripts/updateLicenses.sh + @echo Running updateLicense.py on ALL_SRC ... + @./scripts/updateLicense.py $(ALL_SRC) .PHONY: lint lint: goleak golangci-lint -v run - ./scripts/updateLicenses.sh > $(FMT_LOG) - ./scripts/import-order-cleanup.sh stdout > $(IMPORT_LOG) + @./scripts/updateLicense.py $(ALL_SRC) > $(FMT_LOG) + @./scripts/import-order-cleanup.py -o stdout -t $(ALL_SRC) > $(IMPORT_LOG) @[ ! -s "$(FMT_LOG)" -a ! -s "$(IMPORT_LOG)" ] || (echo "License check or import ordering failures, run 'make fmt'" | cat - $(FMT_LOG) $(IMPORT_LOG) && false) ./scripts/check-semconv-version.sh ./scripts/check-go-version.sh diff --git a/Makefile.Protobuf.mk b/Makefile.Protobuf.mk index b1a492f2098..b7859909ee3 100644 --- a/Makefile.Protobuf.mk +++ b/Makefile.Protobuf.mk @@ -79,7 +79,14 @@ endef # TODO add proto-hotrod to the list after regenerating its file (may need linter tweaking) .PHONY: proto -proto: proto-model proto-api-v2 proto-storage-v1 proto-zipkin proto-openmetrics proto-otel proto-api-v3 +proto: proto-model \ + proto-api-v2 \ + proto-storage-v1 \ + proto-hotrod \ + proto-zipkin \ + proto-openmetrics \ + proto-otel \ + proto-api-v3 .PHONY: proto-model proto-model: diff --git a/examples/hotrod/services/driver/driver.pb.go b/examples/hotrod/services/driver/driver.pb.go index 1e5d36e96d0..3e4e5947bc3 100644 --- a/examples/hotrod/services/driver/driver.pb.go +++ b/examples/hotrod/services/driver/driver.pb.go @@ -1,19 +1,4 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. - -// Copyright (c) 2020 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - // source: examples/hotrod/services/driver/driver.proto package driver @@ -21,24 +6,23 @@ package driver import ( context "context" fmt "fmt" - math "math" - proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type DriverLocationRequest struct { Location string `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"` @@ -53,23 +37,18 @@ func (*DriverLocationRequest) ProtoMessage() {} func (*DriverLocationRequest) Descriptor() ([]byte, []int) { return fileDescriptor_cdcd28b7ebdcd54f, []int{0} } - func (m *DriverLocationRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DriverLocationRequest.Unmarshal(m, b) } - func (m *DriverLocationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_DriverLocationRequest.Marshal(b, m, deterministic) } - func (m *DriverLocationRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_DriverLocationRequest.Merge(m, src) } - func (m *DriverLocationRequest) XXX_Size() int { return xxx_messageInfo_DriverLocationRequest.Size(m) } - func (m *DriverLocationRequest) XXX_DiscardUnknown() { xxx_messageInfo_DriverLocationRequest.DiscardUnknown(m) } @@ -97,23 +76,18 @@ func (*DriverLocation) ProtoMessage() {} func (*DriverLocation) Descriptor() ([]byte, []int) { return fileDescriptor_cdcd28b7ebdcd54f, []int{1} } - func (m *DriverLocation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DriverLocation.Unmarshal(m, b) } - func (m *DriverLocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_DriverLocation.Marshal(b, m, deterministic) } - func (m *DriverLocation) XXX_Merge(src proto.Message) { xxx_messageInfo_DriverLocation.Merge(m, src) } - func (m *DriverLocation) XXX_Size() int { return xxx_messageInfo_DriverLocation.Size(m) } - func (m *DriverLocation) XXX_DiscardUnknown() { xxx_messageInfo_DriverLocation.DiscardUnknown(m) } @@ -147,23 +121,18 @@ func (*DriverLocationResponse) ProtoMessage() {} func (*DriverLocationResponse) Descriptor() ([]byte, []int) { return fileDescriptor_cdcd28b7ebdcd54f, []int{2} } - func (m *DriverLocationResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DriverLocationResponse.Unmarshal(m, b) } - func (m *DriverLocationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_DriverLocationResponse.Marshal(b, m, deterministic) } - func (m *DriverLocationResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_DriverLocationResponse.Merge(m, src) } - func (m *DriverLocationResponse) XXX_Size() int { return xxx_messageInfo_DriverLocationResponse.Size(m) } - func (m *DriverLocationResponse) XXX_DiscardUnknown() { xxx_messageInfo_DriverLocationResponse.DiscardUnknown(m) } @@ -205,10 +174,8 @@ var fileDescriptor_cdcd28b7ebdcd54f = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var ( - _ context.Context - _ grpc.ClientConn -) +var _ context.Context +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -243,6 +210,14 @@ type DriverServiceServer interface { FindNearest(context.Context, *DriverLocationRequest) (*DriverLocationResponse, error) } +// UnimplementedDriverServiceServer can be embedded to have forward compatible implementations. +type UnimplementedDriverServiceServer struct { +} + +func (*UnimplementedDriverServiceServer) FindNearest(ctx context.Context, req *DriverLocationRequest) (*DriverLocationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindNearest not implemented") +} + func RegisterDriverServiceServer(s *grpc.Server, srv DriverServiceServer) { s.RegisterService(&_DriverService_serviceDesc, srv) } diff --git a/model/converter/empty_test.go b/model/converter/empty_test.go new file mode 100644 index 00000000000..2bdc03ea5d5 --- /dev/null +++ b/model/converter/empty_test.go @@ -0,0 +1,30 @@ +// Copyright (c) 2020 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package converter + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestDummy(t *testing.T) { + // This is a dummy test in the root package. + // Without it `go test -v .` prints "testing: warning: no tests to run". +} + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/model/converter/thrift/empty_test.go b/model/converter/thrift/empty_test.go new file mode 100644 index 00000000000..ae70adeb4cb --- /dev/null +++ b/model/converter/thrift/empty_test.go @@ -0,0 +1,30 @@ +// Copyright (c) 2020 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package thrift + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestDummy(t *testing.T) { + // This is a dummy test in the root package. + // Without it `go test -v .` prints "testing: warning: no tests to run". +} + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/empty_test.go b/pkg/empty_test.go new file mode 100644 index 00000000000..df54281289b --- /dev/null +++ b/pkg/empty_test.go @@ -0,0 +1,30 @@ +// Copyright (c) 2020 The Jaeger Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pkg + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestDummy(t *testing.T) { + // This is a dummy test in the root package. + // Without it `go test -v .` prints "testing: warning: no tests to run". +} + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/scripts/import-order-cleanup.sh b/scripts/import-order-cleanup.sh deleted file mode 100755 index 758ce00ad42..00000000000 --- a/scripts/import-order-cleanup.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -# shellcheck disable=SC2046 # we want multple arguments here -./scripts/import-order-cleanup.py -o "$1" -t $(git ls-files "*\.go" | \ - grep -v \ - -e thrift-gen \ - -e swagger-gen \ - -e thrift-0.9.2 \ - -e proto-gen \ - -e model.pb.go \ - -e model_test.pb.go \ - -e storage_test.pb.go -) diff --git a/scripts/updateLicenses.sh b/scripts/updateLicenses.sh deleted file mode 100755 index ed305e1b521..00000000000 --- a/scripts/updateLicenses.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -# shellcheck disable=SC2046 # we want multple arguments here -./scripts/updateLicense.py $(git ls-files "*\.go" | \ - grep -v \ - -e thrift-gen \ - -e swagger-gen \ - -e proto-gen \ - -e model.pb.go \ - -e model.pb.gw.go \ - -e model_test.pb.go \ - -e storage_test.pb.go -)