From 3c9f7a7de641bed699533ace6451387ddbfec44e Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 25 Aug 2023 01:05:41 +0400 Subject: [PATCH] chore: re-enable nolintlint and typecheck linters Drop startup/rand.go, as since Go 1.20 `rand.Seed` is done automatically. Signed-off-by: Andrey Smirnov --- .golangci.yml | 2 -- cmd/installer/pkg/install/extensions.go | 1 - cmd/talosctl/cmd/mgmt/gen/config.go | 1 - cmd/talosctl/main.go | 4 --- hack/cloud-image-uploader/main.go | 4 --- internal/app/apid/main.go | 4 --- .../server/v1alpha1/v1alpha1_cluster.go | 2 +- .../server/v1alpha1/v1alpha1_server.go | 16 ++++-------- internal/app/machined/main.go | 5 ---- .../controllers/cluster/discovery_service.go | 4 +-- .../pkg/controllers/cri/seccomp_profile.go | 2 -- .../machined/pkg/controllers/ctest/ctest.go | 2 +- .../machined/pkg/controllers/etcd/member.go | 2 +- .../pkg/controllers/etcd/member_test.go | 4 +-- .../pkg/controllers/k8s/control_plane_test.go | 1 - .../machined/pkg/controllers/k8s/endpoint.go | 2 -- .../pkg/controllers/k8s/kubelet_static_pod.go | 2 +- .../k8s/render_secrets_static_pod.go | 2 +- .../pkg/controllers/k8s/static_pod_server.go | 2 -- .../controllers/kubeaccess/serviceaccount.go | 2 +- .../serviceaccount/crd_controller.go | 4 +-- .../network/address_config_test.go | 1 - .../controllers/network/address_merge_test.go | 1 - .../controllers/network/device_config_test.go | 1 - .../pkg/controllers/network/etcfile_test.go | 3 +-- .../network/hostname_config_test.go | 1 - .../controllers/network/link_merge_test.go | 1 - .../pkg/controllers/network/link_spec.go | 4 +-- .../pkg/controllers/network/link_status.go | 2 +- .../controllers/network/link_status_test.go | 2 +- .../pkg/controllers/network/network.go | 2 -- .../controllers/network/node_address_test.go | 2 +- .../pkg/controllers/network/operator/dhcp4.go | 2 +- .../pkg/controllers/network/operator/dhcp6.go | 2 +- .../network/operator_vip_config_test.go | 1 - .../machined/pkg/controllers/network/probe.go | 1 - .../network/resolver_config_test.go | 1 - .../controllers/network/route_config_test.go | 1 - .../controllers/network/route_spec_test.go | 1 - .../pkg/controllers/network/status_test.go | 1 - .../network/timeserver_config_test.go | 1 - .../controllers/runtime/events_sink_config.go | 2 +- .../controllers/runtime/kmsg_log_config.go | 2 +- .../pkg/controllers/runtime/security_state.go | 3 ++- .../controllers/secrets/api_cert_sans_test.go | 1 - .../pkg/controllers/secrets/api_test.go | 1 - .../pkg/controllers/secrets/etcd_test.go | 1 - .../pkg/controllers/secrets/kubelet_test.go | 1 - .../pkg/controllers/secrets/kubernetes.go | 2 +- .../secrets/kubernetes_cert_sans_test.go | 1 - .../secrets/kubernetes_dynamic_certs_test.go | 1 - .../controllers/secrets/kubernetes_test.go | 1 - .../secrets/maintenance_cert_sans.go | 4 --- .../machined/pkg/controllers/secrets/root.go | 2 -- .../pkg/controllers/secrets/root_test.go | 1 - .../pkg/controllers/secrets/trustd.go | 2 +- .../pkg/controllers/secrets/trustd_test.go | 1 - .../runtime/v1alpha1/bootloader/grub/probe.go | 2 -- .../v1alpha1/bootloader/grub/revert.go | 3 ++- .../v1alpha1/bootloader/mount/mount.go | 3 ++- .../v1alpha1/bootloader/sdboot/efivars.go | 2 +- .../v1alpha1/bootloader/sdboot/sdboot.go | 3 ++- .../v1alpha1/platform/exoscale/metadata.go | 1 - .../v1alpha1/platform/nocloud/nocloud.go | 2 -- .../v1alpha1/platform/oracle/metadata.go | 2 +- .../runtime/v1alpha1/v1alpha1_controller.go | 2 -- .../runtime/v1alpha1/v1alpha1_sequencer.go | 2 +- .../pkg/system/runner/process/process.go | 1 - .../app/machined/pkg/system/service_runner.go | 2 -- .../app/machined/pkg/system/services/apid.go | 2 +- .../machined/pkg/system/services/dashboard.go | 2 +- .../app/machined/pkg/system/services/etcd.go | 1 - .../machined/pkg/system/services/trustd.go | 2 +- internal/app/machined/revert.go | 1 - internal/app/maintenance/server.go | 2 -- internal/app/trustd/main.go | 5 ---- internal/integration/api/apply-config.go | 8 ++---- internal/integration/api/cgroups.go | 1 - internal/integration/api/discovery.go | 4 --- internal/integration/api/machine-status.go | 1 - internal/integration/api/reset.go | 6 ----- internal/integration/api/serviceaccount.go | 4 --- internal/integration/base/api.go | 2 -- internal/integration/base/cli.go | 2 -- internal/integration/cli/health.go | 4 --- .../pkg/containers/cri/containerd/hosts.go | 2 +- internal/pkg/containers/cri/cri.go | 2 +- internal/pkg/dashboard/networkconfig.go | 3 --- internal/pkg/discovery/registry/kubernetes.go | 2 -- internal/pkg/etcd/certs.go | 4 --- internal/pkg/extensions/kernel_modules.go | 3 ++- internal/pkg/meta/meta.go | 2 +- internal/pkg/secureboot/tpm2/pcr.go | 4 +-- internal/pkg/secureboot/tpm2/seal.go | 2 +- internal/pkg/secureboot/tpm2/unseal.go | 7 +++--- internal/pkg/toml/merge.go | 4 +-- internal/pkg/tui/installer/connection.go | 2 -- pkg/cluster/check/etcd.go | 2 -- pkg/cluster/check/kubernetes.go | 4 --- pkg/cluster/crashdump.go | 2 -- pkg/cluster/kubernetes/patch.go | 2 -- pkg/cluster/kubernetes/talos_managed.go | 4 +-- pkg/imager/filemap/filemap.go | 2 +- pkg/imager/profile/profile.go | 2 -- pkg/kubernetes/inject/serviceaccount.go | 2 -- pkg/machinery/client/client.go | 8 +++--- pkg/machinery/client/events.go | 2 +- pkg/machinery/client/resolver/roundrobin.go | 1 - .../config/configloader/configloader.go | 2 +- .../configloader/internal/decoder/decoder.go | 2 +- pkg/machinery/config/types/types.go | 6 ++--- .../types/v1alpha1/generate/generate.go | 2 -- .../types/v1alpha1/v1alpha1_validation.go | 4 --- pkg/machinery/extensions/config.go | 1 - .../resources/cri/seccomp_profile.go | 1 - .../resources/k8s/admissioncontrol_config.go | 2 -- .../resources/k8s/apiserver_config.go | 2 -- .../resources/k8s/auditpolicy_config.go | 2 -- .../resources/k8s/controllermanager_config.go | 2 -- .../resources/k8s/extramanifests_config.go | 2 -- pkg/machinery/resources/k8s/k8s.go | 1 - .../resources/k8s/manifests_config.go | 2 -- .../resources/k8s/scheduler_config.go | 2 -- pkg/machinery/resources/kubespan/config.go | 1 - .../resources/network/address_spec.go | 1 - pkg/machinery/resources/network/link_spec.go | 2 -- pkg/machinery/resources/perf/cpu.go | 1 - pkg/machinery/resources/runtime/runtime.go | 1 - pkg/machinery/resources/secrets/secrets.go | 1 - .../resources/siderolink/siderolink.go | 1 - pkg/machinery/resources/time/time.go | 1 - pkg/machinery/resources/v1alpha1/v1alpha1.go | 1 - pkg/provision/providers/vm/launch.go | 2 +- pkg/provision/providers/vm/network.go | 2 +- pkg/startup/rand.go | 25 ------------------- 135 files changed, 72 insertions(+), 265 deletions(-) delete mode 100644 pkg/startup/rand.go diff --git a/.golangci.yml b/.golangci.yml index 37ea5e5e7b..b79d7b891e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -156,13 +156,11 @@ linters: - nestif - nilnil # we return "nil, nil" - nonamedreturns - - nolintlint - nosnakecase - paralleltest - promlinter # https://github.com/golangci/golangci-lint/issues/2222 - tagliatelle # we have many different conventions - thelper - - typecheck - varnamelen # too annoying - wrapcheck - contextcheck # enable once golangci-lint 1.50.1 or 1.51 lands diff --git a/cmd/installer/pkg/install/extensions.go b/cmd/installer/pkg/install/extensions.go index 85ae3bac1a..66836bc1e0 100644 --- a/cmd/installer/pkg/install/extensions.go +++ b/cmd/installer/pkg/install/extensions.go @@ -13,7 +13,6 @@ import ( "github.com/siderolabs/talos/pkg/machinery/constants" ) -// nolint:gocyclo func (i *Installer) installExtensions() error { builder := extensions.Builder{ InitramfsPath: fmt.Sprintf(constants.InitramfsAssetPath, i.options.Arch), diff --git a/cmd/talosctl/cmd/mgmt/gen/config.go b/cmd/talosctl/cmd/mgmt/gen/config.go index 731303f40d..98de192c15 100644 --- a/cmd/talosctl/cmd/mgmt/gen/config.go +++ b/cmd/talosctl/cmd/mgmt/gen/config.go @@ -287,7 +287,6 @@ func validateFlags() error { return err } -// nolint:gocyclo func writeConfigBundle(configBundle *bundle.Bundle, outputPaths configOutputPaths, commentsFlags encoder.CommentsFlags) error { outputTypesSet := slices.ToSet(genConfigCmdFlags.outputTypes) diff --git a/cmd/talosctl/main.go b/cmd/talosctl/main.go index 9abf501d37..d8834e0fe9 100644 --- a/cmd/talosctl/main.go +++ b/cmd/talosctl/main.go @@ -9,13 +9,9 @@ import ( "os" "github.com/siderolabs/talos/cmd/talosctl/cmd" - "github.com/siderolabs/talos/pkg/cli" - "github.com/siderolabs/talos/pkg/startup" ) func main() { - cli.Should(startup.RandSeed()) - if err := cmd.Execute(); err != nil { os.Exit(1) } diff --git a/hack/cloud-image-uploader/main.go b/hack/cloud-image-uploader/main.go index e530d34fe7..e0474dd4c3 100644 --- a/hack/cloud-image-uploader/main.go +++ b/hack/cloud-image-uploader/main.go @@ -8,12 +8,10 @@ package main import ( "context" cryptorand "crypto/rand" - "encoding/binary" "encoding/json" "fmt" "io" "log" - "math/rand" "os" "path/filepath" "sync" @@ -77,8 +75,6 @@ func run() error { log.Fatalf("error seeding rand: %s", err) } - rand.Seed(int64(binary.LittleEndian.Uint64(seed))) //nolint:staticcheck - ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/internal/app/apid/main.go b/internal/app/apid/main.go index c8ccfbd89f..fcd944b007 100644 --- a/internal/app/apid/main.go +++ b/internal/app/apid/main.go @@ -72,10 +72,6 @@ func apidMain() error { startup.LimitMaxProcs(constants.ApidMaxProcs) - if err := startup.RandSeed(); err != nil { - return fmt.Errorf("failed to seed RNG: %w", err) - } - runtimeConn, err := grpc.Dial("unix://"+constants.APIRuntimeSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return fmt.Errorf("failed to dial runtime connection: %w", err) diff --git a/internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go b/internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go index f57d46896a..2e98c99c78 100644 --- a/internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go +++ b/internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go @@ -117,7 +117,7 @@ func (cl *clusterState) String() string { })) } -//nolint:gocyclo,cyclop +//nolint:gocyclo func buildClusterInfo(ctx context.Context, req *clusterapi.HealthCheckRequest, r runtime.Runtime, diff --git a/internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go b/internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go index a6c9a50d81..f159ccb617 100644 --- a/internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go +++ b/internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go @@ -297,8 +297,6 @@ func (s *Server) GenerateConfiguration(ctx context.Context, in *machine.Generate } // Reboot implements the machine.MachineServer interface. -// -//nolint:dupl func (s *Server) Reboot(ctx context.Context, in *machine.RebootRequest) (reply *machine.RebootResponse, err error) { actorID := uuid.New().String() @@ -330,8 +328,6 @@ func (s *Server) Reboot(ctx context.Context, in *machine.RebootRequest) (reply * } // Rollback implements the machine.MachineServer interface. -// -//nolint:gocyclo func (s *Server) Rollback(ctx context.Context, in *machine.RollbackRequest) (*machine.RollbackResponse, error) { log.Printf("rollback via API received") @@ -407,8 +403,6 @@ func (s *Server) Bootstrap(ctx context.Context, in *machine.BootstrapRequest) (r } // Shutdown implements the machine.MachineServer interface. -// -//nolint:dupl func (s *Server) Shutdown(ctx context.Context, in *machine.ShutdownRequest) (reply *machine.ShutdownResponse, err error) { actorID := uuid.New().String() @@ -563,7 +557,7 @@ func (opt *ResetOptions) GetSystemDiskTargets() []runtime.PartitionTarget { // Reset resets the node. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (s *Server) Reset(ctx context.Context, in *machine.ResetRequest) (reply *machine.ResetResponse, err error) { actorID := uuid.New().String() @@ -2229,7 +2223,7 @@ func (s *Server) PacketCapture(in *machine.PacketCaptureRequest, srv machine.Mac if err = srv.SendMsg(&common.Data{Bytes: data}); err != nil { cancel() - pr.CloseWithError(err) //nolint:errcheck + pr.CloseWithError(err) } } @@ -2244,7 +2238,7 @@ func capturePackets(pw *io.PipeWriter, handle *pcapgo.EthernetHandle, snapLen ui pcapw := pcapgo.NewWriterNanos(pw) if err := pcapw.WriteFileHeader(snapLen, linkType); err != nil { - pw.CloseWithError(err) //nolint:errcheck + pw.CloseWithError(err) return } @@ -2263,7 +2257,7 @@ func capturePackets(pw *io.PipeWriter, handle *pcapgo.EthernetHandle, snapLen ui packet, err := pkgsrc.NextPacket() if err == nil { if err = pcapw.WritePacket(packet.Metadata().CaptureInfo, packet.Data()); err != nil { - pw.CloseWithError(err) //nolint:errcheck + pw.CloseWithError(err) return } @@ -2286,7 +2280,7 @@ func capturePackets(pw *io.PipeWriter, handle *pcapgo.EthernetHandle, snapLen ui errors.Is(err, io.ErrNoProgress) || errors.Is(err, io.ErrClosedPipe) || errors.Is(err, io.ErrShortBuffer) || errors.Is(err, syscall.EBADF) || strings.Contains(err.Error(), "use of closed file") { - pw.CloseWithError(err) //nolint:errcheck + pw.CloseWithError(err) return } diff --git a/internal/app/machined/main.go b/internal/app/machined/main.go index f00b36420e..5bd17f9384 100644 --- a/internal/app/machined/main.go +++ b/internal/app/machined/main.go @@ -167,11 +167,6 @@ func run() error { // Limit GOMAXPROCS. startup.LimitMaxProcs(constants.MachinedMaxProcs) - // Ensure RNG is seeded. - if err := startup.RandSeed(); err != nil { - return err - } - // Set the PATH env var. if err := os.Setenv("PATH", constants.PATH); err != nil { return errors.New("error setting PATH") diff --git a/internal/app/machined/pkg/controllers/cluster/discovery_service.go b/internal/app/machined/pkg/controllers/cluster/discovery_service.go index 26af0f0c2c..6c52d0a2f2 100644 --- a/internal/app/machined/pkg/controllers/cluster/discovery_service.go +++ b/internal/app/machined/pkg/controllers/cluster/discovery_service.go @@ -273,7 +273,7 @@ func (ctrl *DiscoveryServiceController) Run(ctx context.Context, r controller.Ru Affiliate: localData, Endpoints: localEndpoints, }, otherEndpoints); err != nil { - return fmt.Errorf("error setting local affiliate data: %w", err) //nolint:govet + return fmt.Errorf("error setting local affiliate data: %w", err) } prevLocalData = localData @@ -312,7 +312,7 @@ func (ctrl *DiscoveryServiceController) Run(ctx context.Context, r controller.Ru return nil }); err != nil { - return err //nolint:govet + return err } touchedIDs[id] = struct{}{} diff --git a/internal/app/machined/pkg/controllers/cri/seccomp_profile.go b/internal/app/machined/pkg/controllers/cri/seccomp_profile.go index 104ed98bd8..8da0ae7d03 100644 --- a/internal/app/machined/pkg/controllers/cri/seccomp_profile.go +++ b/internal/app/machined/pkg/controllers/cri/seccomp_profile.go @@ -49,8 +49,6 @@ func (ctrl *SeccompProfileController) Outputs() []controller.Output { } // Run implements controller.StatsController interface. -// -//nolint:gocyclo,cyclop func (ctrl *SeccompProfileController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { for { select { diff --git a/internal/app/machined/pkg/controllers/ctest/ctest.go b/internal/app/machined/pkg/controllers/ctest/ctest.go index 19a1f55e64..059dc5d750 100644 --- a/internal/app/machined/pkg/controllers/ctest/ctest.go +++ b/internal/app/machined/pkg/controllers/ctest/ctest.go @@ -26,7 +26,7 @@ import ( ) // DefaultSuite is a base suite for controller testing. -type DefaultSuite struct { //nolint:govet +type DefaultSuite struct { suite.Suite state state.State diff --git a/internal/app/machined/pkg/controllers/etcd/member.go b/internal/app/machined/pkg/controllers/etcd/member.go index b0f5abcce2..a6665e60c3 100644 --- a/internal/app/machined/pkg/controllers/etcd/member.go +++ b/internal/app/machined/pkg/controllers/etcd/member.go @@ -56,7 +56,7 @@ func (ctrl *MemberController) Outputs() []controller.Output { // Run implements controller.Controller interface. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (ctrl *MemberController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { for { select { diff --git a/internal/app/machined/pkg/controllers/etcd/member_test.go b/internal/app/machined/pkg/controllers/etcd/member_test.go index 9045f2ea5d..a93df983ad 100644 --- a/internal/app/machined/pkg/controllers/etcd/member_test.go +++ b/internal/app/machined/pkg/controllers/etcd/member_test.go @@ -76,7 +76,7 @@ func (suite *MemberSuite) assertInexistentEtcdMember(member *etcd.Member) func() } } -func (suite *MemberSuite) TestEtcdRunning() { //nolint:dupl +func (suite *MemberSuite) TestEtcdRunning() { // given suite.ctrl.GetLocalMemberIDFunc = func(ctx context.Context) (uint64, error) { return 123, nil @@ -98,7 +98,7 @@ func (suite *MemberSuite) TestEtcdRunning() { //nolint:dupl ) } -func (suite *MemberSuite) TestEtcdNotRunning() { //nolint:dupl +func (suite *MemberSuite) TestEtcdNotRunning() { // given suite.ctrl.GetLocalMemberIDFunc = func(ctx context.Context) (uint64, error) { return 123, nil diff --git a/internal/app/machined/pkg/controllers/k8s/control_plane_test.go b/internal/app/machined/pkg/controllers/k8s/control_plane_test.go index 70b43adf10..29b29f812c 100644 --- a/internal/app/machined/pkg/controllers/k8s/control_plane_test.go +++ b/internal/app/machined/pkg/controllers/k8s/control_plane_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package k8s_test import ( diff --git a/internal/app/machined/pkg/controllers/k8s/endpoint.go b/internal/app/machined/pkg/controllers/k8s/endpoint.go index 89dc7b3239..9f1f691a35 100644 --- a/internal/app/machined/pkg/controllers/k8s/endpoint.go +++ b/internal/app/machined/pkg/controllers/k8s/endpoint.go @@ -106,7 +106,6 @@ func (ctrl *EndpointController) Run(ctx context.Context, r controller.Runtime, l } } -//nolint:gocyclo func (ctrl *EndpointController) watchEndpointsOnWorker(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { logger.Debug("waiting for kubelet client config", zap.String("file", constants.KubeletKubeconfig)) @@ -144,7 +143,6 @@ func (ctrl *EndpointController) watchEndpointsOnWorker(ctx context.Context, r co } } -//nolint:gocyclo func (ctrl *EndpointController) watchEndpointsOnControlPlane(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { if err := r.UpdateInputs([]controller.Input{ { diff --git a/internal/app/machined/pkg/controllers/k8s/kubelet_static_pod.go b/internal/app/machined/pkg/controllers/k8s/kubelet_static_pod.go index e57de80f56..995fdb790a 100644 --- a/internal/app/machined/pkg/controllers/k8s/kubelet_static_pod.go +++ b/internal/app/machined/pkg/controllers/k8s/kubelet_static_pod.go @@ -73,7 +73,7 @@ func (ctrl *KubeletStaticPodController) Outputs() []controller.Output { // Run implements controller.Controller interface. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (ctrl *KubeletStaticPodController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { var kubeletClient *kubelet.Client diff --git a/internal/app/machined/pkg/controllers/k8s/render_secrets_static_pod.go b/internal/app/machined/pkg/controllers/k8s/render_secrets_static_pod.go index b90661587b..d8d70de1fb 100644 --- a/internal/app/machined/pkg/controllers/k8s/render_secrets_static_pod.go +++ b/internal/app/machined/pkg/controllers/k8s/render_secrets_static_pod.go @@ -34,7 +34,7 @@ func (ctrl *RenderSecretsStaticPodController) Name() string { } // Inputs implements controller.Controller interface. -func (ctrl *RenderSecretsStaticPodController) Inputs() []controller.Input { //nolint:dupl +func (ctrl *RenderSecretsStaticPodController) Inputs() []controller.Input { return []controller.Input{ { Namespace: secrets.NamespaceName, diff --git a/internal/app/machined/pkg/controllers/k8s/static_pod_server.go b/internal/app/machined/pkg/controllers/k8s/static_pod_server.go index 5107df9f72..2c80fc9e19 100644 --- a/internal/app/machined/pkg/controllers/k8s/static_pod_server.go +++ b/internal/app/machined/pkg/controllers/k8s/static_pod_server.go @@ -65,8 +65,6 @@ type podList struct { } // Run implements controller.Controller interface. -// -//nolint:gocyclo,cyclop func (ctrl *StaticPodServerController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { ctrl.staticPodVersions = map[string]string{} diff --git a/internal/app/machined/pkg/controllers/kubeaccess/serviceaccount.go b/internal/app/machined/pkg/controllers/kubeaccess/serviceaccount.go index fb0969a212..ae510a62f2 100644 --- a/internal/app/machined/pkg/controllers/kubeaccess/serviceaccount.go +++ b/internal/app/machined/pkg/controllers/kubeaccess/serviceaccount.go @@ -67,7 +67,7 @@ func (ctrl *CRDController) Outputs() []controller.Output { // Run implements controller.Controller interface. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (ctrl *CRDController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { var crdControllerCtxCancel context.CancelFunc diff --git a/internal/app/machined/pkg/controllers/kubeaccess/serviceaccount/crd_controller.go b/internal/app/machined/pkg/controllers/kubeaccess/serviceaccount/crd_controller.go index 9b6850bbe1..546c2da3f6 100644 --- a/internal/app/machined/pkg/controllers/kubeaccess/serviceaccount/crd_controller.go +++ b/internal/app/machined/pkg/controllers/kubeaccess/serviceaccount/crd_controller.go @@ -248,7 +248,7 @@ func (t *CRDController) Run(ctx context.Context, workers int) error { } func (t *CRDController) runWorker(ctx context.Context) { - for t.processNextWorkItem(ctx) { //nolint:revive + for t.processNextWorkItem(ctx) { } } @@ -293,7 +293,7 @@ func (t *CRDController) processNextWorkItem(ctx context.Context) bool { return true } -//nolint:gocyclo,cyclop,dupl +//nolint:gocyclo,cyclop func (t *CRDController) syncHandler(ctx context.Context, key string) error { namespace, name, err := cache.SplitMetaNamespaceKey(key) if err != nil { diff --git a/internal/app/machined/pkg/controllers/network/address_config_test.go b/internal/app/machined/pkg/controllers/network/address_config_test.go index 946bf555ed..be6973fe74 100644 --- a/internal/app/machined/pkg/controllers/network/address_config_test.go +++ b/internal/app/machined/pkg/controllers/network/address_config_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/network/address_merge_test.go b/internal/app/machined/pkg/controllers/network/address_merge_test.go index 9f365f0790..e6ff36f874 100644 --- a/internal/app/machined/pkg/controllers/network/address_merge_test.go +++ b/internal/app/machined/pkg/controllers/network/address_merge_test.go @@ -166,7 +166,6 @@ func (suite *AddressMergeSuite) TestMerge() { ) } -//nolint:gocyclo func (suite *AddressMergeSuite) TestMergeFlapping() { // simulate two conflicting address definitions which are getting removed/added constantly dhcp := network.NewAddressSpec(network.ConfigNamespaceName, "dhcp/eth0/10.0.0.1/8") diff --git a/internal/app/machined/pkg/controllers/network/device_config_test.go b/internal/app/machined/pkg/controllers/network/device_config_test.go index 8d76b5aa9a..492ac16719 100644 --- a/internal/app/machined/pkg/controllers/network/device_config_test.go +++ b/internal/app/machined/pkg/controllers/network/device_config_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/network/etcfile_test.go b/internal/app/machined/pkg/controllers/network/etcfile_test.go index 1a35c72de6..8ec63eb7ff 100644 --- a/internal/app/machined/pkg/controllers/network/etcfile_test.go +++ b/internal/app/machined/pkg/controllers/network/etcfile_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( @@ -199,7 +198,7 @@ func (suite *EtcFileConfigSuite) TestNoSearchDomain() { suite.testFiles( []resource.Resource{cfg, suite.defaultAddress, suite.hostnameStatus, suite.resolverStatus}, "nameserver 1.1.1.1\nnameserver 2.2.2.2\nnameserver 3.3.3.3\n", - "127.0.0.1 localhost\n33.11.22.44 foo.example.com foo\n::1 localhost ip6-localhost ip6-loopback\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\n", //nolint:lll + "127.0.0.1 localhost\n33.11.22.44 foo.example.com foo\n::1 localhost ip6-localhost ip6-loopback\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\n", ) } diff --git a/internal/app/machined/pkg/controllers/network/hostname_config_test.go b/internal/app/machined/pkg/controllers/network/hostname_config_test.go index 7678cc4149..93e6f2c8ca 100644 --- a/internal/app/machined/pkg/controllers/network/hostname_config_test.go +++ b/internal/app/machined/pkg/controllers/network/hostname_config_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/network/link_merge_test.go b/internal/app/machined/pkg/controllers/network/link_merge_test.go index 47428c6296..050eec1423 100644 --- a/internal/app/machined/pkg/controllers/network/link_merge_test.go +++ b/internal/app/machined/pkg/controllers/network/link_merge_test.go @@ -192,7 +192,6 @@ func (suite *LinkMergeSuite) TestMergeLogicalLink() { ) } -//nolint:gocyclo func (suite *LinkMergeSuite) TestMergeFlapping() { // simulate two conflicting link definitions which are getting removed/added constantly dhcp := network.NewLinkSpec(network.ConfigNamespaceName, "dhcp/eth0") diff --git a/internal/app/machined/pkg/controllers/network/link_spec.go b/internal/app/machined/pkg/controllers/network/link_spec.go index 1a47d68137..4da612307b 100644 --- a/internal/app/machined/pkg/controllers/network/link_spec.go +++ b/internal/app/machined/pkg/controllers/network/link_spec.go @@ -143,8 +143,8 @@ func (ctrl *LinkSpecController) Run(ctx context.Context, r controller.Runtime, l // in proper order. func SortBonds(items []resource.Resource) { sort.Slice(items, func(i, j int) bool { - left := items[i].(*network.LinkSpec).TypedSpec() //nolint:errcheck - right := items[j].(*network.LinkSpec).TypedSpec() //nolint:errcheck + left := items[i].(*network.LinkSpec).TypedSpec() + right := items[j].(*network.LinkSpec).TypedSpec() l := ordered.MakeTriple(left.Name, 0, "") if left.BondSlave.MasterName != "" { diff --git a/internal/app/machined/pkg/controllers/network/link_status.go b/internal/app/machined/pkg/controllers/network/link_status.go index 68547cb4b9..3e330237bf 100644 --- a/internal/app/machined/pkg/controllers/network/link_status.go +++ b/internal/app/machined/pkg/controllers/network/link_status.go @@ -104,7 +104,7 @@ func (ctrl *LinkStatusController) Run(ctx context.Context, r controller.Runtime, if err != nil { logger.Warn("error dialing ethtool ioctl socket", zap.Error(err)) } else { - defer ethIoctlClient.Close() //nolint:errcheck + defer ethIoctlClient.Close() } wgClient, err := wgctrl.New() diff --git a/internal/app/machined/pkg/controllers/network/link_status_test.go b/internal/app/machined/pkg/controllers/network/link_status_test.go index d1f8538400..9c5a44072f 100644 --- a/internal/app/machined/pkg/controllers/network/link_status_test.go +++ b/internal/app/machined/pkg/controllers/network/link_status_test.go @@ -147,7 +147,7 @@ func (suite *LinkStatusSuite) TestInterfaceHwInfo() { suite.Require().NoError(err) for _, res := range resources.Items { - spec := res.(*network.LinkStatus).TypedSpec() //nolint:errcheck,forcetypeassert + spec := res.(*network.LinkStatus).TypedSpec() //nolint:forcetypeassert if !spec.Physical() { continue diff --git a/internal/app/machined/pkg/controllers/network/network.go b/internal/app/machined/pkg/controllers/network/network.go index 265e1860da..7bb3fb83d1 100644 --- a/internal/app/machined/pkg/controllers/network/network.go +++ b/internal/app/machined/pkg/controllers/network/network.go @@ -127,8 +127,6 @@ func SetBridgeSlave(link *network.LinkSpecSpec, bridge string) { } // SetBridgeMaster sets the bridge master spec. -// -//nolint:gocyclo func SetBridgeMaster(link *network.LinkSpecSpec, bridge talosconfig.Bridge) error { link.Logical = true link.Kind = network.LinkKindBridge diff --git a/internal/app/machined/pkg/controllers/network/node_address_test.go b/internal/app/machined/pkg/controllers/network/node_address_test.go index 08c4634eb0..97f595f45d 100644 --- a/internal/app/machined/pkg/controllers/network/node_address_test.go +++ b/internal/app/machined/pkg/controllers/network/node_address_test.go @@ -67,7 +67,7 @@ func (suite *NodeAddressSuite) TestDefaults() { ) } -//nolint:gocyclo,cyclop +//nolint:gocyclo func (suite *NodeAddressSuite) TestFilters() { var ( addressStatusController netctrl.AddressStatusController diff --git a/internal/app/machined/pkg/controllers/network/operator/dhcp4.go b/internal/app/machined/pkg/controllers/network/operator/dhcp4.go index 8e49128d49..d7f2c7e90b 100644 --- a/internal/app/machined/pkg/controllers/network/operator/dhcp4.go +++ b/internal/app/machined/pkg/controllers/network/operator/dhcp4.go @@ -136,7 +136,7 @@ func (d *DHCP4) waitForNetworkReady(ctx context.Context) error { // Run the operator loop. // -//nolint:gocyclo,cyclop,dupl +//nolint:gocyclo,cyclop func (d *DHCP4) Run(ctx context.Context, notifyCh chan<- struct{}) { const minRenewDuration = 5 * time.Second // Protect from renewing too often diff --git a/internal/app/machined/pkg/controllers/network/operator/dhcp6.go b/internal/app/machined/pkg/controllers/network/operator/dhcp6.go index 07aa02a7e2..b8e588f0aa 100644 --- a/internal/app/machined/pkg/controllers/network/operator/dhcp6.go +++ b/internal/app/machined/pkg/controllers/network/operator/dhcp6.go @@ -62,7 +62,7 @@ func (d *DHCP6) Prefix() string { // Run the operator loop. // -//nolint:gocyclo,dupl +//nolint:gocyclo func (d *DHCP6) Run(ctx context.Context, notifyCh chan<- struct{}) { iface, err := net.InterfaceByName(d.linkName) if err != nil { diff --git a/internal/app/machined/pkg/controllers/network/operator_vip_config_test.go b/internal/app/machined/pkg/controllers/network/operator_vip_config_test.go index 97c8148e43..98bacf78e1 100644 --- a/internal/app/machined/pkg/controllers/network/operator_vip_config_test.go +++ b/internal/app/machined/pkg/controllers/network/operator_vip_config_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/network/probe.go b/internal/app/machined/pkg/controllers/network/probe.go index c409d4f888..8b89fb33d3 100644 --- a/internal/app/machined/pkg/controllers/network/probe.go +++ b/internal/app/machined/pkg/controllers/network/probe.go @@ -139,7 +139,6 @@ func (ctrl *ProbeController) reconcileRunners(ctx context.Context, r controller. return nil } -//nolint:gocyclo,cyclop func (ctrl *ProbeController) reconcileOutputs(ctx context.Context, r controller.Runtime, ev probe.Notification) error { if _, exists := ctrl.runners[ev.ID]; !exists { // probe was already removed, late notification, ignore it diff --git a/internal/app/machined/pkg/controllers/network/resolver_config_test.go b/internal/app/machined/pkg/controllers/network/resolver_config_test.go index 0e4142861d..7740abd399 100644 --- a/internal/app/machined/pkg/controllers/network/resolver_config_test.go +++ b/internal/app/machined/pkg/controllers/network/resolver_config_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/network/route_config_test.go b/internal/app/machined/pkg/controllers/network/route_config_test.go index 0a694043a9..d8a5988b2f 100644 --- a/internal/app/machined/pkg/controllers/network/route_config_test.go +++ b/internal/app/machined/pkg/controllers/network/route_config_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/network/route_spec_test.go b/internal/app/machined/pkg/controllers/network/route_spec_test.go index 6eb341c9d2..a18ba498cf 100644 --- a/internal/app/machined/pkg/controllers/network/route_spec_test.go +++ b/internal/app/machined/pkg/controllers/network/route_spec_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/network/status_test.go b/internal/app/machined/pkg/controllers/network/status_test.go index cdb2a88382..dc6b5d6400 100644 --- a/internal/app/machined/pkg/controllers/network/status_test.go +++ b/internal/app/machined/pkg/controllers/network/status_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/network/timeserver_config_test.go b/internal/app/machined/pkg/controllers/network/timeserver_config_test.go index f0397ed975..8c750db158 100644 --- a/internal/app/machined/pkg/controllers/network/timeserver_config_test.go +++ b/internal/app/machined/pkg/controllers/network/timeserver_config_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package network_test import ( diff --git a/internal/app/machined/pkg/controllers/runtime/events_sink_config.go b/internal/app/machined/pkg/controllers/runtime/events_sink_config.go index 211aff201a..a7bb559068 100644 --- a/internal/app/machined/pkg/controllers/runtime/events_sink_config.go +++ b/internal/app/machined/pkg/controllers/runtime/events_sink_config.go @@ -54,7 +54,7 @@ func (ctrl *EventsSinkConfigController) Outputs() []controller.Output { // Run implements controller.Controller interface. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (ctrl *EventsSinkConfigController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) (err error) { for { select { diff --git a/internal/app/machined/pkg/controllers/runtime/kmsg_log_config.go b/internal/app/machined/pkg/controllers/runtime/kmsg_log_config.go index a7a77616ca..55474ed8cd 100644 --- a/internal/app/machined/pkg/controllers/runtime/kmsg_log_config.go +++ b/internal/app/machined/pkg/controllers/runtime/kmsg_log_config.go @@ -56,7 +56,7 @@ func (ctrl *KmsgLogConfigController) Outputs() []controller.Output { // Run implements controller.Controller interface. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (ctrl *KmsgLogConfigController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) (err error) { for { select { diff --git a/internal/app/machined/pkg/controllers/runtime/security_state.go b/internal/app/machined/pkg/controllers/runtime/security_state.go index 1395486e11..b84541a76e 100644 --- a/internal/app/machined/pkg/controllers/runtime/security_state.go +++ b/internal/app/machined/pkg/controllers/runtime/security_state.go @@ -59,7 +59,8 @@ func (ctrl *SecurityStateController) Outputs() []controller.Output { } // Run implements controller.Controller interface. -// nolint:gocyclo +// +//nolint:gocyclo func (ctrl *SecurityStateController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { for { select { diff --git a/internal/app/machined/pkg/controllers/secrets/api_cert_sans_test.go b/internal/app/machined/pkg/controllers/secrets/api_cert_sans_test.go index 200e839be7..f444cac0bc 100644 --- a/internal/app/machined/pkg/controllers/secrets/api_cert_sans_test.go +++ b/internal/app/machined/pkg/controllers/secrets/api_cert_sans_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/controllers/secrets/api_test.go b/internal/app/machined/pkg/controllers/secrets/api_test.go index 136f30cb55..7f16eef621 100644 --- a/internal/app/machined/pkg/controllers/secrets/api_test.go +++ b/internal/app/machined/pkg/controllers/secrets/api_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/controllers/secrets/etcd_test.go b/internal/app/machined/pkg/controllers/secrets/etcd_test.go index bdf86e38b8..4258425c72 100644 --- a/internal/app/machined/pkg/controllers/secrets/etcd_test.go +++ b/internal/app/machined/pkg/controllers/secrets/etcd_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/controllers/secrets/kubelet_test.go b/internal/app/machined/pkg/controllers/secrets/kubelet_test.go index 8cb281914f..83eb0675a4 100644 --- a/internal/app/machined/pkg/controllers/secrets/kubelet_test.go +++ b/internal/app/machined/pkg/controllers/secrets/kubelet_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/controllers/secrets/kubernetes.go b/internal/app/machined/pkg/controllers/secrets/kubernetes.go index fc2cc00307..6013bf2ff2 100644 --- a/internal/app/machined/pkg/controllers/secrets/kubernetes.go +++ b/internal/app/machined/pkg/controllers/secrets/kubernetes.go @@ -70,7 +70,7 @@ func (ctrl *KubernetesController) Outputs() []controller.Output { // Run implements controller.Controller interface. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (ctrl *KubernetesController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { refreshTicker := time.NewTicker(KubernetesCertificateValidityDuration / 2) defer refreshTicker.Stop() diff --git a/internal/app/machined/pkg/controllers/secrets/kubernetes_cert_sans_test.go b/internal/app/machined/pkg/controllers/secrets/kubernetes_cert_sans_test.go index 6474eb58bd..a3f9f89fc0 100644 --- a/internal/app/machined/pkg/controllers/secrets/kubernetes_cert_sans_test.go +++ b/internal/app/machined/pkg/controllers/secrets/kubernetes_cert_sans_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/controllers/secrets/kubernetes_dynamic_certs_test.go b/internal/app/machined/pkg/controllers/secrets/kubernetes_dynamic_certs_test.go index 97fd344feb..d81f89804b 100644 --- a/internal/app/machined/pkg/controllers/secrets/kubernetes_dynamic_certs_test.go +++ b/internal/app/machined/pkg/controllers/secrets/kubernetes_dynamic_certs_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/controllers/secrets/kubernetes_test.go b/internal/app/machined/pkg/controllers/secrets/kubernetes_test.go index 039e742f00..e51f1b2118 100644 --- a/internal/app/machined/pkg/controllers/secrets/kubernetes_test.go +++ b/internal/app/machined/pkg/controllers/secrets/kubernetes_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/controllers/secrets/maintenance_cert_sans.go b/internal/app/machined/pkg/controllers/secrets/maintenance_cert_sans.go index c1f67e907c..644b6aa4f6 100644 --- a/internal/app/machined/pkg/controllers/secrets/maintenance_cert_sans.go +++ b/internal/app/machined/pkg/controllers/secrets/maintenance_cert_sans.go @@ -30,8 +30,6 @@ func (ctrl *MaintenanceCertSANsController) Name() string { } // Inputs implements controller.Controller interface. -// -//nolint:dupl func (ctrl *MaintenanceCertSANsController) Inputs() []controller.Input { return []controller.Input{ { @@ -60,8 +58,6 @@ func (ctrl *MaintenanceCertSANsController) Outputs() []controller.Output { } // Run implements controller.Controller interface. -// -//nolint:gocyclo func (ctrl *MaintenanceCertSANsController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { for { select { diff --git a/internal/app/machined/pkg/controllers/secrets/root.go b/internal/app/machined/pkg/controllers/secrets/root.go index 1c19514c6f..bbdffe72ec 100644 --- a/internal/app/machined/pkg/controllers/secrets/root.go +++ b/internal/app/machined/pkg/controllers/secrets/root.go @@ -68,8 +68,6 @@ func NewRootEtcdController() *RootEtcdController { type RootKubernetesController = transform.Controller[*config.MachineConfig, *secrets.KubernetesRoot] // NewRootKubernetesController instanciates the controller. -// -//nolint:gocyclo func NewRootKubernetesController() *RootKubernetesController { return transform.NewController( transform.Settings[*config.MachineConfig, *secrets.KubernetesRoot]{ diff --git a/internal/app/machined/pkg/controllers/secrets/root_test.go b/internal/app/machined/pkg/controllers/secrets/root_test.go index 7b3673b37a..77af7f479e 100644 --- a/internal/app/machined/pkg/controllers/secrets/root_test.go +++ b/internal/app/machined/pkg/controllers/secrets/root_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/controllers/secrets/trustd.go b/internal/app/machined/pkg/controllers/secrets/trustd.go index 6e27f51059..a4cd002b6b 100644 --- a/internal/app/machined/pkg/controllers/secrets/trustd.go +++ b/internal/app/machined/pkg/controllers/secrets/trustd.go @@ -119,7 +119,7 @@ func (ctrl *TrustdController) Run(ctx context.Context, r controller.Runtime, log } } -//nolint:gocyclo,cyclop,dupl +//nolint:gocyclo,dupl func (ctrl *TrustdController) reconcile(ctx context.Context, r controller.Runtime, logger *zap.Logger) error { inputs := []controller.Input{ { diff --git a/internal/app/machined/pkg/controllers/secrets/trustd_test.go b/internal/app/machined/pkg/controllers/secrets/trustd_test.go index d068ce8343..295b547554 100644 --- a/internal/app/machined/pkg/controllers/secrets/trustd_test.go +++ b/internal/app/machined/pkg/controllers/secrets/trustd_test.go @@ -2,7 +2,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:dupl package secrets_test import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/probe.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/probe.go index 47750c1407..1450f19303 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/probe.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/probe.go @@ -15,8 +15,6 @@ import ( // Probe probes a block device for GRUB bootloader. // // If the 'disk' is passed, search happens on that disk only, otherwise searches all partitions. -// -//nolint:gocyclo func Probe(ctx context.Context, disk string) (*Config, error) { var grubConf *Config diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/revert.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/revert.go index 0fceacb674..5a2cbae66f 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/revert.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/revert.go @@ -20,7 +20,8 @@ import ( ) // Revert reverts the bootloader to the previous version. -// nolint:gocyclo +// +//nolint:gocyclo func (c *Config) Revert(ctx context.Context) error { if c == nil { return fmt.Errorf("cannot revert bootloader: %w", bootloaderNotInstalledError{}) diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/mount/mount.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/mount/mount.go index fade56194b..e6dfe3fda3 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/mount/mount.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/mount/mount.go @@ -18,7 +18,8 @@ import ( ) // PartitionOp mounts a partition with the specified label, executes the operation func, and unmounts the partition. -// nolint:gocyclo +// +//nolint:gocyclo func PartitionOp(ctx context.Context, disk string, partitionLabel string, opFunc func() error) error { var probedBlockDevice *blockdevice.BlockDevice diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/efivars.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/efivars.go index 86f3ef86b6..0b27ab7720 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/efivars.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/efivars.go @@ -66,7 +66,7 @@ func WriteVariable(c efivario.Context, name, value string) error { return err } - defer unix.Mount("efivarfs", constants.EFIVarsMountPoint, "efivarfs", unix.MS_REMOUNT|unix.MS_RDONLY, "") // nolint: errcheck + defer unix.Mount("efivarfs", constants.EFIVarsMountPoint, "efivarfs", unix.MS_REMOUNT|unix.MS_RDONLY, "") //nolint:errcheck out := make([]byte, (len(value)+1)*2) diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/sdboot.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/sdboot.go index 5f9cb2fe59..6a199d5fa6 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/sdboot.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/sdboot.go @@ -49,7 +49,8 @@ func New() *Config { } // Probe for existing sd-boot bootloader. -// nolint:gocyclo +// +//nolint:gocyclo func Probe(ctx context.Context, disk string) (*Config, error) { // if not UEFI boot, nothing to do if !isUEFIBoot() { diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/exoscale/metadata.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/exoscale/metadata.go index 51522f6b39..69a65a27c5 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/exoscale/metadata.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/exoscale/metadata.go @@ -29,7 +29,6 @@ type MetadataConfig struct { Zone string `json:"availability-zone,omitempty"` } -//nolint:gocyclo func (e *Exoscale) getMetadata(ctx context.Context) (metadata *MetadataConfig, err error) { getMetadataKey := func(key string) (string, error) { res, metaerr := download.Download(ctx, fmt.Sprintf("%s/%s", ExoscaleMetadataEndpoint, key), diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/nocloud.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/nocloud.go index 75fe83edf0..a67012f413 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/nocloud.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/nocloud.go @@ -99,8 +99,6 @@ func (n *Nocloud) KernelArgs() procfs.Parameters { } // NetworkConfiguration implements the runtime.Platform interface. -// -//nolint:gocyclo func (n *Nocloud) NetworkConfiguration(ctx context.Context, st state.State, ch chan<- *runtime.PlatformNetworkConfig) error { metadataConfigDl, metadataNetworkConfigDl, _, metadata, err := n.acquireConfig(ctx, st) if stderrors.Is(err, errors.ErrNoConfigSource) { diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/oracle/metadata.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/oracle/metadata.go index 1842227e6c..88440daf88 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/oracle/metadata.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/oracle/metadata.go @@ -37,7 +37,7 @@ type MetadataConfig struct { } func (o *Oracle) getMetadata(ctx context.Context) (*MetadataConfig, error) { - metaConfigDl, err := download.Download(ctx, OracleMetadataEndpoint, //nolint:errcheck + metaConfigDl, err := download.Download(ctx, OracleMetadataEndpoint, download.WithHeaders(map[string]string{"Authorization": "Bearer Oracle"}), download.WithErrorOnNotFound(errors.ErrNoHostname), download.WithErrorOnEmptyResponse(errors.ErrNoHostname)) diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_controller.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_controller.go index 5faeea92d6..7f61b99474 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_controller.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_controller.go @@ -72,8 +72,6 @@ func NewController() (*Controller, error) { // Run executes all phases known to the controller in serial. `Controller` // aborts immediately if any phase fails. -// -//nolint:gocyclo func (c *Controller) Run(ctx context.Context, seq runtime.Sequence, data interface{}, setters ...runtime.LockOption) error { // We must ensure that the runtime is configured since all sequences depend // on the runtime. diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go index 126a5170bf..71cec87b2a 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go @@ -295,7 +295,7 @@ func (*Sequencer) Reboot(r runtime.Runtime) []runtime.Phase { // Reset is the reset sequence. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (*Sequencer) Reset(r runtime.Runtime, in runtime.ResetOptions) []runtime.Phase { phases := PhaseList{} diff --git a/internal/app/machined/pkg/system/runner/process/process.go b/internal/app/machined/pkg/system/runner/process/process.go index b68d1519bd..1957b15d43 100644 --- a/internal/app/machined/pkg/system/runner/process/process.go +++ b/internal/app/machined/pkg/system/runner/process/process.go @@ -190,7 +190,6 @@ func (p *processRunner) build() (commandWrapper, error) { }, nil } -//nolint:gocyclo func (p *processRunner) run(eventSink events.Recorder) error { cmdWrapper, err := p.build() if err != nil { diff --git a/internal/app/machined/pkg/system/service_runner.go b/internal/app/machined/pkg/system/service_runner.go index 5d891f8084..2cdb41f737 100644 --- a/internal/app/machined/pkg/system/service_runner.go +++ b/internal/app/machined/pkg/system/service_runner.go @@ -191,8 +191,6 @@ var ErrSkip = errors.New("service skipped") // Run returns an error when a service stops. // // Run should be run in a goroutine. -// -//nolint:gocyclo func (svcrunner *ServiceRunner) Run() error { defer func() { // reset context for the next run diff --git a/internal/app/machined/pkg/system/services/apid.go b/internal/app/machined/pkg/system/services/apid.go index c14b7a18a1..33af3f04fd 100644 --- a/internal/app/machined/pkg/system/services/apid.go +++ b/internal/app/machined/pkg/system/services/apid.go @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:golint,dupl +//nolint:golint package services import ( diff --git a/internal/app/machined/pkg/system/services/dashboard.go b/internal/app/machined/pkg/system/services/dashboard.go index 3b45ed6bb4..05aa6ddabb 100644 --- a/internal/app/machined/pkg/system/services/dashboard.go +++ b/internal/app/machined/pkg/system/services/dashboard.go @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:golint,dupl +//nolint:golint package services import ( diff --git a/internal/app/machined/pkg/system/services/etcd.go b/internal/app/machined/pkg/system/services/etcd.go index 15a0a81877..8aeacedeab 100644 --- a/internal/app/machined/pkg/system/services/etcd.go +++ b/internal/app/machined/pkg/system/services/etcd.go @@ -375,7 +375,6 @@ func buildInitialCluster(ctx context.Context, r runtime.Runtime, name string, pe return initial, id, nil } -//nolint:gocyclo func (e *Etcd) argsForInit(ctx context.Context, r runtime.Runtime, spec *etcdresource.SpecSpec) error { var upgraded bool diff --git a/internal/app/machined/pkg/system/services/trustd.go b/internal/app/machined/pkg/system/services/trustd.go index 9093a9c39c..2e0850a05b 100644 --- a/internal/app/machined/pkg/system/services/trustd.go +++ b/internal/app/machined/pkg/system/services/trustd.go @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//nolint:golint,dupl +//nolint:golint package services import ( diff --git a/internal/app/machined/revert.go b/internal/app/machined/revert.go index b6260e93a4..bd48c3ca07 100644 --- a/internal/app/machined/revert.go +++ b/internal/app/machined/revert.go @@ -19,7 +19,6 @@ func revertBootloader(ctx context.Context) { } } -//nolint:gocyclo func revertBootloadInternal(ctx context.Context) error { metaState, err := meta.New(ctx, nil) if err != nil { diff --git a/internal/app/maintenance/server.go b/internal/app/maintenance/server.go index 223a5168a1..83e4d3c573 100644 --- a/internal/app/maintenance/server.go +++ b/internal/app/maintenance/server.go @@ -158,8 +158,6 @@ func (s *Server) Version(ctx context.Context, in *emptypb.Empty) (*machine.Versi } // Upgrade initiates an upgrade. -// -//nolint:gocyclo,cyclop func (s *Server) Upgrade(ctx context.Context, in *machine.UpgradeRequest) (reply *machine.UpgradeResponse, err error) { if err = assertPeerSideroLink(ctx); err != nil { return nil, err diff --git a/internal/app/trustd/main.go b/internal/app/trustd/main.go index 0261251f90..def648d2d6 100644 --- a/internal/app/trustd/main.go +++ b/internal/app/trustd/main.go @@ -52,7 +52,6 @@ func Main() { } } -//nolint:gocyclo func trustdMain() error { ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT) defer cancel() @@ -67,10 +66,6 @@ func trustdMain() error { var err error - if err = startup.RandSeed(); err != nil { - return fmt.Errorf("startup: %s", err) - } - runtimeConn, err := grpc.Dial("unix://"+constants.TrustdRuntimeSocketPath, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return fmt.Errorf("failed to dial runtime connection: %w", err) diff --git a/internal/integration/api/apply-config.go b/internal/integration/api/apply-config.go index 7a0f4ecebd..983188aaa1 100644 --- a/internal/integration/api/apply-config.go +++ b/internal/integration/api/apply-config.go @@ -228,8 +228,6 @@ func (suite *ApplyConfigSuite) TestApplyWithoutReboot() { } // TestApplyConfigRotateEncryptionSecrets verify key rotation by sequential apply config calls. -// -//nolint:gocyclo func (suite *ApplyConfigSuite) TestApplyConfigRotateEncryptionSecrets() { if testing.Short() { suite.T().Skip("skipping in short mode") @@ -248,11 +246,11 @@ func (suite *ApplyConfigSuite) TestApplyConfigRotateEncryptionSecrets() { encryption := machineConfig.MachineConfig.MachineSystemDiskEncryption - if encryption == nil { //nolint:staticcheck + if encryption == nil { suite.T().Skip("skipped in not encrypted mode") } - cfg := encryption.EphemeralPartition //nolint:staticcheck + cfg := encryption.EphemeralPartition if cfg == nil { suite.T().Skip("skipped in not encrypted mode") @@ -458,8 +456,6 @@ func (suite *ApplyConfigSuite) TestApplyDryRun() { } // TestApplyTry applies the config in try mode with a short timeout. -// -//nolint:gocyclo func (suite *ApplyConfigSuite) TestApplyTry() { nodes := suite.DiscoverNodeInternalIPsByType(suite.ctx, machine.TypeWorker) suite.Require().NotEmpty(nodes) diff --git a/internal/integration/api/cgroups.go b/internal/integration/api/cgroups.go index 4708acea76..cb97f6aa26 100644 --- a/internal/integration/api/cgroups.go +++ b/internal/integration/api/cgroups.go @@ -126,7 +126,6 @@ func (suite *CGroupsSuite) TestCGroupsVersion() { } } -//nolint:gocyclo func (suite *CGroupsSuite) readCmdline(ctx context.Context) (string, error) { reader, err := suite.Client.Read(ctx, "/proc/cmdline") if err != nil { diff --git a/internal/integration/api/discovery.go b/internal/integration/api/discovery.go index e44f9d7f50..dab7c1e234 100644 --- a/internal/integration/api/discovery.go +++ b/internal/integration/api/discovery.go @@ -277,7 +277,6 @@ func (suite *DiscoverySuite) TestKubeSpanPeers() { } } -//nolint:dupl func (suite *DiscoverySuite) getMembers(nodeCtx context.Context) []*cluster.Member { var result []*cluster.Member @@ -300,7 +299,6 @@ func (suite *DiscoverySuite) getNodeIdentity(nodeCtx context.Context) *cluster.I return identity } -//nolint:dupl func (suite *DiscoverySuite) getAffiliates(nodeCtx context.Context, namespace resource.Namespace) []*cluster.Affiliate { var result []*cluster.Affiliate @@ -312,7 +310,6 @@ func (suite *DiscoverySuite) getAffiliates(nodeCtx context.Context, namespace re return result } -//nolint:dupl func (suite *DiscoverySuite) getKubeSpanPeerSpecs(nodeCtx context.Context) []*kubespan.PeerSpec { var result []*kubespan.PeerSpec @@ -328,7 +325,6 @@ func (suite *DiscoverySuite) getKubeSpanPeerSpecs(nodeCtx context.Context) []*ku return result } -//nolint:dupl func (suite *DiscoverySuite) getKubeSpanPeerStatuses(nodeCtx context.Context) []*kubespan.PeerStatus { var result []*kubespan.PeerStatus diff --git a/internal/integration/api/machine-status.go b/internal/integration/api/machine-status.go index 4b8c15fbac..eb784cccc1 100644 --- a/internal/integration/api/machine-status.go +++ b/internal/integration/api/machine-status.go @@ -54,7 +54,6 @@ func (suite *MachineStatusSuite) TestMachineStatusReady() { } } -//nolint:gocyclo func (suite *MachineStatusSuite) waitMachineStatusReady(node string) error { ctx, cancel := context.WithTimeout(client.WithNode(suite.ctx, node), 30*time.Second) defer cancel() diff --git a/internal/integration/api/reset.go b/internal/integration/api/reset.go index b727d0f473..5385f747b1 100644 --- a/internal/integration/api/reset.go +++ b/internal/integration/api/reset.go @@ -154,8 +154,6 @@ func (suite *ResetSuite) TestResetNoGracefulControlplane() { } // TestResetWithSpecEphemeral resets only ephemeral partition on the node. -// -//nolint:dupl func (suite *ResetSuite) TestResetWithSpecEphemeral() { node := suite.RandomDiscoveredNodeInternalIP() @@ -195,8 +193,6 @@ func (suite *ResetSuite) TestResetWithSpecEphemeral() { // TestResetWithSpecState resets only state partition on the node. // // As ephemeral partition is not reset, so kubelet cert shouldn't change. -// -//nolint:dupl func (suite *ResetSuite) TestResetWithSpecState() { if suite.Capabilities().SecureBooted { // this is because in secure boot mode, the machine config is only applied and cannot be passed as kernel args @@ -254,8 +250,6 @@ func (suite *ResetSuite) TestResetWithSpecState() { // TestResetDuringBoot resets the node multiple times, second reset is done // before boot sequence is complete. -// -//nolint:dupl func (suite *ResetSuite) TestResetDuringBoot() { node := suite.RandomDiscoveredNodeInternalIP() nodeCtx := client.WithNodes(suite.ctx, node) diff --git a/internal/integration/api/serviceaccount.go b/internal/integration/api/serviceaccount.go index f146352540..2201e3fb9f 100644 --- a/internal/integration/api/serviceaccount.go +++ b/internal/integration/api/serviceaccount.go @@ -70,8 +70,6 @@ func (suite *ServiceAccountSuite) TearDownTest() { } // TestValid tests Kubernetes service accounts. -// -//nolint:dupl func (suite *ServiceAccountSuite) TestValid() { name := "test-valid" @@ -160,8 +158,6 @@ func (suite *ServiceAccountSuite) TestNotAllowedRoles() { } // TestFeatureNotEnabled tests Kubernetes service accounts when API access feature is not enabled. -// -//nolint:dupl func (suite *ServiceAccountSuite) TestFeatureNotEnabled() { name := "test-feature-not-enabled" diff --git a/internal/integration/base/api.go b/internal/integration/base/api.go index bd163b53ac..39972987e7 100644 --- a/internal/integration/base/api.go +++ b/internal/integration/base/api.go @@ -122,8 +122,6 @@ func (apiSuite *APISuite) DiscoverNodeInternalIPsByType(ctx context.Context, mac } // RandomDiscoveredNodeInternalIP returns the internal IP a random node of the specified type (or any type if no types are specified). -// -//nolint:dupl func (apiSuite *APISuite) RandomDiscoveredNodeInternalIP(types ...machine.Type) string { nodeInfo := apiSuite.DiscoverNodes(context.TODO()) diff --git a/internal/integration/base/cli.go b/internal/integration/base/cli.go index 796598f42a..ec9a4bdffd 100644 --- a/internal/integration/base/cli.go +++ b/internal/integration/base/cli.go @@ -58,8 +58,6 @@ func (cliSuite *CLISuite) DiscoverNodeInternalIPsByType(ctx context.Context, mac } // RandomDiscoveredNodeInternalIP returns the internal IP a random node of the specified type (or any type if no types are specified). -// -//nolint:dupl func (cliSuite *CLISuite) RandomDiscoveredNodeInternalIP(types ...machine.Type) string { nodeInfo := cliSuite.DiscoverNodes(context.TODO()) diff --git a/internal/integration/cli/health.go b/internal/integration/cli/health.go index 33b99b4bbe..2b00fdde9b 100644 --- a/internal/integration/cli/health.go +++ b/internal/integration/cli/health.go @@ -30,8 +30,6 @@ func (suite *HealthSuite) SuiteName() string { } // TestClientSideWithExplicitNodes does successful health check run from client-side, providing the explicit set of nodes. -// -//nolint:gocyclo func (suite *HealthSuite) TestClientSideWithExplicitNodes() { info := suite.DiscoverNodes(context.TODO()) @@ -59,8 +57,6 @@ func (suite *HealthSuite) TestClientSideWithExplicitNodes() { // TestClientSideWithDiscovery does a health check run from client-side without explicitly specifying the nodes. // It verifies that the check still passes, because the nodes get populated by the discovery service. -// -//nolint:gocyclo func (suite *HealthSuite) TestClientSideWithDiscovery() { discoveryEnabled, err := suite.isDiscoveryEnabled() suite.Require().NoError(err) diff --git a/internal/pkg/containers/cri/containerd/hosts.go b/internal/pkg/containers/cri/containerd/hosts.go index d2416278c3..228a905c55 100644 --- a/internal/pkg/containers/cri/containerd/hosts.go +++ b/internal/pkg/containers/cri/containerd/hosts.go @@ -153,7 +153,7 @@ func GenerateHosts(cfg config.Registries, basePath string) (*HostsConfig, error) } } - buf.Write(tomlBytes) //nolint:errcheck + buf.Write(tomlBytes) } directory.Files = append(directory.Files, diff --git a/internal/pkg/containers/cri/cri.go b/internal/pkg/containers/cri/cri.go index 9b48d10733..d9c5ed498f 100644 --- a/internal/pkg/containers/cri/cri.go +++ b/internal/pkg/containers/cri/cri.go @@ -185,7 +185,7 @@ func findContainer(cntID string, containers []*runtimeapi.Container) (*runtimeap return nil, false } -// nolint: gocyclo +//nolint:gocyclo func (i *inspector) buildPod(sandbox *runtimeapi.PodSandbox) (*ctrs.Pod, error) { sandboxStatus, sandboxInfo, err := i.client.PodSandboxStatus(i.ctx, sandbox.Id) if err != nil { diff --git a/internal/pkg/dashboard/networkconfig.go b/internal/pkg/dashboard/networkconfig.go index efb14d8785..6a4976e2b5 100644 --- a/internal/pkg/dashboard/networkconfig.go +++ b/internal/pkg/dashboard/networkconfig.go @@ -64,8 +64,6 @@ type NetworkConfigGrid struct { } // NewNetworkConfigGrid initializes NetworkConfigGrid. -// -//nolint:gocyclo func NewNetworkConfigGrid(ctx context.Context, dashboard *Dashboard) *NetworkConfigGrid { widget := &NetworkConfigGrid{ Grid: *tview.NewGrid(), @@ -336,7 +334,6 @@ func (widget *NetworkConfigGrid) clearForm() { func (widget *NetworkConfigGrid) updateNodeData(data resourcedata.Data) { nodeData := widget.getOrCreateNodeData(data.Node) - //nolint:gocritic switch res := data.Resource.(type) { case *network.LinkStatus: if data.Deleted { diff --git a/internal/pkg/discovery/registry/kubernetes.go b/internal/pkg/discovery/registry/kubernetes.go index 8272530a82..5264405421 100644 --- a/internal/pkg/discovery/registry/kubernetes.go +++ b/internal/pkg/discovery/registry/kubernetes.go @@ -66,8 +66,6 @@ func AnnotationsFromAffiliate(affiliate *cluster.Affiliate) map[string]string { // AffiliateFromNode converts Kubernetes Node resource to Affiliate. // // If the Node resource doesn't have cluster discovery annotations, nil is returned. -// -//nolint:gocyclo func AffiliateFromNode(node *v1.Node) *cluster.AffiliateSpec { nodeID, ok := node.Annotations[constants.ClusterNodeIDAnnotation] if !ok { diff --git a/internal/pkg/etcd/certs.go b/internal/pkg/etcd/certs.go index 23241bbb77..492596efb2 100644 --- a/internal/pkg/etcd/certs.go +++ b/internal/pkg/etcd/certs.go @@ -67,8 +67,6 @@ func (gen *CertificateGenerator) buildOptions(autoSANs, includeLocalhost bool) [ } // GeneratePeerCert generates etcd peer certificate and key from etcd CA. -// -//nolint:dupl func (gen *CertificateGenerator) GeneratePeerCert() (*x509.PEMEncodedCertificateAndKey, error) { opts := gen.buildOptions(true, false) @@ -93,8 +91,6 @@ func (gen *CertificateGenerator) GeneratePeerCert() (*x509.PEMEncodedCertificate } // GenerateServerCert generates server etcd certificate and key from etcd CA. -// -//nolint:dupl func (gen *CertificateGenerator) GenerateServerCert() (*x509.PEMEncodedCertificateAndKey, error) { opts := gen.buildOptions(true, true) diff --git a/internal/pkg/extensions/kernel_modules.go b/internal/pkg/extensions/kernel_modules.go index 0763abeeb6..ba734f1ee2 100644 --- a/internal/pkg/extensions/kernel_modules.go +++ b/internal/pkg/extensions/kernel_modules.go @@ -41,7 +41,8 @@ func (ext *Extension) KernelModuleDirectory() string { } // GenerateKernelModuleDependencyTreeExtension generates a kernel module dependency tree extension. -// nolint:gocyclo +// +//nolint:gocyclo func GenerateKernelModuleDependencyTreeExtension(extensionsPathWithKernelModules []string, arch string, printFunc func(format string, v ...any)) (*Extension, error) { printFunc("preparing to run depmod to generate kernel modules dependency tree") diff --git a/internal/pkg/meta/meta.go b/internal/pkg/meta/meta.go index 2ad196e3e4..5a474cd4d3 100644 --- a/internal/pkg/meta/meta.go +++ b/internal/pkg/meta/meta.go @@ -300,7 +300,7 @@ func (meta *Meta) DeleteTag(ctx context.Context, t uint8) (bool, error) { return ok, nil } - err := meta.state.Destroy(ctx, runtime.NewMetaKey(runtime.NamespaceName, runtime.MetaKeyTagToID(t)).Metadata()) //nolint:errcheck + err := meta.state.Destroy(ctx, runtime.NewMetaKey(runtime.NamespaceName, runtime.MetaKeyTagToID(t)).Metadata()) if state.IsNotFoundError(err) { err = nil } diff --git a/internal/pkg/secureboot/tpm2/pcr.go b/internal/pkg/secureboot/tpm2/pcr.go index 70d49e011a..7381108677 100644 --- a/internal/pkg/secureboot/tpm2/pcr.go +++ b/internal/pkg/secureboot/tpm2/pcr.go @@ -77,7 +77,7 @@ func PCRExtent(pcr int, data []byte) error { return err } - defer t.Close() // nolint: errcheck + defer t.Close() //nolint:errcheck // since we are using SHA256, we can assume that the PCR bank is SHA256 digest := sha256.Sum256(data) @@ -127,7 +127,7 @@ func PolicyPCRDigest(t transport.TPM, policyHandle tpm2.TPMHandle, pcrSelection return &policyGetDigestResponse.PolicyDigest, nil } -// nolint:gocyclo +//nolint:gocyclo func validatePCRBanks(t transport.TPM) error { pcrValue, err := ReadPCR(t, secureboot.UKIPCR) if err != nil { diff --git a/internal/pkg/secureboot/tpm2/seal.go b/internal/pkg/secureboot/tpm2/seal.go index 97201ef7ae..c937348597 100644 --- a/internal/pkg/secureboot/tpm2/seal.go +++ b/internal/pkg/secureboot/tpm2/seal.go @@ -21,7 +21,7 @@ func Seal(key []byte) (*SealedResponse, error) { if err != nil { return nil, err } - defer t.Close() // nolint: errcheck + defer t.Close() //nolint:errcheck // fail early if PCR banks are not present or filled with all zeroes or 0xff if err = validatePCRBanks(t); err != nil { diff --git a/internal/pkg/secureboot/tpm2/unseal.go b/internal/pkg/secureboot/tpm2/unseal.go index 4010037ee6..1be23f5bec 100644 --- a/internal/pkg/secureboot/tpm2/unseal.go +++ b/internal/pkg/secureboot/tpm2/unseal.go @@ -21,13 +21,14 @@ import ( ) // Unseal unseals a sealed blob using the TPM -// nolint:gocyclo,cyclop +// +//nolint:gocyclo,cyclop func Unseal(sealed SealedResponse) ([]byte, error) { t, err := transport.OpenTPM() if err != nil { return nil, err } - defer t.Close() // nolint: errcheck + defer t.Close() //nolint:errcheck // fail early if PCR banks are not present or filled with all zeroes or 0xff if err = validatePCRBanks(t); err != nil { @@ -106,7 +107,7 @@ func Unseal(sealed SealedResponse) ([]byte, error) { return nil, fmt.Errorf("failed to create policy session: %v", err) } - defer policyCloseFunc() // nolint: errcheck + defer policyCloseFunc() //nolint:errcheck pubKey, err := ParsePCRSigningPubKey(constants.PCRPublicKey) if err != nil { diff --git a/internal/pkg/toml/merge.go b/internal/pkg/toml/merge.go index b44da63328..eb5781a57e 100644 --- a/internal/pkg/toml/merge.go +++ b/internal/pkg/toml/merge.go @@ -37,8 +37,8 @@ func Merge(parts []string) ([]byte, error) { var out bytes.Buffer - _, _ = out.Write(header) //nolint:errcheck - _ = out.WriteByte('\n') //nolint:errcheck + _, _ = out.Write(header) + _ = out.WriteByte('\n') if err := toml.NewEncoder(&out).Encode(merged); err != nil { return nil, fmt.Errorf("error encoding merged config: %w", err) diff --git a/internal/pkg/tui/installer/connection.go b/internal/pkg/tui/installer/connection.go index 3339058345..62b8f9d020 100644 --- a/internal/pkg/tui/installer/connection.go +++ b/internal/pkg/tui/installer/connection.go @@ -86,8 +86,6 @@ type Link struct { } // Links gets a list of network interfaces. -// -//nolint:gocyclo func (c *Connection) Links() ([]Link, error) { ctx := c.nodeCtx diff --git a/pkg/cluster/check/etcd.go b/pkg/cluster/check/etcd.go index e1c921d0d7..a727aee37e 100644 --- a/pkg/cluster/check/etcd.go +++ b/pkg/cluster/check/etcd.go @@ -21,8 +21,6 @@ import ( ) // EtcdConsistentAssertion checks that etcd membership is consistent across nodes. -// -//nolint:gocyclo func EtcdConsistentAssertion(ctx context.Context, cl ClusterInfo) error { cli, err := cl.Client() if err != nil { diff --git a/pkg/cluster/check/kubernetes.go b/pkg/cluster/check/kubernetes.go index 1dd18579fa..7b24df49b2 100644 --- a/pkg/cluster/check/kubernetes.go +++ b/pkg/cluster/check/kubernetes.go @@ -25,8 +25,6 @@ import ( ) // K8sAllNodesReportedAssertion checks whether all the nodes show up in node list. -// -//nolint:gocyclo func K8sAllNodesReportedAssertion(ctx context.Context, cl ClusterInfo) error { clientset, err := cl.K8sClient(ctx) if err != nil { @@ -387,8 +385,6 @@ func ReplicaSetPresent(ctx context.Context, cluster cluster.K8sProvider, namespa } // K8sControlPlaneStaticPods checks whether all the controlplane nodes are running required Kubernetes static pods. -// -//nolint:gocyclo,cyclop func K8sControlPlaneStaticPods(ctx context.Context, cl ClusterInfo) error { expectedNodes := append(cl.NodesByType(machine.TypeInit), cl.NodesByType(machine.TypeControlPlane)...) diff --git a/pkg/cluster/crashdump.go b/pkg/cluster/crashdump.go index c802ff7025..d42247b09e 100644 --- a/pkg/cluster/crashdump.go +++ b/pkg/cluster/crashdump.go @@ -33,8 +33,6 @@ var LogLinesPerService = map[string]int32{ // CrashDump produces information to help with debugging. // // CrashDump implements CrashDumper interface. -// -//nolint:gocyclo func (s *APICrashDumper) CrashDump(ctx context.Context, out io.Writer) { cli, err := s.Client() if err != nil { diff --git a/pkg/cluster/kubernetes/patch.go b/pkg/cluster/kubernetes/patch.go index a0d3e540bf..a5b8438c90 100644 --- a/pkg/cluster/kubernetes/patch.go +++ b/pkg/cluster/kubernetes/patch.go @@ -18,8 +18,6 @@ import ( ) // patchNodeConfig updates node configuration by means of patch function. -// -//nolint:gocyclo func patchNodeConfig(ctx context.Context, cluster UpgradeProvider, node string, patchFunc func(config *v1alpha1config.Config) error) error { c, err := cluster.Client() if err != nil { diff --git a/pkg/cluster/kubernetes/talos_managed.go b/pkg/cluster/kubernetes/talos_managed.go index 30774b1c06..e553fc7980 100644 --- a/pkg/cluster/kubernetes/talos_managed.go +++ b/pkg/cluster/kubernetes/talos_managed.go @@ -41,7 +41,7 @@ type UpgradeProvider interface { // Upgrade the Kubernetes control plane components, manifests, kubelets. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func Upgrade(ctx context.Context, cluster UpgradeProvider, options UpgradeOptions) error { if !options.Path.IsSupported() { return fmt.Errorf("unsupported upgrade path %s (from %q to %q)", options.Path, options.Path.FromVersion(), options.Path.ToVersion()) @@ -405,7 +405,6 @@ func upgradeStaticPodPatcher(options UpgradeOptions, service string, configResou } } -//nolint:gocyclo func getManifests(ctx context.Context, cluster UpgradeProvider) ([]*unstructured.Unstructured, error) { talosclient, err := cluster.Client() if err != nil { @@ -422,7 +421,6 @@ func getManifests(ctx context.Context, cluster UpgradeProvider) ([]*unstructured return manifests.GetBootstrapManifests(ctx, talosclient.COSI, nil) } -//nolint:gocyclo func syncManifests(ctx context.Context, objects []*unstructured.Unstructured, cluster UpgradeProvider, options UpgradeOptions) error { config, err := cluster.K8sRestConfig(ctx) if err != nil { diff --git a/pkg/imager/filemap/filemap.go b/pkg/imager/filemap/filemap.go index 322d7e77bf..718a5d8369 100644 --- a/pkg/imager/filemap/filemap.go +++ b/pkg/imager/filemap/filemap.go @@ -42,7 +42,7 @@ func Layer(filemap []File) (v1.Layer, error) { return err } - defer in.Close() // nolint: errcheck + defer in.Close() //nolint:errcheck st, err := in.Stat() if err != nil { diff --git a/pkg/imager/profile/profile.go b/pkg/imager/profile/profile.go index 9817f52dd6..dabb93c7b4 100644 --- a/pkg/imager/profile/profile.go +++ b/pkg/imager/profile/profile.go @@ -111,8 +111,6 @@ func (p *Profile) Validate() error { } // OutputPath generates the output path for the profile. -// -//nolint:gocyclo func (p *Profile) OutputPath() string { path := p.Platform diff --git a/pkg/kubernetes/inject/serviceaccount.go b/pkg/kubernetes/inject/serviceaccount.go index 543ae1c48b..3697d2e8a5 100644 --- a/pkg/kubernetes/inject/serviceaccount.go +++ b/pkg/kubernetes/inject/serviceaccount.go @@ -179,8 +179,6 @@ func isServiceAccount(raw map[string]any) bool { // injectToDocument takes a single YAML document and attempts to inject a ServiceAccount // into it if it is a known Kubernetes resource type which contains a corev1.PodSpec. -// -//nolint:gocyclo func injectToObject(raw map[string]any) (metav1.Object, error) { var err error diff --git a/pkg/machinery/client/client.go b/pkg/machinery/client/client.go index 8718318447..8cee9492c4 100644 --- a/pkg/machinery/client/client.go +++ b/pkg/machinery/client/client.go @@ -784,7 +784,7 @@ func (c *Client) ClusterHealthCheck(ctx context.Context, waitTimeout time.Durati // // Deprecated: Use EtcdRemoveMemberByID instead. func (c *Client) EtcdRemoveMember(ctx context.Context, req *machineapi.EtcdRemoveMemberRequest, callOptions ...grpc.CallOption) error { - resp, err := c.MachineClient.EtcdRemoveMember(ctx, req, callOptions...) //nolint:staticcheck + resp, err := c.MachineClient.EtcdRemoveMember(ctx, req, callOptions...) if err == nil { _, err = FilterMessages(resp, err) @@ -983,8 +983,6 @@ type MachineStream interface { } // ReadStream converts grpc stream into io.Reader. -// -//nolint:gocyclo func ReadStream(stream MachineStream) (io.ReadCloser, error) { pr, pw := io.Pipe() @@ -998,7 +996,7 @@ func ReadStream(stream MachineStream) (io.ReadCloser, error) { if errors.Is(err, io.EOF) || StatusCode(err) == codes.Canceled || StatusCode(err) == codes.DeadlineExceeded { return } - //nolint:errcheck + pw.CloseWithError(err) return @@ -1012,7 +1010,7 @@ func ReadStream(stream MachineStream) (io.ReadCloser, error) { } if data.Metadata != nil && data.Metadata.Error != "" { - pw.CloseWithError(metaToErr(data.Metadata)) //nolint:errcheck + pw.CloseWithError(metaToErr(data.Metadata)) return } diff --git a/pkg/machinery/client/events.go b/pkg/machinery/client/events.go index ebd55e2e99..bf370b664d 100644 --- a/pkg/machinery/client/events.go +++ b/pkg/machinery/client/events.go @@ -144,7 +144,7 @@ type EventResult struct { // It blocks until the first (empty) event is received, then spawns a goroutine that sends events to the given channel. // EventResult objects sent into the channel contain either the errors or the received events. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (c *Client) EventsWatchV2(ctx context.Context, ch chan<- EventResult, opts ...EventsOptionFunc) error { ctx, cancel := context.WithCancel(ctx) diff --git a/pkg/machinery/client/resolver/roundrobin.go b/pkg/machinery/client/resolver/roundrobin.go index d5b4882fc0..a40ea3e392 100644 --- a/pkg/machinery/client/resolver/roundrobin.go +++ b/pkg/machinery/client/resolver/roundrobin.go @@ -68,7 +68,6 @@ func EnsureEndpointsHavePorts(endpoints []string, defaultPort int) []string { func (r *roundRobinResolver) start() error { var addrs []resolver.Address //nolint:prealloc - //nolint:staticcheck endpoints := strings.Split(r.target.Endpoint(), ",") for _, addr := range endpoints { diff --git a/pkg/machinery/config/configloader/configloader.go b/pkg/machinery/config/configloader/configloader.go index 01ef5873d9..9abd785989 100644 --- a/pkg/machinery/config/configloader/configloader.go +++ b/pkg/machinery/config/configloader/configloader.go @@ -14,7 +14,7 @@ import ( "github.com/siderolabs/talos/pkg/machinery/config" "github.com/siderolabs/talos/pkg/machinery/config/configloader/internal/decoder" "github.com/siderolabs/talos/pkg/machinery/config/container" - _ "github.com/siderolabs/talos/pkg/machinery/config/types" //nolint:revive + _ "github.com/siderolabs/talos/pkg/machinery/config/types" // import config types to register them ) // ErrNoConfig is returned when no configuration was found in the input. diff --git a/pkg/machinery/config/configloader/internal/decoder/decoder.go b/pkg/machinery/config/configloader/internal/decoder/decoder.go index 1e6c068c98..70d67d2065 100644 --- a/pkg/machinery/config/configloader/internal/decoder/decoder.go +++ b/pkg/machinery/config/configloader/internal/decoder/decoder.go @@ -89,7 +89,7 @@ func parse(r io.Reader) (decoded []config.Document, err error) { } } -//nolint:gocyclo,cyclop +//nolint:gocyclo func decode(manifest *yaml.Node) (target config.Document, err error) { var ( version string diff --git a/pkg/machinery/config/types/types.go b/pkg/machinery/config/types/types.go index fdbe8415fb..79a37f51e2 100644 --- a/pkg/machinery/config/types/types.go +++ b/pkg/machinery/config/types/types.go @@ -6,7 +6,7 @@ package types import ( - _ "github.com/siderolabs/talos/pkg/machinery/config/types/runtime" //nolint:revive - _ "github.com/siderolabs/talos/pkg/machinery/config/types/siderolink" - _ "github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1" + _ "github.com/siderolabs/talos/pkg/machinery/config/types/runtime" // import config types to register them + _ "github.com/siderolabs/talos/pkg/machinery/config/types/siderolink" // import config types to register them + _ "github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1" // import config types to register them ) diff --git a/pkg/machinery/config/types/v1alpha1/generate/generate.go b/pkg/machinery/config/types/v1alpha1/generate/generate.go index 483e79afac..50693fbcd3 100644 --- a/pkg/machinery/config/types/v1alpha1/generate/generate.go +++ b/pkg/machinery/config/types/v1alpha1/generate/generate.go @@ -82,8 +82,6 @@ func NewSecretsBundle(clock Clock, opts ...GenOption) (*SecretsBundle, error) { // of a Kubernetes PKI directory (typically `/etc/kubernetes/pki`) and using the provided bootstrapToken as input. // // Deprecated: use generate.NewSecretsBundleFromKubernetesPKI instead. -// -//nolint:gocyclo func NewSecretsBundleFromKubernetesPKI(pkiDir, bootstrapToken string, versionContract *config.VersionContract) (*SecretsBundle, error) { return secrets.NewBundleFromKubernetesPKI(pkiDir, bootstrapToken, versionContract) } diff --git a/pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go b/pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go index e21ad5c01f..6c45b099ac 100644 --- a/pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go +++ b/pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go @@ -355,8 +355,6 @@ func isValidDNSName(name string) bool { } // Validate validates the config. -// -//nolint:gocyclo func (c *ClusterConfig) Validate() error { var result *multierror.Error @@ -472,8 +470,6 @@ func (manifests ClusterInlineManifests) Validate() error { } // Validate the discovery config. -// -//nolint:gocyclo func (c *ClusterDiscoveryConfig) Validate(clusterCfg *ClusterConfig) error { var result *multierror.Error diff --git a/pkg/machinery/extensions/config.go b/pkg/machinery/extensions/config.go index f891aba506..7c4488dcb4 100644 --- a/pkg/machinery/extensions/config.go +++ b/pkg/machinery/extensions/config.go @@ -10,7 +10,6 @@ import ( "gopkg.in/yaml.v3" ) -//nolint:lll //go:generate deep-copy -type Layer -header-file ../../../hack/boilerplate.txt -o deep_copy.generated.go . // Config specifies Talos installer extensions configuration. diff --git a/pkg/machinery/resources/cri/seccomp_profile.go b/pkg/machinery/resources/cri/seccomp_profile.go index 9870d370e6..8c5ad28d1e 100644 --- a/pkg/machinery/resources/cri/seccomp_profile.go +++ b/pkg/machinery/resources/cri/seccomp_profile.go @@ -13,7 +13,6 @@ import ( "github.com/siderolabs/talos/pkg/machinery/proto" ) -//nolint:lll //go:generate deep-copy -type SeccompProfileSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . // SeccompProfileType is type of SeccompProfile resource. diff --git a/pkg/machinery/resources/k8s/admissioncontrol_config.go b/pkg/machinery/resources/k8s/admissioncontrol_config.go index 08e7f01265..690eb28b39 100644 --- a/pkg/machinery/resources/k8s/admissioncontrol_config.go +++ b/pkg/machinery/resources/k8s/admissioncontrol_config.go @@ -3,8 +3,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // Package k8s provides resources which interface with Kubernetes. -// -//nolint:dupl package k8s import ( diff --git a/pkg/machinery/resources/k8s/apiserver_config.go b/pkg/machinery/resources/k8s/apiserver_config.go index fee7d70f14..94f365bb42 100644 --- a/pkg/machinery/resources/k8s/apiserver_config.go +++ b/pkg/machinery/resources/k8s/apiserver_config.go @@ -3,8 +3,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // Package k8s provides resources which interface with Kubernetes. -// -//nolint:dupl package k8s import ( diff --git a/pkg/machinery/resources/k8s/auditpolicy_config.go b/pkg/machinery/resources/k8s/auditpolicy_config.go index ecfe50fcc4..78bed028c4 100644 --- a/pkg/machinery/resources/k8s/auditpolicy_config.go +++ b/pkg/machinery/resources/k8s/auditpolicy_config.go @@ -3,8 +3,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // Package k8s provides resources which interface with Kubernetes. -// -//nolint:dupl package k8s import ( diff --git a/pkg/machinery/resources/k8s/controllermanager_config.go b/pkg/machinery/resources/k8s/controllermanager_config.go index e8df86fb42..da4b980142 100644 --- a/pkg/machinery/resources/k8s/controllermanager_config.go +++ b/pkg/machinery/resources/k8s/controllermanager_config.go @@ -3,8 +3,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // Package k8s provides resources which interface with Kubernetes. -// -//nolint:dupl package k8s import ( diff --git a/pkg/machinery/resources/k8s/extramanifests_config.go b/pkg/machinery/resources/k8s/extramanifests_config.go index 3dc81e0a1a..de26ac4ef4 100644 --- a/pkg/machinery/resources/k8s/extramanifests_config.go +++ b/pkg/machinery/resources/k8s/extramanifests_config.go @@ -3,8 +3,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // Package k8s provides resources which interface with Kubernetes. -// -//nolint:dupl package k8s import ( diff --git a/pkg/machinery/resources/k8s/k8s.go b/pkg/machinery/resources/k8s/k8s.go index 03fbf96b08..9786d4fbec 100644 --- a/pkg/machinery/resources/k8s/k8s.go +++ b/pkg/machinery/resources/k8s/k8s.go @@ -7,7 +7,6 @@ package k8s import "github.com/cosi-project/runtime/pkg/resource" -//nolint:lll //go:generate deep-copy -type AdmissionControlConfigSpec -type APIServerConfigSpec -type AuditPolicyConfigSpec -type BootstrapManifestsConfigSpec -type ConfigStatusSpec -type ControllerManagerConfigSpec -type EndpointSpec -type ExtraManifestsConfigSpec -type KubeletLifecycleSpec -type KubePrismConfigSpec -type KubePrismEndpointsSpec -type KubePrismStatusesSpec -type KubeletSpecSpec -type ManifestSpec -type ManifestStatusSpec -type NodeCordonedSpecSpec -type NodeLabelSpecSpec -type NodeTaintSpecSpec -type KubeletConfigSpec -type NodeIPSpec -type NodeIPConfigSpec -type NodeStatusSpec -type NodenameSpec -type SchedulerConfigSpec -type SecretsStatusSpec -type StaticPodSpec -type StaticPodStatusSpec -type StaticPodServerStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . // NamespaceName contains resources supporting Kubernetes components on all node types. diff --git a/pkg/machinery/resources/k8s/manifests_config.go b/pkg/machinery/resources/k8s/manifests_config.go index bdd63149d8..016c88374d 100644 --- a/pkg/machinery/resources/k8s/manifests_config.go +++ b/pkg/machinery/resources/k8s/manifests_config.go @@ -3,8 +3,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // Package k8s provides resources which interface with Kubernetes. -// -//nolint:dupl package k8s import ( diff --git a/pkg/machinery/resources/k8s/scheduler_config.go b/pkg/machinery/resources/k8s/scheduler_config.go index bb58334ac7..7e6727fb48 100644 --- a/pkg/machinery/resources/k8s/scheduler_config.go +++ b/pkg/machinery/resources/k8s/scheduler_config.go @@ -3,8 +3,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // Package k8s provides resources which interface with Kubernetes. -// -//nolint:dupl package k8s import ( diff --git a/pkg/machinery/resources/kubespan/config.go b/pkg/machinery/resources/kubespan/config.go index 780e8ccd7f..e3d85649d8 100644 --- a/pkg/machinery/resources/kubespan/config.go +++ b/pkg/machinery/resources/kubespan/config.go @@ -14,7 +14,6 @@ import ( "github.com/siderolabs/talos/pkg/machinery/resources/config" ) -//nolint:lll //go:generate deep-copy -type ConfigSpec -type EndpointSpec -type IdentitySpec -type PeerSpecSpec -type PeerStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . // ConfigType is type of Config resource. diff --git a/pkg/machinery/resources/network/address_spec.go b/pkg/machinery/resources/network/address_spec.go index a79997c8cd..1639db5669 100644 --- a/pkg/machinery/resources/network/address_spec.go +++ b/pkg/machinery/resources/network/address_spec.go @@ -16,7 +16,6 @@ import ( "github.com/siderolabs/talos/pkg/machinery/proto" ) -//nolint:lll //go:generate deep-copy -type AddressSpecSpec -type AddressStatusSpec -type HardwareAddrSpec -type HostnameSpecSpec -type HostnameStatusSpec -type LinkRefreshSpec -type LinkSpecSpec -type LinkStatusSpec -type NodeAddressSpec -type NodeAddressFilterSpec -type OperatorSpecSpec -type ProbeSpecSpec -type ProbeStatusSpec -type ResolverSpecSpec -type ResolverStatusSpec -type RouteSpecSpec -type RouteStatusSpec -type StatusSpec -type TimeServerSpecSpec -type TimeServerStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . // AddressSpecType is type of AddressSpec resource. diff --git a/pkg/machinery/resources/network/link_spec.go b/pkg/machinery/resources/network/link_spec.go index 7231a16047..3c0689f6f6 100644 --- a/pkg/machinery/resources/network/link_spec.go +++ b/pkg/machinery/resources/network/link_spec.go @@ -81,8 +81,6 @@ type BridgeSlave struct { } // Merge with other, overwriting fields from other if set. -// -//nolint:gocyclo func (spec *LinkSpecSpec) Merge(other *LinkSpecSpec) error { // prefer Logical, as it is defined for bonds/vlans, etc. updateIfNotZero(&spec.Logical, other.Logical) diff --git a/pkg/machinery/resources/perf/cpu.go b/pkg/machinery/resources/perf/cpu.go index 148fbe1f0e..e44bb7338b 100644 --- a/pkg/machinery/resources/perf/cpu.go +++ b/pkg/machinery/resources/perf/cpu.go @@ -13,7 +13,6 @@ import ( "github.com/siderolabs/talos/pkg/machinery/proto" ) -//nolint:lll //go:generate deep-copy -type CPUSpec -type MemorySpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . // CPUType is type of Etcd resource. diff --git a/pkg/machinery/resources/runtime/runtime.go b/pkg/machinery/resources/runtime/runtime.go index 6d55990d78..7cfb376016 100644 --- a/pkg/machinery/resources/runtime/runtime.go +++ b/pkg/machinery/resources/runtime/runtime.go @@ -4,5 +4,4 @@ package runtime -//nolint:lll //go:generate deep-copy -type DevicesStatusSpec -type EventSinkConfigSpec -type KernelModuleSpecSpec -type KernelParamSpecSpec -type KernelParamStatusSpec -type KmsgLogConfigSpec -type MaintenanceServiceConfigSpec -type MaintenanceServiceRequestSpec -type MachineStatusSpec -type MetaKeySpec -type MountStatusSpec -type PlatformMetadataSpec -type SecurityStateSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . diff --git a/pkg/machinery/resources/secrets/secrets.go b/pkg/machinery/resources/secrets/secrets.go index a182f4139f..768fd8e56c 100644 --- a/pkg/machinery/resources/secrets/secrets.go +++ b/pkg/machinery/resources/secrets/secrets.go @@ -10,5 +10,4 @@ import "github.com/cosi-project/runtime/pkg/resource" // NamespaceName contains resources containing secret material. const NamespaceName resource.Namespace = "secrets" -//nolint:lll //go:generate deep-copy -type APICertsSpec -type CertSANSpec -type EtcdCertsSpec -type EtcdRootSpec -type KubeletSpec -type KubernetesCertsSpec -type KubernetesDynamicCertsSpec -type KubernetesRootSpec -type MaintenanceServiceCertsSpec -type MaintenanceRootSpec -type OSRootSpec -type TrustdCertsSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . diff --git a/pkg/machinery/resources/siderolink/siderolink.go b/pkg/machinery/resources/siderolink/siderolink.go index 9070702423..dc6e0fce83 100644 --- a/pkg/machinery/resources/siderolink/siderolink.go +++ b/pkg/machinery/resources/siderolink/siderolink.go @@ -15,7 +15,6 @@ import ( "github.com/siderolabs/talos/pkg/machinery/resources/config" ) -//nolint:lll //go:generate deep-copy -type ConfigSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . // ConfigType is type of Config resource. diff --git a/pkg/machinery/resources/time/time.go b/pkg/machinery/resources/time/time.go index c173b1d615..7670703e57 100644 --- a/pkg/machinery/resources/time/time.go +++ b/pkg/machinery/resources/time/time.go @@ -5,5 +5,4 @@ // Package time provides time-related resources. package time -//nolint:lll //go:generate deep-copy -type AdjtimeStatusSpec -type StatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . diff --git a/pkg/machinery/resources/v1alpha1/v1alpha1.go b/pkg/machinery/resources/v1alpha1/v1alpha1.go index 23eebf77f5..69f70676dc 100644 --- a/pkg/machinery/resources/v1alpha1/v1alpha1.go +++ b/pkg/machinery/resources/v1alpha1/v1alpha1.go @@ -7,7 +7,6 @@ package v1alpha1 import "github.com/cosi-project/runtime/pkg/resource" -//nolint:lll //go:generate deep-copy -type AcquireConfigSpecSpec -type AcquireConfigStatusSpec -type ServiceSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go . // NamespaceName contains resources linking v1alpha2 components with v1alpha1 Talos runtime. diff --git a/pkg/provision/providers/vm/launch.go b/pkg/provision/providers/vm/launch.go index 1757edbfa7..fecc704fb7 100644 --- a/pkg/provision/providers/vm/launch.go +++ b/pkg/provision/providers/vm/launch.go @@ -133,7 +133,7 @@ func NewHTTPServer(gatewayAddr netip.Addr, port int, config []byte, controller C httpServer.AddHandler( "/status", httpGetWrapper( func(w io.Writer) { - json.NewEncoder(w).Encode(controller.Status()) //nolint:errcheck,errchkjson + json.NewEncoder(w).Encode(controller.Status()) //nolint:errcheck }, ), ) diff --git a/pkg/provision/providers/vm/network.go b/pkg/provision/providers/vm/network.go index d2e013d3ab..241d94e74c 100644 --- a/pkg/provision/providers/vm/network.go +++ b/pkg/provision/providers/vm/network.go @@ -32,7 +32,7 @@ import ( // so that interface name is defined by network name, and different networks have // different bridge interfaces. // -//nolint:gocyclo,cyclop +//nolint:gocyclo func (p *Provisioner) CreateNetwork(ctx context.Context, state *State, network provision.NetworkRequest, options provision.Options) error { networkNameHash := sha256.Sum256([]byte(network.Name)) state.BridgeName = fmt.Sprintf("%s%s", "talos", hex.EncodeToString(networkNameHash[:])[:8]) diff --git a/pkg/startup/rand.go b/pkg/startup/rand.go deleted file mode 100644 index 10c21be558..0000000000 --- a/pkg/startup/rand.go +++ /dev/null @@ -1,25 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -package startup - -import ( - cryptorand "crypto/rand" - "encoding/binary" - "fmt" - "math/rand" -) - -// RandSeed default math/rand PRNG. -func RandSeed() error { - seed := make([]byte, 8) - if _, err := cryptorand.Read(seed); err != nil { - return fmt.Errorf("error seeding rand: %w", err) - } - - // nolint:staticcheck - rand.Seed(int64(binary.LittleEndian.Uint64(seed))) - - return nil -}