From 1fcaba319eaef2e5cf37c49c6719c036134f385c Mon Sep 17 00:00:00 2001 From: Marina Biryukova Date: Fri, 4 Aug 2023 18:45:19 +0300 Subject: [PATCH] [#2] Add linters Signed-off-by: Marina Biryukova --- .forgejo/workflows/linters.yml | 20 ++++++++++++++++++++ Makefile | 4 ++-- challenge/challenges.go | 2 +- challenge/nns01/nns_provider.go | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .forgejo/workflows/linters.yml diff --git a/.forgejo/workflows/linters.yml b/.forgejo/workflows/linters.yml new file mode 100644 index 00000000..96b729b5 --- /dev/null +++ b/.forgejo/workflows/linters.yml @@ -0,0 +1,20 @@ +name: Linters +on: [pull_request] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.19' + cache: true + + - name: golangci-lint + uses: https://github.com/golangci/golangci-lint-action@v3 + with: + version: latest \ No newline at end of file diff --git a/Makefile b/Makefile index bd341e1a..2eac50f0 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,8 @@ test: clean e2e: clean LEGO_E2E_TESTS=local go test -count=1 -v ./e2e/... -checks: - golangci-lint run +lint: + @golangci-lint --timeout=5m run # Release helper .PHONY: patch minor major detach diff --git a/challenge/challenges.go b/challenge/challenges.go index 1872c4d0..6f886fb5 100644 --- a/challenge/challenges.go +++ b/challenge/challenges.go @@ -21,7 +21,7 @@ const ( // TLSALPN01 is the "tls-alpn-01" ACME challenge https://www.rfc-editor.org/rfc/rfc8737.html TLSALPN01 = Type("tls-alpn-01") - // NNS01 is the "nns-01" ACME challenge + // NNS01 is the "nns-01" ACME challenge. NNS01 = Type("nns-01") ) diff --git a/challenge/nns01/nns_provider.go b/challenge/nns01/nns_provider.go index 4d8b567e..31484ec0 100644 --- a/challenge/nns01/nns_provider.go +++ b/challenge/nns01/nns_provider.go @@ -41,7 +41,7 @@ func NewNNSProvider(nnsServer string, walletFile string, accountAddress string, return nil, fmt.Errorf("retrieve wallet from file: %w", err) } var address util.Uint160 - if len(accountAddress) == 0 { + if accountAddress == "" { address = w.GetChangeAddress() } else { address, err = flags.ParseAddress(accountAddress)