feat: Require Go 1.26 and use new(expr) for pointer literals - #4481
feat: Require Go 1.26 and use new(expr) for pointer literals#4481ajayk wants to merge 2 commits into
Conversation
Bump go.mod to 1.26 per the N-1 support policy (Go 1.27 is current) and replace Ptr() with the new(v) builtin across tests.
|
@ajayk - please read step 4 of CONTRIBUTING.md and run the scripts locally to fix all test and linter errors, then push the changes to this PR before we can proceed. |
Bump go.mod to 1.26 per the N-1 support policy (Go 1.27 is current) and replace Ptr() with the new(v) builtin across tests.
addressed them sorry about this ! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4481 +/- ##
==========================================
- Coverage 98.51% 98.51% -0.01%
==========================================
Files 195 195
Lines 17691 17685 -6
==========================================
- Hits 17429 17423 -6
Misses 262 262 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I'm surprised the the Codecov report actually dropped in with this PR, but the bulk of the changes are for deprecated functions that are fixed with |
| @@ -209,10 +209,10 @@ func TestUsers_Keys(t *testing.T) { | |||
| // Verify that fetching individual key works | |||
| k, _, err := client.Users.GetKey(t.Context(), id) | |||
| if err != nil { | |||
| t.Fatalf("Users.GetKey(%q) returned error: %v", id, err) | |||
| t.Fatalf("Users.GetKey(%d) returned error: %v", id, err) | |||
There was a problem hiding this comment.
Can we use %v?
| t.Fatalf("Users.GetKey(%d) returned error: %v", id, err) | |
| t.Fatalf("Users.GetKey(%v) returned error: %v", id, err) |
alexandear
left a comment
There was a problem hiding this comment.
Please update all occurrences of Ptr with new:
❯ rg "Ptr\(" -c
CONTRIBUTING.md:4
tools/redundantptr/redundantptr.go:2
scrape/apps_test.go:2
tools/redundantptr/testdata/src/has-warnings/github.go:9
github/github-iterators.go:246
tools/redundantptr/testdata/src/no-warnings/github.go:9
README.md:2
github/github-stringify_test.go:976
github/gen-iterators.go:1
github/gen-stringify-test.go:11
github/github.go:2
github/github_test.go:4
github/doc.go:2
There was a problem hiding this comment.
Please change to 1.26 in all go.mod files:
❯ rg "go 1.25"
scrape/go.mod
3:go 1.25.0
tools/extraneousnew/go.mod
3:go 1.25.0
tools/redundantptr/go.mod
3:go 1.25.0
tools/structfield/go.mod
3:go 1.25.0
tools/fmtpercentv/go.mod
3:go 1.25.0
tools/check-structfield-settings/go.mod
3:go 1.25.0
tools/paramcheck/go.mod
3:go 1.25.0
tools/sliceofpointers/go.mod
3:go 1.25.0
|
|
||
| // Ptr is a helper routine that allocates a new T value | ||
| // to store v and returns a pointer to it. | ||
| // |
There was a problem hiding this comment.
Please mark this function as deprecated.
Bump go.mod to 1.26 per the N-1 support policy (Go 1.27 is current) and replace Ptr() with the new(v) builtin across tests.