From 063950e239af0a1ba5de6e2f3105d99d8a69458f Mon Sep 17 00:00:00 2001 From: Dmitriy Matrenichev Date: Tue, 4 Oct 2022 18:30:34 +0300 Subject: [PATCH] chore: bump golangci-lint to v1.50.0 I had to do several things: - contextcheck now supports Go 1.18 generics, but I had to disable it because of this https://github.com/kkHAIKE/contextcheck/issues/9 - dupword produces to many false positives, so it's also disabled - revive found all packages which didn't have a documentation comment before. And tehre is A LOT of them. I updated some of them, but gave up at some point and just added them to exclude rules for now. - change lint-vulncheck to use `base` stage as base Signed-off-by: Dmitriy Matrenichev --- .golangci.yml | 234 ++++++++++++++++++ Dockerfile | 2 +- Makefile | 4 +- cmd/installer/cmd/root.go | 1 + cmd/installer/main.go | 1 + cmd/installer/pkg/epoch.go | 1 + cmd/installer/pkg/install/extensions.go | 1 + cmd/installer/pkg/install/manifest.go | 1 + cmd/installer/pkg/ova/ova.go | 1 + cmd/talosctl/cmd/docs.go | 3 +- cmd/talosctl/cmd/mgmt/gen/ca.go | 1 + cmd/talosctl/cmd/talos/pcap.go | 2 + cmd/talosctl/main.go | 1 + cmd/talosctl/pkg/mgmt/helpers/artifacts.go | 1 + cmd/talosctl/pkg/talos/global/client.go | 1 + cmd/talosctl/pkg/talos/helpers/mode.go | 2 +- internal/app/apid/main.go | 1 + .../app/apid/pkg/director/local_address.go | 2 +- internal/app/init/main.go | 1 + .../server/v1alpha1/v1alpha1_cluster.go | 1 + internal/app/machined/main.go | 1 + .../pkg/controllers/hardware/hardware.go | 1 + .../app/machined/pkg/controllers/k8s/k8s.go | 2 +- .../pkg/controllers/network/cmdline.go | 2 +- .../pkg/controllers/runtime/runtime.go | 6 + internal/app/machined/pkg/runtime/runtime.go | 2 +- .../board/bananapi_m64/bananapi_m64.go | 1 + .../pkg/runtime/v1alpha1/board/board.go | 1 + .../v1alpha1/board/jetson_nano/jetson_nano.go | 1 + .../libretech_all_h3_cc_h5.go | 1 + .../v1alpha1/board/nanopi_r4s/nanopi_r4s.go | 1 + .../runtime/v1alpha1/board/pine64/pine64.go | 1 + .../runtime/v1alpha1/board/rock64/rock64.go | 1 + .../runtime/v1alpha1/board/rockpi4/rockpi4.go | 1 + .../v1alpha1/board/rockpi4c/rockpi4c.go | 1 + .../pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go | 1 + .../v1alpha1/board/rpi_generic/rpi_generic.go | 1 + .../runtime/v1alpha1/bootloader/bootloader.go | 1 + .../pkg/runtime/v1alpha1/platform/aws/aws.go | 1 + .../runtime/v1alpha1/platform/azure/azure.go | 1 + .../v1alpha1/platform/container/container.go | 1 + .../platform/digitalocean/digitalocean.go | 1 + .../v1alpha1/platform/equinixmetal/equinix.go | 1 + .../v1alpha1/platform/errors/errors.go | 1 + .../pkg/runtime/v1alpha1/platform/gcp/gcp.go | 1 + .../v1alpha1/platform/hcloud/hcloud.go | 1 + .../runtime/v1alpha1/platform/metal/metal.go | 1 + .../v1alpha1/platform/nocloud/metadata.go | 1 + .../v1alpha1/platform/openstack/openstack.go | 1 + .../v1alpha1/platform/oracle/oracle.go | 1 + .../pkg/runtime/v1alpha1/platform/platform.go | 1 + .../v1alpha1/platform/scaleway/scaleway.go | 1 + .../v1alpha1/platform/upcloud/upcloud.go | 1 + .../runtime/v1alpha1/platform/utils/utils.go | 1 + .../v1alpha1/platform/vmware/vmware_amd64.go | 1 + .../runtime/v1alpha1/platform/vultr/vultr.go | 1 + .../v1alpha1/v1alpha1_priority_lock.go | 1 + .../v1alpha1/v1alpha1_sequencer_tasks.go | 2 +- .../app/machined/pkg/system/runner/runner.go | 1 + .../machined/pkg/system/services/machined.go | 12 +- .../app/machined/pkg/system/services/udevd.go | 3 +- internal/app/machined/pkg/system/system.go | 4 +- internal/app/storaged/server.go | 1 + internal/pkg/configuration/configuration.go | 1 + internal/pkg/containers/container.go | 1 + internal/pkg/smbios/smbios.go | 1 + pkg/cluster/sonobuoy/sonobuoy.go | 2 +- pkg/conditions/all.go | 1 + pkg/copy/copy.go | 1 + pkg/grpc/dialer/dialer.go | 1 + pkg/grpc/factory/factory.go | 2 +- pkg/grpc/middleware/authz/metadata.go | 2 +- pkg/kernel/kernel.go | 1 + pkg/kernel/kspp/kspp.go | 1 + pkg/machinery/config/provider.go | 8 + .../types/v1alpha1/generate/example_test.go | 2 +- pkg/machinery/constants/constants.go | 2 +- pkg/machinery/proto/proto_test.go | 2 + pkg/machinery/role/role.go | 2 +- pkg/reporter/reporter.go | 1 + pkg/safepath/safepath.go | 1 + pkg/tail/tail.go | 1 + pkg/version/version.go | 1 + 83 files changed, 339 insertions(+), 25 deletions(-) create mode 100644 internal/app/machined/pkg/controllers/runtime/runtime.go diff --git a/.golangci.yml b/.golangci.yml index 28e4237aff4..f52d43f885f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -167,6 +167,8 @@ linters: - typecheck - varnamelen # too annoying - wrapcheck + - contextcheck # enable once golangci-lint 1.50.1 or 1.51 lands + - dupword # too annoying # abandoned linters for which golangci shows the warning that the repo is archived by the owner - golint @@ -196,6 +198,238 @@ issues: - path: internal/app/machined/pkg/system/services linters: - dupl + - path: cmd/installer/pkg/qemuimg + text: "should have a package comment" + linters: + - revive + - path: cmd/talosctl/cmd/mgmt + text: "should have a package comment" + linters: + - revive + - path: cmd/talosctl/cmd/mgmt/inject + text: "should have a package comment" + linters: + - revive + - path: cmd/talosctl/cmd/talos + text: "should have a package comment" + linters: + - revive + - path: cmd/talosctl/pkg/talos/action + text: "should have a package comment" + linters: + - revive + - path: cmd/talosctl/pkg/talos/global + text: "should have a package comment" + linters: + - revive + - path: cmd/talosctl/pkg/talos/helpers + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/controllers/cri + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/controllers/kubeaccess/serviceaccount + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/controllers/perf + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/system/events + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/system/health + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/system/runner/containerd + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/system/runner/goroutine + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/system/runner/process + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/system/runner/restart + text: "should have a package comment" + linters: + - revive + - path: internal/app/machined/pkg/system + text: "should have a package comment" + linters: + - revive + - path: internal/app/maintenance + text: "should have a package comment" + linters: + - revive + - path: internal/app/maintenance/server + text: "should have a package comment" + linters: + - revive + - path: internal/app/poweroff + text: "should have a package comment" + linters: + - revive + - path: internal/app/trustd/internal/reg + text: "should have a package comment" + linters: + - revive + - path: internal/app/trustd + text: "should have a package comment" + linters: + - revive + - path: internal/pkg/containers/image + text: "should have a package comment" + linters: + - revive + - path: internal/pkg/etcd + text: "should have a package comment" + linters: + - revive + - path: internal/pkg/install + text: "should have a package comment" + linters: + - revive + - path: internal/pkg/mount + text: "should have a package comment" + linters: + - revive + - path: internal/pkg/mount/switchroot + text: "should have a package comment" + linters: + - revive + - path: internal/pkg/tui/components + text: "should have a package comment" + linters: + - revive + - path: pkg/argsbuilder + text: "should have a package comment" + linters: + - revive + - path: pkg/chunker + text: "should have a package comment" + linters: + - revive + - path: pkg/chunker/file + text: "should have a package comment" + linters: + - revive + - path: pkg/chunker/stream + text: "should have a package comment" + linters: + - revive + - path: pkg/download + text: "should have a package comment" + linters: + - revive + - path: pkg/grpc/dialer + text: "should have a package comment" + linters: + - revive + - path: pkg/grpc/factory + text: "should have a package comment" + linters: + - revive + - path: pkg/grpc/gen + text: "should have a package comment" + linters: + - revive + - path: pkg/grpc/middleware/auth/basic + text: "should have a package comment" + linters: + - revive + - path: pkg/grpc/middleware/authz + text: "should have a package comment" + linters: + - revive + - path: pkg/kubernetes + text: "should have a package comment" + linters: + - revive + - path: pkg/kubernetes/inject + text: "should have a package comment" + linters: + - revive + - path: pkg/provision/providers + text: "should have a package comment" + linters: + - revive + - path: pkg/provision/providers/qemu + text: "should have a package comment" + linters: + - revive + - path: config/encoder + text: "should have a package comment" + linters: + - revive + - path: resources/kubespan + text: "should have a package comment" + linters: + - revive + - path: client/config + text: "should have a package comment" + linters: + - revive + - path: config/merge + text: "should have a package comment" + linters: + - revive + - path: config/types/v1alpha1/bundle + text: "should have a package comment" + linters: + - revive + - path: resources/cri + text: "should have a package comment" + linters: + - revive + - path: resources/runtime + text: "should have a package comment" + linters: + - revive + - path: kernel + text: "should have a package comment" + linters: + - revive + - path: constants + text: "should have a package comment" + linters: + - revive + - path: resources/perf + text: "should have a package comment" + linters: + - revive + - path: resources/cluster + text: "should have a package comment" + linters: + - revive + - path: role + text: "should have a package comment" + linters: + - revive + - path: resources/hardware + text: "should have a package comment" + linters: + - revive + - path: config/decoder + text: "should have a package comment" + linters: + - revive + - path: config/internal/cis + text: "should have a package comment" + linters: + - revive + - path: config/types/v1alpha1/machine + text: "should have a package comment" + linters: + - revive # pkg/machinery module - path: config/types/v1alpha1 diff --git a/Dockerfile b/Dockerfile index 28aeeb392d1..044a286a88f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -300,7 +300,7 @@ WORKDIR /src # The vulncheck target runs the vulnerability check tool. -FROM build-go AS lint-vulncheck +FROM base AS lint-vulncheck RUN --mount=type=cache,target=/.cache govulncheck ./... # The init target builds the init binary. diff --git a/Makefile b/Makefile index 94f7239b963..1bdd15622a8 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,8 @@ PKGS ?= v1.3.0-alpha.0-29-g91e73b3 EXTRAS ?= v1.3.0-alpha.0-1-g8f00d77 GO_VERSION ?= 1.19 GOIMPORTS_VERSION ?= v0.1.11 -GOFUMPT_VERSION ?= v0.3.0 -GOLANGCILINT_VERSION ?= v1.48.0 +GOFUMPT_VERSION ?= v0.4.0 +GOLANGCILINT_VERSION ?= v1.50.0 STRINGER_VERSION ?= v0.1.12 ENUMER_VERSION ?= v1.1.2 DEEPCOPY_GEN_VERSION ?= v0.21.3 diff --git a/cmd/installer/cmd/root.go b/cmd/installer/cmd/root.go index 4cd636a0270..feead61020c 100644 --- a/cmd/installer/cmd/root.go +++ b/cmd/installer/cmd/root.go @@ -2,6 +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/. +// Package cmd implements the installer command. package cmd import ( diff --git a/cmd/installer/main.go b/cmd/installer/main.go index d060e7d00cd..cd69e853040 100644 --- a/cmd/installer/main.go +++ b/cmd/installer/main.go @@ -2,6 +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/. +// Package installer provides the installer implementation. package main import "github.com/talos-systems/talos/cmd/installer/cmd" diff --git a/cmd/installer/pkg/epoch.go b/cmd/installer/pkg/epoch.go index 6a4c1caa67d..a3f6c0b17bb 100644 --- a/cmd/installer/pkg/epoch.go +++ b/cmd/installer/pkg/epoch.go @@ -2,6 +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/. +// Package pkg contains the installer cmd logic. package pkg import ( diff --git a/cmd/installer/pkg/install/extensions.go b/cmd/installer/pkg/install/extensions.go index 61469e52635..1e89de4e53c 100644 --- a/cmd/installer/pkg/install/extensions.go +++ b/cmd/installer/pkg/install/extensions.go @@ -2,6 +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/. +// Package install provides the installation routine. package install import ( diff --git a/cmd/installer/pkg/install/manifest.go b/cmd/installer/pkg/install/manifest.go index 09fdbfa0482..267dfb50d79 100644 --- a/cmd/installer/pkg/install/manifest.go +++ b/cmd/installer/pkg/install/manifest.go @@ -212,6 +212,7 @@ func (m *Manifest) checkMounts(device Device) error { } if !device.SkipOverlayMountsCheck && fields[len(fields)-2] == "overlay" { + //nolint:dupword // parsing options (last column) in the overlay mount line which looks like: // 163 70 0:52 /apid / ro,relatime - overlay overlay rw,lowerdir=/opt,upperdir=/var/system/overlays/opt-diff,workdir=/var/system/overlays/opt-workdir diff --git a/cmd/installer/pkg/ova/ova.go b/cmd/installer/pkg/ova/ova.go index f2a09163bd9..27cd44c1a30 100644 --- a/cmd/installer/pkg/ova/ova.go +++ b/cmd/installer/pkg/ova/ova.go @@ -2,6 +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/. +// Package ova implements OVA creation. package ova import ( diff --git a/cmd/talosctl/cmd/docs.go b/cmd/talosctl/cmd/docs.go index 0a7ce4385b5..931246541a9 100644 --- a/cmd/talosctl/cmd/docs.go +++ b/cmd/talosctl/cmd/docs.go @@ -2,6 +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/. +// Package cmd provides the talosctl command implementation. package cmd import ( @@ -98,7 +99,7 @@ var docsCmd = &cobra.Command{ }, } -// GenMarkdownReference is the the same as GenMarkdownTree, but +// GenMarkdownReference is the same as GenMarkdownTree, but // with custom filePrepender and linkHandler. func GenMarkdownReference(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { for _, c := range cmd.Commands() { diff --git a/cmd/talosctl/cmd/mgmt/gen/ca.go b/cmd/talosctl/cmd/mgmt/gen/ca.go index a668956abd6..c07cf375ca3 100644 --- a/cmd/talosctl/cmd/mgmt/gen/ca.go +++ b/cmd/talosctl/cmd/mgmt/gen/ca.go @@ -2,6 +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/. +// Package gen implements the genration of various artifacts. package gen import ( diff --git a/cmd/talosctl/cmd/talos/pcap.go b/cmd/talosctl/cmd/talos/pcap.go index 761a6ec46fe..4dfcbdcc27f 100644 --- a/cmd/talosctl/cmd/talos/pcap.go +++ b/cmd/talosctl/cmd/talos/pcap.go @@ -159,6 +159,8 @@ func dumpPackets(r io.Reader) error { // { 0x30, 0, 0, 0x00000000 }, // { 0x54, 0, 0, 0x000000f0 }, // { 0x15, 0, 8, 0x00000060 }, +// +//nolint:dupword func parseBPFInstructions(in string) ([]*machine.BPFInstruction, error) { in = strings.TrimSpace(in) diff --git a/cmd/talosctl/main.go b/cmd/talosctl/main.go index a703f43fcf0..9c68f1cdea3 100644 --- a/cmd/talosctl/main.go +++ b/cmd/talosctl/main.go @@ -2,6 +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/. +// Package talosctl provides the talosctl utility implementation. package main import ( diff --git a/cmd/talosctl/pkg/mgmt/helpers/artifacts.go b/cmd/talosctl/pkg/mgmt/helpers/artifacts.go index a607bc47d7a..1a1a0f6dbb2 100644 --- a/cmd/talosctl/pkg/mgmt/helpers/artifacts.go +++ b/cmd/talosctl/pkg/mgmt/helpers/artifacts.go @@ -2,6 +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/. +// Package helpers provides helpers for talosctl. package helpers import ( diff --git a/cmd/talosctl/pkg/talos/global/client.go b/cmd/talosctl/pkg/talos/global/client.go index 13858295d59..e5525c63087 100644 --- a/cmd/talosctl/pkg/talos/global/client.go +++ b/cmd/talosctl/pkg/talos/global/client.go @@ -2,6 +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/. +// Package global provides global flags for talosctl. package global import ( diff --git a/cmd/talosctl/pkg/talos/helpers/mode.go b/cmd/talosctl/pkg/talos/helpers/mode.go index d6a7a144005..97cdf3d4a22 100644 --- a/cmd/talosctl/pkg/talos/helpers/mode.go +++ b/cmd/talosctl/pkg/talos/helpers/mode.go @@ -20,7 +20,7 @@ import ( // Should be never passed to the API. const InteractiveMode machine.ApplyConfigurationRequest_Mode = -1 -// Mode apply, patch, edit config config update mode. +// Mode apply, patch, edit config update mode. type Mode struct { options map[string]machine.ApplyConfigurationRequest_Mode Mode machine.ApplyConfigurationRequest_Mode diff --git a/internal/app/apid/main.go b/internal/app/apid/main.go index f58613107cf..2d5c8db9731 100644 --- a/internal/app/apid/main.go +++ b/internal/app/apid/main.go @@ -2,6 +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/. +// Package apid implements apid functionality. package apid import ( diff --git a/internal/app/apid/pkg/director/local_address.go b/internal/app/apid/pkg/director/local_address.go index d27d8973eb8..c7d05a925a0 100644 --- a/internal/app/apid/pkg/director/local_address.go +++ b/internal/app/apid/pkg/director/local_address.go @@ -28,7 +28,7 @@ type localAddressProvider struct { } // NewLocalAddressProvider initializes and returns a new LocalAddressProvider. -func NewLocalAddressProvider(st state.State) (*localAddressProvider, error) { +func NewLocalAddressProvider(st state.State) (LocalAddressProvider, error) { p := &localAddressProvider{} evCh := make(chan state.Event) diff --git a/internal/app/init/main.go b/internal/app/init/main.go index 552d5e6e766..33c6e8754f4 100644 --- a/internal/app/init/main.go +++ b/internal/app/init/main.go @@ -2,6 +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/. +// Package init implements booting process. package main import ( diff --git a/internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go b/internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go index e9cbdd7f4fd..811181d6337 100644 --- a/internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go +++ b/internal/app/machined/internal/server/v1alpha1/v1alpha1_cluster.go @@ -2,6 +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/. +// Package runtime provides the runtime implementation. package runtime import ( diff --git a/internal/app/machined/main.go b/internal/app/machined/main.go index 4811eac7bd1..f1b908c1aa6 100644 --- a/internal/app/machined/main.go +++ b/internal/app/machined/main.go @@ -2,6 +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/. +// Package machined provides machined implementation. package main import ( diff --git a/internal/app/machined/pkg/controllers/hardware/hardware.go b/internal/app/machined/pkg/controllers/hardware/hardware.go index c0e3a629e45..435d173a9cf 100644 --- a/internal/app/machined/pkg/controllers/hardware/hardware.go +++ b/internal/app/machined/pkg/controllers/hardware/hardware.go @@ -2,4 +2,5 @@ // 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 hardware provides the hardware controller implementation. package hardware diff --git a/internal/app/machined/pkg/controllers/k8s/k8s.go b/internal/app/machined/pkg/controllers/k8s/k8s.go index 9aef70c2e2a..0b4fa5afc37 100644 --- a/internal/app/machined/pkg/controllers/k8s/k8s.go +++ b/internal/app/machined/pkg/controllers/k8s/k8s.go @@ -12,5 +12,5 @@ import ( func init() { // ugly hack, but it doesn't look like there's better API // cut out error handler which logs error to standard logger - utilruntime.ErrorHandlers = utilruntime.ErrorHandlers[len(utilruntime.ErrorHandlers)-1:] + utilruntime.ErrorHandlers = utilruntime.ErrorHandlers[len(utilruntime.ErrorHandlers)-1:] //nolint:reassign } diff --git a/internal/app/machined/pkg/controllers/network/cmdline.go b/internal/app/machined/pkg/controllers/network/cmdline.go index 467e6338770..536b8af7445 100644 --- a/internal/app/machined/pkg/controllers/network/cmdline.go +++ b/internal/app/machined/pkg/controllers/network/cmdline.go @@ -336,7 +336,7 @@ func ParseCmdlineNetwork(cmdline *procfs.Cmdline) (CmdlineNetworking, error) { // v1alpha1.Bond was chosen to re-use the `SetBondMaster` and `SetBondSlave` functions // ref: modinfo bonding // -//nolint:gocyclo,cyclop +//nolint:gocyclo,cyclop,dupword func parseBondOptions(options string) (v1alpha1.Bond, error) { var bond v1alpha1.Bond diff --git a/internal/app/machined/pkg/controllers/runtime/runtime.go b/internal/app/machined/pkg/controllers/runtime/runtime.go new file mode 100644 index 00000000000..25fd607cf93 --- /dev/null +++ b/internal/app/machined/pkg/controllers/runtime/runtime.go @@ -0,0 +1,6 @@ +// 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 runtime provides the runtime implementation. +package runtime diff --git a/internal/app/machined/pkg/runtime/runtime.go b/internal/app/machined/pkg/runtime/runtime.go index 2e27822eedd..40a5fb340d4 100644 --- a/internal/app/machined/pkg/runtime/runtime.go +++ b/internal/app/machined/pkg/runtime/runtime.go @@ -11,7 +11,7 @@ import ( ) // Runtime defines the runtime parameters. -type Runtime interface { +type Runtime interface { //nolint:interfacebloat Config() config.Provider LoadAndValidateConfig([]byte) (config.Provider, error) RollbackToConfigAfter([]byte, time.Duration) error diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go b/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go index c611ca51b90..8dcd8040ce7 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/bananapi_m64/bananapi_m64.go @@ -2,6 +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/. +// Package bananapim64 provides the Banana Pi M64 board implementation. package bananapim64 import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/board.go b/internal/app/machined/pkg/runtime/v1alpha1/board/board.go index 3bcf7d51953..e29cd6e3795 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/board.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/board.go @@ -2,6 +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/. +// Package board provides the function to discover the current board. package board import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go b/internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go index 774183be363..c170968b1c2 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go @@ -2,6 +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/. +// Package jetsonnano provides the Jetson Nano board implementation. package jetsonnano import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5/libretech_all_h3_cc_h5.go b/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5/libretech_all_h3_cc_h5.go index 4ecc54d350a..7c5f80ba8ab 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5/libretech_all_h3_cc_h5.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/libretech_all_h3_cc_h5/libretech_all_h3_cc_h5.go @@ -2,6 +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/. +// Package libretechallh3cch5 provides the LibretechAllH3CCH5 board implementation. package libretechallh3cch5 import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/nanopi_r4s/nanopi_r4s.go b/internal/app/machined/pkg/runtime/v1alpha1/board/nanopi_r4s/nanopi_r4s.go index ddaf58e23dc..91c2791868c 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/nanopi_r4s/nanopi_r4s.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/nanopi_r4s/nanopi_r4s.go @@ -2,6 +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/. +// Package nanopir4s provides the Nano Pi R4S board implementation. package nanopir4s import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go b/internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go index 10deb73da38..5712e32a1bd 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/pine64/pine64.go @@ -2,6 +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/. +// Package pine64 provides the Pine64 board implementation. package pine64 import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rock64/rock64.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rock64/rock64.go index 309ead70897..9c933a992fa 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rock64/rock64.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rock64/rock64.go @@ -2,6 +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/. +// Package rock64 provides the Pine64 Rock64 board implementation. package rock64 import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4/rockpi4.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4/rockpi4.go index 9a9d137d45c..f02cb504ef4 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4/rockpi4.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4/rockpi4.go @@ -2,6 +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/. +// Package rockpi4 provides the Radxa rock pi implementation. package rockpi4 import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4c/rockpi4c.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4c/rockpi4c.go index cbdf4c1bf9c..1b095b4066a 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4c/rockpi4c.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rockpi4c/rockpi4c.go @@ -2,6 +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/. +// Package rockpi4c provides the Radxa rock pi implementation. package rockpi4c import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go index c0a06004bbf..0e4748aad58 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_4/rpi_4.go @@ -2,6 +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/. +// Package rpi4 provides the Raspberry Pi 4 Model B implementation. package rpi4 import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_generic/rpi_generic.go b/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_generic/rpi_generic.go index 6a7743be0d5..9ec1e0c2da0 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_generic/rpi_generic.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/board/rpi_generic/rpi_generic.go @@ -2,6 +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/. +// Package rpigeneric provides the Raspberry Pi Compute Module 4 implementation. package rpigeneric import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/bootloader.go b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/bootloader.go index 9224080a41c..9eb273c7615 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/bootloader/bootloader.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/bootloader/bootloader.go @@ -2,6 +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/. +// Package bootloader provides bootloader implementation. package bootloader // Bootloader describes a bootloader. diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/aws/aws.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/aws/aws.go index 14455f63480..7e65b57d392 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/aws/aws.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/aws/aws.go @@ -2,6 +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/. +// Package aws contains the AWS implementation of the [platform.Platform]. package aws import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/azure.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/azure.go index d386299becf..44834e7a67f 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/azure.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/azure/azure.go @@ -2,6 +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/. +// Package azure contains the Azure implementation of the [platform.Platform]. package azure import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/container/container.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/container/container.go index 016243049a6..60b7afecc8f 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/container/container.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/container/container.go @@ -2,6 +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/. +// Package container contains the Container implementation of the [platform.Platform]. package container import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/digitalocean/digitalocean.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/digitalocean/digitalocean.go index 0a2006c59f9..c1b53d43006 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/digitalocean/digitalocean.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/digitalocean/digitalocean.go @@ -2,6 +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/. +// Package digitalocean contains the Digital Ocean implementation of the [platform.Platform]. package digitalocean import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/equinixmetal/equinix.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/equinixmetal/equinix.go index 000ec582357..f98ce513385 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/equinixmetal/equinix.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/equinixmetal/equinix.go @@ -2,6 +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/. +// Package equinixmetal contains the Equinix Metal implementation of the [platform.Platform]. package equinixmetal import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/errors/errors.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/errors/errors.go index e85a0c6ff71..b7a9c968ec1 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/errors/errors.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/errors/errors.go @@ -2,6 +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/. +// Package errors contains errors used by the platform package. package errors import "errors" diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/gcp/gcp.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/gcp/gcp.go index 75c5fee3a1c..d8566d56299 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/gcp/gcp.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/gcp/gcp.go @@ -2,6 +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/. +// Package gcp contains the GCP implementation of the [platform.Platform]. package gcp import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/hcloud/hcloud.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/hcloud/hcloud.go index f35aa131542..230a6e3838a 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/hcloud/hcloud.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/hcloud/hcloud.go @@ -2,6 +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/. +// Package hcloud contains the Hcloud implementation of the [platform.Platform]. package hcloud import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal.go index 44cd4617741..8b4d87c4da1 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal.go @@ -2,6 +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/. +// Package metal contains the metal implementation of the [platform.Platform]. package metal import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/metadata.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/metadata.go index 8a1b8d5d6c2..1f2c0d259b6 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/metadata.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/nocloud/metadata.go @@ -2,6 +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/. +// Package nocloud provides the NoCloud platform implementation. package nocloud import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go index bdea4fd3489..9988dec7d0b 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go @@ -2,6 +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/. +// Package openstack provides the Openstack platform implementation. package openstack import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/oracle/oracle.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/oracle/oracle.go index 7eb2d415808..37f9d591537 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/oracle/oracle.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/oracle/oracle.go @@ -2,6 +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/. +// Package oracle provides the Oracle platform implementation. package oracle import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/platform.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/platform.go index 02750c17020..a730f62cf75 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/platform.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/platform.go @@ -2,6 +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/. +// Package platform provides functions to get the [runtime.Platform]. package platform import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/scaleway/scaleway.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/scaleway/scaleway.go index f691a8a8db6..c39748179b9 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/scaleway/scaleway.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/scaleway/scaleway.go @@ -2,6 +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/. +// Package scaleway provides the Scaleway platform implementation. package scaleway import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/upcloud/upcloud.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/upcloud/upcloud.go index 25b8cc8969d..93199444061 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/upcloud/upcloud.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/upcloud/upcloud.go @@ -2,6 +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/. +// Package upcloud provides the UpCloud platform implementation. package upcloud import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/utils/utils.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/utils/utils.go index 5e05b7e8bae..8ee2386cb2a 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/utils/utils.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/utils/utils.go @@ -2,6 +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/. +// Package utils provides utility functions for the platform package. package utils import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware_amd64.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware_amd64.go index a35aa4947c4..d268f4ec475 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware_amd64.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/vmware/vmware_amd64.go @@ -4,6 +4,7 @@ //go:build amd64 +// Package vmware provides the VMware platform implementation. package vmware import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/vultr/vultr.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/vultr/vultr.go index 14646f288a4..827b97006a4 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/vultr/vultr.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/vultr/vultr.go @@ -2,6 +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/. +// Package vultr provides the Vultr platform implementation. package vultr import ( diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_priority_lock.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_priority_lock.go index 25c577d6ecc..b496b1400ed 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_priority_lock.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_priority_lock.go @@ -113,6 +113,7 @@ func (lock *PriorityLock[T]) Lock(ctx context.Context, takeOverTimeout time.Dura } } +// Unlock releases the lock. func (lock *PriorityLock[T]) Unlock() { var zeroSeq T diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go index 40840b6e6d4..7abdb557e79 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go @@ -1772,7 +1772,7 @@ func MountStatePartition(seq runtime.Sequence, data interface{}) (runtime.TaskEx var encryption config.Encryption // first try reading encryption from the config - // config always has the priority here + // which always has the priority here if r.Config() != nil && r.Config().Machine() != nil { encryption = r.Config().Machine().SystemDiskEncryption().Get(constants.StatePartitionLabel) } diff --git a/internal/app/machined/pkg/system/runner/runner.go b/internal/app/machined/pkg/system/runner/runner.go index c92988bd19d..4c47d125627 100644 --- a/internal/app/machined/pkg/system/runner/runner.go +++ b/internal/app/machined/pkg/system/runner/runner.go @@ -2,6 +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/. +// Package runner provides a runner for running services. package runner import ( diff --git a/internal/app/machined/pkg/system/services/machined.go b/internal/app/machined/pkg/system/services/machined.go index 7df22fcb0c6..f2f6bab434a 100644 --- a/internal/app/machined/pkg/system/services/machined.go +++ b/internal/app/machined/pkg/system/services/machined.go @@ -92,7 +92,7 @@ type machinedService struct { c runtime.Controller } -// Main is an entrypoint the the API service. +// Main is an entrypoint to the API service. func (s *machinedService) Main(ctx context.Context, r runtime.Runtime, logWriter io.Writer) error { injector := &authz.Injector{ Mode: authz.MetadataOnly, @@ -106,7 +106,7 @@ func (s *machinedService) Main(ctx context.Context, r runtime.Runtime, logWriter } // Start the API server. - server := factory.NewServer( + server := factory.NewServer( //nolint:contextcheck &v1alpha1server.Server{ Controller: s.c, // breaking the import loop cycle between services/ package and v1alpha1_server.go @@ -117,10 +117,10 @@ func (s *machinedService) Main(ctx context.Context, r runtime.Runtime, logWriter factory.WithLog("machined ", logWriter), factory.WithUnaryInterceptor(injector.UnaryInterceptor()), - factory.WithStreamInterceptor(injector.StreamInterceptor()), + factory.WithStreamInterceptor(injector.StreamInterceptor()), //nolint:contextcheck factory.WithUnaryInterceptor(authorizer.UnaryInterceptor()), - factory.WithStreamInterceptor(authorizer.StreamInterceptor()), + factory.WithStreamInterceptor(authorizer.StreamInterceptor()), //nolint:contextcheck ) // ensure socket dir exists @@ -133,7 +133,7 @@ func (s *machinedService) Main(ctx context.Context, r runtime.Runtime, logWriter return err } - listener, err := factory.NewListener(factory.Network("unix"), factory.SocketPath(constants.MachineSocketPath)) + listener, err := factory.NewListener(factory.Network("unix"), factory.SocketPath(constants.MachineSocketPath)) //nolint:contextcheck if err != nil { return err } @@ -153,7 +153,7 @@ func (s *machinedService) Main(ctx context.Context, r runtime.Runtime, logWriter shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 10*time.Second) defer shutdownCancel() - factory.ServerGracefulStop(server, shutdownCtx) + factory.ServerGracefulStop(server, shutdownCtx) //nolint:contextcheck return nil } diff --git a/internal/app/machined/pkg/system/services/udevd.go b/internal/app/machined/pkg/system/services/udevd.go index 3d1bac359d1..d4a42098fc9 100644 --- a/internal/app/machined/pkg/system/services/udevd.go +++ b/internal/app/machined/pkg/system/services/udevd.go @@ -37,7 +37,8 @@ func (c *Udevd) ID(r runtime.Runtime) string { // PreFunc implements the Service interface. func (c *Udevd) PreFunc(ctx context.Context, r runtime.Runtime) error { - _, err := cmd.Run( + _, err := cmd.RunContext( + ctx, "/sbin/udevadm", "hwdb", "--update", diff --git a/internal/app/machined/pkg/system/system.go b/internal/app/machined/pkg/system/system.go index 3047cbfbe38..a228cc6ee94 100644 --- a/internal/app/machined/pkg/system/system.go +++ b/internal/app/machined/pkg/system/system.go @@ -126,9 +126,9 @@ func (s *singleton) Unload(ctx context.Context, serviceIDs ...string) error { return nil } -// Start will invoke the service's Pre, Condition, and Type funcs. If the any +// Start will invoke the service's Pre, Condition, and Type funcs. If any // error occurs in the Pre or Condition invocations, it is up to the caller to -// to restart the service. +// restart the service. func (s *singleton) Start(serviceIDs ...string) error { s.mu.Lock() defer s.mu.Unlock() diff --git a/internal/app/storaged/server.go b/internal/app/storaged/server.go index da169c4971b..e63a4290a73 100644 --- a/internal/app/storaged/server.go +++ b/internal/app/storaged/server.go @@ -2,6 +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/. +// Package internal contains server implementation. package internal import ( diff --git a/internal/pkg/configuration/configuration.go b/internal/pkg/configuration/configuration.go index 02b316f22ae..c6caa758eac 100644 --- a/internal/pkg/configuration/configuration.go +++ b/internal/pkg/configuration/configuration.go @@ -2,6 +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/. +// Package configuration implements configuration generation. package configuration import ( diff --git a/internal/pkg/containers/container.go b/internal/pkg/containers/container.go index 1b9836f1758..611246d8e11 100644 --- a/internal/pkg/containers/container.go +++ b/internal/pkg/containers/container.go @@ -2,6 +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/. +// Package containers provides the container implementatiom. package containers import ( diff --git a/internal/pkg/smbios/smbios.go b/internal/pkg/smbios/smbios.go index 72c607cd366..f5bb68c9170 100644 --- a/internal/pkg/smbios/smbios.go +++ b/internal/pkg/smbios/smbios.go @@ -2,6 +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/. +// Package smbios provides access to SMBIOS information. package smbios import ( diff --git a/pkg/cluster/sonobuoy/sonobuoy.go b/pkg/cluster/sonobuoy/sonobuoy.go index 8d74aeb6b2f..5b2ca636402 100644 --- a/pkg/cluster/sonobuoy/sonobuoy.go +++ b/pkg/cluster/sonobuoy/sonobuoy.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/. -// Package sonobuoy provides functions to to run Kubernetes e2e tests. +// Package sonobuoy provides functions to run Kubernetes e2e tests. package sonobuoy import ( diff --git a/pkg/conditions/all.go b/pkg/conditions/all.go index b151599378a..8c029581b9d 100644 --- a/pkg/conditions/all.go +++ b/pkg/conditions/all.go @@ -2,6 +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/. +// Package conditions provides a set of conditions which can be used to wait for some condition to be met. package conditions import ( diff --git a/pkg/copy/copy.go b/pkg/copy/copy.go index ef6f8e915fc..50d17766aa1 100644 --- a/pkg/copy/copy.go +++ b/pkg/copy/copy.go @@ -2,6 +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/. +// Package copy provides a file copy utility implementation. package copy //nolint:predeclared import ( diff --git a/pkg/grpc/dialer/dialer.go b/pkg/grpc/dialer/dialer.go index 8b6a68c8589..eb8551728a6 100644 --- a/pkg/grpc/dialer/dialer.go +++ b/pkg/grpc/dialer/dialer.go @@ -2,6 +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/. +// Package dialer ... package dialer import ( diff --git a/pkg/grpc/factory/factory.go b/pkg/grpc/factory/factory.go index 1d41fe9bf7b..b540b986e1d 100644 --- a/pkg/grpc/factory/factory.go +++ b/pkg/grpc/factory/factory.go @@ -157,7 +157,7 @@ func NewDefaultOptions(setters ...Option) *Options { logger = log.New(opts.logDestination, opts.logPrefix, log.Flags()) } - // Recovery is installed as the the first middleware in the chain to handle panics (via defer and recover()) in all subsequent middlewares. + // Recovery is installed as the first middleware in the chain to handle panics (via defer and recover()) in all subsequent middlewares. recoveryOpt := grpc_recovery.WithRecoveryHandler(recoveryHandler(logger)) opts.UnaryInterceptors = append( []grpc.UnaryServerInterceptor{grpc_recovery.UnaryServerInterceptor(recoveryOpt)}, diff --git a/pkg/grpc/middleware/authz/metadata.go b/pkg/grpc/middleware/authz/metadata.go index 67595d14c55..6d805561be5 100644 --- a/pkg/grpc/middleware/authz/metadata.go +++ b/pkg/grpc/middleware/authz/metadata.go @@ -21,7 +21,7 @@ func SetMetadata(md metadata.MD, roles role.Set) { md.Set(mdKey, roles.Strings()...) } -// getFromMetadata returns roles extracted from from gRPC metadata. +// getFromMetadata returns roles extracted from gRPC metadata. func getFromMetadata(ctx context.Context, logf func(format string, v ...interface{})) (role.Set, bool) { md, ok := metadata.FromIncomingContext(ctx) if !ok { diff --git a/pkg/kernel/kernel.go b/pkg/kernel/kernel.go index 46b9d3ef26b..d30947b9587 100644 --- a/pkg/kernel/kernel.go +++ b/pkg/kernel/kernel.go @@ -2,6 +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/. +// Package kernel provides the utilities to interact with the kernel. package kernel import ( diff --git a/pkg/kernel/kspp/kspp.go b/pkg/kernel/kspp/kspp.go index b244b8b212c..0935dfb46cd 100644 --- a/pkg/kernel/kspp/kspp.go +++ b/pkg/kernel/kspp/kspp.go @@ -2,6 +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/. +// Package kspp implements KSPP kernel parameters enforcement. package kspp import ( diff --git a/pkg/machinery/config/provider.go b/pkg/machinery/config/provider.go index 5b2e4418b21..d82934e5efc 100644 --- a/pkg/machinery/config/provider.go +++ b/pkg/machinery/config/provider.go @@ -43,6 +43,8 @@ type Provider interface { // MachineConfig defines the requirements for a config that pertains to machine // related options. +// +//nolint:interfacebloat type MachineConfig interface { Install() Install Security() Security @@ -159,6 +161,8 @@ type ExtraHost interface { } // Device represents a network interface. +// +//nolint:interfacebloat type Device interface { Interface() string Addresses() []string @@ -219,6 +223,8 @@ type WireguardPeer interface { // Bond contains the various options for configuring a // bonded interface. +// +//nolint:interfacebloat type Bond interface { Interfaces() []string ARPIPTarget() []string @@ -360,6 +366,8 @@ type RegistryTLSConfig interface { // ClusterConfig defines the requirements for a config that pertains to cluster // related options. +// +//nolint:interfacebloat type ClusterConfig interface { ID() string Name() string diff --git a/pkg/machinery/config/types/v1alpha1/generate/example_test.go b/pkg/machinery/config/types/v1alpha1/generate/example_test.go index 834bbe9969a..5c1e2a87f9c 100644 --- a/pkg/machinery/config/types/v1alpha1/generate/example_test.go +++ b/pkg/machinery/config/types/v1alpha1/generate/example_test.go @@ -15,7 +15,7 @@ import ( "github.com/talos-systems/talos/pkg/machinery/constants" ) -//nolint:wsl +//nolint:wsl,testableexamples func Example() { // This is an example of generating a set of machine configuration files for multiple // nodes of the cluster from a single cluster-specific cluster. diff --git a/pkg/machinery/constants/constants.go b/pkg/machinery/constants/constants.go index 433cc0d8427..eea5608f78c 100644 --- a/pkg/machinery/constants/constants.go +++ b/pkg/machinery/constants/constants.go @@ -166,7 +166,7 @@ const ( // KubernetesDefaultCertificateValidityDuration specifies default certificate duration for Kubernetes generated certificates. KubernetesDefaultCertificateValidityDuration = time.Hour * 24 * 365 - // DefaultCertificatesDir is the path the the Kubernetes PKI directory. + // DefaultCertificatesDir is the path the Kubernetes PKI directory. DefaultCertificatesDir = "/etc/kubernetes/pki" // KubernetesCACert is the path to the root CA certificate. diff --git a/pkg/machinery/proto/proto_test.go b/pkg/machinery/proto/proto_test.go index 2f1a2eb317c..c12b5739051 100644 --- a/pkg/machinery/proto/proto_test.go +++ b/pkg/machinery/proto/proto_test.go @@ -180,6 +180,7 @@ func ExampleVIPOperatorSpec_outputProtoMarshal() { // 0a060a04c0a8010110011a090a01611201621a01632207080310041a0164 } +//nolint:dupword func ExampleVIPOperatorSpec_outputProtoencMarshal() { spec := &network.VIPOperatorSpec{ IP: netip.MustParseAddr("192.168.1.1"), @@ -240,6 +241,7 @@ func TestVIPOperatorSpec(t *testing.T) { runTestPipe[networkpb.VIPOperatorSpec](t, spec) } +//nolint:dupword func TestVLANSpecOldEncoding(t *testing.T) { t.Parallel() // Input: diff --git a/pkg/machinery/role/role.go b/pkg/machinery/role/role.go index 3e8b1c03730..12e5e8b0308 100644 --- a/pkg/machinery/role/role.go +++ b/pkg/machinery/role/role.go @@ -12,7 +12,7 @@ import ( ) // Role represents Talos user role. -// Its string value is used everywhere: as the the Organization value of Talos client certificate, +// Its string value is used everywhere: as the Organization value of Talos client certificate, // as the value of talosctl flag, etc. type Role string diff --git a/pkg/reporter/reporter.go b/pkg/reporter/reporter.go index dd23930994d..7fd0f0f6802 100644 --- a/pkg/reporter/reporter.go +++ b/pkg/reporter/reporter.go @@ -2,6 +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/. +// Package reporter implements the console reporter. package reporter import ( diff --git a/pkg/safepath/safepath.go b/pkg/safepath/safepath.go index 4659f5c3639..a7991c06293 100644 --- a/pkg/safepath/safepath.go +++ b/pkg/safepath/safepath.go @@ -2,6 +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/. +// Package safepath provides a set of functions to make paths safe for use with. package safepath import ( diff --git a/pkg/tail/tail.go b/pkg/tail/tail.go index d65657bd595..a251e607998 100644 --- a/pkg/tail/tail.go +++ b/pkg/tail/tail.go @@ -2,6 +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/. +// Package tail implements tailing of [io.ReadSeeker]. package tail import ( diff --git a/pkg/version/version.go b/pkg/version/version.go index 3a9c705bb1b..6cffd00934f 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -2,6 +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/. +// Package version defines version information. package version import (