Skip to content

Commit 707b7bd

Browse files
srpnatefinch
andauthored
update the WorkDir (-w) flag to default to the Dir (-d) value as documented (#310)
The code settings up the command-line switch was passing `inv.Dir` as the default value, which at the time of the call is always `"."`. This means that the later code that sets `inv.WorkDir = inv.Dir` won't run because `inv.WorkDir` is not the empty string. The command line -help documentation reads: -w <string> working directory where magefiles will run (default -d value) But given the above, this is not the observed behavior. Now `inv.WorkDir` is defaulted to the empty string, and the code works as expected. Co-authored-by: Nate Finch <[email protected]>
1 parent 9a10961 commit 707b7bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mage/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func Parse(stderr, stdout io.Writer, args []string) (inv Invocation, cmd Command
178178
fs.DurationVar(&inv.Timeout, "t", 0, "timeout in duration parsable format (e.g. 5m30s)")
179179
fs.BoolVar(&inv.Keep, "keep", false, "keep intermediate mage files around after running")
180180
fs.StringVar(&inv.Dir, "d", ".", "directory to read magefiles from")
181-
fs.StringVar(&inv.WorkDir, "w", inv.Dir, "working directory where magefiles will run")
181+
fs.StringVar(&inv.WorkDir, "w", "", "working directory where magefiles will run")
182182
fs.StringVar(&inv.GoCmd, "gocmd", mg.GoCmd(), "use the given go binary to compile the output")
183183
fs.StringVar(&inv.GOOS, "goos", "", "set GOOS for binary produced with -compile")
184184
fs.StringVar(&inv.GOARCH, "goarch", "", "set GOARCH for binary produced with -compile")

0 commit comments

Comments
 (0)