Skip to content

Instantly share code, notes, and snippets.

@madflojo
Created May 13, 2022 14:58
Show Gist options
  • Save madflojo/3646acde4a3d9b46e8b821aba46a76ca to your computer and use it in GitHub Desktop.
Save madflojo/3646acde4a3d9b46e8b821aba46a76ca to your computer and use it in GitHub Desktop.
Go Project Structure - App Run
// cfg is used across the app package to contain configuration.
var cfg *viper.Viper
// Run starts the primary application. It handles starting background services,
// populating package globals & structures, and clean up tasks.
func Run(c *viper.Viper) error {
// Apply config provided by main to the package global
cfg = c
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment