Skip to content

Commit

Permalink
chore: bump golangci-lint to v1.50.0
Browse files Browse the repository at this point in the history
I had to do several things:
- contextcheck now supports Go 1.18 generics, but I had to disable it because of this kkHAIKE/contextcheck#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>
  • Loading branch information
DmitriyMV authored and DJAlPee committed May 22, 2023
1 parent decab2d commit 063950e
Show file tree
Hide file tree
Showing 83 changed files with 339 additions and 25 deletions.
234 changes: 234 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cmd/installer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions cmd/installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions cmd/installer/pkg/epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions cmd/installer/pkg/install/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions cmd/installer/pkg/install/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions cmd/installer/pkg/ova/ova.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 2 additions & 1 deletion cmd/talosctl/cmd/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions cmd/talosctl/cmd/mgmt/gen/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 2 additions & 0 deletions cmd/talosctl/cmd/talos/pcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions cmd/talosctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions cmd/talosctl/pkg/mgmt/helpers/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions cmd/talosctl/pkg/talos/global/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion cmd/talosctl/pkg/talos/helpers/mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions internal/app/apid/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion internal/app/apid/pkg/director/local_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 063950e

Please sign in to comment.