-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use fluxinit package to init flux library instead of builtin (#1…
…9887) * fix: use fluxinit package to init flux library instead of builtin The builtin package performs costly initialization work in the go init() function, which causes the work to be performed for all paths of the main executables that need it, including help screens. This patch uses the fluxinit package, which requires a call to do the costly work. It allows help screens and other code paths to execute quickly. * fix: need to draw in the influxdb-specific standard library in fluxinit
- Loading branch information
1 parent
428a46b
commit 37ef9d2
Showing
6 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package fluxinit | ||
|
||
import ( | ||
"github.com/influxdata/flux/runtime" | ||
|
||
_ "github.com/influxdata/flux/stdlib" | ||
_ "github.com/influxdata/influxdb/v2/query/stdlib" // Import the stdlib | ||
) | ||
|
||
// FluxInit() prepares the runtime for compilation and execution of flux. This | ||
// is a costly step and should only be performed if the intention is to compile | ||
// and execute flux code. | ||
// | ||
// Importing this package and calling FluxInit is equivalent to importing the | ||
// "builtin" package. It draws in the standard library functions, which | ||
// register themselves in init() functions, then performs the final steps | ||
// necessary to prepare for executing flux. | ||
func FluxInit() { | ||
runtime.FinalizeBuiltIns() | ||
} |