-
Notifications
You must be signed in to change notification settings - Fork 26
/
wire_gen.go
81 lines (72 loc) · 2.52 KB
/
wire_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package cc
import (
"github.com/aserto-dev/certs"
"github.com/aserto-dev/logger"
"github.com/aserto-dev/topaz/pkg/cc/config"
"github.com/aserto-dev/topaz/pkg/cc/context"
"github.com/google/wire"
)
// Injectors from wire.go:
// buildCC sets up the CC struct that contains all dependencies that
// are cross cutting
func buildCC(logOutput logger.Writer, errOutput logger.ErrWriter, configPath config.Path, overrides config.Overrider) (*CC, func(), error) {
errGroupAndContext := context.NewContext()
contextContext := errGroupAndContext.Ctx
loggerConfig, err := config.NewLoggerConfig(configPath, overrides)
if err != nil {
return nil, nil, err
}
zerologLogger, err := logger.NewLogger(logOutput, errOutput, loggerConfig)
if err != nil {
return nil, nil, err
}
generator := certs.NewGenerator(zerologLogger)
configConfig, err := config.NewConfig(configPath, zerologLogger, overrides, generator)
if err != nil {
return nil, nil, err
}
group := errGroupAndContext.ErrGroup
ccCC := &CC{
Context: contextContext,
Config: configConfig,
Log: zerologLogger,
ErrGroup: group,
}
return ccCC, func() {
}, nil
}
func buildTestCC(logOutput logger.Writer, errOutput logger.ErrWriter, configPath config.Path, overrides config.Overrider) (*CC, func(), error) {
errGroupAndContext := context.NewTestContext()
contextContext := errGroupAndContext.Ctx
loggerConfig, err := config.NewLoggerConfig(configPath, overrides)
if err != nil {
return nil, nil, err
}
zerologLogger, err := logger.NewLogger(logOutput, errOutput, loggerConfig)
if err != nil {
return nil, nil, err
}
generator := certs.NewGenerator(zerologLogger)
configConfig, err := config.NewConfig(configPath, zerologLogger, overrides, generator)
if err != nil {
return nil, nil, err
}
group := errGroupAndContext.ErrGroup
ccCC := &CC{
Context: contextContext,
Config: configConfig,
Log: zerologLogger,
ErrGroup: group,
}
return ccCC, func() {
}, nil
}
// wire.go:
var (
ccSet = wire.NewSet(context.NewContext, config.NewConfig, config.NewLoggerConfig, logger.NewLogger, certs.NewGenerator, wire.Struct(new(CC), "*"), wire.FieldsOf(new(*context.ErrGroupAndContext), "Ctx", "ErrGroup"))
ccTestSet = wire.NewSet(context.NewTestContext, config.NewConfig, config.NewLoggerConfig, logger.NewLogger, certs.NewGenerator, wire.Struct(new(CC), "*"), wire.FieldsOf(new(*context.ErrGroupAndContext), "Ctx", "ErrGroup"))
)