Skip to content

Commit 98798df

Browse files
authored
Merge pull request #184 from inosato/refactor_for_go1.16
Refactor for go 1.16
2 parents a4656a8 + 493f328 commit 98798df

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

.goreleaser.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
env:
2-
- GO111MODULE=on
31
before:
42
hooks:
53
- make clean

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export DOCKER_BUILDKIT = 1
1212

1313
.PHONY: nginx-prometheus-exporter
1414
nginx-prometheus-exporter:
15-
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
15+
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
1616

1717
.PHONY: lint
1818
lint:
1919
go run github.com/golangci/golangci-lint/cmd/golangci-lint run
2020

2121
.PHONY: test
2222
test:
23-
GO111MODULE=on go test ./...
23+
go test ./...
2424

2525
.PHONY: container
2626
container:

build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN go mod download
1212
COPY *.go ./
1313
COPY collector ./collector
1414
COPY client ./client
15-
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 .
15+
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 .
1616

1717

1818
FROM scratch as intermediate

client/nginx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package client
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"net/http"
77
"strconv"
88
"strings"
@@ -53,7 +53,7 @@ func (client *NginxClient) GetStubStats() (*StubStats, error) {
5353
return nil, fmt.Errorf("expected %v response, got %v", http.StatusOK, resp.StatusCode)
5454
}
5555

56-
body, err := ioutil.ReadAll(resp.Body)
56+
body, err := io.ReadAll(resp.Body)
5757
if err != nil {
5858
return nil, fmt.Errorf("failed to read the response body: %v", err)
5959
}

exporter.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"crypto/x509"
77
"flag"
88
"fmt"
9-
"io/ioutil"
109
"log"
1110
"net"
1211
"net/http"
@@ -327,7 +326,7 @@ func main() {
327326

328327
sslConfig := &tls.Config{InsecureSkipVerify: !*sslVerify}
329328
if *sslCaCert != "" {
330-
caCert, err := ioutil.ReadFile(*sslCaCert)
329+
caCert, err := os.ReadFile(*sslCaCert)
331330
if err != nil {
332331
log.Fatalf("Loading CA cert failed: %v", err)
333332
}

0 commit comments

Comments
 (0)