Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: v2.2.2
version: v2.6.1
plugins:
- module: "github.com/google/go-github/v78/tools/fmtpercentv"
path: ./tools/fmtpercentv
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ linters:
- intrange
- jsonfieldname
- misspell
- modernize
- musttag
- nakedret
- paralleltest
Expand Down Expand Up @@ -84,6 +85,9 @@ linters:
ignore-rules:
- analyses # returned by the GitHub API
- cancelled # returned by the GitHub API
modernize:
disable:
- omitzero # TODO: fix
perfsprint:
errorf: true
strconcat: false
Expand Down
2 changes: 1 addition & 1 deletion example/commitpr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func getTree(ref *github.Reference) (tree *github.Tree, err error) {
entries := []*github.TreeEntry{}

// Load each file into the tree.
for _, fileArg := range strings.Split(*sourceFiles, ",") {
for fileArg := range strings.SplitSeq(*sourceFiles, ",") {
file, content, err := getFileContent(fileArg)
if err != nil {
return nil, err
Expand Down
3 changes: 2 additions & 1 deletion github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ func NewClientWithEnvProxy() *Client {
}

// NewTokenClient returns a new GitHub API client authenticated with the provided token.
//
// Deprecated: Use NewClient(nil).WithAuthToken(token) instead.
func NewTokenClient(_ context.Context, token string) *Client {
// This always returns a nil error.
Expand Down Expand Up @@ -709,7 +710,7 @@ func newResponse(r *http.Response) *Response {
// various pagination link values in the Response.
func (r *Response) populatePageValues() {
if links, ok := r.Response.Header["Link"]; ok && len(links) > 0 {
for _, link := range strings.Split(links[0], ",") {
for link := range strings.SplitSeq(links[0], ",") {
segments := strings.Split(strings.TrimSpace(link), ";")

// link must at least have href and rel
Expand Down
2 changes: 1 addition & 1 deletion github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func TestWithEnterpriseURLs(t *testing.T) {
// Ensure that length of Client.rateLimits is the same as number of fields in RateLimits struct.
func TestClient_rateLimits(t *testing.T) {
t.Parallel()
if got, want := len(Client{}.rateLimits), reflect.TypeOf(RateLimits{}).NumField(); got != want {
if got, want := len(Client{}.rateLimits), reflect.TypeFor[RateLimits]().NumField(); got != want {
t.Errorf("len(Client{}.rateLimits) is %v, want %v", got, want)
}
}
Expand Down
2 changes: 1 addition & 1 deletion github/issue_import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestIssueImportService_CheckStatusSince(t *testing.T) {
testHeader(t, r, "Accept", mediaTypeIssueImportAPI)
w.WriteHeader(http.StatusOK)
//nolint:fmtpercentv
assertWrite(t, w, []byte(fmt.Sprintf("[%s]", issueImportResponseJSON)))
assertWrite(t, w, fmt.Appendf(nil, "[%s]", issueImportResponseJSON))
})

ctx := t.Context()
Expand Down
2 changes: 1 addition & 1 deletion github/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestMigrationService_ListMigrations(t *testing.T) {

w.WriteHeader(http.StatusOK)
//nolint:fmtpercentv
assertWrite(t, w, []byte(fmt.Sprintf("[%s]", migrationJSON)))
assertWrite(t, w, fmt.Appendf(nil, "[%s]", migrationJSON))
})

ctx := t.Context()
Expand Down
2 changes: 1 addition & 1 deletion github/migrations_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestMigrationService_ListUserMigrations(t *testing.T) {

w.WriteHeader(http.StatusOK)
//nolint:fmtpercentv
assertWrite(t, w, []byte(fmt.Sprintf("[%s]", userMigrationJSON)))
assertWrite(t, w, fmt.Appendf(nil, "[%s]", userMigrationJSON))
})

ctx := t.Context()
Expand Down
2 changes: 1 addition & 1 deletion github/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"reflect"
)

var timestampType = reflect.TypeOf(Timestamp{})
var timestampType = reflect.TypeFor[Timestamp]()

// Stringify attempts to create a reasonable string representation of types in
// the GitHub library. It does things like resolve pointers to their values
Expand Down
2 changes: 1 addition & 1 deletion script/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -e

GOLANGCI_LINT_VERSION="2.3.0"
GOLANGCI_LINT_VERSION="2.6.1"

CDPATH="" cd -- "$(dirname -- "$0")/.."
BIN="$(pwd -P)"/bin
Expand Down
Loading