Skip to content

Commit

Permalink
Merge pull request #5221 from twz123/dupwords
Browse files Browse the repository at this point in the history
Enable dupwords linter
  • Loading branch information
twz123 authored Nov 12, 2024
2 parents e331fe2 + d0991b9 commit 4ddccb3
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ run:
linters:
enable:
- depguard # Checks if package imports are in a list of acceptable packages
- dupword # Finds word repetitions
- errorlint # Find code that will cause problems with Go's error wrapping scheme
- gofmt # Checks whether code was gofmt-ed
- goheader # Checks is file headers matche a given pattern
Expand Down
3 changes: 2 additions & 1 deletion cmd/airgap/listimages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ func TestAirgapListImages(t *testing.T) {
t.Run("NodeLocalLoadBalancing", func(t *testing.T) {
const (
customImage = "example.com/envoy:v1337"
yamlData = `
//nolint:dupword
yamlData = `
apiVersion: k0s.k0sproject.io/v1beta1
kind: ClusterConfig
spec:
Expand Down
2 changes: 1 addition & 1 deletion inttest/common/autopilot/waitfor.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/sirupsen/logrus"
)

// WaitForPlanState waits for the the Plan with the given name to reach the given state.
// WaitForPlanState waits for the Plan with the given name to reach the given state.
func WaitForPlanState(ctx context.Context, client apclient.Interface, name string, state apv1beta2.PlanStateType) (plan *apv1beta2.Plan, err error) {
err = watch.FromClient[*apv1beta2.PlanList, apv1beta2.Plan](client.AutopilotV1beta2().Plans()).
WithObjectName(name).
Expand Down
1 change: 1 addition & 0 deletions inttest/customca/customca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (s *CustomCASuite) TestK0sGetsUp() {
defer ssh.Disconnect()

err = ssh.Exec(s.Context(), "sh -e", common.SSHStreams{
//nolint:dupword // this is a script
In: strings.NewReader(fmt.Sprintf(`
K0S_PATH=%q
IP_ADDRESS=%q
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/helm/v1beta1/chart_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type ChartSpec struct {
Version string `json:"version,omitempty"`
Namespace string `json:"namespace,omitempty"`
Timeout string `json:"timeout,omitempty"`
// ForceUpgrade when set to false, disables the use of the "--force" flag when upgrading the the chart (default: true).
// ForceUpgrade when set to false, disables the use of the "--force" flag when upgrading the chart (default: true).
// +optional
ForceUpgrade *bool `json:"forceUpgrade,omitempty"`
Order int `json:"order,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/k0s/v1beta1/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ type Chart struct {
// A duration string is a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
// +kubebuilder:validation:XIntOrString
Timeout BackwardCompatibleDuration `json:"timeout,omitempty"`
// ForceUpgrade when set to false, disables the use of the "--force" flag when upgrading the the chart (default: true).
// ForceUpgrade when set to false, disables the use of the "--force" flag when upgrading the chart (default: true).
// +optional
ForceUpgrade *bool `json:"forceUpgrade,omitempty"`
Order int `json:"order,omitempty"`
Expand Down
10 changes: 5 additions & 5 deletions pkg/component/controller/cplb_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,15 @@ const dummyLinkName = "dummyvip0"
var keepalivedConfigTemplate = template.Must(template.New("keepalived").Parse(`
{{ range $i, $instance := .VRRPInstances }}
vrrp_instance k0s-vip-{{$i}} {
# All servers must have state BACKUP so that when a new server comes up
# it doesn't perform a failover. This must be combined with the priority.
# All servers must have state BACKUP so that when a new server comes up
# it doesn't perform a failover. This must be combined with the priority.
state BACKUP
# Make sure the interface is aligned with your server's network interface
# Make sure the interface is aligned with your server's network interface.
interface {{ .Interface }}
# The virtual router ID must be unique to each VRRP instance that you define
# The virtual router ID must be unique to each VRRP instance that you define.
virtual_router_id {{ $instance.VirtualRouterID }}
# All servers have the same priority so that when a new one comes up we don't
# do a failover
# do a failover.
priority 200
# advertisement interval, 1 second by default
advert_int {{ $instance.AdvertIntervalSeconds }}
Expand Down
2 changes: 1 addition & 1 deletion pkg/component/worker/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func writeKubeletBootstrapKubeconfig(kubeconfig []byte) (string, error) {
rmErr := os.Remove(bootstrapFile.Name())
// Don't propagate any fs.ErrNotExist errors. There is no point in doing
// this, since the desired state is already reached: The bootstrap file
// file is no longer present on the file system.
// is no longer present on the file system.
if errors.Is(rmErr, fs.ErrNotExist) {
rmErr = nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/constant/constant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TestRuncModuleVersions(t *testing.T) {

if runtime.GOOS == "windows" {
// The runc dependency is only a thing on Linux.
assert.Zero(t, numMatched, "Expected no packages to to pass the filter on Windows.")
assert.Zero(t, numMatched, "Expected no packages to pass the filter on Windows.")
} else {
assert.NotZero(t, numMatched, "Not a single package passed the filter.")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/debounce/debounce.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type Debouncer[T any] struct {
Timeout time.Duration

// Filter controls which elements reset the time window and which elements
// are are simply silently dropped. It may be nil, in which case no items
// will be dropped.
// are simply silently dropped. It may be nil, in which case no items will
// be dropped.
Filter func(item T) bool

// Callback is the func that receives debounced items.
Expand Down
1 change: 1 addition & 0 deletions pkg/install/linux_sysv.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

package install

//nolint:dupword // this is a script
const sysvScript = `#!/bin/sh
# For RedHat and cousins:
# chkconfig: - 99 01
Expand Down
1 change: 1 addition & 0 deletions pkg/install/linux_upstart.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

package install

//nolint:dupword // this is a script
const upstartScript = `# {{.Description}}
{{- if .Option.Environment}}{{range .Option.Environment}}
Expand Down
2 changes: 1 addition & 1 deletion static/_crds/helm/helm.k0sproject.io_charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
type: string
forceUpgrade:
description: 'ForceUpgrade when set to false, disables the use of
the "--force" flag when upgrading the the chart (default: true).'
the "--force" flag when upgrading the chart (default: true).'
type: boolean
namespace:
type: string
Expand Down
4 changes: 2 additions & 2 deletions static/_crds/k0s/k0s.k0sproject.io_clusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ spec:
type: string
forceUpgrade:
description: 'ForceUpgrade when set to false, disables
the use of the "--force" flag when upgrading the the
chart (default: true).'
the use of the "--force" flag when upgrading the chart
(default: true).'
type: boolean
name:
maxLength: 53
Expand Down

0 comments on commit 4ddccb3

Please sign in to comment.