generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: detect when
go mod tidy
and build scaffolding is needed (#3360)
closes #3129 Increases performance of go builds by 0.5s-0.8s in some cases. Changes: - Track if any thing has changed that would require us to - call `go mod tidy` (in either the main module directory, or in the build directory) - scaffold the build template (if we scaffold, we also need to run go mod tidy) - If a build fails for any reason, reset ongoing build state so next time we always rebuild everything. Trigger details: - If we detect changes in `go.mod`, `go.sum` or `types.ftl.go`, always rebuild fully - If the list of imported packages has changed, `go mod tidy` is required in the module's directory - If the MainModuleContext has changed in any way, then the build template needs to be scaffolded, and `go mod tidy` needs to be run in `.ftl/go/main` Performace: - Scaffolding is super fast - Running `go mod tidy` usually takes around 0.5-0.8s (but can take more if network requests are required) - The 2 `go mod tidy` executions are run in parallel, so if either is required then there is no real performance gain. If neither is required then we see the performance improvement. - The rest of the build time is split between extracting schema (0.5-1.5s) and compiling (0.5-1.5s)
- Loading branch information
Showing
8 changed files
with
186 additions
and
68 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,7 @@ use ( | |
{{- range .SharedModulesPaths }} | ||
{{ . }} | ||
{{- end }} | ||
{{ if .IncludeMainPackage }} | ||
.ftl/go/main | ||
{{ end }} | ||
) |
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
Oops, something went wrong.