Go build helper script (#163)

Create a docker container and a script to call it, to help people build go plugins for use with fission.
This commit is contained in:
Soam Vasani
2017-03-27 23:26:59 -07:00
committed by GitHub
parent a13015e75a
commit a6eb4c6d31
5 changed files with 30 additions and 15 deletions
+8 -6
View File
@@ -4,8 +4,11 @@ The `go` runtime uses the [`plugin` package](https://golang.org/pkg/plugin/) to
## Requirements
- go 1.8
- A [go-runtime fission environment](environments/go/README.md)
To use this environment, download the [build helper
script](environments/go/builder/go-function-build).
The script must be run in the same directory as the function you're
building.
## Examples
@@ -13,13 +16,12 @@ The `go` runtime uses the [`plugin` package](https://golang.org/pkg/plugin/) to
`hello.go` is an very basic HTTP handler returning `"Hello, World!"`.
```
# Build the function as a plugin
$ ./build.sh
# Build the function as a plugin. Outputs result to 'function.so'.
$ go-function-build hello.go
# Upload the function to fission
$ fission function create --name hello --env go-runtime --package hello.so
$ fission function create --name hello --env go-runtime --package function.so
# Map /hello to the hello function
$ fission route create --method GET --url /hello --function hello
-8
View File
@@ -1,8 +0,0 @@
#!/bin/sh
FISSION_PATH="github.com/fission/fission"
docker run --rm -v $GOPATH/src/$FISSION_PATH:/usr/src/$FISSION_PATH \
-e GOPATH=/usr/ \
-w /usr/src/$FISSION_PATH/examples/go \
golang:1.8 go build -buildmode=plugin -o hello.so hello.go