From 6126c691cb0bb29928a2bb8274c97693b26b5809 Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Wed, 3 Aug 2022 10:18:45 +0200
Subject: [PATCH] Use golang 1.19
Signed-off-by: Pavol Loffay
---
.github/workflows/continuous-integration.yaml | 6 +++---
.github/workflows/e2e.yaml | 2 +-
.github/workflows/release.yaml | 2 +-
.github/workflows/scorecard.yaml | 2 +-
Dockerfile | 2 +-
cmd/otel-allocator/Dockerfile | 2 +-
cmd/otel-allocator/config/config.go | 4 ++--
cmd/otel-allocator/go.mod | 2 +-
go.mod | 2 +-
pkg/collector/adapters/config_validate.go | 6 +++---
pkg/collector/reconcile/horizontalpodautoscaler_test.go | 4 ++--
pkg/collector/reconcile/suite_test.go | 7 +++----
pkg/collector/upgrade/noop.go | 2 +-
pkg/targetallocator/serviceaccount.go | 2 +-
14 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml
index dbcf645c10..6deff2320d 100644
--- a/.github/workflows/continuous-integration.yaml
+++ b/.github/workflows/continuous-integration.yaml
@@ -14,7 +14,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v3
@@ -35,7 +35,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v3
@@ -43,7 +43,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
args: -v
- version: v1.45
+ version: v1.48
security:
name: Security
diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index ac32a4cb08..2c2d9473d7 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -24,7 +24,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v3
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index ceed9ccc45..d84b0272d6 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -10,7 +10,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
- go-version: 1.18
+ go-version: 1.19
- uses: actions/checkout@v3
diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml
index 23f4adab44..1de97b83b0 100644
--- a/.github/workflows/scorecard.yaml
+++ b/.github/workflows/scorecard.yaml
@@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
- go-version: 1.18
+ go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v3
diff --git a/Dockerfile b/Dockerfile
index f3f25cdfbc..89a589723e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
# Build the manager binary
-FROM golang:1.18 as builder
+FROM golang:1.19 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
diff --git a/cmd/otel-allocator/Dockerfile b/cmd/otel-allocator/Dockerfile
index 6f88d650a5..3e856c08a0 100644
--- a/cmd/otel-allocator/Dockerfile
+++ b/cmd/otel-allocator/Dockerfile
@@ -1,5 +1,5 @@
# Build the target allocator binary
-FROM golang:1.18 as builder
+FROM golang:1.19 as builder
WORKDIR /app
diff --git a/cmd/otel-allocator/config/config.go b/cmd/otel-allocator/config/config.go
index d1776506e0..4be3bdf3c2 100644
--- a/cmd/otel-allocator/config/config.go
+++ b/cmd/otel-allocator/config/config.go
@@ -5,7 +5,7 @@ import (
"flag"
"fmt"
"io/fs"
- "io/ioutil"
+ "os"
"path/filepath"
"time"
@@ -59,7 +59,7 @@ func Load(file string) (Config, error) {
func unmarshal(cfg *Config, configFile string) error {
- yamlFile, err := ioutil.ReadFile(configFile)
+ yamlFile, err := os.ReadFile(configFile)
if err != nil {
return err
}
diff --git a/cmd/otel-allocator/go.mod b/cmd/otel-allocator/go.mod
index 2ed30a0207..af1eec2eec 100644
--- a/cmd/otel-allocator/go.mod
+++ b/cmd/otel-allocator/go.mod
@@ -1,6 +1,6 @@
module github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator
-go 1.18
+go 1.19
require (
github.com/fsnotify/fsnotify v1.5.1
diff --git a/go.mod b/go.mod
index f2dc89a721..fa888fa405 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/open-telemetry/opentelemetry-operator
-go 1.18
+go 1.19
retract v1.51.0
diff --git a/pkg/collector/adapters/config_validate.go b/pkg/collector/adapters/config_validate.go
index c7fc0fa87a..f34f36f2d3 100644
--- a/pkg/collector/adapters/config_validate.go
+++ b/pkg/collector/adapters/config_validate.go
@@ -18,9 +18,9 @@ import (
"github.com/go-logr/logr"
)
-//Following Otel Doc: Configuring a receiver does not enable it. The receivers are enabled via pipelines within the service section.
-//GetEnabledReceivers returns all enabled receivers as a true flag set. If it can't find any receiver, it will return a nil interface.
-func GetEnabledReceivers(logger logr.Logger, config map[interface{}]interface{}) map[interface{}]bool {
+// Following Otel Doc: Configuring a receiver does not enable it. The receivers are enabled via pipelines within the service section.
+// GetEnabledReceivers returns all enabled receivers as a true flag set. If it can't find any receiver, it will return a nil interface.
+func GetEnabledReceivers(_ logr.Logger, config map[interface{}]interface{}) map[interface{}]bool {
cfgReceivers, ok := config["receivers"]
if !ok {
return nil
diff --git a/pkg/collector/reconcile/horizontalpodautoscaler_test.go b/pkg/collector/reconcile/horizontalpodautoscaler_test.go
index af2737c518..13cfe1a37f 100644
--- a/pkg/collector/reconcile/horizontalpodautoscaler_test.go
+++ b/pkg/collector/reconcile/horizontalpodautoscaler_test.go
@@ -17,7 +17,7 @@ package reconcile
import (
"context"
"fmt"
- "io/ioutil"
+ "os"
"testing"
"github.com/stretchr/testify/assert"
@@ -102,7 +102,7 @@ func TestExpectedHPA(t *testing.T) {
}
func paramsWithHPA(autoscalingVersion autodetect.AutoscalingVersion) Params {
- configYAML, err := ioutil.ReadFile("../testdata/test.yaml")
+ configYAML, err := os.ReadFile("../testdata/test.yaml")
if err != nil {
fmt.Printf("Error getting yaml file: %v", err)
}
diff --git a/pkg/collector/reconcile/suite_test.go b/pkg/collector/reconcile/suite_test.go
index 0ce59bc928..c1640d6fe3 100644
--- a/pkg/collector/reconcile/suite_test.go
+++ b/pkg/collector/reconcile/suite_test.go
@@ -18,7 +18,6 @@ import (
"context"
"crypto/tls"
"fmt"
- "io/ioutil"
"net"
"os"
"path/filepath"
@@ -164,7 +163,7 @@ func TestMain(m *testing.M) {
func params() Params {
replicas := int32(2)
- configYAML, err := ioutil.ReadFile("../testdata/test.yaml")
+ configYAML, err := os.ReadFile("../testdata/test.yaml")
if err != nil {
fmt.Printf("Error getting yaml file: %v", err)
}
@@ -208,9 +207,9 @@ func newParams(taContainerImage string, file string) (Params, error) {
var err error
if file == "" {
- configYAML, err = ioutil.ReadFile("../testdata/test.yaml")
+ configYAML, err = os.ReadFile("../testdata/test.yaml")
} else {
- configYAML, err = ioutil.ReadFile(file)
+ configYAML, err = os.ReadFile(file)
}
if err != nil {
return Params{}, fmt.Errorf("Error getting yaml file: %w", err)
diff --git a/pkg/collector/upgrade/noop.go b/pkg/collector/upgrade/noop.go
index 1061bb0462..1ec75d3dcd 100644
--- a/pkg/collector/upgrade/noop.go
+++ b/pkg/collector/upgrade/noop.go
@@ -20,7 +20,7 @@ import (
"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
)
-//nolint unused
+// nolint unused
func noop(cl client.Client, otelcol *v1alpha1.OpenTelemetryCollector) (*v1alpha1.OpenTelemetryCollector, error) {
return otelcol, nil
}
diff --git a/pkg/targetallocator/serviceaccount.go b/pkg/targetallocator/serviceaccount.go
index bd6d32df21..78627f3bf9 100644
--- a/pkg/targetallocator/serviceaccount.go
+++ b/pkg/targetallocator/serviceaccount.go
@@ -31,7 +31,7 @@ func ServiceAccountName(instance v1alpha1.OpenTelemetryCollector) string {
return instance.Spec.TargetAllocator.ServiceAccount
}
-//ServiceAccount returns the service account for the given instance.
+// ServiceAccount returns the service account for the given instance.
func ServiceAccount(otelcol v1alpha1.OpenTelemetryCollector) corev1.ServiceAccount {
labels := Labels(otelcol)
labels["app.kubernetes.io/name"] = naming.TargetAllocatorServiceAccount(otelcol)