Skip to content

Sort controllers so that builds are reproducible. #112

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 2 commits into from
Jan 30, 2018

Conversation

nathantchan
Copy link
Contributor

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.

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.
harness/build.go Outdated
@@ -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() })
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice idea, can you make this compatible with go 1.6 (sort.SliceStable isnt available until 1.8) ?

@notzippy notzippy added this to the v0.19 milestone Jan 16, 2018
@notzippy notzippy changed the base branch from master to develop January 30, 2018 05:26
@notzippy notzippy merged commit 6ca1d73 into revel:develop Jan 30, 2018
@nathantchan nathantchan deleted the stable_controllers branch May 5, 2018 19:58
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.

2 participants