swig/Examples/test-suite/go/director_string_runme.go
Ian Lance Taylor 8a1c09e280 Fix Go tests to run in module mode
Stop using relative imports and add a go.mod file.

Tested against Go 1.6 through Go pre-1.13, and gccgo.
2019-04-24 21:43:38 -07:00

39 lines
591 B
Go

package main
import . "director_string"
type B struct { // From A
abi A
smem string
}
func NewB(s string) A {
p := &B{nil, ""}
ret := NewDirectorA(p, s)
p.abi = ret
return ret
}
func (p *B) Get_first() string {
return DirectorAGet_first(p.abi) + " world!"
}
func (p *B) Process_text(s string) {
DirectorAProcess_text(p.abi, s)
p.smem = "hello"
}
func main() {
b := NewB("hello")
b.Get(0)
if b.Get_first() != "hello world!" {
panic(b.Get_first())
}
b.Call_process_func()
if b.DirectorInterface().(*B).smem != "hello" {
panic(b.DirectorInterface().(*B).smem)
}
}