Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit 5257a1b

Browse files
committedMar 14, 2023
bump to go 1.20
1 parent e36b1db commit 5257a1b

File tree

13 files changed

+203
-24
lines changed

13 files changed

+203
-24
lines changed
 

‎.github/workflows/build.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
- name: Set up Go
16-
uses: actions/setup-go@v2
16+
uses: actions/setup-go@v3
1717
with:
18-
go-version: 1.18
18+
go-version: '1.20.2'
19+
- name: golangci-lint
20+
uses: golangci/golangci-lint-action@v3
21+
with:
22+
version: latest
1923
- name: Build
2024
run: make commit

‎.github/workflows/release.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ jobs:
1111
name: "Tagged Release"
1212
runs-on: "ubuntu-latest"
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
- name: Set up Go
16-
uses: actions/setup-go@v2
16+
uses: actions/setup-go@v3
1717
with:
18-
go-version: 1.18
18+
go-version: '1.20.2'
19+
- name: golangci-lint
20+
uses: golangci/golangci-lint-action@v3
21+
with:
22+
version: latest
1923
- name: Build
2024
run: make commit
2125
- name: Automatic Releases
22-
uses: marvinpinto/action-automatic-releases@v1.2.0
26+
uses: marvinpinto/action-automatic-releases@v1.2.1
2327
with:
2428
repo_token: "${{ secrets.GITHUB_TOKEN }}"
2529
prerelease: false

‎Makefile

+7-9
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,12 @@ target:
2121

2222
.PHONY: format
2323
format:
24-
ifeq (, $(shell which goimports))
25-
go install golang.org/x/tools/cmd/goimports@latest
26-
endif
27-
@echo "Running goimports ..."
24+
@echo 'goimports ./...'
2825
@goimports -w -local github.com/tomcz/openldap_exporter $(shell find . -type f -name '*.go' | grep -v '/vendor/')
2926

3027
.PHONY: lint
3128
lint:
32-
ifeq (, $(shell which staticcheck))
33-
go install honnef.co/go/tools/cmd/staticcheck@latest
34-
endif
35-
@echo "Running staticcheck ..."
36-
@staticcheck $(shell go list ./... | grep -v /vendor/)
29+
golangci-lint run
3730

3831
.PHONY: compile
3932
compile: target
@@ -47,3 +40,8 @@ cross-compile:
4740
OUTFILE=openldap_exporter-osx-amd64 GOOS=darwin GOARCH=amd64 $(MAKE) compile
4841
OUTFILE=openldap_exporter-osx-arm64 GOOS=darwin GOARCH=arm64 $(MAKE) compile
4942
(cd target && find . -name '*.gz' -exec sha256sum {} \;) > target/verify.sha256
43+
44+
.PHONY: vendor
45+
vendor:
46+
go mod tidy -compat=1.20
47+
go mod vendor

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ NOTES:
126126

127127
## Build
128128

129-
1. Install Go 1.18 from https://golang.org/
129+
1. Install Go 1.20 from https://golang.org/
130130
2. Build the binaries: `make build`

‎go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
module github.com/tomcz/openldap_exporter
22

3-
go 1.18
3+
go 1.20
44

55
require (
66
github.com/go-kit/log v0.2.0
77
github.com/prometheus/client_golang v1.12.1
88
github.com/prometheus/exporter-toolkit v0.7.3
99
github.com/sirupsen/logrus v1.8.1
10+
github.com/tomcz/gotools v0.4.2
1011
github.com/urfave/cli/v2 v2.4.0
1112
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
1213
gopkg.in/ldap.v2 v2.5.1

‎go.sum

+4-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
116116
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
117117
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
118118
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
119-
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
120119
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
120+
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
121121
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
122122
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
123123
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@@ -208,6 +208,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
208208
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
209209
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
210210
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
211+
github.com/tomcz/gotools v0.4.2 h1:bforF32o12uGyJH1sJPMAkI/XeGaGylwk0XC4wKgOf8=
212+
github.com/tomcz/gotools v0.4.2/go.mod h1:SYLitf1gefAO8soXL4ueN+z5IrkEv18Nb0W2hoOi/+s=
211213
github.com/urfave/cli/v2 v2.4.0 h1:m2pxjjDFgDxSPtO8WSdbndj17Wu2y8vOT86wE/tjr+I=
212214
github.com/urfave/cli/v2 v2.4.0/go.mod h1:NX9W0zmTvedE5oDoOMs2RTC8RvdK98NTYZE5LbaEYPg=
213215
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -401,7 +403,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
401403
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
402404
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
403405
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
404-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
405406
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
406407
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
407408
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -497,6 +498,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
497498
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
498499
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
499500
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
501+
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
500502
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
501503
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
502504
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

‎server.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package openldap_exporter
22

33
import (
4-
"context"
54
"errors"
65
"fmt"
76
"net/http"
@@ -11,6 +10,7 @@ import (
1110
"github.com/prometheus/client_golang/prometheus/promhttp"
1211
"github.com/prometheus/exporter-toolkit/web"
1312
log "github.com/sirupsen/logrus"
13+
"github.com/tomcz/gotools/quiet"
1414
)
1515

1616
var commit string
@@ -56,9 +56,7 @@ func (s *Server) Start() error {
5656
}
5757

5858
func (s *Server) Stop() {
59-
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
60-
s.server.Shutdown(ctx)
61-
cancel()
59+
quiet.CloseWithTimeout(s.server.Shutdown, 100*time.Millisecond)
6260
}
6361

6462
func (s *Server) adaptor(kvs ...interface{}) error {

‎vendor/github.com/tomcz/gotools/LICENSE

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/tomcz/gotools/quiet/README.md

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/tomcz/gotools/quiet/close.go

+91
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/tomcz/gotools/quiet/closer.go

+50
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/tomcz/gotools/quiet/doc.go

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/modules.txt

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ github.com/russross/blackfriday/v2
6464
# github.com/sirupsen/logrus v1.8.1
6565
## explicit; go 1.13
6666
github.com/sirupsen/logrus
67+
# github.com/tomcz/gotools v0.4.2
68+
## explicit; go 1.19
69+
github.com/tomcz/gotools/quiet
6770
# github.com/urfave/cli/v2 v2.4.0
6871
## explicit; go 1.11
6972
github.com/urfave/cli/v2

0 commit comments

Comments
 (0)