MCPcopy
hub / github.com/sourcegraph/checkup / ensureClient

Method ensureClient

storage/github/github.go:75–92  ·  view source on GitHub ↗

ensureClient builds an GitHub API client if none exists and stores it on the struct.

()

Source from the content-addressed store, hash-verified

73
74// ensureClient builds an GitHub API client if none exists and stores it on the struct.
75func (gh *Storage) ensureClient() error {
76 if gh.client != nil {
77 return nil
78 }
79
80 if gh.AccessToken == "" {
81 return fmt.Errorf("Please specify access_token in storage configuration")
82 }
83
84 gh.client = github.NewClient(oauth2.NewClient(
85 oauth2.NoContext,
86 oauth2.StaticTokenSource(
87 &oauth2.Token{AccessToken: gh.AccessToken},
88 ),
89 ))
90
91 return nil
92}
93
94// fullPathName ensures the configured Dir value is present in the filename and
95// returns a filename with the Dir prefixed before the input filename if necessary.

Callers 4

readFileMethod · 0.95
writeFileMethod · 0.95
deleteFileMethod · 0.95
MaintainMethod · 0.95

Implementers 5

fakecheckup_test.go
Storagestorage/sql/sql.go
Storagestorage/s3/s3.go
Storagestorage/github/github.go
Storagestorage/fs/fs.go

Calls

no outgoing calls

Tested by

no test coverage detected