Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 31 million developers.Sign up
Several nice to have fixes that have been waiting for some TLC. The important ones:
- Binaries compiled with
-compilenow have support for all the applicable flags from Mage itself, so for example you can do
<your binary> -lto list the targets. see https://magefile.org/compiling/ for full details.
- Specifying GOOS and GOARCH now won't confuse mage. Previously if you attempted to use mage to run
go buildand specified a different GOOS or GOARCH in your environment variables, those environment variables would change the binary that mage builds out of your magefile, and generally made it not executable on your system. Now that won't happen. To run
-compileand create a binary for a different platform, use the
This fixes #188 - if you had mixed magefiles in with non-magefiles and then tried to import the magefiles... everything broke. This puts the behavior back to what it was previous to 1.7.0, where we did not set build the magefile itself with the mage build flag.
The big feature for this release is mage imports. You can now import targets from another package into another magefile. This is a huge benefit for anyone that wants to reuse common targets, like gofmt etc.
The big thing in this release is fixing mg.SerialDeps, which was broken in v1.6.0 (and now has tests ro prevent that from happening again).
PR #172 brought up a problem with systems where the magefile cachedir is on a different drive. On these machines, trying to move the generated mainfile fails because it's not a simple rename, you have to copy the data. However, this defeats the purpose of moving the mainfile, which was just to retain the modtime so the go tool wouldn't think it was newer than the compiled binary.
Upon more reflection the obvious thing to do is just to generate the mainfile tweak its mod time to be old. That's what this change does, which greatly simplifies that code, and fixes the bug.
Don't cache mainfiles, just set modtime (#173)
If you're running go 1.10 or above, Mage now use the go tool's built-in GOCACHE to determine whether or not to rebuild the binary it runs. This results in a ~100ms slower run time for small magefiles, but it removes the problem where if you change some library your magefile depends on, mage wouldn't realize it and wouldn't rebuild the binary, and thus you'd be running the old (unchanged) code.
Since go 1.9 and below don't have a GOCACHE, we maintain our (somewhat flawed) caching mechanism in those cases.
Note that this depends on the go command that mage uses to compile your magefiles, not the go command used to build mage itself.
Rely on GOCACHE rather than our own hashing mechanism (#168)
Add sh.Copy (#130)
make sure we test that the returned interface is non-nil before converting to error (#166)
Ensure dep error propagation (#164)
add code so mg.Deps understands namespaces (#163)
consider missing cache dir cleaned (#162)
For real go modules support, with tests and everything. Also changed how we parse the code so that we could remove a ton of code copied from the stdlib (-11k lines!).
This release adds a -gocmd to the list of flags you can use with mage. This flag allows you to choose what command mage runs when it builds the binary of your magefile. This can be useful if you have multiple versions of go installed (e.g. with
go get golang.org/dl/go1.xx), and different projects need to be built with different versions of go.
Now you can run
mage -gocmd go1.11 build . or
mage -gocmd go1.8.7 install etc.
The default is to use whatever "go" command is first in your path.
There's also a MAGEFILE_GOCMD environment variable you can set if you want to always default to something other than "go".
v1.2.4 is the newest version of Mage. I stripped out v2 tags in order to keep go modules from requiring the /v2 import path. Mage is and always will be backwards compatible with earlier versions, so there's no reason to move to v2. I had originally moved to v2 with the thought that every new release would be a new major version, since Mage doesn't really need semantic versioning... but that was before semantic import versioning came around.
Apologies for any problems this causes anyone.
b0bfbc2 don't default to v2 anymore (#148)
6837488 add go.mod (#145)
0cb9a96 Use go/build from 1.11 to support modules (#144)
01342b9 Add debug flag (#143)
b3530f3 Fix dependency logging (#141)
253ba37 move checkdupes into parse (#138)
b853551 Check for duplicates with namespace prefixed if any (#137)
cfd05cd Output package docs with target list (#134)
198454a fix target library (#131)
7e35744 Log dependencies in runDeps (#128)
80d390c usage: separate commands and options (#96)
0b004e8 Fix panic in 126 (#127)
3ff5dec docs for namespaces (#125)
c807db8 Add namespace/subcommand support to Mage (#121)
0ef06c8 Fix doc of mg.Fatalf (#120)
5e51f9a Document requiring mage for 0-install with dep (#116)
-compile flag to compile a static binary (#115)
81dbe70 Fix typo in the targets page (#105)
ecff873 Fix broken link (#103)
d4ed947 Teach mage clean (#97)
0e9ea17 Add explicit return statements (#99)
6376808 parse: sanitize function doc synopsis (#95)
acc8beb Avoid name conflicts with magefiles (#93)
898127b Support for aliases (#58) (#90)
a693abc Update _index.en.md (#91)
bf7f17a fix mage install (#89)
accd8ef update logo with text (#87)
aefb6e8 new font for the logo (#86)
58812e2 Enable bootstrap build (#85)
ab3ca2f Cleaned up use of mage/types package (#81)
9d728ef remove mg dep from mainfile (#84)
8016235 [site] minor typo fix (#82)
68180eb Fix various typos (#80)
2060ed7 Docs for file sources (#78)
3c8c70c doc context targets (#77)
0eef6fe add serial deps and rename DepsWithContext (#76)
fe23edb Add mg.Target (#54)
be7943d Support multiple targets (#65)
df36722 context for jobs (#32)