Very minor clean-ups (import re-ordering by automated tooling) (#28)

This commit is contained in:
Michael Vorburger ⛑️ 2021-12-12 01:20:19 +01:00 committed by GitHub
parent ca55bde751
commit 1f5ac0b49d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 27 deletions

View File

@ -4,6 +4,9 @@ import (
"context"
"errors"
"fmt"
"strings"
"time"
kitlogrus "github.com/go-kit/kit/log/logrus"
discardMetrics "github.com/go-kit/kit/metrics/discard"
expvarMetrics "github.com/go-kit/kit/metrics/expvar"
@ -11,8 +14,6 @@ import (
influx "github.com/influxdata/influxdb1-client/v2"
"github.com/itzg/mc-router/server"
"github.com/sirupsen/logrus"
"strings"
"time"
)
type MetricsBuilder interface {

View File

@ -4,14 +4,15 @@ import (
"bufio"
"bytes"
"encoding/binary"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/text/encoding/unicode"
"golang.org/x/text/transform"
"io"
"net"
"strings"
"time"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/text/encoding/unicode"
"golang.org/x/text/transform"
)
func ReadPacket(reader io.Reader, addr net.Addr, state State) (*Packet, error) {

View File

@ -2,9 +2,10 @@ package mcproto
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
)
func TestReadVarInt(t *testing.T) {

View File

@ -2,9 +2,10 @@ package server
import (
"expvar"
"net/http"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
"net/http"
)
var apiRoutes = mux.NewRouter()

View File

@ -3,15 +3,16 @@ package server
import (
"bytes"
"context"
"io"
"net"
"strconv"
"time"
"github.com/go-kit/kit/metrics"
"github.com/itzg/mc-router/mcproto"
"github.com/juju/ratelimit"
"github.com/pires/go-proxyproto"
"github.com/sirupsen/logrus"
"io"
"net"
"strconv"
"time"
)
const (
@ -243,7 +244,6 @@ func (c *connectorImpl) findAndConnectBackend(ctx context.Context, frontendConn
}
c.pumpConnections(ctx, frontendConn, backendConn)
return
}
func (c *connectorImpl) pumpConnections(ctx context.Context, frontendConn, backendConn net.Conn) {

View File

@ -1,17 +1,18 @@
package server
import (
"net"
"strconv"
"strings"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"net"
"strconv"
"strings"
)
const (

View File

@ -2,10 +2,11 @@ package server
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/core/v1"
"testing"
)
func TestK8sWatcherImpl_handleAddThenUpdate(t *testing.T) {

View File

@ -2,11 +2,12 @@ package server
import (
"encoding/json"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
"net/http"
"strings"
"sync"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
)
func init() {
@ -134,16 +135,12 @@ func (r *routesImpl) FindBackendForServerAddress(serverAddress string) (string,
address := strings.ToLower(addressParts[0])
if r.mappings == nil {
return r.defaultRoute, address
} else {
if r.mappings != nil {
if route, exists := r.mappings[address]; exists {
return route, address
} else {
return r.defaultRoute, address
}
}
return r.defaultRoute, address
}
func (r *routesImpl) GetMappings() map[string]string {

View File

@ -1,8 +1,9 @@
package server
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_routesImpl_FindBackendForServerAddress(t *testing.T) {