Skip to content

Instantly share code, notes, and snippets.

@jahkeup
Created April 5, 2021 04:54
Show Gist options
  • Save jahkeup/ab3c315ae574e46a5d40baee34b19d72 to your computer and use it in GitHub Desktop.
Save jahkeup/ab3c315ae574e46a5d40baee34b19d72 to your computer and use it in GitHub Desktop.

Literally what my dog has brought me to.

Everything leads to a bark and distrubance of focus.

go run /home/jake/src/github.com/jahkeup/hey/cmd/heyd
panic: ARE YOU FUCKING KIDDING ME. I MUST MEET THAT DOG.

goroutine 1 [running]:
main.(*Jerry).Bark(0x4fc0a0, 0x464e40, 0xc000020238)
        /home/jake/src/github.com/jahkeup/hey/cmd/heyd/wire_gen.go:29 +0x39
main.main()
        /home/jake/src/github.com/jahkeup/hey/cmd/heyd/main.go:8 +0x36
exit status 2
package main
type Barker interface {
Bark() error
}
func main() {
getThing().Barker.Bark()
}
//+build wireinject
package main
import (
"github.com/google/wire"
)
type Jerry struct{}
func (*Jerry) Bark() error {
panic("ARE YOU FUCKING KIDDING ME. I MUST MEET THAT DOG.")
return nil
}
type Container struct {
Barker
SecondContainer
}
type SecondContainer struct {
BarkerAlso Barker
}
// Does the same value get plumbed?
func NewSecondContainer(b Barker) SecondContainer {
return SecondContainer{b}
}
// injector
func getThing() Container {
panic(wire.Build(wire.InterfaceValue(new(Barker), &Jerry{}), wire.Struct(new(Container), "*"), NewSecondContainer))
}
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//+build !wireinject
package main
// Injectors from wire.go:
func getThing() Container {
barker := _wireJerryValue
secondContainer := NewSecondContainer(barker)
container := Container{
Barker: barker,
SecondContainer: secondContainer,
}
return container
}
var (
_wireJerryValue = &Jerry{}
)
// wire.go:
type Jerry struct{}
func (*Jerry) Bark() error {
panic("ARE YOU FUCKING KIDDING ME. I MUST MEET THAT DOG.")
return nil
}
type Container struct {
Barker
SecondContainer
}
type SecondContainer struct {
BarkerAlso Barker
}
func NewSecondContainer(b Barker) SecondContainer {
return SecondContainer{b}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment