From 859476f1c99d4c1149e00209d7f4aaa549856e83 Mon Sep 17 00:00:00 2001 From: te5se Date: Sat, 24 Feb 2024 17:17:50 +0500 Subject: [PATCH] - add -m(skip go mod tidy) build flag to dev command --- v2/cmd/wails/flags/build.go | 1 - v2/cmd/wails/flags/buildcommon.go | 1 + v2/cmd/wails/internal/dev/dev.go | 10 ++++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/v2/cmd/wails/flags/build.go b/v2/cmd/wails/flags/build.go index 974d9c3adc7..05b868ada72 100644 --- a/v2/cmd/wails/flags/build.go +++ b/v2/cmd/wails/flags/build.go @@ -25,7 +25,6 @@ type Build struct { BuildCommon NoPackage bool `name:"noPackage" description:"Skips platform specific packaging"` - SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"` Upx bool `description:"Compress final binary with UPX (if installed)"` UpxFlags string `description:"Flags to pass to upx"` Platform string `description:"Platform to target. Comma separate multiple platforms"` diff --git a/v2/cmd/wails/flags/buildcommon.go b/v2/cmd/wails/flags/buildcommon.go index dcad33abffb..4bbc4c62ca5 100644 --- a/v2/cmd/wails/flags/buildcommon.go +++ b/v2/cmd/wails/flags/buildcommon.go @@ -9,6 +9,7 @@ type BuildCommon struct { Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"` Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"` NoSyncGoMod bool `description:"Don't sync go.mod"` + SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"` } func (c BuildCommon) Default() BuildCommon { diff --git a/v2/cmd/wails/internal/dev/dev.go b/v2/cmd/wails/internal/dev/dev.go index 02022d12132..2f6b10a7396 100644 --- a/v2/cmd/wails/internal/dev/dev.go +++ b/v2/cmd/wails/internal/dev/dev.go @@ -60,10 +60,12 @@ func Application(f *flags.Dev, logger *clilogger.CLILogger) error { return err } - // Run go mod tidy to ensure we're up-to-date - err = runCommand(cwd, false, f.Compiler, "mod", "tidy") - if err != nil { - return err + if !f.SkipModTidy { + // Run go mod tidy to ensure we're up-to-date + err = runCommand(cwd, false, f.Compiler, "mod", "tidy") + if err != nil { + return err + } } buildOptions := f.GenerateBuildOptions()