Skip to content

Commit b8e80e6

Browse files
committed
update go
1 parent 73bf5ca commit b8e80e6

File tree

6 files changed

+53
-22
lines changed

6 files changed

+53
-22
lines changed

.circleci/config.yml

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
version: 2
22
jobs:
3-
go1.23: &base
3+
go1.24: &base
44
docker:
5-
- image: cimg/go:1.23
5+
- image: cimg/go:1.24
66
steps:
77
- run: go version
88
- checkout
99
- run: go test -tags nikandfor_loc_unsafe -v ./...
1010
- run: go test -tags nikandfor_loc_unsafe -v -race ./...
1111

12+
go1.23:
13+
<<: *base
14+
docker:
15+
- image: cimg/go:1.23
16+
1217
go1.22:
1318
<<: *base
1419
docker:
@@ -34,22 +39,22 @@ jobs:
3439
docker:
3540
- image: cimg/go:1.18
3641

37-
go1.17:
38-
<<: *base
39-
docker:
40-
- image: cimg/go:1.17
4142

42-
43-
go1.23_safe: &base_safe
43+
go1.24_safe: &base_safe
4444
<<: *base
4545
docker:
46-
- image: cimg/go:1.23
46+
- image: cimg/go:1.24
4747
steps:
4848
- run: go version
4949
- checkout
5050
- run: go test -v -race ./...
5151
- run: go test -v ./...
5252

53+
go1.23_safe:
54+
<<: *base_safe
55+
docker:
56+
- image: cimg/go:1.23
57+
5358
go1.22_safe:
5459
<<: *base_safe
5560
docker:
@@ -70,25 +75,20 @@ jobs:
7075
docker:
7176
- image: cimg/go:1.19
7277

73-
go1.18_safe:
74-
<<: *base_safe
75-
docker:
76-
- image: cimg/go:1.18
77-
7878
workflows:
7979
version: 2
8080
build:
8181
jobs:
82+
- go1.24_safe
8283
- go1.23_safe
8384
- go1.22_safe
8485
- go1.21_safe
8586
- go1.20_safe
8687
- go1.19_safe
87-
- go1.18_safe
88+
- go1.24
8889
- go1.23
8990
- go1.22
9091
- go1.21
9192
- go1.20
9293
- go1.19
9394
- go1.18
94-
- go1.17

.github/workflows/go.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
14-
go-ver: ["1.23", "1.22", "1.21", "1.20", "1.19"]
14+
go-ver: ["1.24", "1.23", "1.22", "1.21", "1.20", "1.19"]
1515
include:
1616
- os: "ubuntu-latest"
17-
go-ver: "1.23"
17+
go-ver: "1.24"
1818
cover: true
1919

2020
runs-on: ${{ matrix.os }}
@@ -40,6 +40,12 @@ jobs:
4040
- name: Test Race
4141
run: go test -race -v ./...
4242

43+
- name: Test Unsafe
44+
run: go test -tags nikandfor_loc_unsafe -v ./...
45+
46+
- name: Test Unsafe Race
47+
run: go test -race -tags nikandfor_loc_unsafe -v ./...
48+
4349
- name: Upload coverage reports to Codecov
4450
uses: codecov/codecov-action@v4
4551
if: ${{ matrix.cover }}

.golangci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
run:
22
#modules-download-mode: readonly
3+
issues:
4+
exclude:
5+
- "padding"
6+
exclude-rules:
37
linters-settings:
48
govet:
59
check-shadowing: false

build_tag_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//go:build nikandfor_loc_unsafe
2+
3+
package loc
4+
5+
import "testing"
6+
7+
func TestBuildTag(t *testing.T) {
8+
t.Logf("build tag is set")
9+
}

location_test.go

+15-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ package loc
33
import (
44
"path"
55
"path/filepath"
6+
"runtime"
7+
"strings"
68
"testing"
79

810
"github.com/stretchr/testify/assert"
911
)
1012

13+
// padding
14+
// padding
15+
// padding
16+
1117
func TestLocation(t *testing.T) {
1218
testLocationInside(t)
1319
}
@@ -19,20 +25,26 @@ func testLocationInside(t *testing.T) {
1925
name, file, line := pc.NameFileLine()
2026
assert.Equal(t, "loc.testLocationInside", path.Base(name))
2127
assert.Equal(t, "location_test.go", filepath.Base(file))
22-
assert.Equal(t, 18, line)
28+
assert.Equal(t, 24, line)
2329
}
2430

2531
func TestLocationShort(t *testing.T) {
2632
pc := Caller(0)
27-
assert.Equal(t, "location_test.go:26", pc.String())
33+
assert.Equal(t, "location_test.go:32", pc.String())
2834
}
2935

3036
func TestLocation2(t *testing.T) {
3137
func() {
3238
func() {
3339
l := FuncEntry(0)
3440

35-
assert.Equal(t, "location_test.go:32", l.String())
41+
ver := runtime.Version()
42+
exp := "location_test.go:38"
43+
if strings.HasPrefix(ver, "go1.24") {
44+
exp = "location_test.go:36"
45+
}
46+
47+
assert.Equal(t, exp, l.String(), "ver: %v", ver)
3648
}()
3749
}()
3850
}

unsafe.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ func callers(skip int, pc []PC) int
88

99
//go:noescape
1010
//go:linkname caller1 runtime.callers
11-
func caller1(skip int, pc *PC, len, cap int) int //nolint:predeclared
11+
func caller1(skip int, pc *PC, len, cap int) int //nolint:predeclared,revive

0 commit comments

Comments
 (0)