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 <dmitry.matrenichev@siderolabs.com>
This commit is contained in:
Dmitriy Matrenichev 2022-10-04 18:30:34 +03:00
parent aa3d9b4ca6
commit 93e55b85f2
No known key found for this signature in database
GPG Key ID: D3363CF894E68892
83 changed files with 339 additions and 25 deletions

View File

@ -167,6 +167,8 @@ linters:
- typecheck - typecheck
- varnamelen # too annoying - varnamelen # too annoying
- wrapcheck - 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 # abandoned linters for which golangci shows the warning that the repo is archived by the owner
- golint - golint
@ -196,6 +198,238 @@ issues:
- path: internal/app/machined/pkg/system/services - path: internal/app/machined/pkg/system/services
linters: linters:
- dupl - 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 # pkg/machinery module
- path: config/types/v1alpha1 - path: config/types/v1alpha1

View File

@ -300,7 +300,7 @@ WORKDIR /src
# The vulncheck target runs the vulnerability check tool. # 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 ./... RUN --mount=type=cache,target=/.cache govulncheck ./...
# The init target builds the init binary. # The init target builds the init binary.

View File

@ -18,8 +18,8 @@ PKGS ?= v1.3.0-alpha.0-29-g91e73b3
EXTRAS ?= v1.3.0-alpha.0-1-g8f00d77 EXTRAS ?= v1.3.0-alpha.0-1-g8f00d77
GO_VERSION ?= 1.19 GO_VERSION ?= 1.19
GOIMPORTS_VERSION ?= v0.1.11 GOIMPORTS_VERSION ?= v0.1.11
GOFUMPT_VERSION ?= v0.3.0 GOFUMPT_VERSION ?= v0.4.0
GOLANGCILINT_VERSION ?= v1.48.0 GOLANGCILINT_VERSION ?= v1.50.0
STRINGER_VERSION ?= v0.1.12 STRINGER_VERSION ?= v0.1.12
ENUMER_VERSION ?= v1.1.2 ENUMER_VERSION ?= v1.1.2
DEEPCOPY_GEN_VERSION ?= v0.21.3 DEEPCOPY_GEN_VERSION ?= v0.21.3

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package cmd implements the installer command.
package cmd package cmd
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package installer provides the installer implementation.
package main package main
import "github.com/talos-systems/talos/cmd/installer/cmd" import "github.com/talos-systems/talos/cmd/installer/cmd"

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package pkg contains the installer cmd logic.
package pkg package pkg
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package install provides the installation routine.
package install package install
import ( import (

View File

@ -212,6 +212,7 @@ func (m *Manifest) checkMounts(device Device) error {
} }
if !device.SkipOverlayMountsCheck && fields[len(fields)-2] == "overlay" { if !device.SkipOverlayMountsCheck && fields[len(fields)-2] == "overlay" {
//nolint:dupword
// parsing options (last column) in the overlay mount line which looks like: // 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 // 163 70 0:52 /apid / ro,relatime - overlay overlay rw,lowerdir=/opt,upperdir=/var/system/overlays/opt-diff,workdir=/var/system/overlays/opt-workdir

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package ova implements OVA creation.
package ova package ova
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package cmd provides the talosctl command implementation.
package cmd package cmd
import ( 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. // with custom filePrepender and linkHandler.
func GenMarkdownReference(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { func GenMarkdownReference(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error {
for _, c := range cmd.Commands() { for _, c := range cmd.Commands() {

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package gen implements the genration of various artifacts.
package gen package gen
import ( import (

View File

@ -159,6 +159,8 @@ func dumpPackets(r io.Reader) error {
// { 0x30, 0, 0, 0x00000000 }, // { 0x30, 0, 0, 0x00000000 },
// { 0x54, 0, 0, 0x000000f0 }, // { 0x54, 0, 0, 0x000000f0 },
// { 0x15, 0, 8, 0x00000060 }, // { 0x15, 0, 8, 0x00000060 },
//
//nolint:dupword
func parseBPFInstructions(in string) ([]*machine.BPFInstruction, error) { func parseBPFInstructions(in string) ([]*machine.BPFInstruction, error) {
in = strings.TrimSpace(in) in = strings.TrimSpace(in)

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package talosctl provides the talosctl utility implementation.
package main package main
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package helpers provides helpers for talosctl.
package helpers package helpers
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package global provides global flags for talosctl.
package global package global
import ( import (

View File

@ -20,7 +20,7 @@ import (
// Should be never passed to the API. // Should be never passed to the API.
const InteractiveMode machine.ApplyConfigurationRequest_Mode = -1 const InteractiveMode machine.ApplyConfigurationRequest_Mode = -1
// Mode apply, patch, edit config config update mode. // Mode apply, patch, edit config update mode.
type Mode struct { type Mode struct {
options map[string]machine.ApplyConfigurationRequest_Mode options map[string]machine.ApplyConfigurationRequest_Mode
Mode machine.ApplyConfigurationRequest_Mode Mode machine.ApplyConfigurationRequest_Mode

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package apid implements apid functionality.
package apid package apid
import ( import (

View File

@ -28,7 +28,7 @@ type localAddressProvider struct {
} }
// NewLocalAddressProvider initializes and returns a new LocalAddressProvider. // NewLocalAddressProvider initializes and returns a new LocalAddressProvider.
func NewLocalAddressProvider(st state.State) (*localAddressProvider, error) { func NewLocalAddressProvider(st state.State) (LocalAddressProvider, error) {
p := &localAddressProvider{} p := &localAddressProvider{}
evCh := make(chan state.Event) evCh := make(chan state.Event)

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package init implements booting process.
package main package main
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package runtime provides the runtime implementation.
package runtime package runtime
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package machined provides machined implementation.
package main package main
import ( import (

View File

@ -2,4 +2,5 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package hardware provides the hardware controller implementation.
package hardware package hardware

View File

@ -12,5 +12,5 @@ import (
func init() { func init() {
// ugly hack, but it doesn't look like there's better API // ugly hack, but it doesn't look like there's better API
// cut out error handler which logs error to standard logger // 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
} }

View File

@ -336,7 +336,7 @@ func ParseCmdlineNetwork(cmdline *procfs.Cmdline) (CmdlineNetworking, error) {
// v1alpha1.Bond was chosen to re-use the `SetBondMaster` and `SetBondSlave` functions // v1alpha1.Bond was chosen to re-use the `SetBondMaster` and `SetBondSlave` functions
// ref: modinfo bonding // ref: modinfo bonding
// //
//nolint:gocyclo,cyclop //nolint:gocyclo,cyclop,dupword
func parseBondOptions(options string) (v1alpha1.Bond, error) { func parseBondOptions(options string) (v1alpha1.Bond, error) {
var bond v1alpha1.Bond var bond v1alpha1.Bond

View File

@ -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

View File

@ -11,7 +11,7 @@ import (
) )
// Runtime defines the runtime parameters. // Runtime defines the runtime parameters.
type Runtime interface { type Runtime interface { //nolint:interfacebloat
Config() config.Provider Config() config.Provider
LoadAndValidateConfig([]byte) (config.Provider, error) LoadAndValidateConfig([]byte) (config.Provider, error)
RollbackToConfigAfter([]byte, time.Duration) error RollbackToConfigAfter([]byte, time.Duration) error

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package bananapim64 provides the Banana Pi M64 board implementation.
package bananapim64 package bananapim64
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package board provides the function to discover the current board.
package board package board
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package jetsonnano provides the Jetson Nano board implementation.
package jetsonnano package jetsonnano
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package libretechallh3cch5 provides the LibretechAllH3CCH5 board implementation.
package libretechallh3cch5 package libretechallh3cch5
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package nanopir4s provides the Nano Pi R4S board implementation.
package nanopir4s package nanopir4s
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package pine64 provides the Pine64 board implementation.
package pine64 package pine64
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package rock64 provides the Pine64 Rock64 board implementation.
package rock64 package rock64
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package rockpi4 provides the Radxa rock pi implementation.
package rockpi4 package rockpi4
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package rockpi4c provides the Radxa rock pi implementation.
package rockpi4c package rockpi4c
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package rpi4 provides the Raspberry Pi 4 Model B implementation.
package rpi4 package rpi4
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package rpigeneric provides the Raspberry Pi Compute Module 4 implementation.
package rpigeneric package rpigeneric
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package bootloader provides bootloader implementation.
package bootloader package bootloader
// Bootloader describes a bootloader. // Bootloader describes a bootloader.

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package aws contains the AWS implementation of the [platform.Platform].
package aws package aws
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package azure contains the Azure implementation of the [platform.Platform].
package azure package azure
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package container contains the Container implementation of the [platform.Platform].
package container package container
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // 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 package digitalocean
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // 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 package equinixmetal
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package errors contains errors used by the platform package.
package errors package errors
import "errors" import "errors"

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package gcp contains the GCP implementation of the [platform.Platform].
package gcp package gcp
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package hcloud contains the Hcloud implementation of the [platform.Platform].
package hcloud package hcloud
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package metal contains the metal implementation of the [platform.Platform].
package metal package metal
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package nocloud provides the NoCloud platform implementation.
package nocloud package nocloud
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package openstack provides the Openstack platform implementation.
package openstack package openstack
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package oracle provides the Oracle platform implementation.
package oracle package oracle
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package platform provides functions to get the [runtime.Platform].
package platform package platform
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package scaleway provides the Scaleway platform implementation.
package scaleway package scaleway
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package upcloud provides the UpCloud platform implementation.
package upcloud package upcloud
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package utils provides utility functions for the platform package.
package utils package utils
import ( import (

View File

@ -4,6 +4,7 @@
//go:build amd64 //go:build amd64
// Package vmware provides the VMware platform implementation.
package vmware package vmware
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package vultr provides the Vultr platform implementation.
package vultr package vultr
import ( import (

View File

@ -113,6 +113,7 @@ func (lock *PriorityLock[T]) Lock(ctx context.Context, takeOverTimeout time.Dura
} }
} }
// Unlock releases the lock.
func (lock *PriorityLock[T]) Unlock() { func (lock *PriorityLock[T]) Unlock() {
var zeroSeq T var zeroSeq T

View File

@ -1772,7 +1772,7 @@ func MountStatePartition(seq runtime.Sequence, data interface{}) (runtime.TaskEx
var encryption config.Encryption var encryption config.Encryption
// first try reading encryption from the config // 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 { if r.Config() != nil && r.Config().Machine() != nil {
encryption = r.Config().Machine().SystemDiskEncryption().Get(constants.StatePartitionLabel) encryption = r.Config().Machine().SystemDiskEncryption().Get(constants.StatePartitionLabel)
} }

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package runner provides a runner for running services.
package runner package runner
import ( import (

View File

@ -92,7 +92,7 @@ type machinedService struct {
c runtime.Controller 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 { func (s *machinedService) Main(ctx context.Context, r runtime.Runtime, logWriter io.Writer) error {
injector := &authz.Injector{ injector := &authz.Injector{
Mode: authz.MetadataOnly, Mode: authz.MetadataOnly,
@ -106,7 +106,7 @@ func (s *machinedService) Main(ctx context.Context, r runtime.Runtime, logWriter
} }
// Start the API server. // Start the API server.
server := factory.NewServer( server := factory.NewServer( //nolint:contextcheck
&v1alpha1server.Server{ &v1alpha1server.Server{
Controller: s.c, Controller: s.c,
// breaking the import loop cycle between services/ package and v1alpha1_server.go // 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.WithLog("machined ", logWriter),
factory.WithUnaryInterceptor(injector.UnaryInterceptor()), factory.WithUnaryInterceptor(injector.UnaryInterceptor()),
factory.WithStreamInterceptor(injector.StreamInterceptor()), factory.WithStreamInterceptor(injector.StreamInterceptor()), //nolint:contextcheck
factory.WithUnaryInterceptor(authorizer.UnaryInterceptor()), factory.WithUnaryInterceptor(authorizer.UnaryInterceptor()),
factory.WithStreamInterceptor(authorizer.StreamInterceptor()), factory.WithStreamInterceptor(authorizer.StreamInterceptor()), //nolint:contextcheck
) )
// ensure socket dir exists // ensure socket dir exists
@ -133,7 +133,7 @@ func (s *machinedService) Main(ctx context.Context, r runtime.Runtime, logWriter
return err 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 { if err != nil {
return err 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) shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 10*time.Second)
defer shutdownCancel() defer shutdownCancel()
factory.ServerGracefulStop(server, shutdownCtx) factory.ServerGracefulStop(server, shutdownCtx) //nolint:contextcheck
return nil return nil
} }

View File

@ -37,7 +37,8 @@ func (c *Udevd) ID(r runtime.Runtime) string {
// PreFunc implements the Service interface. // PreFunc implements the Service interface.
func (c *Udevd) PreFunc(ctx context.Context, r runtime.Runtime) error { func (c *Udevd) PreFunc(ctx context.Context, r runtime.Runtime) error {
_, err := cmd.Run( _, err := cmd.RunContext(
ctx,
"/sbin/udevadm", "/sbin/udevadm",
"hwdb", "hwdb",
"--update", "--update",

View File

@ -126,9 +126,9 @@ func (s *singleton) Unload(ctx context.Context, serviceIDs ...string) error {
return nil 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 // 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 { func (s *singleton) Start(serviceIDs ...string) error {
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package internal contains server implementation.
package internal package internal
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package configuration implements configuration generation.
package configuration package configuration
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package containers provides the container implementatiom.
package containers package containers
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package smbios provides access to SMBIOS information.
package smbios package smbios
import ( import (

View File

@ -2,7 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // 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 package sonobuoy
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // 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 package conditions
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package copy provides a file copy utility implementation.
package copy //nolint:predeclared package copy //nolint:predeclared
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package dialer ...
package dialer package dialer
import ( import (

View File

@ -157,7 +157,7 @@ func NewDefaultOptions(setters ...Option) *Options {
logger = log.New(opts.logDestination, opts.logPrefix, log.Flags()) 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)) recoveryOpt := grpc_recovery.WithRecoveryHandler(recoveryHandler(logger))
opts.UnaryInterceptors = append( opts.UnaryInterceptors = append(
[]grpc.UnaryServerInterceptor{grpc_recovery.UnaryServerInterceptor(recoveryOpt)}, []grpc.UnaryServerInterceptor{grpc_recovery.UnaryServerInterceptor(recoveryOpt)},

View File

@ -21,7 +21,7 @@ func SetMetadata(md metadata.MD, roles role.Set) {
md.Set(mdKey, roles.Strings()...) 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) { func getFromMetadata(ctx context.Context, logf func(format string, v ...interface{})) (role.Set, bool) {
md, ok := metadata.FromIncomingContext(ctx) md, ok := metadata.FromIncomingContext(ctx)
if !ok { if !ok {

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package kernel provides the utilities to interact with the kernel.
package kernel package kernel
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package kspp implements KSPP kernel parameters enforcement.
package kspp package kspp
import ( import (

View File

@ -43,6 +43,8 @@ type Provider interface {
// MachineConfig defines the requirements for a config that pertains to machine // MachineConfig defines the requirements for a config that pertains to machine
// related options. // related options.
//
//nolint:interfacebloat
type MachineConfig interface { type MachineConfig interface {
Install() Install Install() Install
Security() Security Security() Security
@ -159,6 +161,8 @@ type ExtraHost interface {
} }
// Device represents a network interface. // Device represents a network interface.
//
//nolint:interfacebloat
type Device interface { type Device interface {
Interface() string Interface() string
Addresses() []string Addresses() []string
@ -219,6 +223,8 @@ type WireguardPeer interface {
// Bond contains the various options for configuring a // Bond contains the various options for configuring a
// bonded interface. // bonded interface.
//
//nolint:interfacebloat
type Bond interface { type Bond interface {
Interfaces() []string Interfaces() []string
ARPIPTarget() []string ARPIPTarget() []string
@ -360,6 +366,8 @@ type RegistryTLSConfig interface {
// ClusterConfig defines the requirements for a config that pertains to cluster // ClusterConfig defines the requirements for a config that pertains to cluster
// related options. // related options.
//
//nolint:interfacebloat
type ClusterConfig interface { type ClusterConfig interface {
ID() string ID() string
Name() string Name() string

View File

@ -15,7 +15,7 @@ import (
"github.com/talos-systems/talos/pkg/machinery/constants" "github.com/talos-systems/talos/pkg/machinery/constants"
) )
//nolint:wsl //nolint:wsl,testableexamples
func Example() { func Example() {
// This is an example of generating a set of machine configuration files for multiple // This is an example of generating a set of machine configuration files for multiple
// nodes of the cluster from a single cluster-specific cluster. // nodes of the cluster from a single cluster-specific cluster.

View File

@ -166,7 +166,7 @@ const (
// KubernetesDefaultCertificateValidityDuration specifies default certificate duration for Kubernetes generated certificates. // KubernetesDefaultCertificateValidityDuration specifies default certificate duration for Kubernetes generated certificates.
KubernetesDefaultCertificateValidityDuration = time.Hour * 24 * 365 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" DefaultCertificatesDir = "/etc/kubernetes/pki"
// KubernetesCACert is the path to the root CA certificate. // KubernetesCACert is the path to the root CA certificate.

View File

@ -180,6 +180,7 @@ func ExampleVIPOperatorSpec_outputProtoMarshal() {
// 0a060a04c0a8010110011a090a01611201621a01632207080310041a0164 // 0a060a04c0a8010110011a090a01611201621a01632207080310041a0164
} }
//nolint:dupword
func ExampleVIPOperatorSpec_outputProtoencMarshal() { func ExampleVIPOperatorSpec_outputProtoencMarshal() {
spec := &network.VIPOperatorSpec{ spec := &network.VIPOperatorSpec{
IP: netip.MustParseAddr("192.168.1.1"), IP: netip.MustParseAddr("192.168.1.1"),
@ -240,6 +241,7 @@ func TestVIPOperatorSpec(t *testing.T) {
runTestPipe[networkpb.VIPOperatorSpec](t, spec) runTestPipe[networkpb.VIPOperatorSpec](t, spec)
} }
//nolint:dupword
func TestVLANSpecOldEncoding(t *testing.T) { func TestVLANSpecOldEncoding(t *testing.T) {
t.Parallel() t.Parallel()
// Input: // Input:

View File

@ -12,7 +12,7 @@ import (
) )
// Role represents Talos user role. // 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. // as the value of talosctl flag, etc.
type Role string type Role string

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package reporter implements the console reporter.
package reporter package reporter
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // 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 package safepath
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package tail implements tailing of [io.ReadSeeker].
package tail package tail
import ( import (

View File

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package version defines version information.
package version package version
import ( import (