Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 609 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 609 Bytes

This is an example to show how to mix Go/Go+ code in the same package.

In this example, we have a Go source file named a.go:

package main

import "fmt"

func p(a interface{}) {
	sayMix()
	fmt.Println("Hello,", a)
}

And we have a Go+ source file named b.gop:

func sayMix() {
	println "Mix Go and Go+"
}

p "world"

You can see that Go calls a Go+ function named sayMix, and Go+ calls a Go function named p. As you are used to in Go programming, this kind of circular reference is allowed.

Run gop run . to see the output of this example:

Mix Go and Go+
Hello, world