Registry / utility / dig
library1.19.0gogounverified

Package dig provides an opinionated way of resolving object dependencies.

go get go.uber.org/dig
INSTALL
IMPORT
SIG · DIG
D
dig
utilitygov1.19.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dig
go.uber.org/dig

Creates a dependency injection container, provides a value, and invokes a function that depends on it.

package main import ( "fmt" "go.uber.org/dig" ) func main() { c := dig.New() c.Provide(func() string { return "Hello, World!" }) c.Invoke(func(s string) { fmt.Println(s) }) }
Debug
Known issues
gotchaDig uses reflection and may panic if dependencies are not provided correctly.
fix
Ensure all dependencies are provided before invoking functions that require them.
affects: *
Upgrade
Version history
1.19.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
dig — go get dig · libregistry