Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qfix] Enable depguard linter #1490

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ linters-settings:
min-len: 2
min-occurrences: 2
depguard:
list-type: blacklist
include-go-root: false
packages:
- errors
packages-with-error-message:
# specify an error message to output when a blacklisted package is used
- errors: "Please use \"github.com/pkg/errors\" instead of \"errors\" in go imports"
rules:
main:
deny:
- pkg: "errors"
desc: "Please use \"github.com/pkg/errors\" instead of \"errors\" in go imports"
misspell:
locale: US
unparam:
Expand Down Expand Up @@ -129,11 +127,10 @@ linters-settings:
linters:
disable-all: true
enable:
# - rowserrcheck
- goheader
- bodyclose
- deadcode
# - depguard
- depguard
- dogsled
- dupl
- errcheck
Expand All @@ -150,7 +147,6 @@ linters:
- govet
- ineffassign
- interfacer
# - lll
- misspell
- nakedret
- scopelint
Expand All @@ -160,7 +156,6 @@ linters:
- typecheck
- unconvert
- unparam
# - unused
- varcheck
- whitespace
issues:
Expand Down
5 changes: 4 additions & 1 deletion pkg/networkservice/common/mechanisms/kernel/vlan/server.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021-2022 Nordix Foundation.
//
// Copyright (c) 2023 Cisco Foundation.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -22,9 +24,10 @@ package vlan

import (
"context"
"errors"
"sync"

"github.com/pkg/errors"

"github.com/RoaringBitmap/roaring"
"github.com/golang/protobuf/ptypes/empty"

Expand Down
5 changes: 4 additions & 1 deletion pkg/networkservice/common/mechanisms/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//
// Copyright (c) 2021 Doc.ai and/or its affiliates.
//
// Copyright (c) 2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -20,9 +22,10 @@ package mechanisms_test

import (
"context"
"errors"
"testing"

"github.com/pkg/errors"

"github.com/stretchr/testify/require"

"github.com/networkservicemesh/sdk/pkg/networkservice/utils/checks/checkcontext"
Expand Down
7 changes: 3 additions & 4 deletions pkg/networkservice/common/timeout/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2020-2021 Doc.ai and/or its affiliates.
//
// Copyright (c) 2020-2022 Cisco Systems, Inc.
// Copyright (c) 2020-2023 Cisco Systems, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -23,10 +23,9 @@ import (
"context"
"time"

iserror "errors"
"github.com/pkg/errors"

"github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"

"github.com/networkservicemesh/sdk/pkg/networkservice/common/begin"
"github.com/networkservicemesh/sdk/pkg/networkservice/utils/metadata"
Expand Down Expand Up @@ -90,7 +89,7 @@ func (s *timeoutServer) Request(ctx context.Context, request *networkservice.Net

func (s *timeoutServer) Close(ctx context.Context, conn *networkservice.Connection) (*empty.Empty, error) {
_, err := next.Server(ctx).Close(ctx, conn)
if !(iserror.Is(err, context.DeadlineExceeded) || iserror.Is(err, context.Canceled)) {
if !(errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled)) {
if oldCancel, loaded := loadAndDelete(ctx, metadata.IsClient(s)); loaded {
oldCancel()
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/networkservice/connectioncontext/ipcontext/vl3/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Cisco and/or its affiliates.
// Copyright (c) 2022-2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -20,7 +20,8 @@ package vl3

import (
"context"
"errors"

"github.com/pkg/errors"

"github.com/edwarnicke/serialize"
"github.com/golang/protobuf/ptypes/empty"
Expand Down
5 changes: 3 additions & 2 deletions pkg/networkservice/connectioncontext/ipcontext/vl3/server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Cisco and/or its affiliates.
// Copyright (c) 2022-2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -18,7 +18,8 @@ package vl3

import (
"context"
"errors"

"github.com/pkg/errors"

"github.com/golang/protobuf/ptypes/empty"
"github.com/networkservicemesh/api/pkg/api/ipam"
Expand Down
5 changes: 4 additions & 1 deletion pkg/networkservice/core/adapters/networkservice_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2020 Doc.ai and/or its affiliates.
//
// Copyright (c) 2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,9 +20,10 @@ package adapters_test

import (
"context"
"errors"
"testing"

"github.com/pkg/errors"

"github.com/golang/protobuf/ptypes/empty"
"github.com/networkservicemesh/api/pkg/api/networkservice"
"github.com/stretchr/testify/require"
Expand Down
3 changes: 2 additions & 1 deletion pkg/registry/common/dnsresolve/ns_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ package dnsresolve

import (
"context"
"errors"
"net"

"github.com/pkg/errors"

"github.com/networkservicemesh/sdk/pkg/tools/clienturlctx"

"github.com/networkservicemesh/sdk/pkg/tools/interdomain"
Expand Down
4 changes: 3 additions & 1 deletion pkg/tools/grpcutils/errors.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2021 Doc.ai and/or its affiliates.
//
// Copyright (c) 2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,7 +19,7 @@
package grpcutils

import (
"errors"
"github.com/pkg/errors"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
5 changes: 4 additions & 1 deletion pkg/tools/sandbox/fake_resolver.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
//
// Copyright (c) 2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,13 +20,14 @@ package sandbox

import (
"context"
"errors"
"fmt"
"net"
"net/url"
"strconv"
"sync"

"github.com/pkg/errors"

"github.com/networkservicemesh/sdk/pkg/registry/common/dnsresolve"
)

Expand Down