diff --git a/.golangci.yml b/.golangci.yml index e743ccc..bc5fd52 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,3 +19,5 @@ linters: - cyclop # allow complex functions - nlreturn # allow return/break without whitespace - exhaustivestruct # don't require exhaustive fields in struct initializers + - exhaustive # don't require exhaustive enums + - wrapcheck # disabled due to false positives for gRPC errors diff --git a/go.mod b/go.mod index f3a841f..79caa5e 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,9 @@ require ( cloud.google.com/go v0.81.0 cloud.google.com/go/spanner v1.17.0 github.com/stoewer/go-strcase v1.2.0 - go.einride.tech/aip v0.34.2 - google.golang.org/api v0.44.0 - google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1 + go.einride.tech/aip v0.35.0 + google.golang.org/api v0.45.0 + google.golang.org/genproto v0.0.0-20210413151531-c14fb6ef47c3 google.golang.org/grpc v1.37.0 google.golang.org/protobuf v1.26.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 64646c9..d58e131 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.einride.tech/aip v0.34.2 h1:tNxLH1/4GhbW0AhFhO5Zfu0GfoSZN658Nupgd+kb1Hw= -go.einride.tech/aip v0.34.2/go.mod h1:JgWM7uEMZ1GfTehF4YJKSPg3PQlwgpnLbL+imA0yH3M= +go.einride.tech/aip v0.35.0 h1:++nHTdRBpeEcl+0KRlluNLaGP2SaWPlMardeJ8BSHN0= +go.einride.tech/aip v0.35.0/go.mod h1:JgWM7uEMZ1GfTehF4YJKSPg3PQlwgpnLbL+imA0yH3M= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -252,8 +252,8 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602 h1:0Ja1LBD+yisY6RWM/BH7TJVXWsSjs2VwBSmvSX4HdBc= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78 h1:rPRtHfUb0UKZeZ6GH4K4Nt4YRbE9V1u+QZX5upZXqJQ= +golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -300,8 +300,8 @@ golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750 h1:ZBu6861dZq7xBnG1bn5SRU0vA8nx42at4+kP07FMTog= +golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -388,8 +388,8 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0 h1:URs6qR1lAxDsqWITsQXI4ZkGiYJ5dHtRNiCpfs2OeKA= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= +google.golang.org/api v0.45.0 h1:pqMffJFLBVUDIoYsHcqtxgQVTsmxMDpYLOc5MT4Jrww= +google.golang.org/api v0.45.0/go.mod h1:ISLIJCedJolbZvDfAk+Ctuq5hf+aJ33WgtUsfyFoLXA= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -437,8 +437,9 @@ google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210331142528-b7513248f0ba/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1 h1:E7wSQBXkH3T3diucK+9Z1kjn4+/9tNG7lZLr75oOhh8= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210413151531-c14fb6ef47c3 h1:K+7Ig5hjiLVA/i1UFUUbCGimWz5/Ey0lAQjT3QiLaPY= +google.golang.org/genproto v0.0.0-20210413151531-c14fb6ef47c3/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/protoloader/loader.go b/internal/protoloader/loader.go index a3e9d62..c341b00 100644 --- a/internal/protoloader/loader.go +++ b/internal/protoloader/loader.go @@ -51,7 +51,11 @@ func LoadFilesFromGoPackage(goPackage string) (*protoregistry.Files, error) { if err := proto.Unmarshal(data, &fileSet); err != nil { return nil, fmt.Errorf("load proto files from Go package %s: %w", goPackage, err) } - return protodesc.NewFiles(&fileSet) + files, err := protodesc.NewFiles(&fileSet) + if err != nil { + return nil, fmt.Errorf("load proto files from Go package %s: %w", goPackage, err) + } + return files, nil } // nolint: gochecknoglobals diff --git a/spantest/emulator.go b/spantest/emulator.go index 3b22e14..89b60b8 100644 --- a/spantest/emulator.go +++ b/spantest/emulator.go @@ -68,6 +68,7 @@ func NewEmulatorFixture(t *testing.T) Fixture { dockerRm(t, containerID) }) emulatorHost = inspectPortAddress(t, containerID, "9010/tcp") + t.Log("using emulator from container config", emulatorHost) } else { t.Log("using emulator from environment") } @@ -131,7 +132,7 @@ func (fx *EmulatorFixture) NewDatabaseFromDDLFiles(t *testing.T, glob string) *s return fx.NewDatabaseFromStatements(t, statements) } -// NewDatabaseFromDDLFiles creates a new database with a random ID from the provided statements. +// NewDatabaseFromStatements creates a new database with a random ID from the provided statements. func (fx *EmulatorFixture) NewDatabaseFromStatements(t *testing.T, statements []string) *spanner.Client { t.Helper() databaseID := fmt.Sprintf("db%d", rand.Uint64()) // nolint: gosec @@ -200,6 +201,7 @@ func inspectPortAddress(t *testing.T, containerID string, containerPort string) if portID == containerPort { for _, hostPort := range hostPorts { host, port = hostPort.HostIP, hostPort.HostPort + break // prefer first option } } } diff --git a/tools/golangci-lint/rules.mk b/tools/golangci-lint/rules.mk index 89f7e75..1dde119 100644 --- a/tools/golangci-lint/rules.mk +++ b/tools/golangci-lint/rules.mk @@ -1,5 +1,5 @@ golangci_lint_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) -golangci_lint_version := 1.37.0 +golangci_lint_version := 1.39.0 golangci_lint := $(golangci_lint_cwd)/$(golangci_lint_version)/golangci-lint ifeq ($(shell uname),Linux)