cli / go-gh

A Go module for interacting with gh and the GitHub API from the command line.
https://pkg.go.dev/github.com/cli/go-gh/v2
MIT License
322 stars 45 forks source link

TokenForHost returns string "oauth_token" as source when config is read from file #94

Open mislav opened 1 year ago

mislav commented 1 year ago

TokenForHost source return value should be a value like GH_TOKEN or GITHUB_TOKEN when the token comes from an environment variable, or a file path (e.g. /path/to/hosts.yml) when the value comes from a file. However, a static string oauth_token is returned instead of a file name: https://github.com/cli/go-gh/blob/da64a13f361b2a1b9a1eb5358b7d7eee7506f6a2/pkg/auth/auth.go#L64

Since oauth_token source is not useful to find out where a value comes from, printing the file name would be better.

Ref. https://github.com/cli/go-gh/pull/44