Open Michael-F-Ellis opened 2 years ago
This is likely because you have added the "mage" tag to gopls, so it includes the mage files with the rest of the files it analyzes. This is a common problem, and one we hope to fix with #395
@natefinch Do you have a workaround?
@guiyomh with the recent release which adds support for the magefiles
directory you could put your mage files there, no need for the tag. See https://magefile.org/magefiles/#magefiles-directory for more details
Bug Description This is likely
gopls
problem rather than amage
problem but it seems worth posting here in hopes someone knows a workaround.I've filed a thorough report at
and created a minimal repository that reproduces the problem when opened in
vscode
Briefly, the problem arises when putting a magefile in a package directory. It seems that the latest
gopls
doesn't take thego:build mage
directive into account and then chokes on seeing a file withpackage main
among the package files. On the other hand,go vet
,go build
andmage
are perfectly happy with the situation and run without errors or warnings.Changing the magefile package name to match the package pacifies
gopls
, but then mage no longer works.