Skip to content

Commit

Permalink
chore: bump go 1.22 (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma authored Sep 17, 2024
1 parent 4c7546d commit 0285251
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 23 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:

strategy:
matrix:
go-version: [ "1.21", "1.22" ]
go-version: [ "1.22", "1.23" ]
runs-on: ubuntu-latest
env:
GOLANGCI_LINT_VERSION: v1.56.1
GOLANGCI_LINT_VERSION: v1.61.0

steps:
- name: Install Go
Expand All @@ -37,7 +37,6 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
skip-pkg-cache: true
args: --go ${{ matrix.go-version }}

- name: Run tests
Expand Down
19 changes: 6 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,23 @@ linters-settings:
gosec:
excludes:
- G103
- G115

linters:
enable-all: true
disable:
- interfacer # deprecated
- scopelint # deprecated
- maligned # deprecated
- golint # deprecated
- exhaustivestruct # deprecated
- varcheck # deprecated
- nosnakecase # deprecated
- structcheck # deprecated
- deadcode # deprecated
- ifshort # deprecated
- execinquery # deprecated
- exportloopref # deprecated
- gomnd # deprecated
- depguard
- err113
- exhaustive
- exhaustruct
- forcetypeassert
- gochecknoglobals
- goerr113
- gomnd
- ireturn
- mnd
- nlreturn
- maligned
- varnamelen
- wrapcheck
- wsl
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/hamba/statter/v2

go 1.21
go 1.22

require (
github.com/VictoriaMetrics/metrics v1.35.1
github.com/cactus/go-statsd-client/v5 v5.1.0
github.com/hamba/logger/v2 v2.6.0
github.com/prometheus/client_golang v1.20.3
github.com/prometheus/client_golang v1.20.4
github.com/stretchr/testify v1.9.0
github.com/valyala/fastrand v1.1.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4=
github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
Expand Down
1 change: 1 addition & 0 deletions internal/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (s *Sample) percentile(n float64) float64 {
return s.perc[clamp(i, 0, len(s.perc)-1)]
}

//nolint:predeclared
func clamp(i float64, min, max int) int {
if i < float64(min) {
return min
Expand Down
2 changes: 1 addition & 1 deletion key.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func sortTags(tags []Tag) {
for !sorted {
sorted = true
lmo := len(tags) - 1
for i := 0; i < lmo; i++ {
for i := range lmo {
if tags[i+1][0] < tags[i][0] {
tags[i+1], tags[i] = tags[i], tags[i+1]
sorted = false
Expand Down
2 changes: 1 addition & 1 deletion reporter/statsd/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (s *Statsd) Close() error {

func toTags(t [][2]string) []statsd.Tag {
res := make([]statsd.Tag, len(t))
for i := 0; i < len(t); i++ {
for i := range t {
res[i] = statsd.Tag{t[i][0], t[i][1]}
}
return res
Expand Down
2 changes: 1 addition & 1 deletion statter.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (s *Statter) reportSample(name, suffix string, tags [][2]string, sample *st
s.r.Gauge(prefix+"max"+suffix, sample.Max(), tags)
ps := s.cfg.percentiles
vs := sample.Percentiles(ps)
for i := 0; i < len(vs); i++ {
for i := range vs {
name := prefix + strconv.FormatFloat(ps[i], 'g', -1, 64) + "p" + suffix
s.r.Gauge(name, vs[i], tags)
}
Expand Down

0 comments on commit 0285251

Please sign in to comment.