Skip to content

Commit

Permalink
chore: Fix import of context package across codebase (#9852)
Browse files Browse the repository at this point in the history
* chore: fix context imports

Signed-off-by: jannfis <[email protected]>

* x/net is now imported indirectly

Signed-off-by: jannfis <[email protected]>

* Make sanitizerKey a unique type

Signed-off-by: jannfis <[email protected]>
  • Loading branch information
jannfis authored Jul 1, 2022
1 parent ece5de6 commit c1d8173
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ require (
github.com/xanzy/go-gitlab v0.60.0
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
golang.org/x/net v0.0.0-20220621193019-9d032be2e588
golang.org/x/net v0.0.0-20220621193019-9d032be2e588 // indirect
golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
Expand Down
2 changes: 1 addition & 1 deletion server/account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"sort"
"time"

"context"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/kubectl/pkg/util/slice"
Expand Down
2 changes: 1 addition & 1 deletion server/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"
"time"

"context"
kubecache "github.com/argoproj/gitops-engine/pkg/cache"
"github.com/argoproj/gitops-engine/pkg/diff"
"github.com/argoproj/gitops-engine/pkg/sync/common"
Expand All @@ -19,7 +20,6 @@ import (
"github.com/argoproj/pkg/sync"
jsonpatch "github.com/evanphx/json-patch"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
v1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion server/certificate/certificate.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package certificate

import (
"golang.org/x/net/context"
"context"

certificatepkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/certificate"
appsv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
Expand Down
2 changes: 1 addition & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package cluster
import (
"time"

"context"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
2 changes: 1 addition & 1 deletion server/gpgkey/gpgkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

"golang.org/x/net/context"
"context"

gpgkeypkg "github.com/argoproj/argo-cd/v2/pkg/apiclient/gpgkey"
appsv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
Expand Down
2 changes: 1 addition & 1 deletion server/repocreds/repocreds.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/argoproj/argo-cd/v2/util/argo"

"golang.org/x/net/context"
"context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

Expand Down
2 changes: 1 addition & 1 deletion server/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
"reflect"

"context"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/argoproj/gitops-engine/pkg/utils/text"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
apierr "k8s.io/apimachinery/pkg/api/errors"
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
// nolint:staticcheck
golang_proto "github.com/golang/protobuf/proto"

netCtx "context"
"github.com/argoproj/pkg/sync"
"github.com/go-redis/redis/v8"
"github.com/golang-jwt/jwt/v4"
Expand All @@ -35,7 +36,6 @@ import (
log "github.com/sirupsen/logrus"
"github.com/soheilhy/cmux"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
netCtx "golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
Expand Down
2 changes: 1 addition & 1 deletion server/settings/settings.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package settings

import (
"context"
"github.com/ghodss/yaml"
"golang.org/x/net/context"

sessionmgr "github.com/argoproj/argo-cd/v2/util/session"

Expand Down
2 changes: 1 addition & 1 deletion server/version/version.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package version

import (
"context"
"github.com/golang/protobuf/ptypes/empty"
"github.com/google/go-jsonnet"
"golang.org/x/net/context"

"github.com/argoproj/argo-cd/v2/common"
"github.com/argoproj/argo-cd/v2/pkg/apiclient/version"
Expand Down
2 changes: 1 addition & 1 deletion util/db/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"regexp"
"strings"

"context"
"golang.org/x/crypto/ssh"
"golang.org/x/net/context"

log "github.com/sirupsen/logrus"

Expand Down
2 changes: 1 addition & 1 deletion util/db/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"sync"
"time"

"context"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
apiv1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion util/db/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"hash/fnv"

"context"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
apiv1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion util/db/repository_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package db
import (
"strings"

"context"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
apiv1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion util/db/repository_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strings"

"context"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion util/db/repository_secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"strconv"
"testing"

"context"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion util/db/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package db
import (
"testing"

"context"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Expand Down
2 changes: 1 addition & 1 deletion util/db/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"time"

"context"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
Expand Down
2 changes: 1 addition & 1 deletion util/grpc/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package grpc
import (
"errors"

"context"
giterr "github.com/go-git/go-git/v5/plumbing/transport"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
2 changes: 1 addition & 1 deletion util/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"time"

"context"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
Expand Down
2 changes: 1 addition & 1 deletion util/grpc/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"encoding/json"
"fmt"

"context"
"github.com/gogo/protobuf/jsonpb"
"github.com/gogo/protobuf/proto"
grpc_logging "github.com/grpc-ecosystem/go-grpc-middleware/logging"
ctx_logrus "github.com/grpc-ecosystem/go-grpc-middleware/tags/logrus"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc"
)

Expand Down
7 changes: 5 additions & 2 deletions util/grpc/sanitizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import (
"regexp"
"strings"

"golang.org/x/net/context"
"context"

"google.golang.org/grpc"
"google.golang.org/grpc/status"
)

type sanitizerKey string

const (
contextKey = "sanitizer"
contextKey sanitizerKey = "sanitizer"
)

// ErrorSanitizerUnaryServerInterceptor returns a new unary server interceptor that sanitizes error messages
Expand Down
2 changes: 1 addition & 1 deletion util/grpc/useragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package grpc
import (
"strings"

"context"
"github.com/Masterminds/semver/v3"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
Expand Down

0 comments on commit c1d8173

Please sign in to comment.