initializer

package module
v0.0.0-...-4b1b2ef Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 3 Imported by: 0

README

Initializer

Deferred init function, call init when you ready, no hurry :)

package bar

var barPrinter examples.Printer

func init() {
	initializer.Register("bar", Init)
}

func Init() error {
	barPrinter = examples.GetPrinter()
	return nil
}
package main

examples.Setup(prt) // setup all dependencies

initializer.Init() // call Init to start initializing your packages

fmt.Println(bar.Bar())

See example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

func Register

func Register(name string, init Initializer)

Register init function, the name must be unique

Types

type Initializer

type Initializer = func() error

type Logger

type Logger = func(string, ...interface{})
var Log Logger = noOpLog

Function to log initializing process. Default `noOpLog`

Directories

Path Synopsis
bar
cmd
foo

Jump to

Keyboard shortcuts

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