Skip to content

Commit

Permalink
chore: golang 1.15 / golangci-lint action (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
estahn committed Nov 22, 2020
1 parent f55e097 commit 1181deb
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 16 deletions.
1 change: 0 additions & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ markComment: >
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.14
go-version: ^1.15.0
id: go

- name: Login to DockerHub
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.7

- name: Lint
run: $(go env GOPATH)/bin/golangci-lint run
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.32

test:
name: Test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.14
- name: Setup Go
uses: actions/[email protected]
with:
go-version: 1.14
go-version: ^1.15.0
id: go

- name: Checkout
Expand All @@ -62,10 +61,10 @@ jobs:
- name: Unshallow
run: git fetch --prune --unshallow

- name: Set up Go
- name: Setup Go
uses: actions/[email protected]
with:
go-version: 1.14
go-version: ^1.15.0
id: go

- name: Run GoReleaser
Expand Down
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-json
- id: pretty-format-json
args: ['--autofix']
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: detect-private-key
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/golangci/golangci-lint
rev: v1.32.2
hooks:
- id: golangci-lint
3 changes: 0 additions & 3 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ func init() {
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")
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.")

//viper.BindEnv("web.listen-address", "PHP_FPM_WEB_LISTEN_ADDRESS")
//viper.BindPFlag("web.listen-address", serverCmd.Flags().Lookup("web.listen-address"))

// Workaround since vipers BindEnv is currently not working as expected (see https://github.com/spf13/viper/issues/461)

envs := map[string]string{
Expand Down
3 changes: 2 additions & 1 deletion phpfpm/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
package phpfpm

import (
"sync"
"fmt"
"sync"

"github.com/prometheus/client_golang/prometheus"
)

Expand Down
2 changes: 1 addition & 1 deletion phpfpm/phpfpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func JSONResponseFixer(content []byte) []byte {
sold := match[0]
snew := match[1] + string(requestURI) + match[3]

c = strings.Replace(c, sold, snew, -1)
c = strings.ReplaceAll(c, sold, snew)
}

return []byte(c)
Expand Down

0 comments on commit 1181deb

Please sign in to comment.