package main
import "C"

//export test
func test() int{
  var s int
  for a:=0; a<=123456;a++ {
    s += a
  }
  return s
}

func main(){
}

go build -buildmode=c-shared -o test.so test.go

from ctypes import CDLL
import ctypes

t = CDLL('./test.so').test
t.restype = ctypes.c_int64
print(t())