From fbf835f6b27504e3668eaacaee9509fa56603838 Mon Sep 17 00:00:00 2001 From: Miccah Date: Thu, 9 Jan 2025 14:08:20 -0800 Subject: [PATCH] [chore] Use static token in GitHub source (#3834) Also some minor formatting in sources.go --- pkg/sources/github/connector_token.go | 2 +- pkg/sources/sources.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/sources/github/connector_token.go b/pkg/sources/github/connector_token.go index cd6e9ba0d968..88ef8f8f1ec0 100644 --- a/pkg/sources/github/connector_token.go +++ b/pkg/sources/github/connector_token.go @@ -30,7 +30,7 @@ func newTokenConnector(apiEndpoint string, token string, handleRateLimit func(co tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token}) httpClient.Transport = &oauth2.Transport{ Base: httpClient.Transport, - Source: oauth2.ReuseTokenSource(nil, tokenSource), + Source: tokenSource, } apiClient, err := createGitHubClient(httpClient, apiEndpoint) diff --git a/pkg/sources/sources.go b/pkg/sources/sources.go index b1190209cf7d..ad53ff698d0b 100644 --- a/pkg/sources/sources.go +++ b/pkg/sources/sources.go @@ -98,7 +98,7 @@ type SourceUnitEnumerator interface { // synchronous but can be called in a goroutine to support concurrent // enumeration and chunking. An error should only be returned from this // method in the case of context cancellation, fatal source errors, or - // errors returned by the reporter All other errors related to unit + // errors returned by the reporter. All other errors related to unit // enumeration are tracked by the UnitReporter. Enumerate(ctx context.Context, reporter UnitReporter) error } @@ -106,7 +106,7 @@ type SourceUnitEnumerator interface { // BaseUnitReporter is a helper struct that implements the UnitReporter interface // and includes a JobProgress reference. type baseUnitReporter struct { - child UnitReporter + child UnitReporter progress *JobProgress } @@ -126,7 +126,6 @@ func (b baseUnitReporter) UnitErr(ctx context.Context, err error) error { return nil } - // UnitReporter defines the interface a source will use to report whether a // unit was found during enumeration. Either method may be called any number of // times. Implementors of this interface should allow for concurrent calls.