Skip to content
brett hartshorn edited this page Aug 29, 2015 · 2 revisions

The command line option --go is used to enable the Golang backend. Example:

transpile myscript.py --go

The Go backend is fully statically typed, and follows many of the same syntax and restrictions as the C++ and Rust backends. Primitive types are heap allocated, like integers and floats. Any container type (array or map), or user class, are stack allocated.

More Examples

Example1 - input:

def main():
	def F(x:int) ->int:
		return x*2

	a = F(10)
	print a
	assert a==20

Example1 - output:

func main() {
	F := func (x int) int {
		return (x * 2)
	}

	a := F(10);
	fmt.Println(a);
	if (( a ) == 20 == false) { panic("assertion failed"); }
}

Sidebar

Clone this wiki locally