diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae213c014..a6e76792e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17.* + go-version: 1.18.8 - name: Dependencies run: | @@ -39,7 +39,7 @@ jobs: DCO_VERBOSITY=-q script/validate/dco GO111MODULE=on script/setup/install-dev-tools script/validate/vendor - go build -i . + go build . make check make build make binaries diff --git a/Dockerfile b/Dockerfile index 2fd743b61..bfa4a694a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.17 +ARG GO_VERSION=1.18.8 ARG ALPINE_VERSION=3.16 ARG XX_VERSION=1.1.1 diff --git a/Makefile b/Makefile index 331da2732..75e118201 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ version/version.go: check: ## run all linters (TODO: enable "unused", "varcheck", "ineffassign", "unconvert", "staticheck", "goimports", "structcheck") @echo "$(WHALE) $@" - golangci-lint run + @GO111MODULE=off golangci-lint run test: ## run tests, except integration test with test.short @echo "$(WHALE) $@" diff --git a/context/http.go b/context/http.go index bc22f0bba..48e354865 100644 --- a/context/http.go +++ b/context/http.go @@ -246,11 +246,7 @@ func (ctx *muxVarsContext) Value(key interface{}) interface{} { return ctx.vars } - if strings.HasPrefix(keyStr, "vars.") { - keyStr = strings.TrimPrefix(keyStr, "vars.") - } - - if v, ok := ctx.vars[keyStr]; ok { + if v, ok := ctx.vars[strings.TrimPrefix(keyStr, "vars.")]; ok { return v } } diff --git a/project/dev-image/Dockerfile b/project/dev-image/Dockerfile index 1e2a8471c..ec404a9f5 100644 --- a/project/dev-image/Dockerfile +++ b/project/dev-image/Dockerfile @@ -17,4 +17,4 @@ RUN wget https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz --quiet && \ tar -C /usr/local -xzf go$GOLANG_VERSION.linux-amd64.tar.gz && \ rm go${GOLANG_VERSION}.linux-amd64.tar.gz -RUN go get github.com/axw/gocov/gocov github.com/mattn/goveralls github.com/golang/lint/golint +RUN go install github.com/axw/gocov/gocov@latest github.com/mattn/goveralls@latest github.com/golang/lint/golint@latest diff --git a/registry/client/repository.go b/registry/client/repository.go index 3e2ae66d3..04e5a3ba0 100644 --- a/registry/client/repository.go +++ b/registry/client/repository.go @@ -114,9 +114,7 @@ func (r *registry) Repositories(ctx context.Context, entries []string, last stri return 0, err } - for cnt := range ctlg.Repositories { - entries[cnt] = ctlg.Repositories[cnt] - } + copy(entries, ctlg.Repositories) numFilled = len(ctlg.Repositories) link := resp.Header.Get("Link") diff --git a/script/setup/install-dev-tools b/script/setup/install-dev-tools index f01c370e9..7737836bb 100755 --- a/script/setup/install-dev-tools +++ b/script/setup/install-dev-tools @@ -1,6 +1,6 @@ #!/usr/bin/env bash -GOLANGCI_LINT_VERSION="v1.27.0" +GOLANGCI_LINT_VERSION="v1.50.1" # # Install developer tools to $GOBIN (or $GOPATH/bin if unset) @@ -8,5 +8,5 @@ GOLANGCI_LINT_VERSION="v1.27.0" set -eu -o pipefail cd /tmp -go get -u github.com/LK4D4/vndr -go get "github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" +go install github.com/LK4D4/vndr@latest +go install "github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" diff --git a/version/version.sh b/version/version.sh index 75dca7847..dd8296968 100755 --- a/version/version.sh +++ b/version/version.sh @@ -17,7 +17,7 @@ var Package = "$(go list)" // Version indicates which version of the binary is running. This is set to // the latest release tag by hand, always suffixed by "+unknown". During // build, it will be replaced by the actual version. The value here will be -// used if the registry is run after a go get based install. +// used if the registry is run after a go install based install. var Version = "$(git describe --match 'v[0-9]*' --dirty='.m' --always)+unknown" // Revision is filled with the VCS (e.g. git) revision being used to build