diff --git a/.golangci.yml b/.golangci.yml index afc01a3ed..624a84829 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,3 @@ -run: - skip-file: - - ".+\\.pb\\.go" - - ".+\\.pb\\.gw\\.go" - linters-settings: govet: check-shadowing: false @@ -17,6 +12,12 @@ linters-settings: min-occurrences: 3 misspell: locale: US + depguard: + list-type: blacklist + packages: + - golang.org/x/net/context + - github.com/gogo/protobuf/proto + - github.com/google/martian/log linters: enable-all: true @@ -30,4 +31,4 @@ linters: issues: exclude: - - .((os\.)?std(out|err)\..*|.*Close|.*Flush|.*Write|.*Serve|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). + - .(.*Write|.*Serve). diff --git a/.travis.yml b/.travis.yml index 9dddcb801..9b2bdf5d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ before_install: install: - gcloud -q components install kubectl - - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.13.1 + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.13.2 - go get -t ./... script: diff --git a/cmd/gen-test-vectors/main.go b/cmd/gen-test-vectors/main.go index 06be985da..be39c1a6b 100644 --- a/cmd/gen-test-vectors/main.go +++ b/cmd/gen-test-vectors/main.go @@ -31,7 +31,6 @@ import ( "github.com/google/keytransparency/core/testutil" "github.com/google/keytransparency/impl/authentication" "github.com/google/keytransparency/impl/integration" - "github.com/google/martian/log" "github.com/google/tink/go/tink" "github.com/google/trillian/types" @@ -89,7 +88,7 @@ func GenerateTestVectors(ctx context.Context, env *integration.Env) error { MaxBatch: 100, } if _, err := env.Sequencer.RunBatch(ctx, req); err != nil { - log.Errorf("RunBatch(): %v", err) + glog.Errorf("RunBatch(): %v", err) } }) }() diff --git a/cmd/keytransparency-client/cmd/post.go b/cmd/keytransparency-client/cmd/post.go index 3832d8e7e..0314a9dcf 100644 --- a/cmd/keytransparency-client/cmd/post.go +++ b/cmd/keytransparency-client/cmd/post.go @@ -75,9 +75,7 @@ User email MUST match the OAuth account used to authorize the update. return fmt.Errorf("hex.Decode(%v): %v", data, err) } userID := args[0] - timeout := viper.GetDuration("timeout") - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() + ctx := context.Background() // Create client. userCreds, err := userCreds(ctx) @@ -107,7 +105,10 @@ User email MUST match the OAuth account used to authorize the update. PublicKeyData: profileData, AuthorizedKeys: authorizedKeys.Keyset(), } - if _, err := c.Update(ctx, u, []tink.Signer{signer}, + timeout := viper.GetDuration("timeout") + cctx, cancel := context.WithTimeout(ctx, timeout) + defer cancel() + if _, err := c.Update(cctx, u, []tink.Signer{signer}, grpc.PerRPCCredentials(userCreds)); err != nil { return fmt.Errorf("update failed: %v", err) } diff --git a/core/client/multi/writer.go b/core/client/multi/writer.go index b610f5670..37b9e3497 100644 --- a/core/client/multi/writer.go +++ b/core/client/multi/writer.go @@ -48,7 +48,7 @@ func (m *writer) Write(p []byte) (n int, err error) { for _, w := range m.writers { n, err = w.Write(p) if err != nil { - multiError = multiError + fmt.Sprintf("%v bytes written to %v: %v", n, w, err) + multiError += fmt.Sprintf("%v bytes written to %v: %v", n, w, err) } minBytesWritten = min(n, minBytesWritten) } diff --git a/core/crypto/tinkio/pem.go b/core/crypto/tinkio/pem.go index 7b0741701..8945651eb 100644 --- a/core/crypto/tinkio/pem.go +++ b/core/crypto/tinkio/pem.go @@ -20,7 +20,7 @@ import ( "errors" "fmt" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/google/tink/go/signature" "github.com/google/tink/go/testutil" "github.com/google/tink/go/tink" diff --git a/core/crypto/tinkio/protofile.go b/core/crypto/tinkio/protofile.go index a2b3364fd..6306f4de5 100644 --- a/core/crypto/tinkio/protofile.go +++ b/core/crypto/tinkio/protofile.go @@ -5,7 +5,7 @@ import ( "fmt" "io/ioutil" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" tinkpb "github.com/google/tink/proto/tink_go_proto" )