Enable go module support for go environment (#1152)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# Go module usage
|
||||
|
||||
1. Initialize your project
|
||||
|
||||
```bash
|
||||
$ go mod init "<module>"
|
||||
```
|
||||
|
||||
For example,
|
||||
|
||||
```bash
|
||||
$ go mod init "github.com/fission/fission/examples/go/go-module-example"
|
||||
```
|
||||
|
||||
2. Add dependencies
|
||||
|
||||
* See [here](https://github.com/golang/go/wiki/Modules#daily-workflow)
|
||||
|
||||
3. Verify
|
||||
|
||||
```bash
|
||||
$ go mod verify
|
||||
```
|
||||
|
||||
4. Archive and create package as usual
|
||||
|
||||
```bash
|
||||
$ zip -r go.zip .
|
||||
adding: go.mod (deflated 26%)
|
||||
adding: go.sum (deflated 1%)
|
||||
adding: README.md (deflated 37%)
|
||||
adding: main.go (deflated 30%)
|
||||
|
||||
$ fission pkg create --env go --src go.zip
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
module github.com/fission/fission/examples/go/go-module-example
|
||||
|
||||
require github.com/golang/example v0.0.0-20170904185048-46695d81d1fa
|
||||
@@ -0,0 +1 @@
|
||||
github.com/golang/example v0.0.0-20170904185048-46695d81d1fa/go.mod h1:tO/5UvQ/uKigUjQBPqzstj6uxd3fUIjddi19DxGJeWg=
|
||||
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/example/stringutil"
|
||||
)
|
||||
|
||||
// Handler is the entry point for this fission function
|
||||
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||
msg := stringutil.Reverse(stringutil.Reverse("Vendor Example Test"))
|
||||
w.Write([]byte(msg))
|
||||
}
|
||||
Reference in New Issue
Block a user