Skip to content

Commit

Permalink
Upgrade to Go 1.23
Browse files Browse the repository at this point in the history
Fixes #67
  • Loading branch information
mpapenbr committed Aug 15, 2024
1 parent 1cb1fdc commit 11e27d5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
golangci-lint:
strategy:
matrix:
go-version: [1.22.x]
go-version: [1.23.x]
os: [windows-latest]

runs-on: ${{ matrix.os }}
Expand All @@ -30,7 +30,7 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
# Must be specified without patch version: we always use the latest patch version.
version: v1.56
version: v1.60

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.23"

- uses: release-drafter/release-drafter@v6
id: rd
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
tests:
strategy:
matrix:
go-version: [1.22.x]
go-version: [1.23.x]
os: [windows-latest]

runs-on: ${{ matrix.os }}
Expand Down
22 changes: 2 additions & 20 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ run:
# output configuration options
output:
# default is "colored-line-number"
format: colored-line-number
formats:
- format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true
Expand Down Expand Up @@ -227,9 +228,6 @@ linters-settings:
simplify: true

gofumpt:
# select the Go version to target. The default is `1.15`.
lang-version: "1.20"

# choose whether or not to use the extra rules - disabled by default
extra-rules: true

Expand All @@ -242,16 +240,6 @@ linters-settings:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8

gomnd:
settings:
mnd:
# list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks
# optional: remove the "operation" and "assign" if needed
checks: argument,case,condition,operation,return,assign
# ignored-numbers: 1000
# ignored-files: magic_.*.go
# ignored-functions: math.*

gosec:
# list of available rules: https://github.com/securego/gosec#available-rules

Expand All @@ -264,13 +252,9 @@ linters-settings:
# - G204

gosimple:
go: "1.20" # version to target - default is '1.13'
checks: ["all"] # https://staticcheck.io/docs/options#checks for more info

govet:
# report about shadowed variables
check-shadowing: true

# settings per analyzer
settings:
# printf: # analyzer name, run `go tool vet help` to see all analyzers
Expand Down Expand Up @@ -381,12 +365,10 @@ linters-settings:

staticcheck:
# Staticcheck is a go vet on steroids, applying a ton of static analysis checks
go: "1.22" # go version to target. The default is '1.13'
checks: ["all"] # https://staticcheck.io/docs/options#checks for more info

stylecheck:
# Stylecheck is a replacement for golint
go: "1.22" # go version to target. default is '1.13'
checks: ["all"]
dot-import-whitelist:
- fmt
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/mpapenbr/go-racelogger

go 1.22
go 1.23

toolchain go1.23.0

require (
github.com/spf13/cobra v1.8.1
Expand Down
16 changes: 8 additions & 8 deletions internal/racelogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ func (r *Racelogger) setupMainLoop() {
}

func logDurations(msg string, durations []time.Duration) {
min := 1 * time.Second
max := time.Duration(0)
minTime := 1 * time.Second
maxTime := time.Duration(0)
sum := int64(0)
avg := time.Duration(0)
zeroDurations := 0
Expand All @@ -426,11 +426,11 @@ func logDurations(msg string, durations []time.Duration) {
continue
}
validDurations++
if v < min {
min = v
if v < minTime {
minTime = v
}
if v > max {
max = v
if v > maxTime {
maxTime = v
}
sum += v.Nanoseconds()
}
Expand All @@ -445,8 +445,8 @@ func logDurations(msg string, durations []time.Duration) {
log.Debug(msg,
log.Int("zeroDurations", zeroDurations),
log.Int("validDurations", validDurations),
log.Duration("min", min),
log.Duration("max", max),
log.Duration("min", minTime),
log.Duration("max", maxTime),
log.Duration("avg", avg),
log.String("durations", strings.Join(durationsStrs, ",")))
}

0 comments on commit 11e27d5

Please sign in to comment.