Corgi allows you to embed code anywhere in your file.
All code you put above the func statement is considered global code and will be put above the function body. Global code must appear after imports.
Code after the func statement will be placed inside the function.
Each code item is denoted by a leading -:
import "strings"
- var x = 12 // a single line of code
- type RenderNamesData struct {
Names []string
}
// ^ or multiple
func RenderNames(data RenderNamesData)
- namesList := strings.Join(data.Names, ", ")
import (
__corgi_io "io"
"strings"
)
var x = 12 // a single line of code
type RenderNamesData struct {
Names string
}
// ^ or multiple
func RenderNames(__corgi_w __corgi_io.Writer, data RenderNamesData) error {
namesList := strings.Join(data.Names, ", ")
}