gopackagebase

package module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2022 License: BSD-2-Clause Imports: 10 Imported by: 0

README

gopackagebase

go get git.wisellama.rocks/Wisellama/gopackagebase@v0.0.4

This modules contains basic setup and initialization functions that are useful to run at the beginning of a program. This integrates with gosimpleconf to also support parsing config files.

I wanted to create this package to centralize some of the basic setup boilerplate I had started to collect in my Go projects. This repository may be considered an anti-pattern, but it fits my use-case.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRNG

func InitRNG() error

InitRNG will grab some cryptographically secure bytes to use as the seed for the non-crypto random number generator. Suggested on StackOverflow to avoid time-based seeds: https://stackoverflow.com/a/54491783

func InitSignalHandler

func InitSignalHandler() (context.Context, func())

func SetupLogging

func SetupLogging(writeToFile bool, utcTime bool, logFilename string) (*logWriter, error)

Types

type BaseConfig

type BaseConfig struct {
	Ctx       context.Context
	Cancel    func()
	ConfigMap gosimpleconf.ConfigMap
}

func Initialize

func Initialize(configFile string, defaultConfig gosimpleconf.ConfigMap) (*BaseConfig, error)

Initialize will configure all of the base stuff that we want commonly set up at the beginning of a Go project.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL