Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct test input code to support older go versions #490

Merged
merged 4 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion bootstrap.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build ignore
//go:build ignore
// +build ignore

package main

Expand Down
3 changes: 2 additions & 1 deletion install_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build CI
//go:build CI
// +build CI

package main

Expand Down
8 changes: 4 additions & 4 deletions mage/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1739,14 +1739,14 @@ func TestGoModules(t *testing.T) {
t.Fatal(err)
}
defer os.RemoveAll(dir)
err = ioutil.WriteFile(filepath.Join(dir, "magefile.go"), []byte(`//+build mage
// beware, mage builds in go versions older than 1.17 so both build tag formats need to be present
err = ioutil.WriteFile(filepath.Join(dir, "magefile.go"), []byte(`//go:build mage
// +build mage

package main

import "golang.org/x/text/unicode/norm"

func Test() {
print("unicode version: " + norm.Version)
print("nothing is imported here for >1.17 compatibility")
}
`), 0600)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion mage/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package mage
// this template uses the "data"

// var only for tests
var mageMainfileTplString = `// +build ignore
var mageMainfileTplString = `//go:build ignore
// +build ignore

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/alias/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/args/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
1 change: 1 addition & 0 deletions mage/testdata/command.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/compiled/custom.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

// Compiled package description.
Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/context/context.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
1 change: 1 addition & 0 deletions mage/testdata/error.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/func.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/goos_magefiles/magefile_nonwindows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage && !windows
// +build mage,!windows

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/goos_magefiles/magefile_windows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/invalid_alias/magefile.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/keep_flag/magefile.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/list/command.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

// This is a comment on the package which should get turned into output with the
Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/mageimport/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
1 change: 1 addition & 0 deletions mage/testdata/mageimport/oneline/magefile.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package sametarget
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/mageimport/tagged/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/mageimport/tagged/pkg/mage.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package pkg

Expand Down
1 change: 1 addition & 0 deletions mage/testdata/mageimport/trailing/magefile.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build ignore
// +build ignore

package main
Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/mixed_lib_files/mage_helpers.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/mixed_lib_files/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
1 change: 1 addition & 0 deletions mage/testdata/mixed_lib_files/subdir/magefile.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/mixed_main_files/mage_helpers.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/mixed_main_files/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/namespaces/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/no_default/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
1 change: 1 addition & 0 deletions mage/testdata/onlyStdLib/command.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions mage/testdata/panic.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/setdir/setdir.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/setworkdir/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/signals/signals.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/transitiveDeps/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
3 changes: 2 additions & 1 deletion mage/testdata/wrong_dep/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
1 change: 1 addition & 0 deletions parse/testdata/alias.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions parse/testdata/command.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions parse/testdata/func.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
3 changes: 2 additions & 1 deletion parse/testdata/importself/magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage
//go:build mage
// +build mage

package main

Expand Down
1 change: 1 addition & 0 deletions parse/testdata/repeating_synopsis.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
3 changes: 2 additions & 1 deletion parse/testdata/subcommand_1.9.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build mage,go1.9
//go:build mage && go1.9
// +build mage,go1.9

package main

Expand Down
1 change: 1 addition & 0 deletions parse/testdata/subcommands.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mage
// +build mage

package main
Expand Down
1 change: 1 addition & 0 deletions site/content/zeroInstall/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Now you can `go run mage.go <target>` and it'll work just as if you ran
`mage <target>`:

```go
//go:build ignore
// +build ignore

package main
Expand Down