-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Move user config and repo config to Viper #1751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some trouble understanding the full scope of these changes and how they relate to each other (and I'm still getting comfortable with Go), but generally seems ok to me?
Couple high level questions:
- Is viper the thing reading
turbo.json
or is this some other config? - I noticed a bunch of changes in the tests. Are we keeping track of total coverage somehow to get a summary of whether it went up or down from a PR?
@@ -40,17 +39,33 @@ type ApiClient struct { | |||
// ErrTooManyFailures is returned from remote cache API methods after `maxRemoteFailCount` errors have occurred | |||
var ErrTooManyFailures = errors.New("skipping HTTP Request, too many failures have occurred") | |||
|
|||
// _maxRemoteFailCount is the number of failed requests before we stop trying to upload/download | |||
// artifacts to the remote cache | |||
const _maxRemoteFailCount = uint64(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm embarrassed to admit that I just learned that "unsigned int" has nothing to do with cryptography 😬
TeamID string | ||
TeamSlug string | ||
APIURL string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏾 I like it
@@ -23,10 +23,9 @@ import ( | |||
type ApiClient struct { | |||
// The api's base URL | |||
baseUrl string | |||
Token string | |||
token string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beginner Go question: I know uppercasing is how you export from a package, does lowercasing a struct property have any related effects in terms of public/private? I see you're using .token
for both getters and setters later, so there probably isn't, but then I'm curious why it was originally uppercased, and why you changed it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has the same effect as struct and function names. .token
is now only visible in the config
package. All of the other usages, including the tests, are in the config
package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. I thought it would be private to the struct, rather than private to the package. Thanks!
TeamSlug: "my-team-slug", | ||
APIURL: ts.URL, | ||
Token: "my-token", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not blocking: may be worth moving to a top level constant since it doesn't change between tests.
Co-authored-by: Mehul Kar <mehul.kar@gmail.com>
The main goal is break up the giant
Config
struct into pieces that will fit into a top-level helper / command base in the final move tocobra
.cobra
, but that is the eventual goal