Skip to content

Commit

Permalink
Update building
Browse files Browse the repository at this point in the history
* Remove unused / non-standard .go-version.
* Cleanup indenting in Makefile.
* Enable dependabot for subdirs.
* Update golanci-lint CI.
* Update go.mod version directives to match supported versions.
* Disable golanci-lint unused-parameter.

Signed-off-by: SuperQ <[email protected]>
  • Loading branch information
SuperQ committed Aug 12, 2023
1 parent 1a88780 commit 15c7e69
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 405 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ updates:
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "gomod"
directory: "/examples/middleware"
schedule:
interval: "monthly"
- package-ecosystem: "gomod"
directory: "/tutorial/whatsup"
schedule:
interval: "monthly"
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.20.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/[email protected]
with:
args: --verbose
version: v1.51.2
version: v1.53.3
1 change: 0 additions & 1 deletion .go-version

This file was deleted.

27 changes: 23 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---

run:
deadline: 5m
skip-files:
# Skip autogenerated files.
- ^.*\.(pb|y)\.go$

output:
sort-results: true

linters:
enable:
- deadcode
- depguard
- durationcheck
- errorlint
Expand All @@ -23,10 +24,8 @@ linters:
- predeclared
- revive
- staticcheck
- structcheck
- unconvert
- unused
- varcheck
- wastedassign

issues:
Expand All @@ -39,9 +38,29 @@ issues:
- structcheck

linters-settings:
depguard:
rules:
main:
deny:
#- pkg: "sync/atomic"
# desc: "Use go.uber.org/atomic instead of sync/atomic"
- pkg: "github.com/stretchr/testify/assert"
desc: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert"
- pkg: "github.com/go-kit/kit/log"
desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
- pkg: "io/ioutil"
desc: "Use corresponding 'os' or 'io' functions instead."
#- pkg: "regexp"
# desc: "Use github.com/grafana/regexp instead of regexp"
errcheck:
exclude: scripts/errcheck_excludes.txt
goimports:
local-prefixes: github.com/prometheus/client_golang
gofumpt:
extra-rules: true
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: true
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ test-short: deps common-test-short
VERSIONS := 1.19 1.20 1.21
generate-go-collector-test-files:
for GO_VERSION in $(VERSIONS); do \
docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \
docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \
mv -f go_collector_metrics* prometheus; \
done
done

.PHONY: fmt
fmt: common-format
Expand Down
2 changes: 1 addition & 1 deletion examples/middleware/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/jessicalins/instrumentation-practices-examples/middleware

go 1.17
go 1.19

require github.com/prometheus/client_golang v1.13.1

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/prometheus/client_golang

go 1.17
go 1.19

require (
github.com/beorn7/perks v1.0.1
Expand Down
393 changes: 0 additions & 393 deletions go.sum

Large diffs are not rendered by default.

0 comments on commit 15c7e69

Please sign in to comment.