From 2851baa51499b6a064950519e822d8327839505c Mon Sep 17 00:00:00 2001 From: Jeff Wendling Date: Fri, 18 Nov 2022 13:24:45 -0500 Subject: [PATCH] all: bump flake/go versions and regenerate Change-Id: I9a084aec7eff9fef365775b2511fcc77a427be14 --- .golangci.yml | 5 +-- cmd/protoc-gen-go-drpc/README.md | 2 +- cmd/protoc-gen-go-drpc/main.go | 1 + drpcpool/README.md | 13 +++--- examples/drpc/pb/sesamestreet.pb.go | 2 +- examples/drpc_and_http/pb/sesamestreet.pb.go | 2 +- examples/grpc/pb/sesamestreet.pb.go | 2 +- examples/grpc_and_drpc/pb/sesamestreet.pb.go | 2 +- examples/opentelemetry/pb/sesamestreet.pb.go | 2 +- flake.lock | 12 +++--- flake.nix | 26 ++++++------ internal/backcompat/newservice/main.go | 1 + .../newservicedefs/servicedefs.pb.go | 2 +- internal/backcompat/oldservice/main.go | 1 + internal/grpccompat/service.pb.go | 2 +- .../integration/customservice/service.pb.go | 2 +- internal/integration/service/service.pb.go | 2 +- internal/twirpcompat/clientcompat.pb.go | 2 +- internal/twirpcompat/clientcompat.twirp.go | 40 +++++++++---------- 19 files changed, 59 insertions(+), 62 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 0f9cd7a..a962946 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,7 +11,6 @@ run: linters: enable: - bodyclose # find unclosed http response bodies - - deadcode # find code that is not used - dogsled # checks for too many ignored arguments - durationcheck # verifies whether durations are multiplied, usually a mistake - errcheck # find unchecked errors @@ -33,9 +32,7 @@ linters: - nolintlint # checks that nolint directives are correct - revive # check standard linting rules - staticcheck # comprehensive checks - - structcheck # check for unused struct parameters - unconvert # remove unnecessary conversions - - varcheck # find unused global variables and constants - wastedassign #TODO#- forcetypeassert # needs work to replace unchecked interface type assertion #TODO#- gochecknoglobals # needs work to remove globals @@ -169,4 +166,4 @@ issues: text: "do not define dynamic errors" - linters: - revive - text: "if-return" \ No newline at end of file + text: "if-return" diff --git a/cmd/protoc-gen-go-drpc/README.md b/cmd/protoc-gen-go-drpc/README.md index 3f4ed49..c68083c 100644 --- a/cmd/protoc-gen-go-drpc/README.md +++ b/cmd/protoc-gen-go-drpc/README.md @@ -2,6 +2,6 @@ `import "storj.io/drpc/cmd/protoc-gen-go-drpc"` - +protoc-gen-go-drpc generates DRPC code for protobuf services. ## Usage diff --git a/cmd/protoc-gen-go-drpc/main.go b/cmd/protoc-gen-go-drpc/main.go index 9cda156..1e9f068 100644 --- a/cmd/protoc-gen-go-drpc/main.go +++ b/cmd/protoc-gen-go-drpc/main.go @@ -1,6 +1,7 @@ // Copyright (C) 2019 Storj Labs, Inc. // See LICENSE for copying information. +// protoc-gen-go-drpc generates DRPC code for protobuf services. package main import ( diff --git a/drpcpool/README.md b/drpcpool/README.md index e67a51f..1c0297d 100644 --- a/drpcpool/README.md +++ b/drpcpool/README.md @@ -50,7 +50,7 @@ Options contains the options to configure a pool. #### type Pool ```go -type Pool[K comparable] struct { +type Pool struct { } ``` @@ -62,22 +62,23 @@ connections either in total or per key. #### func New ```go -func New[K comparable](opts Options) *Pool[K] +func New(opts Options) *Pool ``` New constructs a new Pool with the provided Options. -#### func (*Pool[K]) Close +#### func (*Pool) Close ```go -func (p *Pool[K]) Close() (err error) +func (p *Pool) Close() (err error) ``` Close evicts all entries from the Pool's cache, closing them and returning all of the combined errors from closing. -#### func (*Pool[K]) Get +#### func (*Pool) Get ```go -func (p *Pool[K]) Get(ctx context.Context, key K, dial func(ctx context.Context, key K) (drpc.Conn, error)) drpc.Conn +func (p *Pool) Get(ctx context.Context, key interface{}, + dial func(ctx context.Context, key interface{}) (drpc.Conn, error)) drpc.Conn ``` Get returns a new drpc.Conn that will use the provided dial function to create an underlying conn to be cached by the Pool when Conn methods are invoked. It diff --git a/examples/drpc/pb/sesamestreet.pb.go b/examples/drpc/pb/sesamestreet.pb.go index 2c4a068..8baaec8 100644 --- a/examples/drpc/pb/sesamestreet.pb.go +++ b/examples/drpc/pb/sesamestreet.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: sesamestreet.proto package pb diff --git a/examples/drpc_and_http/pb/sesamestreet.pb.go b/examples/drpc_and_http/pb/sesamestreet.pb.go index 67c40ae..18769c2 100644 --- a/examples/drpc_and_http/pb/sesamestreet.pb.go +++ b/examples/drpc_and_http/pb/sesamestreet.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: sesamestreet.proto package pb diff --git a/examples/grpc/pb/sesamestreet.pb.go b/examples/grpc/pb/sesamestreet.pb.go index aa756e0..ef915ef 100644 --- a/examples/grpc/pb/sesamestreet.pb.go +++ b/examples/grpc/pb/sesamestreet.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: sesamestreet.proto package pb diff --git a/examples/grpc_and_drpc/pb/sesamestreet.pb.go b/examples/grpc_and_drpc/pb/sesamestreet.pb.go index 63488ed..29c2095 100644 --- a/examples/grpc_and_drpc/pb/sesamestreet.pb.go +++ b/examples/grpc_and_drpc/pb/sesamestreet.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: sesamestreet.proto package pb diff --git a/examples/opentelemetry/pb/sesamestreet.pb.go b/examples/opentelemetry/pb/sesamestreet.pb.go index b003bf5..06b7e94 100644 --- a/examples/opentelemetry/pb/sesamestreet.pb.go +++ b/examples/opentelemetry/pb/sesamestreet.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: sesamestreet.proto package pb diff --git a/flake.lock b/flake.lock index c5c557a..f5caeb3 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1634851050, - "narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "c91f3de5adaf1de973b797ef7485e441a65b8935", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1635797866, - "narHash": "sha256-e3vqt720wyb1PPNcGXej8wwip2/tgO1JsSGYK1NptSw=", + "lastModified": 1668793766, + "narHash": "sha256-IaC4BSIXeZgoeMsDO2gaIJjn5lZV+6XQfQctfXK2dnA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6751e7428f20328fed076acfcbb340d0f4aa0c07", + "rev": "e38f6d37426a26bc8058681daee8a22679949e6f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8fda36b..53d5c99 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ ])); }; subPackages = [ "cmd/protoc-gen-go-drpc" ]; - vendorSha256 = "sha256-3kIFjZDi2qnEDXDY0ozvylxJlBePkK7IPFOVipsfLBU="; + vendorSha256 = "sha256-NMa9c+QIq9VEUQZqZ5X9fNbZDJT99q8XNCH2rRKyMzQ="; }; devShell = @@ -31,12 +31,12 @@ src = fetchFromGitHub { owner = "dominikh"; repo = "go-tools"; - rev = "v0.2.0"; - sha256 = "sha256-QhTjzrERhbhCSkPzyLQwFyxrktNoGL9ris+XfE7n5nQ="; + rev = "2022.1.3"; + sha256 = "sha256-Yli+8gMoRRyNqOgFRv/uyFBVXdIlDH0tfZzvfTYBPyU="; }; doCheck = false; subPackages = [ "cmd/staticcheck" ]; - vendorSha256 = "sha256-EjCOMdeJ0whp2pHZvm4VV2K78UNKzl98Z/cQvGhWSyY="; + vendorSha256 = "sha256-19uLCtKuuZoVwC4SUKvYGWi2ryqAQbcKXY1iNjIqyn8="; }; ci = buildGoModule { @@ -44,11 +44,11 @@ src = fetchFromGitHub { owner = "storj"; repo = "ci"; - rev = "63f7574acdb97dd567c64537228d8582980ec301"; - sha256 = "sha256-AkrUZbS88BLc3dtWxYkecUNa29slwQ7/feT9+lPWO9g="; + rev = "37130d944fc8b60928fd460fe53ebaa7204c8102"; + sha256 = "sha256-NcsLA5d5sF1qSPSu/Pw/Md+0nr+inXAsPx9bKWh3I7Y="; }; doCheck = false; - vendorSha256 = "sha256-6D452YbnkunAfD/M69VmwGDxENmVS72NKj92FTemJR0="; + vendorSha256 = "sha256-G5cAb9zFqjdCLIodGcPv9u4ABZZKEGTx0CvB4i7JdRg="; allowGoReference = true; # until check-imports stops needing this subPackages = [ "check-copyright" @@ -103,8 +103,8 @@ src = fetchFromGitHub { owner = "twitchtv"; repo = "twirp"; - rev = "v8.1.0"; - sha256 = "sha256-ezSNrDfOE1nj4FlX7E7Z7/eGfQw1B7NP34aj8ml5pDk="; + rev = "v8.1.3"; + sha256 = "sha256-p3gHVHGBHakOOQnJAuMK7vZumNXN15mOABuEHUG0wNs="; }; doCheck = false; goPackagePath = "github.com/twitchtv/twirp"; @@ -116,11 +116,11 @@ src = fetchFromGitHub { owner = "golang"; repo = "tools"; - rev = "v0.1.4"; - sha256 = "sha256-7iQZvA6uUjZLP3/dxaM9y9jomSwEoaUgGclnciF8rh4="; + rev = "v0.3.0"; + sha256 = "sha256-UMEhFxODGQ20vkZPtscBpHhUDa6/+hnD85Z1yx0pQfQ="; }; doCheck = false; - vendorSha256 = "sha256-PRC59obp0ptooFuWhg2ruihEfJ0wKeMyT9xcLjoZyCo="; + vendorSha256 = "sha256-EQHYf4Q+XNjwG/KDoTA4m0mlBGxPkJSLUcO0VHFSpeA="; subPackages = [ "cmd/stringer" ]; }; @@ -141,7 +141,7 @@ buildInputs = [ defaultPackage - go_1_17 + go_1_19 golangci-lint protobuf graphviz diff --git a/internal/backcompat/newservice/main.go b/internal/backcompat/newservice/main.go index 768a59e..cabdb08 100644 --- a/internal/backcompat/newservice/main.go +++ b/internal/backcompat/newservice/main.go @@ -1,6 +1,7 @@ // Copyright (C) 2021 Storj Labs, Inc. // See LICENSE for copying information. +// newservice runs the new version of the backwards compatibility check. package main import ( diff --git a/internal/backcompat/newservicedefs/servicedefs.pb.go b/internal/backcompat/newservicedefs/servicedefs.pb.go index ec01117..f7617eb 100644 --- a/internal/backcompat/newservicedefs/servicedefs.pb.go +++ b/internal/backcompat/newservicedefs/servicedefs.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: servicedefs.proto package servicedefs diff --git a/internal/backcompat/oldservice/main.go b/internal/backcompat/oldservice/main.go index 768a59e..80403dc 100644 --- a/internal/backcompat/oldservice/main.go +++ b/internal/backcompat/oldservice/main.go @@ -1,6 +1,7 @@ // Copyright (C) 2021 Storj Labs, Inc. // See LICENSE for copying information. +// oldservice runs the old version of the backwards compatibility check. package main import ( diff --git a/internal/grpccompat/service.pb.go b/internal/grpccompat/service.pb.go index 2228ae0..27e383c 100644 --- a/internal/grpccompat/service.pb.go +++ b/internal/grpccompat/service.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: service.proto package grpccompat diff --git a/internal/integration/customservice/service.pb.go b/internal/integration/customservice/service.pb.go index 6ae6deb..ff33f03 100644 --- a/internal/integration/customservice/service.pb.go +++ b/internal/integration/customservice/service.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: service.proto package service diff --git a/internal/integration/service/service.pb.go b/internal/integration/service/service.pb.go index 6ae6deb..ff33f03 100644 --- a/internal/integration/service/service.pb.go +++ b/internal/integration/service/service.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: service.proto package service diff --git a/internal/twirpcompat/clientcompat.pb.go b/internal/twirpcompat/clientcompat.pb.go index 598b63f..f43dd42 100644 --- a/internal/twirpcompat/clientcompat.pb.go +++ b/internal/twirpcompat/clientcompat.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.18.0 +// protoc v3.21.8 // source: clientcompat.proto package twirpcompat diff --git a/internal/twirpcompat/clientcompat.twirp.go b/internal/twirpcompat/clientcompat.twirp.go index 80c889b..035a55f 100644 --- a/internal/twirpcompat/clientcompat.twirp.go +++ b/internal/twirpcompat/clientcompat.twirp.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-twirp v8.1.0, DO NOT EDIT. +// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. // source: clientcompat.proto package twirpcompat @@ -6,7 +6,7 @@ package twirpcompat import context "context" import fmt "fmt" import http "net/http" -import ioutil "io/ioutil" +import io "io" import json "encoding/json" import strconv "strconv" import strings "strings" @@ -18,7 +18,6 @@ import ctxsetters "github.com/twitchtv/twirp/ctxsetters" import bytes "bytes" import errors "errors" -import io "io" import path "path" import url "net/url" @@ -61,7 +60,7 @@ func NewCompatServiceProtobufClient(baseURL string, client HTTPClient, opts ...t o(&clientOpts) } - // Using ReadOpt allows backwards and forwads compatibility with new options in the future + // Using ReadOpt allows backwards and forwards compatibility with new options in the future literalURLs := false _ = clientOpts.ReadOpt("literalURLs", &literalURLs) var pathPrefix string @@ -200,7 +199,7 @@ func NewCompatServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp o(&clientOpts) } - // Using ReadOpt allows backwards and forwads compatibility with new options in the future + // Using ReadOpt allows backwards and forwards compatibility with new options in the future literalURLs := false _ = clientOpts.ReadOpt("literalURLs", &literalURLs) var pathPrefix string @@ -335,7 +334,7 @@ type compatServiceServer struct { func NewCompatServiceServer(svc CompatService, opts ...interface{}) TwirpServer { serverOpts := newServerOpts(opts) - // Using ReadOpt allows backwards and forwads compatibility with new options in the future + // Using ReadOpt allows backwards and forwards compatibility with new options in the future jsonSkipDefaults := false _ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults) jsonCamelCase := false @@ -536,7 +535,7 @@ func (s *compatServiceServer) serveMethodProtobuf(ctx context.Context, resp http return } - buf, err := ioutil.ReadAll(req.Body) + buf, err := io.ReadAll(req.Body) if err != nil { s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return @@ -716,7 +715,7 @@ func (s *compatServiceServer) serveNoopMethodProtobuf(ctx context.Context, resp return } - buf, err := ioutil.ReadAll(req.Body) + buf, err := io.ReadAll(req.Body) if err != nil { s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return @@ -791,7 +790,7 @@ func (s *compatServiceServer) ServiceDescriptor() ([]byte, int) { } func (s *compatServiceServer) ProtocGenTwirpVersion() string { - return "v8.1.0" + return "v8.1.3" } // PathPrefix returns the base service path, in the form: "//./" @@ -910,7 +909,7 @@ func writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks } // sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed. -// If the URL is unparsable, the baseURL is returned unchaged. +// If the URL is unparsable, the baseURL is returned unchanged. func sanitizeBaseURL(baseURL string) string { u, err := url.Parse(baseURL) if err != nil { @@ -924,9 +923,12 @@ func sanitizeBaseURL(baseURL string) string { // baseServicePath composes the path prefix for the service (without ). // e.g.: baseServicePath("/twirp", "my.pkg", "MyService") -// returns => "/twirp/my.pkg.MyService/" +// +// returns => "/twirp/my.pkg.MyService/" +// // e.g.: baseServicePath("", "", "MyService") -// returns => "/MyService/" +// +// returns => "/MyService/" func baseServicePath(prefix, pkg, service string) string { fullServiceName := service if pkg != "" { @@ -981,7 +983,7 @@ func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType } req.Header.Set("Accept", contentType) req.Header.Set("Content-Type", contentType) - req.Header.Set("Twirp-Version", "v8.1.0") + req.Header.Set("Twirp-Version", "v8.1.3") return req, nil } @@ -1032,7 +1034,7 @@ func errorFromResponse(resp *http.Response) twirp.Error { return twirpErrorFromIntermediary(statusCode, msg, location) } - respBodyBytes, err := ioutil.ReadAll(resp.Body) + respBodyBytes, err := io.ReadAll(resp.Body) if err != nil { return wrapInternal(err, "failed to read server error response body") } @@ -1222,13 +1224,7 @@ func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.Clie if err != nil { return ctx, wrapInternal(err, "failed to do request") } - - defer func() { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = wrapInternal(cerr, "failed to close response body") - } - }() + defer func() { _ = resp.Body.Close() }() if err = ctx.Err(); err != nil { return ctx, wrapInternal(err, "aborted because context was done") @@ -1238,7 +1234,7 @@ func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.Clie return ctx, errorFromResponse(resp) } - respBodyBytes, err := ioutil.ReadAll(resp.Body) + respBodyBytes, err := io.ReadAll(resp.Body) if err != nil { return ctx, wrapInternal(err, "failed to read response body") }