Skip to content
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

Merged
merged 2 commits into from
Jun 3, 2023

Conversation

algorandskiy
Copy link
Contributor

Summary

go generate ./config (or make generate) will produce config-vXX file automatically.

Test Plan

Local run, update config-v27, re-check config-v28

configBytes := autoDefaultsBytes
if *testConfigVersion != 0 {
configVersion = uint32(*testConfigVersion)
configBytes = []byte(prettyPrint(config.GetVersionedDefaultLocalConfig(configVersion), "json"))
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor

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
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Merging #5446 (72db522) into master (3cbb422) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            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     
Impacted Files Coverage Δ
config/migrate.go 78.46% <100.00%> (ø)

... and 14 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@algonautshant algonautshant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@algorandskiy algorandskiy merged commit 47dec14 into algorand:master Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants