Skip to content

Commit d626c4e

Browse files
committed
chore: upgrade Go 1.15 to 1.25, add CI linting, fix lint issues
- Bump go.mod from Go 1.15 to 1.25.0 - Update all dependencies to latest versions - Fix fmt.Errorf vet issue (use errors.New for non-format strings) - Fix unchecked raven.SetDSN error, merge var decl, use switch - Add golangci-lint config and CI lint job - Add -race flag to test target - Standardize CI with separate build/test/lint jobs
1 parent 6744562 commit d626c4e

7 files changed

Lines changed: 133 additions & 1773 deletions

File tree

.github/workflows/go.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,41 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- name: Set up Go
20-
uses: actions/setup-go@v3
20+
uses: actions/setup-go@v5
2121
with:
22-
go-version: 1.19
22+
go-version: "1.25"
2323

2424
- name: Build
25-
run: go build -v ./...
25+
run: make build
26+
27+
test:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@v5
34+
with:
35+
go-version: "1.25"
2636

2737
- name: Test
28-
run: go test -v ./...
38+
run: make test
39+
40+
lint:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Set up Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version: "1.25"
49+
50+
- name: Lint
51+
uses: golangci/golangci-lint-action@v9
52+
with:
53+
version: v2.8
54+
args: --timeout 5m

.golangci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "2"
2+
linters:
3+
exclusions:
4+
generated: lax
5+
presets:
6+
- comments
7+
- common-false-positives
8+
- legacy
9+
- std-error-handling
10+
rules:
11+
- linters:
12+
- funlen
13+
- goconst
14+
- errcheck
15+
- ineffassign
16+
- staticcheck
17+
path: (.+)_test\.go
18+
paths:
19+
- third_party$
20+
- builtin$
21+
- examples$
22+
formatters:
23+
exclusions:
24+
generated: lax
25+
paths:
26+
- third_party$
27+
- builtin$
28+
- examples$

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
.PHONY: build doc
1+
.PHONY: build test doc lint bench
22
build:
33
go build ./...
44

55
test:
6-
go test ./...
6+
go test ./... -race
77

88
doc:
99
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
1010
gomarkdoc ./...
11+
12+
lint:
13+
golangci-lint run
14+
15+
bench:
16+
go test -bench=. -benchmem ./...

errors.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package errors
22

33
import (
4-
"fmt"
4+
stderrors "errors"
55
"runtime"
66
"strings"
77

@@ -155,12 +155,12 @@ func NewWithStatus(msg string, status *grpcstatus.Status) ErrorExt {
155155

156156
// NewWithSkip creates a new error skipping the number of function on the stack
157157
func NewWithSkip(msg string, skip int) ErrorExt {
158-
return WrapWithSkip(fmt.Errorf(msg), "", skip+1)
158+
return WrapWithSkip(stderrors.New(msg), "", skip+1)
159159
}
160160

161161
// NewWithSkipAndStatus creates a new error skipping the number of function on the stack and GRPC status
162162
func NewWithSkipAndStatus(msg string, skip int, status *grpcstatus.Status) ErrorExt {
163-
return WrapWithSkipAndStatus(fmt.Errorf(msg), "", skip+1, status)
163+
return WrapWithSkipAndStatus(stderrors.New(msg), "", skip+1, status)
164164
}
165165

166166
// Wrap wraps an existing error and appends stack information if it does not exists

go.mod

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
module github.com/go-coldbrew/errors
22

3-
go 1.15
3+
go 1.25.0
44

55
require (
6-
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 // indirect
76
github.com/getsentry/raven-go v0.2.0
8-
github.com/go-coldbrew/log v0.2.0
9-
github.com/go-coldbrew/options v0.0.0-20210109113138-49c7e5781276
10-
github.com/google/uuid v1.3.0
7+
github.com/go-coldbrew/log v0.2.5
8+
github.com/go-coldbrew/options v0.2.4
9+
github.com/google/uuid v1.6.0
1110
github.com/opentracing/opentracing-go v1.2.0
1211
github.com/stvp/rollbar v0.5.1
13-
google.golang.org/grpc v1.56.3
12+
google.golang.org/grpc v1.79.3
1413
gopkg.in/airbrake/gobrake.v2 v2.0.9
1514
)
15+
16+
require (
17+
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d // indirect
18+
github.com/go-kit/log v0.2.1 // indirect
19+
github.com/go-logfmt/logfmt v0.6.1 // indirect
20+
github.com/onsi/ginkgo v1.16.5 // indirect
21+
github.com/onsi/gomega v1.39.1 // indirect
22+
github.com/pkg/errors v0.9.1 // indirect
23+
golang.org/x/sys v0.42.0 // indirect
24+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
25+
google.golang.org/protobuf v1.36.10 // indirect
26+
)

0 commit comments

Comments
 (0)