Upgrade linter and fix linter issues
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
This commit is contained in:
parent
9870c5e33b
commit
462e2faadc
|
@ -35,7 +35,7 @@ jobs:
|
|||
GOOS: ${{ matrix.target_os }}
|
||||
GOARCH: ${{ matrix.target_arch }}
|
||||
GOPROXY: https://proxy.golang.org
|
||||
GOLANGCI_LINT_VER: "v1.48.0"
|
||||
GOLANGCI_LINT_VER: "v1.50.1"
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
|
|
|
@ -277,3 +277,6 @@ linters:
|
|||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- structcheck
|
||||
- deadcode
|
||||
- nosnakecase
|
||||
- varcheck
|
||||
|
|
|
@ -37,7 +37,7 @@ func TestPublishMsg(t *testing.T) { //nolint:paralleltest
|
|||
w.WriteHeader(http.StatusOK)
|
||||
_, err := w.Write([]byte("{\"errcode\":0}"))
|
||||
require.NoError(t, err)
|
||||
if r.Method != "POST" {
|
||||
if r.Method != http.MethodPost {
|
||||
t.Errorf("Expected 'POST' request, got '%s'", r.Method)
|
||||
}
|
||||
if r.URL.EscapedPath() != "/test" {
|
||||
|
|
|
@ -196,7 +196,7 @@ func (g *GCPStorage) create(ctx context.Context, req *bindings.InvokeRequest) (*
|
|||
func (g *GCPStorage) get(ctx context.Context, req *bindings.InvokeRequest) (*bindings.InvokeResponse, error) {
|
||||
metadata, err := g.metadata.mergeWithRequestMetadata(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("gcp binding binding error. error merge metadata : %w", err)
|
||||
return nil, fmt.Errorf("gcp binding error. error merge metadata : %w", err)
|
||||
}
|
||||
|
||||
var key string
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
"github.com/dapr/kit/logger"
|
||||
)
|
||||
|
||||
// Binding represents RethinkDB change change state input binding which fires handler with
|
||||
// Binding represents RethinkDB change state input binding which fires handler with
|
||||
// both the previous and current state store content each time there is a change.
|
||||
type Binding struct {
|
||||
logger logger.Logger
|
||||
|
|
|
@ -126,7 +126,7 @@ func TestParseMetadata(t *testing.T) {
|
|||
expectErr: true,
|
||||
},
|
||||
{
|
||||
desc: "Invalid metadata with missing tls client client",
|
||||
desc: "Invalid metadata with missing tls client",
|
||||
input: pubsub.Metadata{Base: mdata.Base{
|
||||
Properties: map[string]string{
|
||||
"natsURL": "nats://localhost:4222",
|
||||
|
|
|
@ -67,6 +67,8 @@ type rabbitMQ struct {
|
|||
}
|
||||
|
||||
// interface used to allow unit testing.
|
||||
//
|
||||
//nolint:interfacebloat
|
||||
type rabbitMQChannelBroker interface {
|
||||
PublishWithContext(ctx context.Context, exchange string, key string, mandatory bool, immediate bool, msg amqp.Publishing) error
|
||||
PublishWithDeferredConfirmWithContext(ctx context.Context, exchange string, key string, mandatory bool, immediate bool, msg amqp.Publishing) (*amqp.DeferredConfirmation, error)
|
||||
|
|
|
@ -185,11 +185,11 @@ func (k *keyvaultSecretStore) getVaultURI() string {
|
|||
|
||||
func (k *keyvaultSecretStore) getMaxResultsFromMetadata(metadata map[string]string) (*int32, error) {
|
||||
if s, ok := metadata["maxresults"]; ok && s != "" {
|
||||
val, err := strconv.Atoi(s) //nolint:gosec
|
||||
val, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
converted := int32(val)
|
||||
converted := int32(val) //nolint:gosec
|
||||
|
||||
return &converted, nil
|
||||
}
|
||||
|
|
|
@ -226,11 +226,11 @@ func (v *vaultSecretStore) getSecret(ctx context.Context, secret, version string
|
|||
|
||||
defer httpresp.Body.Close()
|
||||
|
||||
if httpresp.StatusCode != 200 {
|
||||
if httpresp.StatusCode != http.StatusOK {
|
||||
var b bytes.Buffer
|
||||
io.Copy(&b, httpresp.Body)
|
||||
v.logger.Debugf("getSecret %s couldn't get successful response: %#v, %s", secret, httpresp, b.String())
|
||||
if httpresp.StatusCode == 404 {
|
||||
if httpresp.StatusCode == http.StatusNotFound {
|
||||
// handle not found error
|
||||
return nil, fmt.Errorf("getSecret %s failed %w", secret, ErrNotFound)
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ func (v *vaultSecretStore) listKeysUnderPath(ctx context.Context, path string) (
|
|||
|
||||
defer httpresp.Body.Close()
|
||||
|
||||
if httpresp.StatusCode != 200 {
|
||||
if httpresp.StatusCode != http.StatusOK {
|
||||
var b bytes.Buffer
|
||||
io.Copy(&b, httpresp.Body)
|
||||
v.logger.Debugf("list keys couldn't get successful response: %#v, %s", httpresp, b.String())
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
|
@ -405,7 +406,7 @@ func (c *ociObjectStorageClient) ensureBucketExists(ctx context.Context, client
|
|||
// verify if bucket exists.
|
||||
response, err := client.GetBucket(ctx, req)
|
||||
if err != nil {
|
||||
if response.RawResponse.StatusCode == 404 {
|
||||
if response.RawResponse.StatusCode == http.StatusNotFound {
|
||||
err = createBucket(ctx, client, namespace, name, compartmentOCID)
|
||||
if err == nil {
|
||||
c.logger.Debugf("Created OCI Object Storage Bucket %s as State Store", name)
|
||||
|
@ -445,7 +446,7 @@ func (c *ociObjectStorageClient) getObject(ctx context.Context, objectname strin
|
|||
response, err := c.objectStorageMetadata.OCIObjectStorageClient.GetObject(ctx, request)
|
||||
if err != nil {
|
||||
c.logger.Debugf("Issue in OCI ObjectStorage with retrieving object %s, error: %s", objectname, err)
|
||||
if response.RawResponse.StatusCode == 404 {
|
||||
if response.RawResponse.StatusCode == http.StatusNotFound {
|
||||
return nil, nil, nil, nil
|
||||
}
|
||||
return nil, nil, nil, fmt.Errorf("failed to retrieve object : %w", err)
|
||||
|
|
|
@ -277,6 +277,7 @@ func (m *migration) createStoredProcedureIfNotExists(db *sql.DB, name string, es
|
|||
}
|
||||
|
||||
/* #nosec. */
|
||||
//nolint:dupword
|
||||
func (m *migration) ensureUpsertStoredProcedureExists(db *sql.DB, mr migrationResult) error {
|
||||
tsql := fmt.Sprintf(`
|
||||
CREATE PROCEDURE %s (
|
||||
|
|
|
@ -104,9 +104,9 @@ func appRouter() *mux.Router {
|
|||
|
||||
func handleCall(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
case http.MethodPost:
|
||||
s.handlePost(r)
|
||||
case "GET":
|
||||
case http.MethodGet:
|
||||
w.Write(s.handleGet())
|
||||
default:
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
|
Loading…
Reference in New Issue