Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions internal/bootcheck/default.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//go:build !custombootcheck
// +build !custombootcheck

/*
Package bootcheck provides helpers for checks at boot time.
*/
package bootcheck

// CheckEnv is a no-op by default. Use build tags for build-time isolation of
// custom preflight checks. Ensure to update the build tags on L1-L2 so that
// they are mutually exclusive across implementations.
func CheckEnv() error {
return nil
}
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
package main

import (
"log"

"github.com/alecthomas/kong"

"github.com/crossplane/function-sdk-go"
"github.com/crossplane/function-template-go/internal/bootcheck"
)

func init() {
err := bootcheck.CheckEnv()
if err != nil {
log.Fatalf("bootcheck failed. function will not be started: %v", err)
}
}

// CLI of this Function.
type CLI struct {
Debug bool `short:"d" help:"Emit debug logs in addition to info logs."`
Expand Down
Loading