mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
Sort controllers so that builds are reproducible.
Ordering of controllers in routes.go and main.go is unstable in successive runs of revel build. This change will assure that the ordering is stable.
This commit is contained in:
@@ -42,6 +42,10 @@ func Build(buildFlags ...string) (app *App, compileError *revel.Error) {
|
||||
sourceInfo.InitImportPaths = append(sourceInfo.InitImportPaths, strings.Split(dbImportPath,",")...)
|
||||
}
|
||||
|
||||
// Sort controllers so that file generation is reproducible
|
||||
controllers := sourceInfo.ControllerSpecs()
|
||||
sort.SliceStable(controllers, func(i, j int) bool { return controllers[i].String() < controllers[j].String() })
|
||||
|
||||
// Generate two source files.
|
||||
templateArgs := map[string]interface{}{
|
||||
"Controllers": sourceInfo.ControllerSpecs(),
|
||||
|
||||
Reference in New Issue
Block a user