-
Notifications
You must be signed in to change notification settings - Fork 490
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
config: let go-generate to produce config-vXX.json files #5446
Conversation
configBytes := autoDefaultsBytes | ||
if *testConfigVersion != 0 { | ||
configVersion = uint32(*testConfigVersion) | ||
configBytes = []byte(prettyPrint(config.GetVersionedDefaultLocalConfig(configVersion), "json")) |
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.
Can't you just use prettyPrint(config.AutogenLocal, "json") like above when generating jsonExampleFileName? Also isn't this the same content as jsonExampleFileName above?
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 seems like you are generating the same config file two different ways now?
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.
if testConfigVersion is set to 27
it will generate config-v27.json
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 seems like this is equivalent to
autoDefaultsBytes = []byte(prettyPrint(config.AutogenLocal, "json"))
err = os.WriteFile(*jsonExampleFileName, autoDefaultsBytes, 0644)
if err != nil {
printExit("Unable to write file %s : %v", *jsonExampleFileName, err)
}
And that you didn't need to make config.GetVersionedDefaultLocalConfig public, is that right?
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.
oh I see ... you're also adding an optional flag to specify whatever config version you want.. not used by the go:generate call.
Codecov Report
@@ Coverage Diff @@
## master #5446 +/- ##
==========================================
- Coverage 55.38% 55.38% -0.01%
==========================================
Files 447 447
Lines 63312 63312
==========================================
- Hits 35066 35064 -2
- Misses 25854 25860 +6
+ Partials 2392 2388 -4
... and 14 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Looks great!
Summary
go generate ./config
(ormake generate
) will produce config-vXX file automatically.Test Plan
Local run, update config-v27, re-check config-v28