From: Benoît Canet <benoit.canet.cont...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

golang: Properly build the go hello world.

My toolchain path can be different than your
toolchain path.

Also take care of making the module a C module
and exporting proper GoMain() as used by OSv.

Signed-off-by: Benoît Canet <ben...@scylladb.com>
Message-Id: <1476973368-20687-1-git-send-email-ben...@scylladb.com>

---
diff --git a/golang-example/Makefile b/golang-example/Makefile
--- a/golang-example/Makefile
+++ b/golang-example/Makefile
@@ -3,7 +3,7 @@ module: hello
        echo '/hello: $${MODULE_DIR}/hello' > usr.manifest

 hello: hello.go
-       /usr/lib/golang/bin/go build -buildmode=c-shared hello.go
+       go build -buildmode=c-shared hello.go

 clean:
        rm -f hello usr.manifest
diff --git a/golang-example/hello.go b/golang-example/hello.go
--- a/golang-example/hello.go
+++ b/golang-example/hello.go
@@ -3,9 +3,14 @@ package main
 import (
         "runtime"
         "fmt"
+       "C"
 )

 func main() {
+}
+
+//export GoMain
+func GoMain() {
        fmt.Println("Hello, 世界");
        fmt.Println("Go version:", runtime.Version());
 }

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to