From 50cd051d38113cf08da09ac3beb21ad94027ac1e Mon Sep 17 00:00:00 2001 From: Egor Lysenko Date: Sat, 25 Feb 2023 02:03:26 +0400 Subject: [PATCH] forbid building with go1.20 or newer --- cmd/opera/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/opera/main.go b/cmd/opera/main.go index 5c29d1501..76dd899ed 100644 --- a/cmd/opera/main.go +++ b/cmd/opera/main.go @@ -3,11 +3,22 @@ package main import ( "fmt" "os" + "runtime" "github.com/Fantom-foundation/go-opera/cmd/opera/launcher" ) func main() { + // TODO erase after compatibility issues with go1.20 are fixed + var majorVer int + var minorVer int + var other string + n, err := fmt.Sscanf(runtime.Version(), "go%d.%d%s", &majorVer, &minorVer, &other) + if n >= 2 && err == nil { + if (majorVer*100 + minorVer) > 119 { + panic(runtime.Version() + " is not supported, please downgrade your go compiler to go 1.19 or older") + } + } if err := launcher.Launch(os.Args); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1)