1
0
mirror of https://github.com/magefile/mage.git synced 2026-10-24 06:19:18 +03:00

234 Commits

Author SHA1 Message Date
Nate Finch
0953947c16 make -h no long require compiling (#552) v1.17.2 2026-04-22 18:57:48 -04:00
Nate Finch
791a5b4079 Support Tab Completion (#551)
* add tab completion output and make mage -l no longer compile the whole code
2026-04-22 12:53:37 -04:00
Nate Finch
cff82a6fab fix bug #537 - backticks in comments break output (#544)
* fix bug #537
2026-04-14 23:48:41 -04:00
Shunsuke Suzuki
00dd13d9f6 chore(goreleaser): fix release asset names (#547)
* chore(goreleaser): fix release asset names
v1.17.1
2026-03-31 13:02:43 -04:00
Nate Finch
88c49b7253 support for inline doc comments on optional flags (#549)
support for inline doc comments on optional flags
2026-03-29 10:05:44 -04:00
Nate Finch
707313f6ee add support for retaining multiline comments (#546)
add support for retaining multiline comments
including MAGEFILE_MULTILINE environment variable
and //mage:multiline in-code comment
and -multiline CLI flag.
v1.17.0
2026-03-25 14:13:14 -04:00
Nate Finch
0ac910f894 add a bunch more tests (#543)
* add tests
* fix lint errors and align ci and lint workflows
* update to require go 1.18 since golangci-lint requires it, and because it adds version control info into the binary automatically
* use built-in version info from go 1.18
* remove gopath from install docs
2026-03-15 20:35:16 -04:00
Nate Finch
b11eb445c2 update goreleaser to v2 (#541)
* update goreleaser to v2 and update .goreleaser.yml to new format
2026-03-12 08:00:37 -04:00
Nate Finch
3594347101 Set up linter (#539)
* Set up linter

Add .golangci.toml configuration file for linter settings.
2026-03-12 07:54:31 -04:00
Nate Finch
69e6f82473 Add support for optional arguments (#538)
add support for optional args
v1.16.0
2026-03-07 19:51:18 -05:00
Nate Finch
78acbaf2e3 add the ability to call targets with float64 args (#525)
* add the ability to call targets with float64 args
2025-06-15 10:01:42 -04:00
egor-denysenko
bdc92f6945 chore(docs): updated README and site to include installation using go install command (#499)
* chore(docs): updated README and site index with installation guide
2024-11-26 16:43:40 -05:00
Horacio Duran
32e01077f0 This adds a test to bug 508 (#516)
* This adds a test to bug 508

It fails against master before merging the patch on https://github.com/magefile/mage/pull/509#pullrequestreview-2456725594
2024-11-24 14:01:25 -05:00
na4ma4
0800736cf7 fix default selector ignoring Receiver and returning first matching function name (#509)
Co-authored-by: na4ma4 <na4ma4@users.noreply.github.com>
2024-11-24 15:53:19 +01:00
Horacio Duran
2385abb49a Correct test input code to support older go versions (#490)
Samples used for testing need to have build tags for new and old style:

```
//go:build tag
// +build tag
```

The particular problem here seems to be that 1.16 was actually importing the package referred in the `TestGoModules` test (`import "golang.org/x/text/unicode/norm"`) which, in the CI system's version lacks an old style go tag comment. Hence go complaining of a `//go:build` without a `// +build`. I made all files bi-tagged for consistency.
2023-11-18 18:05:41 +01:00
michalbiesek
0fddccbc36 ci: Extend go-version with 1.21.x (#479) 2023-11-18 14:16:19 +01:00
szTheory
2edffd1665 Comment typo: parse.go (#485) 2023-11-18 13:50:02 +01:00
WilliamRoyNelson
c97c20563f Update documentation to include Windows Magefile Cache (#484)
* Update _index.en.md

* Update documentation to include Windows Magefile Cache
2023-10-11 12:58:51 -04:00
Anuraag Agrawal
9f54e0f83e feat: support trailing line comment for mage:import (#480) 2023-09-12 11:24:18 -04:00
Nate Finch
9e91a03eaa Update CI (#466)
* update ci a bit
v1.15.0
2023-05-11 11:35:27 -04:00
Omar Kohl
9199872054 fix erroneous docstring of sh.Exec() (#452)
sh.Exec() uses the passed in stderr io.Writer to write the stderr output
not "piping its stderr to mage's stderr".
2023-03-06 10:12:10 -05:00
Ch K
02bde0ba4c Update jQuery to 3.5.0 (#458) 2023-02-27 00:22:45 +01:00
TuruTCrane
1b8774a1da -d dir contains magefiles stop with "No .go files marked with the mage build tag..." (#447) (#448) 2023-02-23 17:42:08 +01:00
Peter McAtominey
a9206042d4 mage: cancel context on SIGINT (#313)
* mage: cancel context on SIGINT

On receiving an interrupt signal, mage cancels the context allowing the magefile
to perform any cleanup before exiting.

A second interrupt signal will kill the magefile process without delay.

The behaviour for a timeout remains unchanged (context is cancelled and the magefile
exits).

* mage: add cleanup timeout to cancel

Co-authored-by: Nate Finch <nate.finch@gmail.com>
2022-11-28 23:35:45 -05:00
Herby Gillot
300bbc868b doc: add MacPorts install info (#419)
https://ports.macports.org/port/mage/

Co-authored-by: Nate Finch <natefinch@github.com>
v1.14.0
2022-09-16 10:33:53 -04:00
Jared Allard
85ed9df31e refactor(listGoFiles): remove go list dependency (#440)
* refactor(listGoFiles): remove go list dependency
* refactor to use go/build package to cover all usecases
2022-09-15 14:32:21 -04:00
Andreas Deininger
26cdb5c736 Fixing typos (#429) 2022-06-01 11:18:03 -04:00
Benjamin Cable
40d421b7a1 feat: rename templated imports to avoid collisions (#421) 2022-05-10 16:26:09 -04:00
Per Johansson
051a55c798 Add variadic support to mg.F (#402)
Allows to pass sh.Run to mg.F as such:

	mg.Deps(
		mg.F(sh.Run, "go", "test", "./..."),
	)

This improves the magefile by removing some of the one-liner functions
that you might end up with that are only used through mg.Deps.

Resolves #401.
2022-03-23 09:06:46 -04:00
Nate Finch
30b90221fe fix author links (#413) 2022-03-18 10:48:25 -04:00
Nate Finch
a1377130aa add blog post about v1.13 (#412)
* add blog post about v1.13
2022-03-18 10:27:17 -04:00
Dan Kortschak
ae47c82d86 bring docs for use of directives up to date (#407)
* use no-space directive comment syntax in docs

* update build tag mentions in docs to use go:build over +build and make template conform
2022-03-17 20:42:21 -04:00
Horacio Duran
d4f6f0bca8 Update site to build with newer hugo (#411)
* Update site to build with newer hugo
2022-03-17 16:05:13 -04:00
Nate Finch
361a81d85a give props to netlify on the main page (#410)
* give props to netlify on the main page

* move props to the right template
2022-03-16 14:51:43 -04:00
Horacio Duran
3504e09d7f Add magefiles directory support (#405)
* Use magefolder if no directory set and it exists.

If no directory was passed by the user as an explicit option and there is a folder named "magefolder" use that.

Workdir is kept as it is likely still "."

* Remove the default . for -d flag

Also correct os.Stat error checking to expect no error

* Add tests and test data for magefolder

* Rename magefolder and accept untagged files

Magefolder was renamed to magefiles
We now accept files that are not tagged too when using a magefiles directory

* Assume tagging when mix tagging is present

When using magefiles directory, if there are mixed tagging files assume tagging is used for mage files

* Update error format to %v

We support building for older go versions so error formatting should use %v

* sort outputs

* Accept mixed tagging in magefiles folder

When mixed tagging is found within a magefiles folder, opt to use all files

* little tweak to only do go list once when using magefiles directory

* Add magefiles directory information to the website

* Add a preference for mage files over directories

Add a temporary preference for mage files over magefiles directories and warn users this is a temporary functionality leading to a change where directory will be preferred.

Co-authored-by: Nate Finch <natefinch@github.com>
v1.13.0
2022-03-16 12:23:18 -04:00
Jamie Edge
526bf47751 Replace godoc.org URLs (#342)
* Replaced godoc.org URLs with equivalent pkg.go.dev URLs.

* Switched to full package name for github.com/magefile/mage/mg.

Co-authored-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

Co-authored-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2022-01-16 10:20:48 -05:00
Carolyn Van Slyck
c07f313f3b Detect deps that have already been invoked (#346)
* Detect deps that have already been invoked

Detect when a dependency was accidentally already invoked

mg.Deps(MyDep())

Normally this causes a nil pointer panic when we invoke the function

Error: runtime error: invalid memory address or nil pointer dereference

Now it will print the following as soon as its detected

Error: A dependency of the current target was defined improperly, with parenthesis. Dependencies should be defined as mg.Deps(MyDep), not mg.Deps(MyDep())

I have applied this change to checkfn so that it applies to serial and
parallel deps.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>

* Fix nil checks and improve error message

The new mg.F function is the root of the nil-pointer error that can happen
when someone accidentally calls mg.Deps(TargetA()). I have fixed the check
for whether a function was passed so that it won't panic and included
the usage for mg.F in the error message.

I then added a similar check, is the target a function, to
Deps/SerialDeps/CxtSerialDeps functions so that we can give a better
error message when it's passed a non-function. The error message
otherwise will reference mg.F which I don't think will help point people
to the real problem, which is how they called mg.Deps/SerialDeps.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>

Co-authored-by: Nate Finch <nate.finch@gmail.com>
2022-01-16 10:19:14 -05:00
Viktor Voltaire
3a11bceb7c chore: wrap log.Println in cmd with verbose check (#399)
Co-authored-by: Nate Finch <nate.finch@gmail.com>
2022-01-16 10:15:34 -05:00
Viktor Voltaire
0873a9b4e1 feat: allow mage:import alias to be defined for multiple imports (#398) 2022-01-16 10:03:19 -05:00
rui
2f1ec406df ci: migrate from travis to github action (#391)
* ci: add github action workflow
* remove travis
* drop go1.10.x and go1.9.x
* add go1.17
v1.12.1 v1.12.0
2021-12-15 16:00:02 -05:00
Nate Finch
fe9f94202d evidently goreleaseer has changed in the last 4 years :) (#394) 2021-12-15 13:42:00 -05:00
Nate Finch
fd5011ec00 Fix the rollback mechanism for tags during a release (#392)
* this fixes the rollback mechanism for tags during a release
* check for goreleaser before we do anything else
2021-12-14 12:28:36 -05:00
shouldsee
404c119a58 sh.run(): quoted strings before join (#306)
* sh.run(): quoted strings before join

Co-authored-by: shouldsee <shouldsee@qq.com>
Co-authored-by: Nate Finch <nate.finch@gmail.com>
2021-12-14 10:07:02 -05:00
Mathew Fleisch
0c5affe599 Add asdf installation instructions to docs (#383)
* Add asdf installation instructions to docs

* Update site/content/index.md

Co-authored-by: Nate Finch <natefinch@github.com>

* Clean up asdf installation instructions

Co-authored-by: Nate Finch <nate.finch@gmail.com>
Co-authored-by: Nate Finch <natefinch@github.com>
2021-11-01 12:14:55 -04:00
Miro
e84bbc1d92 #288 add brew and scoop install to docs (#376)
Co-authored-by: Nate Finch <nate.finch@gmail.com>
2021-11-01 11:27:29 -04:00
Miro
80953f7e26 #378 bump travisci go16 (#379) 2021-10-27 14:40:56 -04:00
Nate Finch
dd944245e2 Create issue templates (#374) 2021-09-28 15:37:38 -04:00
Claudia Hardman
d9e2e4152d fix: deterministic compiled mainfile (#348)
* fix: determanistic compiled mainfile

sort template data so resulting mainfile is consistantly reproducible,
which is important to leverage build cache and results in a consistent
build id on output (given identical build parameters, e.g. ldflags,
output file name, etc.)

Result of `mage -compile ./mage_static && go tool buildid ./mage_static`
should now always be identical on repeated invocation.

Results in a probably imperceptible build time quickening, but solves a
minor peave of mine, and adds a test as protection from regression :)

* fix: poorly spelled test

Co-authored-by: Nate Finch <nate.finch@gmail.com>

* Update parse/parse.go

got caught out not using vim's spellcheck

Co-authored-by: Paul Burlumi <paul@burlumi.com>

* Update mage/main.go

got caught out not using vim's spellcheck

Co-authored-by: Paul Burlumi <paul@burlumi.com>

* fix spelling

Co-authored-by: Paul Burlumi <paul@burlumi.com>

Co-authored-by: Nate Finch <nate.finch@gmail.com>
Co-authored-by: Paul Burlumi <paul@burlumi.com>
Co-authored-by: Nate Finch <natefinch@github.com>
2021-09-27 00:33:47 -04:00
Nate Finch
4cf3cfcc82 make -h work with imported targets (#335)
fixes #249
Forgot to allow help to be called on imported targets. Kinda useful, eh?
2021-02-20 08:35:19 -05:00
Nate Finch
de7ca6c108 fix test for go 1.16 (#330)
* fix test for 1.16
2021-01-02 23:34:01 -05:00