Skip to content

Commit 50cd051

Browse files
committed
forbid building with go1.20 or newer
1 parent c7f7f6d commit 50cd051

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cmd/opera/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@ package main
33
import (
44
"fmt"
55
"os"
6+
"runtime"
67

78
"github.com/Fantom-foundation/go-opera/cmd/opera/launcher"
89
)
910

1011
func main() {
12+
// TODO erase after compatibility issues with go1.20 are fixed
13+
var majorVer int
14+
var minorVer int
15+
var other string
16+
n, err := fmt.Sscanf(runtime.Version(), "go%d.%d%s", &majorVer, &minorVer, &other)
17+
if n >= 2 && err == nil {
18+
if (majorVer*100 + minorVer) > 119 {
19+
panic(runtime.Version() + " is not supported, please downgrade your go compiler to go 1.19 or older")
20+
}
21+
}
1122
if err := launcher.Launch(os.Args); err != nil {
1223
fmt.Fprintln(os.Stderr, err)
1324
os.Exit(1)

0 commit comments

Comments
 (0)