diff --git a/tools/redundantptr/testdata/src/github.com/google/go-github/v84/github/github.go b/tools/redundantptr/testdata/src/github.com/google/go-github/v84/github/github.go deleted file mode 100644 index 994d06a400a..00000000000 --- a/tools/redundantptr/testdata/src/github.com/google/go-github/v84/github/github.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2026 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -func Ptr[T any](v T) *T { - return &v -} diff --git a/tools/redundantptr/testdata/src/has-warnings/main.go b/tools/redundantptr/testdata/src/has-warnings/github.go similarity index 53% rename from tools/redundantptr/testdata/src/has-warnings/main.go rename to tools/redundantptr/testdata/src/has-warnings/github.go index 4b78bad402e..e06225792d8 100644 --- a/tools/redundantptr/testdata/src/has-warnings/main.go +++ b/tools/redundantptr/testdata/src/has-warnings/github.go @@ -3,11 +3,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package main - -import ( - "github.com/google/go-github/v84/github" -) +package github func main() { file, content := getFileAndContent() @@ -15,22 +11,22 @@ func main() { Mode string }{Mode: "gfm"} - _ = github.Ptr(string(content)) + _ = Ptr(string(content)) - _ = github.Ptr(file) // want `replace github.Ptr\(file\) with &file` + _ = Ptr(file) // want `replace github.Ptr\(file\) with &file` other := "b.txt" - _ = github.Ptr(other) // want `replace github.Ptr\(other\) with &other` - _ = github.Ptr(opts.Mode) // want `replace github.Ptr\(opts.Mode\) with &opts.Mode` + _ = Ptr(other) // want `replace github.Ptr\(other\) with &other` + _ = Ptr(opts.Mode) // want `replace github.Ptr\(opts.Mode\) with &opts.Mode` for _, loopFile := range []string{"x", "y"} { - _ = github.Ptr(loopFile) // want `replace github.Ptr\(loopFile\) with &loopFile` + _ = Ptr(loopFile) // want `replace github.Ptr\(loopFile\) with &loopFile` } name := "before" - _ = github.Ptr(name) // want `replace github.Ptr\(name\) with &name` + _ = Ptr(name) // want `replace github.Ptr\(name\) with &name` name = "after" - _ = github.Ptr(name) // want `replace github.Ptr\(name\) with &name` + _ = Ptr(name) // want `replace github.Ptr\(name\) with &name` i := 1 _ = Ptr(i) // want `replace github.Ptr\(i\) with &i` diff --git a/tools/redundantptr/testdata/src/no-warnings/main.go b/tools/redundantptr/testdata/src/no-warnings/github.go similarity index 79% rename from tools/redundantptr/testdata/src/no-warnings/main.go rename to tools/redundantptr/testdata/src/no-warnings/github.go index 6f7f392f9a9..c1721610e8b 100644 --- a/tools/redundantptr/testdata/src/no-warnings/main.go +++ b/tools/redundantptr/testdata/src/no-warnings/github.go @@ -3,22 +3,20 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package main - -import "github.com/google/go-github/v84/github" +package github func main() { // Literal argument cannot be addressed. - _ = github.Ptr("a.txt") + _ = Ptr("a.txt") const file = "a.txt" - _ = github.Ptr(file) + _ = Ptr(file) for range []int{1, 2} { - _ = github.Ptr("a") + _ = Ptr("a") } - _ = github.Ptr(getOptions().Mode) + _ = Ptr(getOptions().Mode) } func getOptions() struct {