Skip to content

Commit 1181deb

Browse files
committed
chore: golang 1.15 / golangci-lint action (#127)
1 parent f55e097 commit 1181deb

File tree

7 files changed

+33
-16
lines changed

7 files changed

+33
-16
lines changed

.github/stale.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ markComment: >
1717
for your contributions.
1818
# Comment to post when closing a stale issue. Set to `false` to disable
1919
closeComment: false
20-

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Set up Go
3939
uses: actions/setup-go@v2.1.3
4040
with:
41-
go-version: 1.14
41+
go-version: ^1.15.0
4242
id: go
4343

4444
- name: Login to DockerHub

.github/workflows/test.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,20 @@ jobs:
2323
- name: Checkout
2424
uses: actions/checkout@v2
2525

26-
- name: Install golangci-lint
27-
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.7
28-
29-
- name: Lint
30-
run: $(go env GOPATH)/bin/golangci-lint run
26+
- name: golangci-lint
27+
uses: golangci/golangci-lint-action@v2
28+
with:
29+
version: v1.32
3130

3231
test:
3332
name: Test
3433
runs-on: ubuntu-latest
3534
steps:
3635

37-
- name: Set up Go 1.14
36+
- name: Setup Go
3837
uses: actions/setup-go@v2.1.3
3938
with:
40-
go-version: 1.14
39+
go-version: ^1.15.0
4140
id: go
4241

4342
- name: Checkout
@@ -62,10 +61,10 @@ jobs:
6261
- name: Unshallow
6362
run: git fetch --prune --unshallow
6463

65-
- name: Set up Go
64+
- name: Setup Go
6665
uses: actions/setup-go@v2.1.3
6766
with:
68-
go-version: 1.14
67+
go-version: ^1.15.0
6968
id: go
7069

7170
- name: Run GoReleaser

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.3.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-added-large-files
7+
- id: check-json
8+
- id: pretty-format-json
9+
args: ['--autofix']
10+
- id: check-merge-conflict
11+
- id: check-symlinks
12+
- id: check-yaml
13+
- id: detect-private-key
14+
- id: check-merge-conflict
15+
- id: check-executables-have-shebangs
16+
- id: end-of-file-fixer
17+
- id: mixed-line-ending
18+
- repo: https://github.com/golangci/golangci-lint
19+
rev: v1.32.2
20+
hooks:
21+
- id: golangci-lint

cmd/server.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ func init() {
126126
serverCmd.Flags().StringSliceVar(&scrapeURIs, "phpfpm.scrape-uri", []string{"tcp://127.0.0.1:9000/status"}, "FastCGI address, e.g. unix:///tmp/php.sock;/status or tcp://127.0.0.1:9000/status")
127127
serverCmd.Flags().BoolVar(&fixProcessCount, "phpfpm.fix-process-count", false, "Enable to calculate process numbers via php-fpm_exporter since PHP-FPM sporadically reports wrong active/idle/total process numbers.")
128128

129-
//viper.BindEnv("web.listen-address", "PHP_FPM_WEB_LISTEN_ADDRESS")
130-
//viper.BindPFlag("web.listen-address", serverCmd.Flags().Lookup("web.listen-address"))
131-
132129
// Workaround since vipers BindEnv is currently not working as expected (see https://github.com/spf13/viper/issues/461)
133130

134131
envs := map[string]string{

phpfpm/exporter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
package phpfpm
1616

1717
import (
18-
"sync"
1918
"fmt"
19+
"sync"
20+
2021
"github.com/prometheus/client_golang/prometheus"
2122
)
2223

phpfpm/phpfpm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func JSONResponseFixer(content []byte) []byte {
213213
sold := match[0]
214214
snew := match[1] + string(requestURI) + match[3]
215215

216-
c = strings.Replace(c, sold, snew, -1)
216+
c = strings.ReplaceAll(c, sold, snew)
217217
}
218218

219219
return []byte(c)

0 commit comments

Comments
 (0)