GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — func/templates at main · stackbuilders/func

Expand file tree

/

templates

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

templates

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
certs
certs
 
 
go
go
 
 
node
node
 
 
python
python
 
 
quarkus
quarkus
 
 
rust
rust
 
 
springboot
springboot
 
 
typescript
typescript
 
 
README.md
README.md
 
 
manifest.yaml
manifest.yaml
 
 

README.md

Outline

Templates

Contains all example source code, scaffolding, certificates and metadata used by func when creating and building function instances.

To rebuild run make templates (which caches). To force a full rebuild run make clean && make

Layout

Each directory within templates corresponds to a known language runtime. The certs directory is a reserved word containing root SSL certificates. Each directory within a runtime directory corresponds to a named template. The scaffolding directory within the runtime directory is a reserved word containing the adapter code that converts a function with a given method signature into a service by way of the external function runtime libraries.

Packaging

When updates are made to these templates, they must be packaged (serialized as a Go byte array) by running make templates which rebuilds generate/zz_filesystem_generated.go, and checking in the resultant ./generate/zz_filesystem_generated.go file.

How it works

The ./generate/templates directory contains Go program that generates ./generate/zz_filesystem_generated.go. The file defines a byte array variable named TemplatesZip. The variable contains ZIP representation of the templates directory. The byte array variable is then used to instantiate exported global variable function.EmbeddedTemplatesFS, which implements standard Go interfaces fs.ReadDirFS and fs.StatFS.

Rationale

Until such time as embedding static assets in binaries is included in the base go build functionality (see golang/go#35950) we need to use our custom serialization script (./generate/templates/main.go).

Native Go embedding introduced in Go 1.16 could be used for executable binary, however it cannot be used for library. For a library we need to generate a Go source code containing the templates.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.