Added gomod-flags

Added a gomod-flags parameter which allows you to run go mod commands on the go.mod file before the build is performed. This allows for development environments.
This commit is contained in:
notzippy@gmail.com
2020-04-29 17:05:39 -07:00
parent 0920905a0c
commit 20d5766eb6
4 changed files with 38 additions and 23 deletions

View File

@@ -144,6 +144,20 @@ func Build(c *model.CommandConfig, paths *model.RevelContainer) (_ *App, err err
return false
}
if len(c.GoModFlags) > 0 {
for _, gomod := range c.GoModFlags {
goModCmd := exec.Command(goPath, append([]string{"mod"}, strings.Split(gomod, " ")...)...)
utils.CmdInit(goModCmd, !c.Vendored, c.AppPath)
output, err := goModCmd.CombinedOutput()
utils.Logger.Infof("Gomod applied ", "output", string(output))
// If the build succeeded, we're done.
if err != nil {
utils.Logger.Error("Gomod Failed continuing ", "error", err, "output", string(output))
}
}
}
for {
appVersion := getAppVersion(paths)
if appVersion == "" {