Skip to content

Commit

Permalink
golang: Properly build the go hello world.
Browse files Browse the repository at this point in the history
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 <benoit@scylladb.com>
Message-Id: <1476973368-20687-1-git-send-email-benoit@scylladb.com>
  • Loading branch information
Benoît Canet authored and nyh committed Oct 27, 2016
1 parent cc25ca6 commit 187dd68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion golang-example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions golang-example/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

0 comments on commit 187dd68

Please sign in to comment.