diff --git a/.goreleaser.yml b/.goreleaser.yml index 7a34bdc9..16ee277d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,3 @@ -env: - - GO111MODULE=on before: hooks: - make clean diff --git a/Makefile b/Makefile index 16af9e5f..c4653ef5 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ export DOCKER_BUILDKIT = 1 .PHONY: nginx-prometheus-exporter nginx-prometheus-exporter: - GO111MODULE=on CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$(VERSION) -X main.commit=$(GIT_COMMIT) -X main.date=$(DATE)" -o nginx-prometheus-exporter + CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$(VERSION) -X main.commit=$(GIT_COMMIT) -X main.date=$(DATE)" -o nginx-prometheus-exporter .PHONY: lint lint: @@ -20,7 +20,7 @@ lint: .PHONY: test test: - GO111MODULE=on go test ./... + go test ./... .PHONY: container container: diff --git a/build/Dockerfile b/build/Dockerfile index ab0fe7fe..dc54d2eb 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -12,7 +12,7 @@ RUN go mod download COPY *.go ./ COPY collector ./collector COPY client ./client -RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -trimpath -a -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${GIT_COMMIT} -X main.date=${DATE}" -o nginx-prometheus-exporter . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -trimpath -a -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${GIT_COMMIT} -X main.date=${DATE}" -o nginx-prometheus-exporter . FROM scratch as intermediate diff --git a/client/nginx.go b/client/nginx.go index c186634b..01a66ebc 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -2,7 +2,7 @@ package client import ( "fmt" - "io/ioutil" + "io" "net/http" "strconv" "strings" @@ -53,7 +53,7 @@ func (client *NginxClient) GetStubStats() (*StubStats, error) { return nil, fmt.Errorf("expected %v response, got %v", http.StatusOK, resp.StatusCode) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("failed to read the response body: %v", err) } diff --git a/exporter.go b/exporter.go index 50271baa..251a31cc 100644 --- a/exporter.go +++ b/exporter.go @@ -6,7 +6,6 @@ import ( "crypto/x509" "flag" "fmt" - "io/ioutil" "log" "net" "net/http" @@ -327,7 +326,7 @@ func main() { sslConfig := &tls.Config{InsecureSkipVerify: !*sslVerify} if *sslCaCert != "" { - caCert, err := ioutil.ReadFile(*sslCaCert) + caCert, err := os.ReadFile(*sslCaCert) if err != nil { log.Fatalf("Loading CA cert failed: %v", err) }