This code of conduct copies the Go code of conduct and simply makes obvious that this project is also under the same code of conduct, while also adding myself to the list of people one can report to.
* Use -w as working directory flag
* Make Invocation.WorkDir works as expected when mage is used as library
* Add test for setting working directory
* Sort CLI flags in the documentation
When calling mage import, we weren't prefiltering the list of go
files, so we'd get files with build tags and test files and such.
What we want is just the normal go files for building the library.
Using go list returns us that, so use that.
The TestListMagefilesIgnoresRespectsGOOSArg test tries to list go
files with a different GOOS arg by setting GOOS to windows on Linux
systems and vice versa. This test works fine on amd64, but breaks on
arm64 because a windows/arm64 pair is not available yet and as a
result, the `go list` command underlying the `Magefiles` function
fails.
Fix this problem by keeping GOARCH as amd64 so that the go list
command does not fail.
Pass the `MAGEFILE_GOCMD` environment variable into the compiled binary
when running with `-gocmd` set.
Testing Done:
- Validated that running `mage -debug -gocmd <go-runtime> <target>`
properly sets the environment variable `MAGEFILE_GOCMD=<go-runtime>`
into the temporary binary.
- Validated that compiled magefiles will not persist the initial
`-gocmd` when executing - though this is still toggleable by providing
the environment variable manually.
fixes#208
* GOOS and GOARCH fixes
this fixes#169 - mage now ignores GOOS and GOARCH in the environment
when building its own binaries. The exception is if you use -goos or -goarch
when running -compile.
* print an error if one comes back from running compiled binary
* rework the code a little bit and make sure mage -version prints to stdout
* export CmdRan and use it so we only log an error of not being able to run the magefile
Remove caching of mainfiles, instead just recreate it each time and set the modtime to be old. This fixes a problem where we can't move the file to a different drive (seen in #172 )