go

command
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

README

Go examples

The go runtime uses the plugin package to dynamically load an HTTP handler.

Requirements

First, set up your fission deployment with the go environment.

fission env create --name go-env --image fission/go-env:1.8.1

To ensure that you build functions using the same version as the runtime, fission provides a docker image and helper script for building functions.

Example Usage

hello.go

hello.go is an very basic HTTP handler returning "Hello, World!".

# Download the build helper script
$ curl https://raw.githubusercontent.com/fission/fission/master/environments/go/builder/go-function-build > go-function-build
$ chmod +x go-function-build

# 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-env --package function.so

# Map /hello to the hello function
$ fission route create --method GET --url /hello --function hello

# Run the function
$ curl http://$FISSION_ROUTER/hello
Hello, World!

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL