A template for writing a composition function in Go
Go to file
Cyrill Näf 80577d3612
Merge 4a54755c3d into 5fc63ba87a
2024-11-29 14:11:11 +03:00
.github Check for go mod tidy 2024-11-29 14:55:29 +05:30
example Add an example directory 2023-10-31 23:39:02 -07:00
input Run go generate 2023-10-31 22:51:21 -07:00
package chore(deps): update to function-sdk-go:v0.3.0 2024-09-20 19:02:21 -07:00
.gitignore Initial commit 2023-09-14 20:43:42 -07:00
.golangci.yml Copy linter config from crossplane/crossplane 2023-11-01 17:43:51 -07:00
Dockerfile Add commentary to the Dockerfile, too 2023-10-25 16:03:55 -07:00
LICENSE Initial commit 2023-09-14 20:43:42 -07:00
NOTES.txt add init hooks 2024-01-19 12:23:16 +01:00
README.md Enhance init.sh accepting Go module + README.md 2024-06-17 11:01:36 +00:00
fn.go chore(deps): update to function-sdk-go:v0.3.0 2024-09-20 19:02:21 -07:00
fn_test.go chore(deps): update to function-sdk-go:v0.3.0 2024-09-20 19:02:21 -07:00
go.mod chore(deps): update dependency go to v1.23.2 2024-10-01 19:57:05 +00:00
go.sum chore(deps): update to function-sdk-go:v0.3.0 2024-09-20 19:02:21 -07:00
init.sh Enhance init.sh accepting Go module + README.md 2024-06-17 11:01:36 +00:00
main.go chore(fmt): go fmt 2024-11-19 23:41:32 -08:00
renovate.json Check for go mod tidy 2024-11-29 14:55:29 +05:30

README.md

function-template-go

CI

A template for writing a composition function in Go.

To learn how to use this template:

If you just want to jump in and get started:

  1. Replace function-template-go with your function in go.mod, package/crossplane.yaml, and any Go imports. (You can also do this automatically by running the ./init.sh <Go module: github.com/my-org/my-fn-name> script.)
  2. Update input/v1beta1/ to reflect your desired input (and run go generate)
  3. Add your logic to RunFunction in fn.go
  4. Add tests for your logic in fn_test.go
  5. 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