diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index 8f5431c3..c27c7c3d 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -24,7 +24,7 @@ jobs: uses: golangci/golangci-lint-action@v2 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.45.2 + version: v1.46.2 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/Makefile b/Makefile index 905bf56b..f18063bf 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ TOOLSDIR := $(shell pwd)/hack/tools PATH := bin:$(TOOLSDIR)/bin:$(PATH) STACKER := $(shell which stacker) GOLINTER := $(TOOLSDIR)/bin/golangci-lint -GOLINTER_VERSION := v1.45.2 +GOLINTER_VERSION := v1.46.2 NOTATION := $(TOOLSDIR)/bin/notation BATS := $(TOOLSDIR)/bin/bats TESTDATA := $(TOP_LEVEL)/test/data diff --git a/golangcilint.yaml b/golangcilint.yaml index 14124c71..3c2ce015 100644 --- a/golangcilint.yaml +++ b/golangcilint.yaml @@ -5,7 +5,7 @@ run: linters: enable-all: true - disable: funlen,gocognit,exhaustivestruct,paralleltest,forbidigo,ireturn,wrapcheck,exhaustive,maintidx + disable: funlen,gocognit,exhaustivestruct,paralleltest,forbidigo,ireturn,wrapcheck,exhaustive,maintidx,exhaustruct linters-settings: dupl: diff --git a/pkg/cli/root.go b/pkg/cli/root.go index 4513e957..40f2127f 100644 --- a/pkg/cli/root.go +++ b/pkg/cli/root.go @@ -3,6 +3,7 @@ package cli import ( "context" "fmt" + "net" "net/http" "time" @@ -86,7 +87,7 @@ func newScrubCmd(conf *config.Config) *cobra.Command { // checking if the server is already running req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, - fmt.Sprintf("http://%s:%s/v2", conf.HTTP.Address, conf.HTTP.Port), + fmt.Sprintf("http://%s/v2", net.JoinHostPort(conf.HTTP.Address, conf.HTTP.Port)), nil) if err != nil { log.Error().Err(err).Msg("unable to create a new http request") diff --git a/pkg/compliance/v1_0_0/check.go b/pkg/compliance/v1_0_0/check.go index 0bdb6d3f..f47adb2c 100644 --- a/pkg/compliance/v1_0_0/check.go +++ b/pkg/compliance/v1_0_0/check.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "io" + "net" "net/http" "os" "path" @@ -13,7 +14,8 @@ import ( "testing" godigest "github.com/opencontainers/go-digest" - ispec "github.com/opencontainers/image-spec/specs-go/v1" // nolint: goimports + // nolint: goimports + ispec "github.com/opencontainers/image-spec/specs-go/v1" // nolint:golint,stylecheck,revive . "github.com/smartystreets/goconvey/convey" "github.com/smartystreets/goconvey/convey/reporting" @@ -37,7 +39,7 @@ func CheckWorkflows(t *testing.T, config *compliance.Config) { defer outputJSONExit() } - baseURL := fmt.Sprintf("http://%s:%s", config.Address, config.Port) + baseURL := fmt.Sprintf("http://%s", net.JoinHostPort(config.Address, config.Port)) storageInfo := config.StorageInfo diff --git a/pkg/extensions/monitoring/minimal.go b/pkg/extensions/monitoring/minimal.go index 5bd6ee2f..5aadf1ad 100644 --- a/pkg/extensions/monitoring/minimal.go +++ b/pkg/extensions/monitoring/minimal.go @@ -116,7 +116,9 @@ func (ms *metricServer) ReceiveMetrics() interface{} { return <-ms.cacheChan } -func (ms *metricServer) IsEnabled() (b bool) { +func (ms *metricServer) IsEnabled() bool { + b := false + // send a bool value on the request channel to avoid data race ms.reqChan <- b