Welcome to your new Go Function! The boilerplate function code can be found in
handle.go. This Function responds to HTTP requests.
Develop new features by adding a test to handle_test.go for
each feature, and confirm it works with go test.
Update the running analog of the function using the func CLI or client
library, and it can be invoked from your browser or from the command line:
curl http://myfunction.example.com/If you want to use a module that is in a private git repository,
you can do it by mounting credentials and by setting appropriate environment variable.
This is done by setting the build.volumes and build.buildEnvs properties in the func.yaml config file.
For the pack builder have to use paketo bindings:
# $schema: https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json
specVersion: 0.36.0
name: go-fn
runtime: go
created: 2025-03-17T02:02:34.196208671+01:00
build:
buildEnvs:
- name: GOPRIVATE
value: example.com
- name: SERVICE_BINDING_ROOT
value: /bindings
volumes:
- hostPath: /tmp/git-binding
path: /bindings/git-bindingFor the s2i builder you have to mount credentials in .netrc format.
# $schema: https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json
specVersion: 0.36.0
name: go-fn
runtime: go
created: 2025-03-17T02:02:34.196208671+01:00
build:
buildEnvs:
- name: GOPRIVATE
value: example.com
volumes:
- hostPath: /home/jdoe/.netrc
path: /opt/app-root/src/.netrcFor more, see the complete documentation