Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
func Main()
Main runs the program. fx output is only printed if `-tags debug` is specified during build.
func RegisterSubcommand ¶
RegisterSubcommand registers a subcommand. The name must not contain any whitespace. The description is printed if --help or -h is specified before the command. The name and options are combines to create a module to run.
The following extra values will be provided by fx:
- *slog.Logger: The default slog logger when running Main
- *OsArgs: The command line arguments when running the program
- context.Context: A context that is cancelled when Main returns or when fx shuts down.
To register a subcommand create an init function in a subcommand package:
func init() {
program.RegisterSubcommand("server", "start the server", <...server module options>)
}
Then import with side effects:
import _ "cmd/server"
Types ¶
Click to show internal directories.
Click to hide internal directories.