A template for writing a composition function in Go
Go to file
Philippe Scorsolini 45bc905d9f
Merge pull request #97 from ytsarev/update-golangci-yml
Update golangci-lint configuration to work with latest linter versions
2025-03-24 11:39:38 +01:00
.github Lowercase XPKG repo name to avoid xpkg push failure 2024-12-12 10:56:37 +01:00
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 Update golangci configuration to work with latest linter versions 2025-03-14 02:17:12 +01:00
Dockerfile change base image to distroless/static 2024-10-28 15:27:15 +01:00
LICENSE Initial commit 2023-09-14 20:43:42 -07:00
NOTES.txt Fix go generate instructions 2024-12-12 10:52:28 +01:00
README.md Fix go generate instructions 2024-12-12 10:52:28 +01:00
fn.go Use logging and error libraries from function-sdk-go 2025-03-05 09:41:17 -07:00
fn_test.go Use logging and error libraries from function-sdk-go 2025-03-05 09:41:17 -07:00
go.mod Use logging and error libraries from function-sdk-go 2025-03-05 09:41:17 -07:00
go.sum fix(deps): update module github.com/crossplane/function-sdk-go to v0.4.0 2024-12-16 21:57:54 +00:00
init.sh add init hooks 2024-01-19 12:23:16 +01: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 <function-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