From ff6e9219b284d4a5cbf1d603fa82aefb57c40f92 Mon Sep 17 00:00:00 2001 From: Martin Hutchinson Date: Fri, 27 May 2022 13:16:10 +0100 Subject: [PATCH] Added lint configuration and fixed error (#28) Will try to set up presubmit integration in subsequent PR. For now, `golangci-lint run` at least passes locally, which is still an improvement from before this PR. --- .golangci.yaml | 32 ++++++++++++++++++++++++++++++++ proof/verify_test.go | 7 ------- 2 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 .golangci.yaml diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..be4f413 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,32 @@ +run: + # timeout for analysis, e.g. 30s, 5m, default is 1m + deadline: 90s + +linters-settings: + gocyclo: + # minimal code complexity to report, 30 by default (but we recommend 10-20) + min-complexity: 25 + depguard: + list-type: blacklist + packages: + - golang.org/x/net/context + - github.com/gogo/protobuf/proto + +linters: + disable-all: true + enable: + - deadcode + - depguard + - gocyclo + - gofmt + - goimports + - govet + - ineffassign + - megacheck + - misspell + - revive + - varcheck + +issues: + # Don't turn off any checks by default. We can do this explicitly if needed. + exclude-use-default: false diff --git a/proof/verify_test.go b/proof/verify_test.go index 027a97a..d62931b 100644 --- a/proof/verify_test.go +++ b/proof/verify_test.go @@ -403,10 +403,3 @@ func dh(h string, expLen int) []byte { } return r } - -func shortHash(hash []byte) string { - if len(hash) == 0 { - return "" - } - return fmt.Sprintf("%x...", hash[:4]) -}