chore: bump golangci-lint from 1.47.2 to 1.48.0

Patch version linter upgrade.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
This commit is contained in:
Dmitriy Matrenichev 2022-08-01 17:14:44 +03:00
parent 7e527777e8
commit 0fe4492e72
No known key found for this signature in database
GPG Key ID: D3363CF894E68892
11 changed files with 27 additions and 17 deletions

View File

@ -19,7 +19,7 @@ EXTRAS ?= v1.2.0
GO_VERSION ?= 1.19
GOIMPORTS_VERSION ?= v0.1.11
GOFUMPT_VERSION ?= v0.3.0
GOLANGCILINT_VERSION ?= v1.47.2
GOLANGCILINT_VERSION ?= v1.48.0
STRINGER_VERSION ?= v0.1.12
ENUMER_VERSION ?= v1.1.2
DEEPCOPY_GEN_VERSION ?= v0.21.3

View File

@ -133,7 +133,7 @@ func (ctrl *PKIController) Run(ctx context.Context, r controller.Runtime, logger
}
if err = filetree.ChownRecursive(constants.EtcdPKIPath, constants.EtcdUserID, constants.EtcdUserID); err != nil {
return nil
return err
}
if err = safe.WriterModify(ctx, r, etcd.NewPKIStatus(etcd.NamespaceName, etcd.PKIID), func(status *etcd.PKIStatus) error {

View File

@ -293,7 +293,7 @@ func (t *CRDController) syncHandler(ctx context.Context, key string) error {
if err != nil {
utilruntime.HandleError(fmt.Errorf("invalid resource key: %s", key))
return nil
return nil //nolint:nilerr
}
talosSA, err := t.dynamicLister.Namespace(namespace).Get(name)

View File

@ -88,7 +88,7 @@ func reportHealth(ctx context.Context, gsIncarnation, gsContainerID, gsInstanceI
resp *http.Response
)
req, err = http.NewRequestWithContext(ctx, "POST", u.String(), b)
req, err = http.NewRequestWithContext(ctx, http.MethodPost, u.String(), b)
if err != nil {
return err
}

View File

@ -9,6 +9,7 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"log"
"net"
"net/http"
@ -369,9 +370,18 @@ func (p *EquinixMetal) FireEvent(ctx context.Context, event Event) error {
retry.WithErrorLogging(true)).RetryWithContext(
ctx,
func(ctx context.Context) error {
_, err = http.Post(*eventURL, "application/json", bytes.NewBuffer(eventData))
req, reqErr := http.NewRequestWithContext(ctx, http.MethodPost, *eventURL, bytes.NewReader(eventData))
if reqErr != nil {
return reqErr
}
return retry.ExpectedError(err)
resp, reqErr := http.DefaultClient.Do(req)
if resp != nil {
io.Copy(io.Discard, io.LimitReader(resp.Body, 4*1024*1024)) //nolint:errcheck
resp.Body.Close() //nolint:errcheck
}
return retry.ExpectedError(reqErr)
},
)

View File

@ -176,7 +176,7 @@ func (k *Kubelet) Runner(r runtime.Runtime) (runner.Runner, error) {
// HealthFunc implements the HealthcheckedService interface.
func (k *Kubelet) HealthFunc(runtime.Runtime) health.Check {
return func(ctx context.Context) error {
req, err := http.NewRequest("GET", "http://127.0.0.1:10248/healthz", nil)
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:10248/healthz", nil)
if err != nil {
return err
}

View File

@ -84,7 +84,7 @@ func (suite *ServiceAccountSuite) TestValid() {
sa, err := suite.createServiceAccount("kube-system", name, []string{"os:reader"})
suite.Assert().NoError(err)
defer suite.DeleteResource(suite.ctx, serviceAccountGVR, "default", name) // nolint:errcheck
defer suite.DeleteResource(suite.ctx, serviceAccountGVR, "default", name) //nolint:errcheck
err = suite.WaitForEventExists(suite.ctx, "kube-system", func(event eventsv1.Event) bool {
return event.Regarding.UID == sa.GetUID() &&
@ -127,7 +127,7 @@ func (suite *ServiceAccountSuite) TestNotAllowedNamespace() {
sa, err := suite.createServiceAccount("default", name, []string{"os:reader"})
suite.Assert().NoError(err)
defer suite.DeleteResource(suite.ctx, serviceAccountGVR, "default", name) // nolint:errcheck
defer suite.DeleteResource(suite.ctx, serviceAccountGVR, "default", name) //nolint:errcheck
err = suite.WaitForEventExists(suite.ctx, "default", func(event eventsv1.Event) bool {
return event.Regarding.UID == sa.GetUID() &&
@ -149,7 +149,7 @@ func (suite *ServiceAccountSuite) TestNotAllowedRoles() {
sa, err := suite.createServiceAccount("kube-system", name, []string{"os:admin"})
suite.Assert().NoError(err)
defer suite.DeleteResource(suite.ctx, serviceAccountGVR, "kube-system", name) // nolint:errcheck
defer suite.DeleteResource(suite.ctx, serviceAccountGVR, "kube-system", name) //nolint:errcheck
err = suite.WaitForEventExists(suite.ctx, "kube-system", func(event eventsv1.Event) bool {
return event.Regarding.UID == sa.GetUID() &&
@ -176,7 +176,7 @@ func (suite *ServiceAccountSuite) TestFeatureNotEnabled() {
suite.Assert().NoError(err)
defer suite.DeleteResource(suite.ctx, serviceAccountGVR, "kube-system", name) // nolint:errcheck
defer suite.DeleteResource(suite.ctx, serviceAccountGVR, "kube-system", name) //nolint:errcheck
err = suite.WaitForEventExists(suite.ctx, "kube-system", func(event eventsv1.Event) bool {
return event.Regarding.UID == sa.GetUID() &&

View File

@ -208,17 +208,17 @@ func (suite *GenSuite) TestSecrets() {
suite.RunCLI([]string{"gen", "secrets"}, base.StdoutEmpty())
suite.Assert().FileExists("secrets.yaml")
defer os.Remove("secrets.yaml") // nolint:errcheck
defer os.Remove("secrets.yaml") //nolint:errcheck
suite.RunCLI([]string{"gen", "secrets", "--output-file", "/tmp/secrets2.yaml"}, base.StdoutEmpty())
suite.Assert().FileExists("/tmp/secrets2.yaml")
defer os.Remove("/tmp/secrets2.yaml") // nolint:errcheck
defer os.Remove("/tmp/secrets2.yaml") //nolint:errcheck
suite.RunCLI([]string{"gen", "secrets", "-o", "secrets3.yaml", "--talos-version", "v0.8"}, base.StdoutEmpty())
suite.Assert().FileExists("secrets3.yaml")
defer os.Remove("secrets3.yaml") // nolint:errcheck
defer os.Remove("secrets3.yaml") //nolint:errcheck
}
// TestSecretsWithPKIDirAndToken ...

View File

@ -201,7 +201,7 @@ func (suite *ResolverSuite) TestRegistryHosts() {
suite.Require().NotNil(registryHosts[0].Authorizer)
req, err := http.NewRequest("GET", "htts://some.host:123/v2", nil) //nolint:noctx
req, err := http.NewRequest(http.MethodGet, "htts://some.host:123/v2", nil) //nolint:noctx
suite.Require().NoError(err)
resp := &http.Response{}

View File

@ -53,7 +53,7 @@ func (t tftpRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
return &http.Response{
Status: "200 OK",
StatusCode: 200,
StatusCode: http.StatusOK,
Proto: "TFTP/1.0",
ProtoMajor: 1,
ProtoMinor: 0,

View File

@ -70,7 +70,7 @@ type Mount struct {
Options []string `protobuf:"4"`
}
// nolint:gocyclo
//nolint:gocyclo
func registerDefaultTypes() {
protoenc.RegisterEncoderDecoder(
func(v *url.URL) ([]byte, error) {