A template for writing a composition function in Go.
To learn how to use this template:
- Follow the guide to writing a composition function in Go
- Learn about how composition functions work
- Read the function-sdk-go package documentation
If you just want to jump in and get started:
- Replace
function-template-go
with your function ingo.mod
,package/crossplane.yaml
, and any Go imports. (You can also do this automatically by running the./init.sh <function-name>
script.) - Update
input/v1beta1/
to reflect your desired input (and rungo generate ./...
) - Add your logic to
RunFunction
infn.go
- Add tests for your logic in
fn_test.go
- Update this file,
README.md
, to be about your function!
This template uses Go, Docker, and the Crossplane CLI to build functions.
# Run code generation - see input/generate.go
$ go generate ./...
# Run tests - see fn_test.go
$ go test ./...
# Build the function's runtime image - see Dockerfile
$ docker build . --tag=runtime
# Build a function package - see package/crossplane.yaml
$ crossplane xpkg build -f package --embed-runtime-image=runtime