mirror of
https://github.com/magefile/mage.git
synced 2026-10-24 06:19:18 +03:00
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.
35 lines
515 B
Go
35 lines
515 B
Go
//go:build mage
|
|
// +build mage
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/magefile/mage/mg"
|
|
)
|
|
|
|
// This should work as a default - even if it's in a different file
|
|
var Default = ReturnsNilError
|
|
|
|
// this should not be a target because it returns a string
|
|
func ReturnsString() string {
|
|
fmt.Println("more stuff")
|
|
return ""
|
|
}
|
|
|
|
func ReturnsVoid() {
|
|
mg.Deps(f)
|
|
}
|
|
|
|
func f() {}
|
|
|
|
func TakesContextReturnsVoid(ctx context.Context) {
|
|
|
|
}
|
|
|
|
func TakesContextReturnsError(ctx context.Context) error {
|
|
return nil
|
|
}
|