igop icon indicating copy to clipboard operation
igop copied to clipboard

The Go/Go+ Interpreter

iGo+ The Go/Go+ Interpreter

Go1.14 Go1.15 Go1.16 Go1.17 Go1.18

ABI

support ABI0 and ABIInternal

unsupport features

  • Go1.18 type parameters
  • test -fuzz
  • test -cover

igop command line

Go version < 1.17:

go get -u github.com/goplus/igop/cmd/igop

Go version >= 1.17:

go install github.com/goplus/igop/cmd/igop@latest

Commands

igop             # igop repl mode
igop run         # run a Go/Go+ package
igop build       # compile a Go/Go+ package
igop test        # test a package
igop verson      # print version

igop repl mode

igop                       # run repl mode, support Go/Go+
igop repl                  # run repl mode, support Go/Go+
igop repl -gop=false       # run repl mode, disable Go+ syntax

igop package

run go source

package main

import (
	"github.com/goplus/igop"
	_ "github.com/goplus/igop/pkg/fmt"
)

var source = `
package main

import "fmt"

func main() {
	fmt.Println("hello")
}
`

func main() {
	_, err := igop.RunFile("main.go", source, nil, 0)
	if err != nil {
		panic(err)
	}
}

run gop source

package main

import (
	"github.com/goplus/igop"
	_ "github.com/goplus/igop/gopbuild"
	_ "github.com/goplus/igop/pkg/fmt"
)

var source = `
println "Hello, Go+"
`

func main() {
	_, err := igop.RunFile("main.gop", source, nil, 0)
	if err != nil {
		panic(err)
	}
}