Skip to content

refactor: replace builtin package with fluxinit/static #3304

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

Merged
merged 1 commit into from
Nov 4, 2020

Conversation

adrian-thurston
Copy link
Contributor

A static initialization is not desirable in the main binaries, as it forces all
paths of code to init, but it is still useful in tests. It allows static
intialization to be performed once for all tests and eliminates the need to
always add the FluxInit call. Added a fluxinit/static package that calls
fluxinit.FluxInit() to replace the builtin package. This hides the nature of
the initialization and makes it clear that it is mandatory initialization code.

Copy link
Contributor

@nathanielc nathanielc left a comment

Choose a reason for hiding this comment

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

LGTM with a few clarifying comments.

The FluxInit function references the builtin package which has now been removed. We should update that comment.

Also adding a package comment to the static package would be helpful.

@@ -1,13 +0,0 @@
// Package builtin contains all packages related to Flux built-ins are imported and initialized.
// This should only be imported from main or test packages.
// It is a mistake to import it from any other package.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a similar comment to the new static package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yes thanks for catching that.

@nathanielc
Copy link
Contributor

Also I expect you will have to create equivalent static packages in OSS and IDPE?

@adrian-thurston
Copy link
Contributor Author

Also I expect you will have to create equivalent static packages in OSS and IDPE?

Yup, will need that too.

@adrian-thurston adrian-thurston force-pushed the fix/static-flux-init branch 2 times, most recently from ec6ebb7 to c8e0f1e Compare November 4, 2020 19:14
A static initialization is not desirable in the main binaries, as it forces all
paths of code to init, but it is still useful in tests. It allows static
intialization to be performed once for all tests and eliminates the need to
always add the FluxInit call. Added a fluxinit/static package that calls
fluxinit.FluxInit() to replace the builtin package. This hides the nature of
the initialization and makes it clear that it is mandatory initialization code.
@codecov-io
Copy link

Codecov Report

Merging #3304 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3304      +/-   ##
==========================================
+ Coverage   49.34%   49.36%   +0.01%     
==========================================
  Files         351      351              
  Lines       36393    36393              
==========================================
+ Hits        17957    17964       +7     
+ Misses      15913    15907       -6     
+ Partials     2523     2522       -1     
Impacted Files Coverage Δ
fluxinit/static/static.go 100.00% <100.00%> (ø)
stdlib/universe/pivot.gen.go 9.93% <0.00%> (+0.26%) ⬆️
libflux/go/libflux/parser.go 67.64% <0.00%> (+1.47%) ⬆️
libflux/go/libflux/analyze.go 54.05% <0.00%> (+5.40%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1089af1...dc0ec0d. Read the comment docs.

@adrian-thurston adrian-thurston merged commit b556c3b into master Nov 4, 2020
@adrian-thurston adrian-thurston deleted the fix/static-flux-init branch November 4, 2020 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants