chore: bump golangci-lint
Bump golangci-lint and fixup new warnings. Ignore check that checks for used function parameters, it's kind of noisy and makes it confusing to read interface implementations. Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
parent
36a9a208ec
commit
d1a61fd343
@ -190,6 +190,7 @@ issues:
|
||||
exclude:
|
||||
- package comment should be of the form "Package services ..." # revive
|
||||
- ^ST1000 # ST1000: at least one file in a package should have a package comment (stylecheck)
|
||||
- parameter '\w+' seems to be unused, consider removing or renaming it as _ # noisy check, especially when the usage is an interface implementation
|
||||
|
||||
exclude-rules:
|
||||
- path: cmd/talosctl/cmd
|
||||
|
2
Makefile
2
Makefile
@ -23,7 +23,7 @@ GOIMPORTS_VERSION ?= v0.7.0
|
||||
# renovate: datasource=go depName=mvdan.cc/gofumpt
|
||||
GOFUMPT_VERSION ?= v0.4.0
|
||||
# renovate: datasource=go depName=github.com/golangci/golangci-lint
|
||||
GOLANGCILINT_VERSION ?= v1.51.2
|
||||
GOLANGCILINT_VERSION ?= v1.52.1
|
||||
# renovate: datasource=go depName=golang.org/x/tools
|
||||
STRINGER_VERSION ?= v0.7.0
|
||||
# renovate: datasource=go depName=github.com/alvaroloes/enumer
|
||||
|
@ -67,11 +67,7 @@ func (i *Installer) installExtensions() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = i.rebuildInitramfs(tempDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return i.rebuildInitramfs(tempDir)
|
||||
}
|
||||
|
||||
func printExtensions(extensions []*extensions.Extension) error {
|
||||
|
@ -184,11 +184,7 @@ func getResources(args []string) func(ctx context.Context, c *client.Client) err
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := out.WriteResource(hostname, r, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return out.WriteResource(hostname, r, 0)
|
||||
}
|
||||
|
||||
callbackRD := func(definition *meta.ResourceDefinition) error {
|
||||
|
@ -81,7 +81,7 @@ var supportCmd = &cobra.Command{
|
||||
|
||||
eg.Go(func() error {
|
||||
if supportCmdFlags.verbose {
|
||||
for range progress {
|
||||
for range progress { //nolint:revive
|
||||
}
|
||||
} else {
|
||||
showProgress(progress)
|
||||
|
@ -171,11 +171,7 @@ func mountRootFS() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unix.Mount(constants.ExtensionsConfigFile, filepath.Join(constants.NewRoot, constants.ExtensionsRuntimeConfigFile), "", unix.MS_BIND|unix.MS_RDONLY, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return unix.Mount(constants.ExtensionsConfigFile, filepath.Join(constants.NewRoot, constants.ExtensionsRuntimeConfigFile), "", unix.MS_BIND|unix.MS_RDONLY, "")
|
||||
}
|
||||
|
||||
func bindMountFirmware() error {
|
||||
|
@ -239,11 +239,7 @@ func (ctrl *KubeletServiceController) writePKI(secretSpec *secrets.KubeletSpec)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(constants.KubernetesCACert, secretSpec.CA.Crt, 0o400); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return os.WriteFile(constants.KubernetesCACert, secretSpec.CA.Crt, 0o400)
|
||||
}
|
||||
|
||||
var kubeletKubeConfigTemplate = []byte(`apiVersion: v1
|
||||
|
@ -173,7 +173,7 @@ func (suite *NodeLabelsSuite) assertLabel(expectedLabel, oldValue, expectedValue
|
||||
suite.Assert().NoError(
|
||||
retry.Constant(3*time.Second, retry.WithUnits(100*time.Millisecond)).Retry(
|
||||
func() error {
|
||||
if err := suite.assertResource(
|
||||
return suite.assertResource(
|
||||
resource.NewMetadata(
|
||||
k8s.NamespaceName,
|
||||
k8s.NodeLabelSpecType,
|
||||
@ -199,11 +199,7 @@ func (suite *NodeLabelsSuite) assertLabel(expectedLabel, oldValue, expectedValue
|
||||
|
||||
return nil
|
||||
},
|
||||
)(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
)()
|
||||
},
|
||||
),
|
||||
)
|
||||
|
@ -248,7 +248,7 @@ func (t *CRDController) Run(ctx context.Context, workers int) error {
|
||||
}
|
||||
|
||||
func (t *CRDController) runWorker(ctx context.Context) {
|
||||
for t.processNextWorkItem(ctx) {
|
||||
for t.processNextWorkItem(ctx) { //nolint:revive
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,9 +230,8 @@ func (suite *AddressMergeSuite) TestMergeFlapping() {
|
||||
}
|
||||
|
||||
continue
|
||||
} else {
|
||||
suite.T().Log("finalizer added")
|
||||
}
|
||||
suite.T().Log("finalizer added")
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
|
@ -254,9 +254,8 @@ func (suite *LinkMergeSuite) TestMergeFlapping() {
|
||||
}
|
||||
|
||||
continue
|
||||
} else {
|
||||
suite.T().Log("finalizer added")
|
||||
}
|
||||
suite.T().Log("finalizer added")
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
|
@ -252,9 +252,8 @@ func (suite *OperatorMergeSuite) TestMergeFlapping() {
|
||||
}
|
||||
|
||||
continue
|
||||
} else {
|
||||
suite.T().Log("finalizer added")
|
||||
}
|
||||
suite.T().Log("finalizer added")
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
|
@ -295,9 +295,8 @@ func (suite *RouteMergeSuite) TestMergeFlapping() {
|
||||
}
|
||||
|
||||
continue
|
||||
} else {
|
||||
suite.T().Log("finalizer added")
|
||||
}
|
||||
suite.T().Log("finalizer added")
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
|
@ -21,11 +21,7 @@ import (
|
||||
func Wait(ctx context.Context, r state.State) error {
|
||||
log.Printf("waiting for network to be ready")
|
||||
|
||||
if err := network.NewReadyCondition(r, network.AddressReady).Wait(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return network.NewReadyCondition(r, network.AddressReady).Wait(ctx)
|
||||
}
|
||||
|
||||
// RetryFetch retries fetching from metadata service.
|
||||
|
@ -115,9 +115,9 @@ func (v *VMware) ApplyNetworkConfigV2(ctx context.Context, st state.State, confi
|
||||
macAddressMatched = true
|
||||
|
||||
break
|
||||
} else {
|
||||
availableMACAddresses = append(availableMACAddresses, macAddress)
|
||||
}
|
||||
|
||||
availableMACAddresses = append(availableMACAddresses, macAddress)
|
||||
}
|
||||
|
||||
if !macAddressMatched {
|
||||
|
@ -1727,11 +1727,7 @@ func ResetUserDisks(_ runtime.Sequence, data any) (runtime.TaskExecutionFunc, st
|
||||
|
||||
logger.Printf("wiping user disk %s", deviceName)
|
||||
|
||||
if err = dev.FastWipe(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return dev.FastWipe()
|
||||
}
|
||||
|
||||
for _, deviceName := range in.GetUserDisksToWipe() {
|
||||
|
@ -95,7 +95,7 @@ func (suite *DmesgSuite) TestStreaming() {
|
||||
defer func() {
|
||||
suite.ctxCancel()
|
||||
// drain respCh
|
||||
for range respCh {
|
||||
for range respCh { //nolint:revive
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -207,7 +207,7 @@ func (suite *LogsSuite) testStreaming(tailLines int32) {
|
||||
defer func() {
|
||||
suite.ctxCancel()
|
||||
// drain respCh
|
||||
for range respCh {
|
||||
for range respCh { //nolint:revive
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -459,7 +459,7 @@ func copyFromReaderWithErrChan(out io.Writer, in io.Reader, errCh <-chan error)
|
||||
defer wg.Done()
|
||||
|
||||
// StreamReader is only singly-buffered, so we need to process any errors as we get them.
|
||||
for chanErr = range errCh {
|
||||
for chanErr = range errCh { //nolint:revive
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -183,7 +183,7 @@ func logErr(f func() error) {
|
||||
func extractRootfsFromInitramfs(input bytes.Buffer, rootfsFilePath string) error {
|
||||
recReader := cpio.Newc.Reader(bytes.NewReader(input.Bytes()))
|
||||
|
||||
if err := cpio.ForEachRecord(recReader, func(r cpio.Record) error {
|
||||
return cpio.ForEachRecord(recReader, func(r cpio.Record) error {
|
||||
if r.Name != constants.RootfsAsset {
|
||||
return nil
|
||||
}
|
||||
@ -204,11 +204,7 @@ func extractRootfsFromInitramfs(input bytes.Buffer, rootfsFilePath string) error
|
||||
}
|
||||
|
||||
return f.Close()
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func depmod(kernelModulesPath string) error {
|
||||
|
@ -23,11 +23,7 @@ func (ext *Extension) Validate() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := ext.validateContents(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return ext.validateContents()
|
||||
}
|
||||
|
||||
func (ext *Extension) validateConstraints() error {
|
||||
|
@ -182,11 +182,7 @@ func (c *Config) Save(path string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = os.WriteFile(c.path.Path, configBytes, 0o600); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return os.WriteFile(c.path.Path, configBytes, 0o600)
|
||||
}
|
||||
|
||||
// Bytes gets yaml encoded config data.
|
||||
|
@ -120,7 +120,8 @@ func internalCheckUnknownKeys(typ reflect.Type, spec *yaml.Node) (unknown interf
|
||||
|
||||
switch typ.Kind() { //nolint:exhaustive
|
||||
case reflect.Struct:
|
||||
if fieldIndex, ok := availableKeys[key]; !ok {
|
||||
fieldIndex, ok := availableKeys[key]
|
||||
if !ok {
|
||||
if unknown == nil {
|
||||
unknown = map[string]interface{}{}
|
||||
}
|
||||
@ -128,9 +129,9 @@ func internalCheckUnknownKeys(typ reflect.Type, spec *yaml.Node) (unknown interf
|
||||
unknown.(map[string]interface{})[key] = spec.Content[i+1]
|
||||
|
||||
continue
|
||||
} else {
|
||||
elemType = typ.FieldByIndex(fieldIndex).Type
|
||||
}
|
||||
|
||||
elemType = typ.FieldByIndex(fieldIndex).Type
|
||||
case reflect.Map:
|
||||
elemType = typ.Elem()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user