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 12
  • `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
  • 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
  • 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
  • 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
  • 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
  • wire: improve error message when a provider set includes a binding but not the corresponding concrete type

    wire: improve error message when a provider set includes a binding but not the corresponding concrete type

    Describe the bug

    A wire set containing subsets (one or more wire sets), should be just the same as a wire set with items from that subsets added directly.

    To Reproduce

    Given this code:

    master.go

    package wirebug
    
    type ISomeInterface interface {
    	DoStuff(thing string) int
    }
    
    type SomeStuff struct{}
    
    func (si *SomeStuff) DoStuff(thing string) int {
    	return len(thing)
    }
    
    func NewStuff() *SomeStuff {
    	return &SomeStuff{}
    }
    

    wiring.go

    package wirebug
    
    import "github.com/google/wire"
    
    var WiringProviders = wire.NewSet(
    	NewStuff,
    )
    
    var WiringBindings = wire.NewSet(
    	wire.Bind(new(ISomeInterface), new(SomeStuff)),
    )
    
    var WiringSet = wire.NewSet(
    	WiringProviders,
    	WiringBindings,
    )
    

    injectors.go

    //+build wireinject
    
    package wirebug
    
    import "github.com/google/wire"
    
    func InjectStuff() ISomeInterface {
    	wire.Build(WiringSet)
    	return nil
    }
    

    Running wire ./... results in an error:

    $$$/wirebug/wiring.go:10:2: no binding for *$$$/wirebug.SomeStuff
    wire: at least one generate failure
    

    It's as if items from WiringProviders can't be seen by WiringBindings although they're inside WiringSet. Inside the documentation of wire.NewSet, there's this statement, "Passing a ProviderSet to NewSet is the same as if the set's contents were passed as arguments to NewSet directly.", but it turns out that it's not so.

    Expected behavior

    The file wire_gen.go should be generated without problem.

    Both of these WiringSet

    var WiringProviders = wire.NewSet(
    	NewStuff,
    )
    
    var WiringBindings = wire.NewSet(
    	wire.Bind(new(ISomeInterface), new(SomeStuff)),
    )
    
    var WiringSet = wire.NewSet(
    	WiringProviders,
    	WiringBindings,
    )
    

    and

    var WiringSet = wire.NewSet(
    	NewStuff,
    	wire.Bind(new(ISomeInterface), new(SomeStuff)),
    )
    

    should behave the same. But only the below version works.

    Version

    Version 0.2.1

    Additional context

    None.

    opened by jarollz 8
  • Inject slice of interfaces

    Inject slice of interfaces

    Assume that i have this code

    type Counter interface {
    	GetCount() int
    }
    
    type A struct{}
    type B struct{}
    
    func (*A) GetCount() int {
    	return 1
    }
    
    func (*B) GetCount() int {
    	return 2
    }
    
    type ChainCounter struct {
    	counters []Counter
    }
    
    // Providers
    
    func ProvideA() *A {
    	return &A{}
    }
    
    func ProvideB() *A {
    	return &A{}
    }
    
    func ProvideChainCounter(counters ...Counter) *ChainCounter {
    	return &ChainCounter{counters: counters}
    }
    

    How can i inject A and B (which implementing Counter) to chain counter with wire ?

    opened by alexmatsak 8
  • Better error messages

    Better error messages

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

    It's a go convention not to start a variable name in a package with the package name, which means that config should export config.Provider not config.ConfigProvider. However, wire doesn't include the package name in error messages which forces us to name providers package.PackageProvider for error visibility.

    When combined with other generation tools (e.g. proto3), sometimes interfaces are renamed or moved during code generation. The wire error message just refers to the missing interface as invalid type, which is not very useful for debugging.

    Describe the solution you'd like

    • Error messages referring to a provider should contain the full variable path including the package name (e.g. config.Provider instead of just Provider)

    • Error messages referring to an invalid type should include the raw text name of that type. Example:

    init(s ServiceA){
    ...
    }
    

    Current error:

    inject init: no provider found for invalid type
    

    Improved error:

    inject init: no provider found for invalid type (ServiceA)
    

    Describe alternatives you've considered

    For the first problem, the alternative is to include package names in the provider var name as per the example. For the second problem, there are no alternatives to wire printing the interface name.

    opened by HeshamMeneisi 0
  • how to reusable wire set

    how to reusable wire set

    we have those types and interfaces below

    example.go

    type A struct{
        ...  // some fields
    }
    
    type B struct{
        ....  // some fields
    }
    
    type Session struct{
        ... // some fields
    }
    
    func NewSession() *Session {
        return &Session{
          ...
        }
    }
    
    func (s *Session) doGetA() *A {
        ... // some operate
    }
    
    func (s *Session) doGetB() *B {
        ... // some operate
    }
    
    type AB struct{
          A *A
          B *B
    }
    
    type IADao interface {
        GetA() *A
    }
    
    type IBDao interface {
        GetB() *B
    }
    
    type ADao struct {
        session *Session
    }
    
    func NewADao(session *Session) *ADao {
        return &ADao {
            session: session
        }
    }
    
    func (dao *ADao) GetA() *A{
       return dao.session.doGetA()
    }
    
    type BDao struct {
        session *Session
    }
    
    func NewBDao(session *Session) *BDao {
        return &BDao {
            session: session
        }
    }
    
    func (dao *BDao) GetB() *B{
        return dao.session.doGetB()
    }
    
    type AService struct {
        aDao IADao
        bDao IBDao
    }
    
    func NewAService(aDao IADao, bDao IBDao) *AService {
        return &AService{
            aDao: aDao,
            bDao: bDao
        }
    }
    
    func (s *AService) GetAB() *AB {
        a  := s.aDao.GetA()
        b := s.bDao.Get(B)
        return &AB{
            A:a,
            B:b
        }
    }
    
    type BService struct {
        bDao IBDao
    }
    
    func NewBService(bDao) *BService {
        return &BService {
            bDao: bDao
        }
    }
    
    func (s *BService) GetB() *B {
        return  s.bDao.GetB()
    }
    

    now i want to inject AService and BService, with wire config file below

    wire_config.go

    var aDaoWireSet = wire.NewSet(wire.Bind(new(IADao), new(*ADao)), NewADao, NewSession)
    var bDaoWireSet = wire.NewSet(wire.Bind(new(IBDao), new(*BDao)), NewBDao, NewSession)
    
    var aServiceWireSet = wire.NewSet(aDaoWireSet, bDaoWireSet, NewAService)
    var bServiceWireSet = wire.NewSet(bDaoWireSet, NewBService)
    
    func AService() *Aservice {
       wire.Build(aServiceWireSet)
        return nil
    }
    
    func BService() *BService {
        wire.Build(aServiceWireSet)
        return nil
    }
    

    when i generated the wire_gen.go, encounted an error means that it has muilty dependecy define for the *Session type, it was easy to understand, but if there have some way to make the aDaoWireSet and bDaoWireSet reusable to inject an AService object depend on the same *Session?

    opened by fakerjeff 0
  • Typo in CLI usage string for diff subcommand

    Typo in CLI usage string for diff subcommand

    Describe the bug

    I believe there is a typo here:

    https://github.com/google/wire/blob/0ac845078ca01a1755571c53d7a8e7995b96e40d/cmd/wire/main.go#L182-L193

    To Reproduce

    Run wire diff -h.

    Expected behavior

    Similar to the **diff** command should probably read Similar to the **check** command

    Version

    0.5.0

    Additional context

    Add any other context about the problem here.

    opened by mickeyreiss 0
  • Update installation instruction to remove deprecation warnings

    Update installation instruction to remove deprecation warnings

    Using go get to install an executable produces a deprecation saying that go install should be used instead.

    cla: no 
    opened by dgolub 2
  • internal/wire: add method providers support

    internal/wire: add method providers support

    Fixes #294.

    cla: yes 
    opened by tdakkota 0
  • feat: Add goreleaser

    feat: Add goreleaser

    Support to attach binary files to the releases page.

    cla: yes 
    opened by koolay 2
  • internal/wire: supported a new build constraints

    internal/wire: supported a new build constraints

    The go command now understands //go:build lines and prefers them over // +build lines. As the link says, Go Team has a migration plan. So I fixed it so that it is supported by auto-generation. https://tip.golang.org/doc/go1.17#:~:text=mod%20download%20all.-,//go%3Abuild%20lines,-The%20go%20command

    cla: yes 
    opened by Code-Hex 5
  • feat: 🎸 Add recursion flag to the gen command

    feat: 🎸 Add recursion flag to the gen command

    it can generate wire_gen.go directories recursively

    Please reference any Issue related to this Pull Request. Example: Fixes #1.

    See here for tips on good Pull Request description.

    cla: yes 
    opened by ranxx 2
  • Due to the circular dependency, the wire cannot be generated, but the corresponding variable cannot be found when the error is reported.

    Due to the circular dependency, the wire cannot be generated, but the corresponding variable cannot be found when the error is reported.

    Describe the bug

    If I am in the following apps directory structure in app1 package, app.go

    package app1
    
    import (
    	"awesomeProject/wire_test/app"
    	"fmt"
    )
    
    type A struct {
    	C *app.C
    }
    
    func (a *A) Add(b app.B) {
    	fmt.Println(b)
    }
    
    

    in wire package , wire.go

    //go:build wireinject
    // +build wireinject
    
    package wire
    
    import (
    	"awesomeProject/wire_test/app"
    	"awesomeProject/wire_test/app/app1"
    
    	"github.com/google/wire"
    )
    
    func Inject() *app.B {
    	wire.Build(
    		wire.Struct(new(app1.A), "*"),
    		wire.Struct(new(app.B), "*"),
    		wire.Struct(new(app.C), "*"),
    	)
    	return nil
    }
    
    

    in intance.go

    package app
    
    import "awesomeProject/wire_test/app/app1"
    
    type B struct {
    	A app1.A
    }
    
    type C struct {
    }
    
    

    As a result, the following error was reported. In fact, it should be a circular reference that caused the wire to fail to be generated

    wire: /Users/genyuanguo/Desktop/awesomeProject/wire_test/app/wire/wire.go:13:1: inject Inject: no provider found for *invalid type
            needed by awesomeProject/wire_test/app/app1.A in struct provider "A" (/Users/genyuanguo/Desktop/awesomeProject/wire_test/app/app1/app.go:8:6)
            needed by *awesomeProject/wire_test/app.B in struct provider "B" (/Users/genyuanguo/Desktop/awesomeProject/wire_test/app/intance.go:5:6)
    wire: awesomeProject/wire_test/app/wire: generate failed
    wire: at least one generate failure
    

    To Reproduce

    . └── app |── app1 │   └── app.go |── intance.go └── wire |── wire.go └── wire_gen.go If you use the wire directory structure like this

    Expected behavior

    Should report an error app1 and app circular reference.

    Version

    github.com/google/wire v0.5.0

    Additional context

    Add any other context about the problem here.

    opened by radix-guo 1
  • Changing installation Commands

    Changing installation Commands

    …eprecated.

             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]'.
    

    Please reference any Issue related to this Pull Request. Example: Fixes #1.

    See here for tips on good Pull Request description.

    cla: yes 
    opened by huasx 2
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 43 Sep 15, 2021
🛠 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 108 Nov 30, 2021
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.2k Dec 5, 2021
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 115 Nov 24, 2021
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 2.4k Dec 5, 2021
Simple Dependency Injection Container

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

Rafał Lorenz 14 Dec 10, 2020
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 121 Nov 25, 2021
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 32 May 6, 2021
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 34 Sep 28, 2021
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 65 Dec 7, 2021
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 3 Nov 2, 2021
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 137 Nov 24, 2021
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_ 5 Oct 4, 2021
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 7k Dec 4, 2021
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
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 162 Nov 22, 2021
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 43 Sep 15, 2021
🛠 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 108 Nov 30, 2021
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.2k Dec 5, 2021
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 115 Nov 24, 2021
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 2.4k Dec 5, 2021
Simple Dependency Injection Container

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

Rafał Lorenz 14 Dec 10, 2020
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 121 Nov 25, 2021
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 32 May 6, 2021
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 34 Sep 28, 2021
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 13 Jun 22, 2021
Gerasimos (Makis) Maropoulos 21.5k Dec 1, 2021
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 65 Dec 7, 2021
🦄🌈 YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go.

???? YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go. Support Nacos ,Consoul ,Etcd ,Eureka ,kubernetes.

YoyoFx 495 Dec 3, 2021