Replace net/context with context package

Leveraging `go fix` these changes were made, I only applied some regexp
to get the import grouping correct.

The old package can't be removed from vendor directory yet, as other
dependencies depend on it.
parent 4f46cf40
Pipeline #43255667 passed with stages
in 16 minutes and 18 seconds
package gitalyauth
import (
"context"
"testing"
"time"
"github.com/grpc-ecosystem/go-grpc-middleware/util/metautils"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
......
package gitalyauth
import (
"context"
"encoding/base64"
"fmt"
"strconv"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc/credentials"
)
......
package gitalyauth
import (
"context"
"crypto/hmac"
"crypto/sha256"
"crypto/subtle"
......@@ -11,7 +12,6 @@ import (
"time"
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
......
---
title: Replace golang.org/x/net/context with context package
merge_request: 1038
author:
type: other
package client
import (
"context"
"io"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/streamio"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
......
package client
import (
"context"
"io"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/streamio"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
......
package client
import (
"context"
"io"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/streamio"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
......
package featureflag
import (
"context"
"fmt"
"golang.org/x/net/context"
"google.golang.org/grpc/metadata"
)
......
package featureflag
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"google.golang.org/grpc/metadata"
)
......
package housekeeping
import (
"context"
"os"
"path/filepath"
"strings"
......@@ -8,7 +9,6 @@ import (
grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
)
const deleteTempFilesOlderThanDuration = 7 * 24 * time.Hour
......
package housekeeping
import (
"context"
"io/ioutil"
"os"
"path/filepath"
......@@ -8,7 +9,6 @@ import (
"time"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)
type entryFinalState int
......
package helper
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"gitlab.com/gitlab-org/gitaly/internal/storage"
"golang.org/x/net/context"
"google.golang.org/grpc/metadata"
)
......
package cancelhandler
import (
"golang.org/x/net/context"
"context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
......
package limithandler
import (
"context"
"sync"
"time"
"golang.org/x/net/context"
"golang.org/x/sync/semaphore"
)
......
package limithandler
import (
"context"
"strconv"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)
type counter struct {
......
package limithandler
import (
"golang.org/x/net/context"
"context"
"google.golang.org/grpc"
)
......
package limithandler_test
import (
"context"
"net"
"sync"
"testing"
......@@ -10,7 +11,6 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/middleware/limithandler"
pb "gitlab.com/gitlab-org/gitaly/internal/middleware/limithandler/testpb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
......
package limithandler
import (
"context"
"strings"
"time"
grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
)
const acquireDurationLogThreshold = 10 * time.Millisecond
......
package limithandler_test
import (
"context"
"sync/atomic"
pb "gitlab.com/gitlab-org/gitaly/internal/middleware/limithandler/testpb"
"golang.org/x/net/context"
)
type server struct {
......
......@@ -24,7 +24,8 @@ import fmt "fmt"
import math "math"
import (
context "golang.org/x/net/context"
context "context"
grpc "google.golang.org/grpc"
)
......
package metadatahandler
import (
"context"
grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
"github.com/prometheus/client_golang/prometheus"
gitalyauth "gitlab.com/gitlab-org/gitaly/auth"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/labkit/correlation"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
......
package panichandler
import (
"context"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
......
package sentryhandler
import (
"context"
"fmt"
"strings"
"time"
......@@ -8,7 +9,6 @@ import (
raven "github.com/getsentry/raven-go"
grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
)
......
package sentryhandler
import (
"context"
"fmt"
"testing"
"time"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
......
package rubyserver
import (
"context"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
)
......
package rubyserver
import (
"context"
"fmt"
"io/ioutil"
"os"
......@@ -24,7 +25,6 @@ import (
"gitlab.com/gitlab-org/gitaly/streamio"
grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc"
grpctracing "gitlab.com/gitlab-org/labkit/tracing/grpc"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
......
package auth
import (
"context"
"time"
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
"github.com/prometheus/client_golang/prometheus"
gitalyauth "gitlab.com/gitlab-org/gitaly/auth"
"gitlab.com/gitlab-org/gitaly/internal/config"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
......
package server
import (
netctx "context"
"crypto/x509"
"io/ioutil"
"net"
......@@ -11,7 +12,6 @@ import (
gitalyauth "gitlab.com/gitlab-org/gitaly/auth"
"gitlab.com/gitlab-org/gitaly/internal/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
netctx "golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
......
package server
import (
"context"
"crypto/tls"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
......@@ -22,7 +23,6 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/service"
grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc"
grpctracing "gitlab.com/gitlab-org/labkit/tracing/grpc"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/reflection"
......
package commit
import (
"context"
"io"
"testing"
......@@ -8,7 +9,6 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"io"
"testing"
......@@ -8,7 +9,6 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
......@@ -2,6 +2,7 @@ package commit
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"strconv"
......@@ -10,7 +11,6 @@ import (
grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/git"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
......
package commit
import (
"context"
"fmt"
"testing"
"time"
......@@ -9,7 +10,6 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"io"
"io/ioutil"
"testing"
......@@ -8,7 +9,6 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"io"
"testing"
......@@ -9,7 +10,6 @@ import (
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/service/ref"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/git"
"gitlab.com/gitlab-org/gitaly/internal/git/log"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
......
package commit
import (
"context"
"io/ioutil"
"strings"
"testing"
......@@ -12,7 +13,6 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/git/log"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
......
package commit
import (
"context"
grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/git"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
......
package commit
import (
"context"
"fmt"
"os/exec"
"testing"
......@@ -9,7 +10,6 @@ import (
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"io/ioutil"
"sort"
"strings"
......@@ -10,7 +11,6 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/linguist"
"gitlab.com/gitlab-org/gitaly/internal/service/ref"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
......
package commit
import (
"context"
"fmt"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/git/log"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
......
package commit
import (
"context"
"testing"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"io"
"testing"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
)
func TestSuccessfulListCommitsByOidRequest(t *testing.T) {
......
......@@ -2,6 +2,7 @@ package commit
import (
"bytes"
"context"
"fmt"
"io"
"testing"
......@@ -9,7 +10,6 @@ import (
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/service/ref"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"io"
"testing"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"fmt"
"io/ioutil"
"testing"
......@@ -9,7 +10,6 @@ import (
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/streamio"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
package commit
import (
"context"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/rubyserver"
"golang.org/x/net/context"
)
func (s *server) CommitStats(ctx context.Context, in *gitalypb.CommitStatsRequest) (*gitalypb.CommitStatsResponse, error) {
......
package commit
import (
"context"
"fmt"
"io"
"os"
......@@ -10,7 +11,6 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
)
......
......@@ -2,13 +2,13 @@ package commit
import (
"bytes"
"context"
"fmt"
"io"
"testing"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"golang.org/x/net/context"