Skip to content

Commit 5f59392

Browse files
committed
[chore](internal): fix gofumpt issues part 1
#### Description fix gofumpt issues in internal --- This commit was automatically created by review-helper. Changes are split into focused commits grouped by directory to simplify the review process. Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent ebb6ab9 commit 5f59392

File tree

5 files changed

+191
-155
lines changed

5 files changed

+191
-155
lines changed

internal/components/builder.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,41 +63,49 @@ func (b Builder[ComponentConfigType]) WithProtocol(protocol corev1.Protocol) Bui
6363
o.protocol = protocol
6464
})
6565
}
66+
6667
func (b Builder[ComponentConfigType]) WithAppProtocol(appProtocol *string) Builder[ComponentConfigType] {
6768
return append(b, func(o *Settings[ComponentConfigType]) {
6869
o.appProtocol = appProtocol
6970
})
7071
}
72+
7173
func (b Builder[ComponentConfigType]) WithDefaultRecAddress(defaultRecAddr string) Builder[ComponentConfigType] {
7274
return append(b, func(o *Settings[ComponentConfigType]) {
7375
o.defaultRecAddr = defaultRecAddr
7476
})
7577
}
78+
7679
func (b Builder[ComponentConfigType]) WithTargetPort(targetPort int32) Builder[ComponentConfigType] {
7780
return append(b, func(o *Settings[ComponentConfigType]) {
7881
o.targetPort = intstr.FromInt32(targetPort)
7982
})
8083
}
84+
8185
func (b Builder[ComponentConfigType]) WithNodePort(nodePort int32) Builder[ComponentConfigType] {
8286
return append(b, func(o *Settings[ComponentConfigType]) {
8387
o.nodePort = nodePort
8488
})
8589
}
90+
8691
func (b Builder[ComponentConfigType]) WithName(name string) Builder[ComponentConfigType] {
8792
return append(b, func(o *Settings[ComponentConfigType]) {
8893
o.name = name
8994
})
9095
}
96+
9197
func (b Builder[ComponentConfigType]) WithPort(port int32) Builder[ComponentConfigType] {
9298
return append(b, func(o *Settings[ComponentConfigType]) {
9399
o.port = port
94100
})
95101
}
102+
96103
func (b Builder[ComponentConfigType]) WithPortParser(portParser PortParser[ComponentConfigType]) Builder[ComponentConfigType] {
97104
return append(b, func(o *Settings[ComponentConfigType]) {
98105
o.portParser = portParser
99106
})
100107
}
108+
101109
func (b Builder[ComponentConfigType]) WithRbacGen(rbacGen RBACRuleGenerator[ComponentConfigType]) Builder[ComponentConfigType] {
102110
return append(b, func(o *Settings[ComponentConfigType]) {
103111
o.rbacGen = rbacGen
@@ -121,11 +129,13 @@ func (b Builder[ComponentConfigType]) WithStartupGen(startupGen ProbeGenerator[C
121129
o.startupGen = startupGen
122130
})
123131
}
132+
124133
func (b Builder[ComponentConfigType]) WithEnvVarGen(envVarGen EnvVarGenerator[ComponentConfigType]) Builder[ComponentConfigType] {
125134
return append(b, func(o *Settings[ComponentConfigType]) {
126135
o.envVarGen = envVarGen
127136
})
128137
}
138+
129139
func (b Builder[ComponentConfigType]) WithDefaultsApplier(defaultsApplier Defaulter[ComponentConfigType]) Builder[ComponentConfigType] {
130140
return append(b, func(o *Settings[ComponentConfigType]) {
131141
o.defaultsApplier = defaultsApplier

internal/components/receivers/helpers.go

Lines changed: 125 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -36,136 +36,134 @@ func NewScraperParser(name string) *components.GenericParser[any] {
3636
return components.NewBuilder[any]().WithName(name).WithPort(components.UnsetPort).MustBuild()
3737
}
3838

39-
var (
40-
componentParsers = []components.Parser{
41-
components.NewMultiPortReceiverBuilder("otlp").
42-
AddPortMapping(components.NewProtocolBuilder("grpc", 4317).
43-
WithAppProtocol(&components.GrpcProtocol).
44-
WithTargetPort(4317)).
45-
AddPortMapping(components.NewProtocolBuilder("http", 4318).
46-
WithAppProtocol(&components.HttpProtocol).
47-
WithTargetPort(4318)).
48-
MustBuild(),
49-
components.NewMultiPortReceiverBuilder("skywalking").
50-
AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 11800).
51-
WithTargetPort(11800).
52-
WithAppProtocol(&components.GrpcProtocol)).
53-
AddPortMapping(components.NewProtocolBuilder(components.HttpProtocol, 12800).
54-
WithTargetPort(12800).
55-
WithAppProtocol(&components.HttpProtocol)).
56-
MustBuild(),
57-
components.NewMultiPortReceiverBuilder("jaeger").
58-
AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 14250).
59-
WithTargetPort(14250).
60-
WithProtocol(corev1.ProtocolTCP).
61-
WithAppProtocol(&components.GrpcProtocol)).
62-
AddPortMapping(components.NewProtocolBuilder("thrift_http", 14268).
63-
WithTargetPort(14268).
64-
WithProtocol(corev1.ProtocolTCP).
65-
WithAppProtocol(&components.HttpProtocol)).
66-
AddPortMapping(components.NewProtocolBuilder("thrift_compact", 6831).
67-
WithTargetPort(6831).
68-
WithProtocol(corev1.ProtocolUDP)).
69-
AddPortMapping(components.NewProtocolBuilder("thrift_binary", 6832).
70-
WithTargetPort(6832).
71-
WithProtocol(corev1.ProtocolUDP)).
72-
MustBuild(),
73-
components.NewMultiPortReceiverBuilder("loki").
74-
AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 9095).
75-
WithTargetPort(9095).
76-
WithAppProtocol(&components.GrpcProtocol)).
77-
AddPortMapping(components.NewProtocolBuilder(components.HttpProtocol, 3100).
78-
WithTargetPort(3100).
79-
WithAppProtocol(&components.HttpProtocol)).
80-
MustBuild(),
81-
components.NewSinglePortParserBuilder("awsxray", 2000).
82-
WithTargetPort(2000).
83-
WithProtocol(corev1.ProtocolUDP).
84-
MustBuild(),
85-
components.NewSinglePortParserBuilder("carbon", 2003).
86-
WithTargetPort(2003).
87-
MustBuild(),
88-
components.NewSinglePortParserBuilder("collectd", 8081).
89-
WithTargetPort(8081).
90-
MustBuild(),
91-
components.NewSinglePortParserBuilder("fluentforward", 8006).
92-
WithTargetPort(8006).
93-
MustBuild(),
94-
components.NewSinglePortParserBuilder("influxdb", 8086).
95-
WithTargetPort(8086).
96-
MustBuild(),
97-
components.NewSinglePortParserBuilder("sapm", 7276).
98-
WithTargetPort(7276).
99-
MustBuild(),
100-
components.NewSinglePortParserBuilder("signalfx", 9943).
101-
WithTargetPort(9943).
102-
MustBuild(),
103-
components.NewSinglePortParserBuilder("splunk_hec", 8088).
104-
WithTargetPort(8088).
105-
MustBuild(),
106-
components.NewSinglePortParserBuilder("statsd", 8125).
107-
WithProtocol(corev1.ProtocolUDP).
108-
WithTargetPort(8125).
109-
MustBuild(),
110-
components.NewSinglePortParserBuilder("tcplog", components.UnsetPort).
111-
WithProtocol(corev1.ProtocolTCP).
112-
MustBuild(),
113-
components.NewSinglePortParserBuilder("udplog", components.UnsetPort).
114-
WithProtocol(corev1.ProtocolUDP).
115-
MustBuild(),
116-
components.NewSinglePortParserBuilder("wavefront", 2003).
117-
WithTargetPort(2003).
118-
MustBuild(),
119-
components.NewSinglePortParserBuilder("zipkin", 9411).
39+
var componentParsers = []components.Parser{
40+
components.NewMultiPortReceiverBuilder("otlp").
41+
AddPortMapping(components.NewProtocolBuilder("grpc", 4317).
42+
WithAppProtocol(&components.GrpcProtocol).
43+
WithTargetPort(4317)).
44+
AddPortMapping(components.NewProtocolBuilder("http", 4318).
12045
WithAppProtocol(&components.HttpProtocol).
46+
WithTargetPort(4318)).
47+
MustBuild(),
48+
components.NewMultiPortReceiverBuilder("skywalking").
49+
AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 11800).
50+
WithTargetPort(11800).
51+
WithAppProtocol(&components.GrpcProtocol)).
52+
AddPortMapping(components.NewProtocolBuilder(components.HttpProtocol, 12800).
53+
WithTargetPort(12800).
54+
WithAppProtocol(&components.HttpProtocol)).
55+
MustBuild(),
56+
components.NewMultiPortReceiverBuilder("jaeger").
57+
AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 14250).
58+
WithTargetPort(14250).
59+
WithProtocol(corev1.ProtocolTCP).
60+
WithAppProtocol(&components.GrpcProtocol)).
61+
AddPortMapping(components.NewProtocolBuilder("thrift_http", 14268).
62+
WithTargetPort(14268).
12163
WithProtocol(corev1.ProtocolTCP).
64+
WithAppProtocol(&components.HttpProtocol)).
65+
AddPortMapping(components.NewProtocolBuilder("thrift_compact", 6831).
66+
WithTargetPort(6831).
67+
WithProtocol(corev1.ProtocolUDP)).
68+
AddPortMapping(components.NewProtocolBuilder("thrift_binary", 6832).
69+
WithTargetPort(6832).
70+
WithProtocol(corev1.ProtocolUDP)).
71+
MustBuild(),
72+
components.NewMultiPortReceiverBuilder("loki").
73+
AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 9095).
74+
WithTargetPort(9095).
75+
WithAppProtocol(&components.GrpcProtocol)).
76+
AddPortMapping(components.NewProtocolBuilder(components.HttpProtocol, 3100).
12277
WithTargetPort(3100).
123-
MustBuild(),
124-
components.NewBuilder[kubeletStatsConfig]().WithName("kubeletstats").
125-
WithRbacGen(generateKubeletStatsRbacRules).
126-
WithEnvVarGen(generateKubeletStatsEnvVars).
127-
MustBuild(),
128-
components.NewBuilder[k8seventsConfig]().WithName("k8s_events").
129-
WithRbacGen(generatek8seventsRbacRules).
130-
MustBuild(),
131-
components.NewBuilder[k8sclusterConfig]().WithName("k8s_cluster").
132-
WithRbacGen(generatek8sclusterRbacRules).
133-
MustBuild(),
134-
components.NewBuilder[k8sobjectsConfig]().WithName("k8sobjects").
135-
WithRbacGen(generatek8sobjectsRbacRules).
136-
MustBuild(),
137-
NewScraperParser("prometheus"),
138-
NewScraperParser("sshcheck"),
139-
NewScraperParser("cloudfoundry"),
140-
NewScraperParser("vcenter"),
141-
NewScraperParser("oracledb"),
142-
NewScraperParser("snmp"),
143-
NewScraperParser("googlecloudpubsub"),
144-
NewScraperParser("chrony"),
145-
NewScraperParser("jmx"),
146-
NewScraperParser("podman_stats"),
147-
NewScraperParser("pulsar"),
148-
NewScraperParser("docker_stats"),
149-
NewScraperParser("aerospike"),
150-
NewScraperParser("zookeeper"),
151-
NewScraperParser("prometheus_simple"),
152-
NewScraperParser("saphana"),
153-
NewScraperParser("riak"),
154-
NewScraperParser("redis"),
155-
NewScraperParser("rabbitmq"),
156-
NewScraperParser("purefb"),
157-
NewScraperParser("postgresql"),
158-
NewScraperParser("nsxt"),
159-
NewScraperParser("nginx"),
160-
NewScraperParser("mysql"),
161-
NewScraperParser("memcached"),
162-
NewScraperParser("httpcheck"),
163-
NewScraperParser("haproxy"),
164-
NewScraperParser("flinkmetrics"),
165-
NewScraperParser("couchdb"),
166-
NewScraperParser("filelog"),
167-
}
168-
)
78+
WithAppProtocol(&components.HttpProtocol)).
79+
MustBuild(),
80+
components.NewSinglePortParserBuilder("awsxray", 2000).
81+
WithTargetPort(2000).
82+
WithProtocol(corev1.ProtocolUDP).
83+
MustBuild(),
84+
components.NewSinglePortParserBuilder("carbon", 2003).
85+
WithTargetPort(2003).
86+
MustBuild(),
87+
components.NewSinglePortParserBuilder("collectd", 8081).
88+
WithTargetPort(8081).
89+
MustBuild(),
90+
components.NewSinglePortParserBuilder("fluentforward", 8006).
91+
WithTargetPort(8006).
92+
MustBuild(),
93+
components.NewSinglePortParserBuilder("influxdb", 8086).
94+
WithTargetPort(8086).
95+
MustBuild(),
96+
components.NewSinglePortParserBuilder("sapm", 7276).
97+
WithTargetPort(7276).
98+
MustBuild(),
99+
components.NewSinglePortParserBuilder("signalfx", 9943).
100+
WithTargetPort(9943).
101+
MustBuild(),
102+
components.NewSinglePortParserBuilder("splunk_hec", 8088).
103+
WithTargetPort(8088).
104+
MustBuild(),
105+
components.NewSinglePortParserBuilder("statsd", 8125).
106+
WithProtocol(corev1.ProtocolUDP).
107+
WithTargetPort(8125).
108+
MustBuild(),
109+
components.NewSinglePortParserBuilder("tcplog", components.UnsetPort).
110+
WithProtocol(corev1.ProtocolTCP).
111+
MustBuild(),
112+
components.NewSinglePortParserBuilder("udplog", components.UnsetPort).
113+
WithProtocol(corev1.ProtocolUDP).
114+
MustBuild(),
115+
components.NewSinglePortParserBuilder("wavefront", 2003).
116+
WithTargetPort(2003).
117+
MustBuild(),
118+
components.NewSinglePortParserBuilder("zipkin", 9411).
119+
WithAppProtocol(&components.HttpProtocol).
120+
WithProtocol(corev1.ProtocolTCP).
121+
WithTargetPort(3100).
122+
MustBuild(),
123+
components.NewBuilder[kubeletStatsConfig]().WithName("kubeletstats").
124+
WithRbacGen(generateKubeletStatsRbacRules).
125+
WithEnvVarGen(generateKubeletStatsEnvVars).
126+
MustBuild(),
127+
components.NewBuilder[k8seventsConfig]().WithName("k8s_events").
128+
WithRbacGen(generatek8seventsRbacRules).
129+
MustBuild(),
130+
components.NewBuilder[k8sclusterConfig]().WithName("k8s_cluster").
131+
WithRbacGen(generatek8sclusterRbacRules).
132+
MustBuild(),
133+
components.NewBuilder[k8sobjectsConfig]().WithName("k8sobjects").
134+
WithRbacGen(generatek8sobjectsRbacRules).
135+
MustBuild(),
136+
NewScraperParser("prometheus"),
137+
NewScraperParser("sshcheck"),
138+
NewScraperParser("cloudfoundry"),
139+
NewScraperParser("vcenter"),
140+
NewScraperParser("oracledb"),
141+
NewScraperParser("snmp"),
142+
NewScraperParser("googlecloudpubsub"),
143+
NewScraperParser("chrony"),
144+
NewScraperParser("jmx"),
145+
NewScraperParser("podman_stats"),
146+
NewScraperParser("pulsar"),
147+
NewScraperParser("docker_stats"),
148+
NewScraperParser("aerospike"),
149+
NewScraperParser("zookeeper"),
150+
NewScraperParser("prometheus_simple"),
151+
NewScraperParser("saphana"),
152+
NewScraperParser("riak"),
153+
NewScraperParser("redis"),
154+
NewScraperParser("rabbitmq"),
155+
NewScraperParser("purefb"),
156+
NewScraperParser("postgresql"),
157+
NewScraperParser("nsxt"),
158+
NewScraperParser("nginx"),
159+
NewScraperParser("mysql"),
160+
NewScraperParser("memcached"),
161+
NewScraperParser("httpcheck"),
162+
NewScraperParser("haproxy"),
163+
NewScraperParser("flinkmetrics"),
164+
NewScraperParser("couchdb"),
165+
NewScraperParser("filelog"),
166+
}
169167

170168
func init() {
171169
for _, parser := range componentParsers {

0 commit comments

Comments
 (0)