chore: golang 1.15 / golangci-lint action (#127)

This commit is contained in:
Enrico Stahn 2020-11-22 11:15:40 +11:00
parent f55e097f02
commit 1181deb197
No known key found for this signature in database
GPG key ID: 5263621C269A50DE
7 changed files with 33 additions and 16 deletions

1
.github/stale.yml vendored
View file

@ -17,4 +17,3 @@ markComment: >
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View file

@ -38,7 +38,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2.1.3
with:
go-version: 1.14
go-version: ^1.15.0
id: go
- name: Login to DockerHub

View file

@ -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/setup-go@v2.1.3
with:
go-version: 1.14
go-version: ^1.15.0
id: go
- name: Checkout
@ -65,7 +64,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2.1.3
with:
go-version: 1.14
go-version: ^1.15.0
id: go
- name: Run GoReleaser

21
.pre-commit-config.yaml Normal file
View file

@ -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

View file

@ -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{

View file

@ -15,8 +15,9 @@
package phpfpm
import (
"sync"
"fmt"
"sync"
"github.com/prometheus/client_golang/prometheus"
)

View file

@ -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)