Compile-time Dependency Injection for Go

Overview

Wire: Automated Initialization in Go

Build Status godoc Coverage

Wire is a code generation tool that automates connecting components using dependency injection. Dependencies between components are represented in Wire as function parameters, encouraging explicit initialization instead of global variables. Because Wire operates without runtime state or reflection, code written to be used with Wire is useful even for hand-written initialization.

For an overview, see the introductory blog post.

Installing

Install Wire by running:

go get github.com/google/wire/cmd/wire

and ensuring that $GOPATH/bin is added to your $PATH.

Documentation

Project status

As of version v0.3.0, Wire is beta and is considered feature complete. It works well for the tasks it was designed to perform, and we prefer to keep it as simple as possible.

We'll not be accepting new features at this time, but will gladly accept bug reports and fixes.

Community

For questions, please use GitHub Discussions.

This project is covered by the Go Code of Conduct.

Issues
  • wire: test flakes on Travis with

    wire: test flakes on Travis with "failed to cache compiled Go files"

    Describe the bug

    The Wire tests fail intermittently on Travis with an error like:

            wire_test.go:96: go [list -e -json -compiled -test=false -export=false -deps=true -tags=wireinject -- example.com/foo]: exit status 1: go: finding github.com/google/go-cloud v0.2.0
                go build runtime/internal/atomic: failed to cache compiled Go files
    

    To Reproduce

    This is an intermittent failure, but I've only seen it on Travis. Uncertain what the triggers are.

    Expected behavior

    Wire tests should pass.

    /cc @vangent, who I believe hit this failure before, but I can't find evidence of it.

    bug 
    opened by zombiezen 19
  • Problem running wire from tutorial

    Problem running wire from tutorial

    Describe the bug

    I can not get the wire command to work. Started off with the tutorial, made a directory in ~/go/src/test and copied the main.go and wire.go files from the _tutorial directory. Ran go get github.com/google/wire/cmd/wire then proceeded to run wire, here is the output:

    16:53 $
    ✔ ~/go/src/test
    16:53 $ ls
    main.go	wire.go
    ✔ ~/go/src/test
    16:53 $ cat main.go
    // Copyright 2018 The Wire Authors
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    //
    //     https://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.
    
    // The greeter binary simulates an event with greeters greeting guests.
    package main
    
    import (
    	"errors"
    	"fmt"
    	"os"
    	"time"
    )
    
    // Message is what greeters will use to greet guests.
    type Message string
    
    // NewMessage creates a default Message.
    func NewMessage(phrase string) Message {
    	return Message(phrase)
    }
    
    // NewGreeter initializes a Greeter. If the current epoch time is an even
    // number, NewGreeter will create a grumpy Greeter.
    func NewGreeter(m Message) Greeter {
    	var grumpy bool
    	if time.Now().Unix()%2 == 0 {
    		grumpy = true
    	}
    	return Greeter{Message: m, Grumpy: grumpy}
    }
    
    // Greeter is the type charged with greeting guests.
    type Greeter struct {
    	Grumpy  bool
    	Message Message
    }
    
    // Greet produces a greeting for guests.
    func (g Greeter) Greet() Message {
    	if g.Grumpy {
    		return Message("Go away!")
    	}
    	return g.Message
    }
    
    // NewEvent creates an event with the specified greeter.
    func NewEvent(g Greeter) (Event, error) {
    	if g.Grumpy {
    		return Event{}, errors.New("could not create event: event greeter is grumpy")
    	}
    	return Event{Greeter: g}, nil
    }
    
    // Event is a gathering with greeters.
    type Event struct {
    	Greeter Greeter
    }
    
    // Start ensures the event starts with greeting all guests.
    func (e Event) Start() {
    	msg := e.Greeter.Greet()
    	fmt.Println(msg)
    }
    
    func main() {
    	e, err := InitializeEvent("hi there!")
    	if err != nil {
    		fmt.Printf("failed to create event: %s\n", err)
    		os.Exit(2)
    	}
    	e.Start()
    }
    ✔ ~/go/src/test
    16:53 $ cat wire.go
    //+build wireinject
    
    // The build tag makes sure the stub is not built in the final build.
    package main
    
    import "github.com/google/wire"
    
    // InitializeEvent creates an Event. It will error if the Event is staffed with
    // a grumpy greeter.
    func InitializeEvent(phrase string) (Event, error) {
    	wire.Build(NewEvent, NewGreeter, NewMessage)
    	return Event{}, nil
    }
    ✔ ~/go/src/test
    16:53 $ wire
    packages not found
    wire: generate failed
    ✘-1 ~/go/src/test
    16:53 $
    

    I then tried to run wire from the downloaded repo:

    16:51 $
    ✔ ~/go/src/github.com/google/wire/_tutorial [v0.2.1|✚ 1…1]
    16:54 $ ls
    README.md	main.go		wire.go
    ✔ ~/go/src/github.com/google/wire/_tutorial [v0.2.1|✚ 1…1]
    16:54 $ wire
    packages not found
    wire: generate failed
    ✘-1 ~/go/src/github.com/google/wire/_tutorial [v0.2.1|✚ 1…1]
    16:54 $
    

    To Reproduce

    go get -u github.com/google/wire
    cd ~/go/src/github.com/google/wire
    git co v0.2.1
    cd _tutorial
    rm wire_gen.go
    wire
    

    16:51 $ ✔ ~/go/src/github.com/google/wire/_tutorial [v0.2.1|✚ 1…1] 16:54 $ ls README.md main.go wire.go ✔ ~/go/src/github.com/google/wire/_tutorial [v0.2.1|✚ 1…1] 16:54 $ wire packages not found wire: generate failed ✘-1 ~/go/src/github.com/google/wire/_tutorial [v0.2.1|✚ 1…1] 16:54 $

    
    ## Expected behavior
    
    wire_gen.go will be generated.
    
    ### Version
    
    v0.2.1
    
    ### Additional context
    
    I tried this with master before resorting to v0.2.1 and I got the same error both times. I really want to try this out in my project. Any help would be awesome.
    
    GOPATH=/Users/kortm/go
    go version: `version go1.11.1 darwin/amd64`
    
    
    bug needs info 
    opened by yairgo 13
  • `go:generate wire` in generated files should be optional

    `go:generate wire` in generated files should be optional

    Is your feature request related to a problem? Please describe.

    We generate a lot of files with wire and we would like to use a single execution of wire to do that. When wire writes out go:generate instructions into files it generates, it makes it hard for us remove those commands and generate the wire files on our own.

    Describe the solution you'd like

    I propose adding a flag such as --no-go-generate to the cli, which, when set omits the go:generate line from https://github.com/google/wire/blob/f285c073b52078f165ca19f3ceb192f0f50f3934/internal/wire/wire.go#L253.

    Describe alternatives you've considered

    For now we can work around this issue by removing the line after running wire.

    Additional context

    opened by gracenoah 12
  • Update dependencies to support Generics

    Update dependencies to support Generics

    Hello! First of all, thanks for this project. It is very helpful and makes dependency injection a breeze.

    We've experience some problems working with wire and generics (as I think other people has experienced too according to #354)

    I dont know for sure if these changes added full support for generics but I've managed to fix all the issues I had in my projects.

    Mainly, I had to update the dependencies to use golang.org/x/[email protected]

    The main issue was here: https://github.com/golang/tools/blob/master/go/ast/astutil/rewrite.go#L255 that was included in this commit

    this is a version adapted from the tutorial that works only with the updated version:

    // main.go
    package main
    
    import (
    	"errors"
    	"fmt"
    	"os"
    	"time"
    )
    
    // Message is what greeters will use to greet guests.
    type Message string
    
    type Resolver[K comparable, V any] struct {
    	store map[K]V
    }
    
    func NewResolver[K comparable, V any]() Resolver[K, V] {
    	return Resolver[K, V]{
    		store: map[K]V{},
    	}
    }
    
    func (o Resolver[K, V]) Resolve(key K) (V, error) {
    	val, exists := o.store[key]
    	if !exists {
    		return val, errors.New("not found")
    	}
    
    	return val, nil
    }
    
    func (o Resolver[K, V]) Add(key K, val V) {
    	o.store[key] = val
    }
    
    // NewMessage creates a default Message.
    func NewMessage(phrase string) Message {
    	return Message(phrase)
    }
    
    // NewGreeter initializes a Greeter. If the current epoch time is an even
    // number, NewGreeter will create a grumpy Greeter.
    func NewGreeter(m Resolver[bool, Message]) Greeter {
    	var grumpy bool
    	if time.Now().Unix()%2 == 0 {
    		grumpy = true
    	}
    	return Greeter{MessageResolver: m, Grumpy: grumpy}
    }
    
    // Greeter is the type charged with greeting guests.
    type Greeter struct {
    	Grumpy          bool
    	MessageResolver Resolver[bool, Message]
    }
    
    // Greet produces a greeting for guests.
    func (g Greeter) Greet() Message {
    	m, err := g.MessageResolver.Resolve(g.Grumpy)
    	if err != nil {
    		return Message("not found")
    	}
    	return m
    }
    
    // NewEvent creates an event with the specified greeter.
    func NewEvent(g Greeter) (Event, error) {
    	if g.Grumpy {
    		return Event{}, errors.New("could not create event: event greeter is grumpy")
    	}
    	return Event{Greeter: g}, nil
    }
    
    // Event is a gathering with greeters.
    type Event struct {
    	Greeter Greeter
    }
    
    // Start ensures the event starts with greeting all guests.
    func (e Event) Start() {
    	msg := e.Greeter.Greet()
    	fmt.Println(msg)
    }
    
    func main() {
    	e, err := InitializeEvent("hi there!")
    	if err != nil {
    		fmt.Printf("failed to create event: %s\n", err)
    		os.Exit(2)
    	}
    	e.Start()
    }
    
    // wire.go
    package main
    
    import "github.com/google/wire"
    
    func getMessageResolver() Resolver[bool, Message] {
    	r := NewResolver[bool, Message]()
    	r.Add(false, Message("happy false"))
    	r.Add(true, Message("grumpy true"))
    	return r
    }
    
    // InitializeEvent creates an Event. It will error if the Event is staffed with
    // a grumpy greeter.
    func InitializeEvent(phrase string) (Event, error) {
    	wire.Build(NewEvent, NewGreeter, getMessageResolver)
    	return Event{}, nil
    }
    
    opened by efueyo 11
  • Changing installation Commands

    Changing installation Commands

    go get: installing executables with 'go get' in module mode is deprecated. To adjust and download dependencies of the current module, use 'go get -d'. To install using requirements of the current module, use 'go install'. To install ignoring the current module, use 'go install' with a version, like 'go install example.com/[email protected]'. For more information, see https://golang.org/doc/go-get-install-deprecation or run 'go help get' or 'go help install'.

    cla: no 
    opened by huasx 11
  • wire: wire.FieldsOf() to inject the values from fields of a struct

    wire: wire.FieldsOf() to inject the values from fields of a struct

    Pretty new to wire, so forgive me if I am asking the wrong questions.

    As far as I understand, wire.Value() allows to specify a value to be injected. If I have a struct, the fields of which must be injected rather than the value of the struct itself, would I have to use wire.Value() for each field of the struct?

    Would it make sense to add something like wire.FieldValues(), which injects the fields of the struct that is specified rather than the struct itself?

    enhancement 
    opened by e-nikolov 11
  • fix: run wire with -mod=mod

    fix: run wire with -mod=mod

    fixed the issue when using wire with Go module.

    go run github.com/google/wire/cmd/wire gen
    /go/pkg/mod/github.com/google/[email protected]/cmd/wire/main.go:34:2: missing go.sum entry for module providing package github.com/google/subcommands (imported by github.com/google/wire/cmd/wire); to add:
            go get github.com/google/wire/cmd/[email protected]
    

    Close: https://github.com/google/wire/issues/299, https://github.com/google/wire/pull/342

    opened by giautm 10
  • wire: don't work with go modules [go v.1.11.1]

    wire: don't work with go modules [go v.1.11.1]

    When I run the wire command, I get the following:

    ...
    /home/terminator/.gvm/pkgsets/go1.11.1/global/pkg/mod/github.com/ory/[email protected]+incompatible/dockertest.go:13:2: could not import github.com/cenkalti/backoff (cannot find package "github.com/cenkalti/backoff" in any of:
                    /home/terminator/.gvm/gos/go1.11.1/src/github.com/cenkalti/backoff (from $GOROOT)
                    /home/terminator/.gvm/pkgsets/go1.11.1/global/src/github.com/cenkalti/backoff (from $GOPATH))
    ...
    and many many other dependencies...
    

    wire looks at GOPATH and GOROOT instead of modules dir, what am I doing wrong?

    opened by Terminator637 9
  • Add goreportcard.com badge

    Add goreportcard.com badge

    It is one requirement of the pull request to add wire library to list https://github.com/avelino/awesome-go

    https://github.com/avelino/awesome-go/pull/2965

    https://github.com/avelino/awesome-go/blob/master/CONTRIBUTING.md

    https://github.com/avelino/awesome-go/blob/master/.github/PULL_REQUEST_TEMPLATE.md

    cla: yes 
    opened by dsxack 8
  • Get error message

    Get error message "undefined: InitializeEvent " in tutorial

    Describe the bug

    I had copy tutorial code and run "wire" in ternimal. After getting "wire_gen" file, i ran "go run main.go" or "go build main.go" and it alway show a error message.

    # command-line-arguments
    .\main.go:77:12: undefined: InitializeEvent"  
    

    Am i loss any step or params during wire?

    Version

    go 1.13.4 wire v0.3.0

    Additional context

    main code

    package main
    
    // Copyright 2018 The Wire Authors
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    //
    //     https://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.
    
    // The greeter binary simulates an event with greeters greeting guests.
    import (
    	"errors"
    	"fmt"
    	"os"
    	"time"
    )
    
    // Message is what greeters will use to greet guests.
    type Message string
    
    // NewMessage creates a default Message.
    func NewMessage(phrase string) Message {
    	return Message(phrase)
    }
    
    // NewGreeter initializes a Greeter. If the current epoch time is an even
    // number, NewGreeter will create a grumpy Greeter.
    func NewGreeter(m Message) Greeter {
    	var grumpy bool
    	if time.Now().Unix()%2 == 0 {
    		grumpy = true
    	}
    	return Greeter{Message: m, Grumpy: grumpy}
    }
    
    // Greeter is the type charged with greeting guests.
    type Greeter struct {
    	Grumpy  bool
    	Message Message
    }
    
    // Greet produces a greeting for guests.
    func (g Greeter) Greet() Message {
    	if g.Grumpy {
    		return Message("Go away!")
    	}
    	return g.Message
    }
    
    // NewEvent creates an event with the specified greeter.
    func NewEvent(g Greeter) (Event, error) {
    	if g.Grumpy {
    		return Event{}, errors.New("could not create event: event greeter is grumpy")
    	}
    	return Event{Greeter: g}, nil
    }
    
    // Event is a gathering with greeters.
    type Event struct {
    	Greeter Greeter
    }
    
    // Start ensures the event starts with greeting all guests.
    func (e Event) Start() {
    	msg := e.Greeter.Greet()
    	fmt.Println(msg)
    }
    
    func main() {
    	e, err := InitializeEvent("hi there!")
    	if err != nil {
    		fmt.Printf("failed to create event: %s\n", err)
    		os.Exit(2)
    	}
    	e.Start()
    }
    

    wire.go

    //+build wireinject
    
    // The build tag makes sure the stub is not built in the final build.
    package main
    
    import "github.com/google/wire"
    
    // InitializeEvent creates an Event. It will error if the Event is staffed with
    // a grumpy greeter.
    func InitializeEvent(phrase string) (Event, error) {
    	wire.Build(NewEvent, NewGreeter, NewMessage)
    	return Event{}, nil
    }
    
    opened by authhwang 8
  • Idea: use `go run` in generate line

    Idea: use `go run` in generate line

    An idea suggested by @steebchen is to use //go:generate go run github.com/google/wire/cmd/wire as the automatically inserted generate line for Wire output. This would have the advantage of always using a version of the code generator that's the same as the library being used, at the cost of perhaps some running time.

    EDIT (Hit send too early) I don't think we want to make this change until Go Modules is the default, thus I'm marking this issue blocked.

    enhancement 
    opened by zombiezen 8
  • Export wire.Generate from internal/

    Export wire.Generate from internal/

    This PR explores the idea of allowing wire to be used as a library in addition to its current use as a CLI-only tool.

    Currently, all logic to generate the wire_gen.go files is locked under the internal/ directory. While it has its upsides, it blocks users from using wire as a library. It is helpful for framework authors (see the use of wire in Copper) to wrap wire in their own CLIs and still enable dependency injection.

    This PR exports the wire.Generate method that would allow it to be called by other CLIs to generate the wire_gen.go files.

    opened by tusharsoni 4
  • How to work with un-exported interfaces

    How to work with un-exported interfaces

    You can use go bug to have a cool, automatically filled out bug template, or fill out the template below.

    Describe the bug

    Some Providers rely on locally-defined non-exported interfaces. In Go the interface contract is loosely coupled and therefore those interfaces do not need to be exported in order for the provider/constructor to be called as the resolution will be dynamic at compile-time.

    In the documentation, wire.Bind is the adviced approach to wire Structs into interface arguments, the issue is that in case the interface argument is not exported wire compilation fails because it has no visibility over the non-exported interface.

    To Reproduce

    Project structure:

    ❯ tree
    .
    ├── bar
    │   └── bar.go
    ├── foo
    │   └── foo.go
    ├── go.mod
    ├── go.sum
    ├── main.go
    ├── wire.go
    └── wire_gen.go
    

    bar.go:

    package bar
    
    import "fmt"
    
    type sayer interface {
    	Say() string
    }
    
    func NewBar(s sayer) *Bar {
    	return &Bar{
    		sayer: s,
    	}
    }
    
    type Bar struct {
    	sayer sayer
    }
    
    func (b *Bar) Start() {
    	fmt.Printf("%s\n", b.sayer.Say())
    }
    

    foo.go

    package foo
    
    func NewFoo() *Foo {
    	return &Foo{}
    }
    
    type Foo struct {
    }
    
    func (f *Foo) Say() string {
    	return "I'm foo"
    }
    

    main.go

    package main
    
    func main() {
    	b := InitializeBar()
    	b.Start()
    }
    

    wire.go (does not compile)

    //go:build wireinject
    // +build wireinject
    
    package main
    
    import (
    	"github.com/google/wire"
    	"wire-test/bar"
    )
    import "wire-test/foo"
    
    func InitializeBar() *bar.Bar {
    	wire.Build(foo.NewFoo, wire.Bind(new(bar.sayer), new(*foo.Foo)), bar.NewBar)
    	return &bar.Bar{}
    }
    
    ❯ wire
    wire: /Users/rodrigo.broggi/repo/wire-test/wire.go:13:43: sayer not exported by package bar
    wire: generate failed
    

    Interestingly enough if we change the bar interface to be exported everything compiles correctly and code is well generated, furthermore, the generated code makes no references at all to the exported interface so theoretically one could refactor the generated code along with the interface to make those non-exporeted again.

    Is there a way to overcome that?

    Expected behavior

    A way to generate injectors also for providers that use non-exported interfaces.

    Version

    latest (0.5.0)

    Additional context

    Add any other context about the problem here.

    opened by rbroggi 1
  • add details on how to run generated code

    add details on how to run generated code

    Fixes #362

    Added some details on how to run the generated code. I was having a bad time following the tutorial since I kept getting the error:

    # command-line-arguments
    ./main.go:45:11: undefined: InitializeEvent
    

    when following the tutorial since I ran it with go run main.go using go1.18.3. It's not obvious to me that we need to include wire_gen.go to make it work.

    opened by cglotr 5
  • Missing `go run` or `go build` example of generated code

    Missing `go run` or `go build` example of generated code

    https://github.com/google/wire/blob/79660af94317b9c466adc39f27f469f1079c779b/_tutorial/README.md?plain=1#L115

    I think this step is a missing example of how to run or build the generated code. Also, it's not obvious that we need also to include the generated files when executing either go run or go build like go build main.go wire_gen.go.

    I think adding an extra paragraph explaining how to run or build would be very useful & prevent frustration, especially for people new to go.

    When following the steps, I think most people will set seeing the word Hi there! on the console to be the goal to verify that we get the same outcome as in the non-wire code.

    opened by cglotr 2
  • wire can not recognize the alias any of interface{} in go 1.18.2

    wire can not recognize the alias any of interface{} in go 1.18.2

    You can use go bug to have a cool, automatically filled out bug template, or fill out the template below.

    Describe the bug

    cannot use (*sql.DB)(db) (value of type *sql.DB) as sqlc.DBTX value in argument to sqlc.New: wrong type for method ExecContext (have func(ctx context.Context, query string, args ...invalid type) (database/sql.Result, error), want func(context.Context, string, ...interface{}) (database/sql.Result, error))

    A clear and concise description of what the bug is.

    To Reproduce

    Steps to reproduce the behavior.

    Expected behavior

    A clear and concise description of what you expected to happen.

    Version

    go1.18.2 Which version of Wire are you seeing the bug with?

    Additional context

    Add any other context about the problem here.

    opened by xiazemin 4
Releases(v0.5.0)
  • v0.5.0(Jan 26, 2021)

    New Features

    • Permit specifying build tags for analysis (#252)

    Changed

    • Use full go run command in go:generate comment (#268)

    Bug Fixes

    • internal/wire: fix panic in objectCache.processExpr (#236)
    • internal/wire: copy doc comment for generated injectors (#254)
    • docs: fix syntax error (#255)
    • docs: fix incorrect generated code in example (#277)
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Dec 11, 2019)

    New Features

    • FieldsOf provides a pointer type to the field as well as the actual field type for pointers to structs (#208)
    • A new --output_file_prefix flag permits changing the name of the outputted file (#192)

    Bug Fixes

    • Use go/token to determine whether names are keywords (#203)
    • Wire no longer panics when wire.Struct is given a non-struct first argument (#219)
    • Wire no longer emits invalid code for injectors that return their arguments (#222)
    • Wire's go.mod no longer includes unused dependencies (#228)
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jun 18, 2019)

    Wire version 0.3.0 is the first release we are marking as beta. With this release, we are committing to API stability: we do not intend to make backward-incompatible changes going forward. There are new features and breaking changes in this release, see below for details.

    To upgrade to v0.3.0, please upgrade both the Wire command and library.

    Breaking Changes

    • github.com/google/wire is now the single canonical import path. Any code still using github.com/google/go-cloud/wire will no longer be recognized. To upgrade: change github.com/google/go-cloud/wire to github.com/google/wire.
    • The second argument of Bind is now a pointer type to match argument types in other marker functions. If you have code like wire.Bind(new(Fooer), new(MyFoo))), the behavior will change. To upgrade: see the guide for how to migrate.

    New Features

    • A new marker function FieldsOf to inject fields of a struct directly. See the guide for how to use it.
    • A new marker function Struct for struct providers. This will replace the current struct provider syntax in 1.0, so please upgrade as soon as possible. To upgrade: see the guide.
    • The wire help command will be more useful. You can use wire help to list available commands and their descriptions; you can also use wire help [command] to get more detailed information.
    • A new --header_file flag to gen and diff commands for copying copyright headers. Support using a wire:”-” tag to prevent filling certain struct fields.
    • Misc stability and documentation improvements.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(May 10, 2019)

  • v0.2.1(Jan 14, 2019)

    Bug Fixes

    • Fixed a bug when an interface is bound to a Value, wire would fail to record it as used.
    • Preserve anonymous imports in wire_gen.go (#94)
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Dec 3, 2018)

    • Add support for variadic argument provider functions and injectors (#61, thanks @shantuo!)
    • diff now exits with status 1 for differences and 2 for errors (#90, thanks @vangent!)
    Source code(tar.gz)
    Source code(zip)
Owner
Google
Google ❤️ Open Source
Google
An additive dependency injection container for Golang.

Alice Alice is an additive dependency injection container for Golang. Philosophy Design philosophy behind Alice: The application components should not

Minjie Zha 46 Aug 7, 2022
🛠 A full-featured dependency injection container for go programming language.

DI Dependency injection for Go programming language. Tutorial | Examples | Advanced features Dependency injection is one form of the broader technique

Goava 156 Jul 15, 2022
A reflection based dependency injection toolkit for Go.

⚒️ dig A reflection based dependency injection toolkit for Go. Good for: Powering an application framework, e.g. Fx. Resolving the object graph during

Uber Go 2.7k Aug 12, 2022
Go Dependency Injection Framework

Dingo Dependency injection for go Hello Dingo Dingo works very very similiar to Guice Basically one binds implementations/factories to interfaces, whi

Flamingo 134 Aug 4, 2022
A dependency injection based application framework for Go.

?? Fx An application framework for Go that: Makes dependency injection easy. Eliminates the need for global state and func init(). Installation We rec

Uber Go 3k Aug 18, 2022
Simple Dependency Injection Container

?? gocontainer gocontainer - Dependency Injection Container ?? ABOUT Contributors: Rafał Lorenz Want to contribute ? Feel free to send pull requests!

Rafał Lorenz 15 Mar 10, 2022
Simple and yet powerful Dependency Injection for Go

goioc/di: Dependency Injection Why DI in Go? Why IoC at all? I've been using Dependency Injection in Java for nearly 10 years via Spring Framework. I'

Go IoC 198 Aug 5, 2022
Dependency Injection and Inversion of Control package

Linker Linker is Dependency Injection and Inversion of Control package. It supports the following features: Components registry Automatic dependency i

Logrange 35 Aug 2, 2022
Strict Runtime Dependency Injection for Golang

wire Wire is runtime depedency injection/wiring for golang. It's designed to be strict to avoid your go application running without proper dependency

Muhammad Surya 35 Apr 21, 2022
Generated dependency injection containers in go (golang)

Generation of dependency injection containers for go programs (golang). Dingo is a code generator. It generates dependency injection containers based

null 86 Jul 8, 2022
A dependency injection library that is focused on clean API and flexibility

Dependency injection DI is a dependency injection library that is focused on clean API and flexibility. DI has two types of top-level abstractions: Co

Sergey Treinis 4 Jun 6, 2022
golang-runtime-di is a framework for runtime dependency injection in go

golang-runtime-di description golang-runtime-di is a framework for runtime dependency injection in go. usage quickstart add it to your go.mod: go get

DB Systel GmbH 2 Aug 1, 2022
Golang PE injection on windows

GoPEInjection Golang PE injection on windows See: https://malwareunicorn.org/workshops/peinjection.html Based on Cryptowall's PE injection technique.

malwareunicorn 146 Aug 8, 2022
two scripts written in golang that will help you recognize dependency confusion.

two scripts written in golang that will help you recognize dependency confusion.

gv1_ 6 Mar 3, 2022
Compile-time Dependency Injection for Go

Wire: Automated Initialization in Go Wire is a code generation tool that automates connecting components using dependency injection. Dependencies betw

Google 8.9k Aug 17, 2022
How we can run unit tests in parallel mode with failpoint injection taking effect and without injection race

This is a simple demo to show how we can run unit tests in parallel mode with failpoint injection taking effect and without injection race. The basic

amyangfei 1 Oct 31, 2021
Write your SQL queries in raw files with all benefits of modern IDEs, use them in an easy way inside your application with all the profit of compile time constants

About qry is a general purpose library for storing your raw database queries in .sql files with all benefits of modern IDEs, instead of strings and co

Sergey Treinis 22 Jul 4, 2022
Completely type-safe compile-time mock generator for Go

Mockc Mockc is a completely type-safe compile-time mock generator for Go. You can use it just by writing the mock generators with mockc.Implement() or

Geon Kim 29 May 23, 2021
hiboot is a high performance web and cli application framework with dependency injection support

Hiboot - web/cli application framework About Hiboot is a cloud native web and cli application framework written in Go. Hiboot is not trying to reinven

hidevops.io 175 Jun 12, 2022
An additive dependency injection container for Golang.

Alice Alice is an additive dependency injection container for Golang. Philosophy Design philosophy behind Alice: The application components should not

Minjie Zha 46 Aug 7, 2022
🛠 A full-featured dependency injection container for go programming language.

DI Dependency injection for Go programming language. Tutorial | Examples | Advanced features Dependency injection is one form of the broader technique

Goava 156 Jul 15, 2022
A reflection based dependency injection toolkit for Go.

⚒️ dig A reflection based dependency injection toolkit for Go. Good for: Powering an application framework, e.g. Fx. Resolving the object graph during

Uber Go 2.7k Aug 12, 2022
Go Dependency Injection Framework

Dingo Dependency injection for go Hello Dingo Dingo works very very similiar to Guice Basically one binds implementations/factories to interfaces, whi

Flamingo 134 Aug 4, 2022
A dependency injection based application framework for Go.

?? Fx An application framework for Go that: Makes dependency injection easy. Eliminates the need for global state and func init(). Installation We rec

Uber Go 3k Aug 18, 2022
Simple Dependency Injection Container

?? gocontainer gocontainer - Dependency Injection Container ?? ABOUT Contributors: Rafał Lorenz Want to contribute ? Feel free to send pull requests!

Rafał Lorenz 15 Mar 10, 2022
Simple and yet powerful Dependency Injection for Go

goioc/di: Dependency Injection Why DI in Go? Why IoC at all? I've been using Dependency Injection in Java for nearly 10 years via Spring Framework. I'

Go IoC 198 Aug 5, 2022
Dependency Injection and Inversion of Control package

Linker Linker is Dependency Injection and Inversion of Control package. It supports the following features: Components registry Automatic dependency i

Logrange 35 Aug 2, 2022
Strict Runtime Dependency Injection for Golang

wire Wire is runtime depedency injection/wiring for golang. It's designed to be strict to avoid your go application running without proper dependency

Muhammad Surya 35 Apr 21, 2022
Minimalistic, pluggable Golang evloop/timer handler with dependency-injection

Anagent Minimalistic, pluggable Golang evloop/timer handler with dependency-injection - based on codegangsta/inject - go-macaron/inject and chuckpresl

Ettore Di Giacinto 14 Jan 26, 2022