diff options
-rw-r--r-- | .golangci.yml | 1 | ||||
-rw-r--r-- | auth/rpccredentials.go | 10 | ||||
-rw-r--r-- | proto/go/internal/cmd/protoc-gen-gitaly/main.go | 25 |
3 files changed, 1 insertions, 35 deletions
diff --git a/.golangci.yml b/.golangci.yml index f9af40c86..a8479aefd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,6 +18,7 @@ linters: - goimports # https://godoc.org/golang.org/x/tools/cmd/goimports - staticcheck # https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck - gosimple # https://github.com/dominikh/go-tools/tree/master/cmd/gosimple + - unused issues: # Excluding configuration per-path, per-linter, per-text and per-source diff --git a/auth/rpccredentials.go b/auth/rpccredentials.go index 4b7acc7b2..923ee8567 100644 --- a/auth/rpccredentials.go +++ b/auth/rpccredentials.go @@ -17,16 +17,6 @@ func RPCCredentials(sharedSecret string) credentials.PerRPCCredentials { return &rpcCredentialsV2{sharedSecret: sharedSecret} } -type rpcCredentials struct { - sharedSecret string -} - -func (*rpcCredentials) RequireTransportSecurity() bool { return false } - -func (rc *rpcCredentials) GetRequestMetadata(context.Context, ...string) (map[string]string, error) { - return map[string]string{"authorization": "Bearer " + rc.sharedSecret}, nil -} - // RPCCredentialsV2 can be used with grpc.WithPerRPCCredentials to create // a grpc.DialOption that inserts an V2 (HMAC) token with the current // timestamp for authentication with a Gitaly server. The shared secret diff --git a/proto/go/internal/cmd/protoc-gen-gitaly/main.go b/proto/go/internal/cmd/protoc-gen-gitaly/main.go index 699b14f6b..08c691e2a 100644 --- a/proto/go/internal/cmd/protoc-gen-gitaly/main.go +++ b/proto/go/internal/cmd/protoc-gen-gitaly/main.go @@ -52,7 +52,6 @@ package main import ( "bytes" - "compress/gzip" "fmt" "go/format" "io" @@ -64,7 +63,6 @@ import ( "text/template" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "gitlab.com/gitlab-org/gitaly/proto/go/internal/linter" ) @@ -215,26 +213,3 @@ func renderProtoList(dest io.WriteCloser, protoNames []string) error { return nil } - -// extractFile extracts a FileDescriptorProto from a gzip'd buffer. -// Note: function is copied from the github.com/golang/protobuf dependency: -// https://github.com/golang/protobuf/blob/9eb2c01ac278a5d89ce4b2be68fe4500955d8179/descriptor/descriptor.go#L50 -func extractFile(gz []byte) (*descriptor.FileDescriptorProto, error) { - r, err := gzip.NewReader(bytes.NewReader(gz)) - if err != nil { - return nil, fmt.Errorf("failed to open gzip reader: %v", err) - } - defer r.Close() - - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) - } - - fd := new(descriptor.FileDescriptorProto) - if err := proto.Unmarshal(b, fd); err != nil { - return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) - } - - return fd, nil -} |