The following examples illustrate the use of SWIG with Go.
% swig -go interface.i
% swig -go -cgo interface.i % mkdir -p gopath/src/interface % cp interface_wrap.c interface_wrap.h interface.go gopath/src/interface % GOPATH=`pwd`/gopath % export GOPATH % cd gopath/src/interface % go build % go tool compile $(SRCDIR)/runme.go % go tool link -o runme runme.o
% swig -go -cgo interface.i % mkdir -p gopath/src/interface % cp interface_wrap.c interface_wrap.h interface.go gopath/src/interface % GOPATH=`pwd`/gopath % export GOPATH % cd gopath/src/interface % go build % gccgo -c $(SRCDIR)/runme.go % gccgo -o runme runme.o interface.a