wire.go 586 B

123456789101112131415161718192021222324252627282930313233
  1. //go:build wireinject
  2. // +build wireinject
  3. package wire
  4. import (
  5. "github.com/go-nunu/nunu-layout-advanced/internal/server"
  6. "github.com/go-nunu/nunu-layout-advanced/pkg/app"
  7. "github.com/go-nunu/nunu-layout-advanced/pkg/log"
  8. "github.com/google/wire"
  9. "github.com/spf13/viper"
  10. )
  11. var serverSet = wire.NewSet(
  12. server.NewTask,
  13. )
  14. // build App
  15. func newApp(
  16. task *server.Task,
  17. ) *app.App {
  18. return app.NewApp(
  19. app.WithServer(task),
  20. app.WithName("demo-task"),
  21. )
  22. }
  23. func NewWire(*viper.Viper, *log.Logger) (*app.App, func(), error) {
  24. panic(wire.Build(
  25. serverSet,
  26. newApp,
  27. ))
  28. }