How to call go from python

How to call go from python? Following is an example. but I want handle a list, or define a function returning a list.

How to call go from python? Following is an example. but I want handle a list, or define a function returning a list.


package main

import "C"

// go build -buildmode=c-shared -o path/test.so path/main.go

import (
   "fmt"
   "C"
)

/* Define Circle */
type Circle struct {
  Radius float64
}

//define method for Circle
func (c Circle) getArea() float64 {
  return 3 * c.Radius * c.Radius
}

func (c Circle) setRadius(r float64) {
  c.Radius = r
}

//export test
func test(r float64) {
  var c1 = Circle{Radius: r}
  fmt.Println("r = ", r)
  fmt.Println("r = ", c1.Radius)
  fmt.Println("S = ", c1.getArea())
}

func main() {
    //test(3)
}

Go Programming Tutorial - Real World Advice for Building Go Projects - Practical Go

Go is a language designed for engineering teams. Its central themes are simplicity, readability, and maintainability. This workshop will provide best practice real world advice for teams building projects in Go covering five areas: - Idiomatic code - Package and API design - Error handling - Concurrency - Testing

Thanks for reading

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Further reading about Go Programming

Learn How To Code: Google's Go (golang) Programming Language

Moving from NodeJS to Go

Building a chat widget with Go and JavaScript

Building Modern Desktop Apps in Go

Why Go Is Perfect For DevOps

Go for DevOps, Go for Microservices, and what Go is Actually Good For