Skip to content

Commit

Permalink
Add magefiles directory information to the website
Browse files Browse the repository at this point in the history
  • Loading branch information
perrito666 committed Mar 11, 2022
1 parent 1c2ef11 commit ec2df47
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions site/content/index.md
Expand Up @@ -89,6 +89,13 @@ func Build() error {

Run the above `Build` target by simply running `mage build` in the same directory as the magefile.

## Magefiles directory

If you create your Magefile or files within a directory named `magefiles` And there is no Magefile in your current directory,
`mage` will default to the directory as the source for your targets while keeping the current directory as working one.

The result is the equivalent of running `mage -d magefiles -w .`

## Demo

{{< youtube Hoga60EF_1U >}}
Expand Down
14 changes: 14 additions & 0 deletions site/content/magefiles/_index.en.md
Expand Up @@ -89,3 +89,17 @@ mage target:
The first sentence in the comment will be the short help text shown with mage -l.
The rest of the comment is long help text that will be shown with mage -h <target>
```

### Magefiles directory

Some development IDEs might work erratically with magefiles sharing location with other go files which very well might
have a different package name.

To simplify development, if you place your Magefiles inside a `magefiles` directory, and none remains in your
main folder, the `mage` command will pick the directory as the source of your targets while keeping the current directory
as the working one.

The `magefiles` directory does not require for you to add build tags to the files in it, it is optional, however we
encourage you to keep it consistent, either all or none.

Effectively this is the equivalent of running: `mage -d magefiles -w .`

0 comments on commit ec2df47

Please sign in to comment.