-
Notifications
You must be signed in to change notification settings - Fork 270
Description
Describe the feature
I propose that we add support for a ./magefile subdirectory that could contain all your magefiles without using the mage
build tag and without putting the files in package main. Then if you run mage in that directory or the one above it, mage would use the files in that directory as the files to build into the compiled binary.
What problem does this feature address?
The major benefit of this is mostly that we stop confusing the language server. Currently, when you write magefiles, you give them the mage build tag, and put them in package main.
The problem is that the language server won't consider them when it's running in your editor, because the build tag isn't specified. If you DO specify the build tag, then you sometimes will have two different packages in the same directory (whatever package normally exists in the root directory, and then package main for the magefiles).
If you happen to not have other go code in the root directory or that code is also package main, then it's ok. But if it's not, the language server will barf, because you can't have two packages in the same folder.
Even if you don't have other go code, the language server still will tend to barf, because you have package main and no func main(){} defined.
The other benefit is that sometimes it's just nice to have your build/dev scripts squirreled away in a subdirectory, rather that cluttering up your root directory.