Skip to content

Commit 7025a38

Browse files
committed
Fix compilation option of Go
1 parent 774f7f3 commit 7025a38

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

.verify-helper/config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@ compile = "bash -c 'echo hello > {tempdir}/hello'"
33
execute = "env AWKPATH={basedir} awk -f {path}"
44
bundle = "false"
55
list_dependencies = "sed 's/^@include \"\\(.*\\)\"$/\\1/ ; t ; d' {path}"
6+
7+
[languages.go]
8+
# Because of Go modules, go run does not work outside a module.
9+
# With -C option, go run changes directory and executes otherwise normally.
10+
# We need to add the prefix ../../ because {path} is something like examples/go/helloworld.test.go
11+
# and the argument is interpreted relative to ./examples/go.
12+
# -C option is available in Go >=1.20.
13+
execute = "go run -C ./examples/go ../../{path}"

examples/go/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module example-go
2+
3+
go 1.20

examples/go/helloworld.test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
package main
44

55
import (
6-
"fmt"
7-
"./helloworld"
6+
"example-go/helloworld"
7+
"fmt"
88
)
99

1010
func main() {
11-
fmt.Printf("%s\n", helloworld.GetHelloWorld())
11+
fmt.Printf("%s\n", helloworld.GetHelloWorld())
1212
}

0 commit comments

Comments
 (0)