Skip to content

Commit 46af008

Browse files
authored
[chore](internal): fix gofumpt issues part 3 (#4812)
#### Description fix gofumpt issues in internal/instrumentation --- 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 a962b11 commit 46af008

File tree

20 files changed

+31
-25
lines changed

20 files changed

+31
-25
lines changed

internal/components/component.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ func PortFromEndpoint(endpoint string) (int32, error) {
8686
portStr := r.FindString(endpoint)
8787
cleanedPortStr := strings.ReplaceAll(portStr, ":", "")
8888
port, err = strconv.ParseInt(cleanedPortStr, 10, 32)
89-
9089
if err != nil {
9190
return UnsetPort, err
9291
}

internal/components/processors/k8sattribute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type K8sAttributeConfig struct {
3333

3434
func GenerateK8SAttrRbacRules(_ logr.Logger, config K8sAttributeConfig) ([]rbacv1.PolicyRule, error) {
3535
// These policies need to be added always
36-
var prs = []rbacv1.PolicyRule{
36+
prs := []rbacv1.PolicyRule{
3737
{
3838
APIGroups: []string{""},
3939
Resources: []string{"pods", "namespaces"},

internal/controllers/targetallocator_reconciler_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ import (
3030

3131
var testLogger = logf.Log.WithName("opamp-bridge-controller-unit-tests")
3232

33-
var (
34-
testScheme *runtime.Scheme = scheme.Scheme
35-
)
33+
var testScheme *runtime.Scheme = scheme.Scheme
3634

3735
func init() {
3836
utilruntime.Must(monitoringv1.AddToScheme(testScheme))

internal/instrumentation/annotation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
)
3636

3737
// annotationValue returns the effective annotationInjectJava value, based on the annotations from the pod and namespace.
38-
func annotationValue(ns metav1.ObjectMeta, pod metav1.ObjectMeta, annotation string) string {
38+
func annotationValue(ns, pod metav1.ObjectMeta, annotation string) string {
3939
// is the pod annotated with instructions to inject sidecars? is the namespace annotated?
4040
// if any of those is true, a sidecar might be desired.
4141
podAnnValue := pod.Annotations[annotation]

internal/instrumentation/dotnet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func injectDefaultDotNetEnvVars(container *corev1.Container, runtime string) {
137137
// setDotNetEnvVar function sets env var to the container if not exist already.
138138
// value of concatValues should be set to true if the env var supports multiple values separated by :.
139139
// If it is set to false, the original container's env var value has priority.
140-
func setDotNetEnvVar(container *corev1.Container, envVarName string, envVarValue string, concatValues bool) {
140+
func setDotNetEnvVar(container *corev1.Container, envVarName, envVarValue string, concatValues bool) {
141141
idx := getIndexOfEnv(container.Env, envVarName)
142142
if idx < 0 {
143143
container.Env = append(container.Env, corev1.EnvVar{

internal/instrumentation/podmutator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (langInsts *languageInstrumentations) setCommonInstrumentedContainers(ns co
144144
return nil
145145
}
146146

147-
func (langInsts *languageInstrumentations) setLanguageSpecificContainers(ns metav1.ObjectMeta, pod metav1.ObjectMeta) error {
147+
func (langInsts *languageInstrumentations) setLanguageSpecificContainers(ns, pod metav1.ObjectMeta) error {
148148
inst := []struct {
149149
iwc *instrumentationWithContainers
150150
annotation string

internal/instrumentation/podmutator_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,7 +2958,8 @@ func TestMutatePod(t *testing.T) {
29582958
Image: "otel/apache-httpd:1",
29592959
Command: []string{"/bin/sh", "-c"},
29602960
Args: []string{
2961-
"cp -r /opt/opentelemetry/* /opt/opentelemetry-webserver/agent && export agentLogDir=$(echo \"/opt/opentelemetry-webserver/agent/logs\" | sed 's,/,\\\\/,g') && cat /opt/opentelemetry-webserver/agent/conf/opentelemetry_sdk_log4cxx.xml.template | sed 's/__agent_log_dir__/'${agentLogDir}'/g' > /opt/opentelemetry-webserver/agent/conf/opentelemetry_sdk_log4cxx.xml &&echo \"$OTEL_APACHE_AGENT_CONF\" > /opt/opentelemetry-webserver/source-conf/opentemetry_agent.conf && sed -i 's/<<SID-PLACEHOLDER>>/'${APACHE_SERVICE_INSTANCE_ID}'/g' /opt/opentelemetry-webserver/source-conf/opentemetry_agent.conf && echo -e '\nInclude /usr/local/apache2/conf/opentemetry_agent.conf' >> /opt/opentelemetry-webserver/source-conf/httpd.conf"},
2961+
"cp -r /opt/opentelemetry/* /opt/opentelemetry-webserver/agent && export agentLogDir=$(echo \"/opt/opentelemetry-webserver/agent/logs\" | sed 's,/,\\\\/,g') && cat /opt/opentelemetry-webserver/agent/conf/opentelemetry_sdk_log4cxx.xml.template | sed 's/__agent_log_dir__/'${agentLogDir}'/g' > /opt/opentelemetry-webserver/agent/conf/opentelemetry_sdk_log4cxx.xml &&echo \"$OTEL_APACHE_AGENT_CONF\" > /opt/opentelemetry-webserver/source-conf/opentemetry_agent.conf && sed -i 's/<<SID-PLACEHOLDER>>/'${APACHE_SERVICE_INSTANCE_ID}'/g' /opt/opentelemetry-webserver/source-conf/opentemetry_agent.conf && echo -e '\nInclude /usr/local/apache2/conf/opentemetry_agent.conf' >> /opt/opentelemetry-webserver/source-conf/httpd.conf",
2962+
},
29622963
Env: []corev1.EnvVar{
29632964
{
29642965
Name: apacheAttributesEnvVar,
@@ -3217,7 +3218,8 @@ func TestMutatePod(t *testing.T) {
32173218
{
32183219
Name: "OTEL_NGINX_I13N_SCRIPT",
32193220
Value: nginxSdkInitContainerI13nScript,
3220-
}, {
3221+
},
3222+
{
32213223
Name: nginxServiceInstanceIdEnvVar,
32223224
ValueFrom: &corev1.EnvVarSource{
32233225
FieldRef: &corev1.ObjectFieldSelector{

internal/instrumentation/python.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func injectPythonSDKToContainer(pythonSpec v1alpha1.Python, container *corev1.Co
7373
return nil
7474
}
7575

76-
func injectPythonSDKToPod(pythonSpec v1alpha1.Python, pod corev1.Pod, firstContainerName string, platform string, instSpec v1alpha1.InstrumentationSpec) corev1.Pod {
76+
func injectPythonSDKToPod(pythonSpec v1alpha1.Python, pod corev1.Pod, firstContainerName, platform string, instSpec v1alpha1.InstrumentationSpec) corev1.Pod {
7777
volume := instrVolume(pythonSpec.VolumeClaimTemplate, pythonVolumeName, pythonSpec.VolumeSizeLimit)
7878

7979
// This has been validated already

internal/manifests/collector/configmap.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ func ConfigMap(params manifests.Params) (*corev1.ConfigMap, error) {
5959
}
6060

6161
replacedConf, err := ReplaceConfig(*otelCol, params.TargetAllocator, replaceCfgOpts...)
62-
6362
if err != nil {
6463
params.Log.V(2).Info("failed to update prometheus config to use sharded targets: ", "err", err)
6564
return nil, err

internal/manifests/collector/suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func paramsWithMode(mode v1beta1.Mode) manifests.Params {
6767
},
6868
Spec: v1beta1.OpenTelemetryCollectorSpec{
6969
OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{
70-
7170
Image: "ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.47.0",
7271
Ports: []v1beta1.PortsSpec{
7372
{
@@ -93,7 +92,7 @@ func paramsWithMode(mode v1beta1.Mode) manifests.Params {
9392
}
9493
}
9594

96-
func newParams(taContainerImage string, file string, cfg *config.Config) (manifests.Params, error) {
95+
func newParams(taContainerImage, file string, cfg *config.Config) (manifests.Params, error) {
9796
replicas := int32(1)
9897
var configYAML []byte
9998
var err error

0 commit comments

Comments
 (0)