Skip to content

Commit

Permalink
golangci-lint
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Okhlopkov <[email protected]>
  • Loading branch information
Pavel Okhlopkov committed Nov 2, 2024
1 parent 613b7ec commit 20b7682
Show file tree
Hide file tree
Showing 28 changed files with 38 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
name: Build shell-operator binary
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.23"

- name: Check out shell-operator code
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
name: Run linter
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.23"

- name: Check out shell-operator code
uses: actions/checkout@v4
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Run golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v1.59.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v1.60.1
./golangci-lint run --sort-results --build-tags integration,test
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-labeled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ jobs:
cluster_name: "kube-1-27"
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.23"

- name: Check out shell-operator code
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.23"

- name: Check out shell-operator code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion cmd/shell-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"time"

"github.com/deckhouse/deckhouse/pkg/log"
"gopkg.in/alecthomas/kingpin.v2"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/flant/kube-client/klogtolog"
"github.com/flant/shell-operator/pkg/app"
"github.com/flant/shell-operator/pkg/debug"
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"strings"
"time"

"github.com/deckhouse/deckhouse/pkg/log"
"gopkg.in/alecthomas/kingpin.v2"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/flant/shell-operator/pkg/config"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"os"
"path"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"gopkg.in/yaml.v3"

"github.com/deckhouse/deckhouse/pkg/log"
utils "github.com/flant/shell-operator/pkg/utils/file"
structuredLogger "github.com/flant/shell-operator/pkg/utils/structured-logger"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"time"

"github.com/deckhouse/deckhouse/pkg/log"
utils "github.com/flant/shell-operator/pkg/utils/labels"

"github.com/flant/shell-operator/pkg/app"
utils "github.com/flant/shell-operator/pkg/utils/labels"
)

type CmdUsage struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/hook/controller/hook_controller.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package controller

import (
"github.com/deckhouse/deckhouse/pkg/log"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

"github.com/deckhouse/deckhouse/pkg/log"
. "github.com/flant/shell-operator/pkg/hook/binding_context"
. "github.com/flant/shell-operator/pkg/hook/types"
"github.com/flant/shell-operator/pkg/kube_events_manager"
Expand Down
2 changes: 1 addition & 1 deletion pkg/hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"path/filepath"
"strings"

"github.com/deckhouse/deckhouse/pkg/log"
uuid "github.com/gofrs/uuid/v5"
"github.com/kennygrant/sanitize"
"golang.org/x/time/rate"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/flant/shell-operator/pkg/app"
"github.com/flant/shell-operator/pkg/executor"
. "github.com/flant/shell-operator/pkg/hook/binding_context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/hook/hook_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"sort"
"strings"

"github.com/deckhouse/deckhouse/pkg/log"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/flant/shell-operator/pkg/executor"
"github.com/flant/shell-operator/pkg/hook/controller"
. "github.com/flant/shell-operator/pkg/hook/types"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kube_events_manager/error_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package kube_events_manager
import (
"io"

"github.com/deckhouse/deckhouse/pkg/log"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/client-go/tools/cache"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/flant/shell-operator/pkg/metric_storage"
utils "github.com/flant/shell-operator/pkg/utils/labels"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/kube_events_manager/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sort"

"github.com/deckhouse/deckhouse/pkg/log"

klient "github.com/flant/kube-client/client"
. "github.com/flant/shell-operator/pkg/kube_events_manager/types"
"github.com/flant/shell-operator/pkg/metric_storage"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kube_events_manager/monitor_config.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package kube_events_manager

import (
"github.com/deckhouse/deckhouse/pkg/log"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

"github.com/deckhouse/deckhouse/pkg/log"
. "github.com/flant/shell-operator/pkg/kube_events_manager/types"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/metric/storage.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package metric

import (
"github.com/flant/shell-operator/pkg/metric_storage/operation"
"github.com/prometheus/client_golang/prometheus"

"github.com/flant/shell-operator/pkg/metric_storage/operation"
)

type Storage interface {
Expand Down
5 changes: 2 additions & 3 deletions pkg/metric_storage/metric_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (
"strings"
"sync"

"github.com/flant/shell-operator/pkg/metric"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/flant/shell-operator/pkg/metric"
"github.com/flant/shell-operator/pkg/metric_storage/operation"
"github.com/flant/shell-operator/pkg/metric_storage/vault"
. "github.com/flant/shell-operator/pkg/utils/labels"
Expand Down
3 changes: 1 addition & 2 deletions pkg/metric_storage/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"fmt"
"sync"

"github.com/flant/shell-operator/pkg/metric"

log "github.com/deckhouse/deckhouse/pkg/log"
"github.com/prometheus/client_golang/prometheus"

"github.com/flant/shell-operator/pkg/metric"
. "github.com/flant/shell-operator/pkg/utils/labels"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/schedule_manager/schedule_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package schedule_manager
import (
"context"

"github.com/deckhouse/deckhouse/pkg/log"
"gopkg.in/robfig/cron.v2"

"github.com/deckhouse/deckhouse/pkg/log"
. "github.com/flant/shell-operator/pkg/schedule_manager/types"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/schedule_manager/schedule_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/deckhouse/deckhouse/pkg/log"

"github.com/flant/shell-operator/pkg/schedule_manager/types"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/shell-operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log/slog"

"github.com/deckhouse/deckhouse/pkg/log"

"github.com/flant/shell-operator/pkg/app"
"github.com/flant/shell-operator/pkg/config"
"github.com/flant/shell-operator/pkg/debug"
Expand Down
2 changes: 1 addition & 1 deletion pkg/shell-operator/debug_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"strconv"
"time"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/go-chi/chi/v5"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/flant/shell-operator/pkg/config"
"github.com/flant/shell-operator/pkg/debug"
"github.com/flant/shell-operator/pkg/task/dump"
Expand Down
1 change: 1 addition & 0 deletions pkg/shell-operator/kube_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/deckhouse/deckhouse/pkg/log"

klient "github.com/flant/kube-client/client"
"github.com/flant/shell-operator/pkg/app"
"github.com/flant/shell-operator/pkg/kube/object_patch"
Expand Down
2 changes: 1 addition & 1 deletion pkg/shell-operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"fmt"
"time"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/gofrs/uuid/v5"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

"github.com/deckhouse/deckhouse/pkg/log"
klient "github.com/flant/kube-client/client"
"github.com/flant/shell-operator/pkg/hook"
"github.com/flant/shell-operator/pkg/hook/binding_context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/admission/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"net/http"
"strings"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
v1 "k8s.io/api/admission/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/deckhouse/deckhouse/pkg/log"
structuredLogger "github.com/flant/shell-operator/pkg/utils/structured-logger"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/conversion/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"net/http"
"strings"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"

"github.com/deckhouse/deckhouse/pkg/log"
structuredLogger "github.com/flant/shell-operator/pkg/utils/structured-logger"
)

Expand Down
1 change: 1 addition & 0 deletions test/hook/context/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/deckhouse/deckhouse/pkg/log"

"github.com/flant/kube-client/fake"
"github.com/flant/shell-operator/pkg/hook"
. "github.com/flant/shell-operator/pkg/hook/binding_context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/deckhouse/deckhouse/pkg/log"
"github.com/flant/shell-operator/pkg/app"
"github.com/flant/shell-operator/pkg/kube_events_manager"
. "github.com/flant/shell-operator/pkg/kube_events_manager/types"
Expand All @@ -26,7 +27,7 @@ var _ = Describe("Binding 'kubernetes' with kind 'Pod' should emit KubeEvent obj
var KubeEventsManager kube_events_manager.KubeEventsManager

BeforeEach(func() {
KubeEventsManager = kube_events_manager.NewKubeEventsManager(context.Background(), KubeClient)
KubeEventsManager = kube_events_manager.NewKubeEventsManager(context.Background(), KubeClient, log.NewNop())
})

Context("with configVersion: v1", func() {
Expand Down Expand Up @@ -67,7 +68,7 @@ var _ = Describe("Binding 'kubernetes' with kind 'Pod' should emit KubeEvent obj

When("Pod is Added", func() {
JustBeforeEach(func() {
app.SetupLogging(nil)
app.SetupLogging(nil, log.NewNop())

// Unlock KubeEvent emitting.
m := KubeEventsManager.GetMonitor(monitorConfig.Metadata.MonitorId)
Expand Down
3 changes: 2 additions & 1 deletion test/integration/suite/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/deckhouse/deckhouse/pkg/log"
klient "github.com/flant/kube-client/client"
"github.com/flant/shell-operator/pkg/kube/object_patch"
)
Expand All @@ -36,5 +37,5 @@ var _ = BeforeSuite(func() {
err := KubeClient.Init()
Expect(err).ShouldNot(HaveOccurred())

ObjectPatcher = object_patch.NewObjectPatcher(KubeClient)
ObjectPatcher = object_patch.NewObjectPatcher(KubeClient, log.NewNop())
})

0 comments on commit 20b7682

Please sign in to comment.