summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2021-07-26 16:22:34 -0700
committerStan Hu <stanhu@gmail.com>2021-07-26 16:22:34 -0700
commit4e81d534c2f2c87ebdfeafb1f8338b17ffdfc708 (patch)
treea8084b9c6e3baf279eed8b27999e6813b0407794
parent0997266fc03b0851e4ef52d25dbe8b44bdba7de7 (diff)
downloadgitlab-shell-4e81d534c2f2c87ebdfeafb1f8338b17ffdfc708.tar.gz
Fix formatting via make fmt
-rw-r--r--client/gitlabnet.go6
-rw-r--r--client/httpclient.go2
-rw-r--r--cmd/gitlab-sshd/main.go4
-rw-r--r--internal/config/config.go1
-rw-r--r--internal/config/config_test.go4
-rw-r--r--internal/handler/exec.go4
-rw-r--r--internal/sshd/sshd.go15
-rw-r--r--internal/sshd/sshd_test.go8
-rw-r--r--internal/testhelper/testhelper.go2
9 files changed, 22 insertions, 24 deletions
diff --git a/client/gitlabnet.go b/client/gitlabnet.go
index a262d93..f71c110 100644
--- a/client/gitlabnet.go
+++ b/client/gitlabnet.go
@@ -132,9 +132,9 @@ func (c *GitlabNetClient) DoRequest(ctx context.Context, method, path string, da
start := time.Now()
response, err := c.httpClient.Do(request)
fields := log.Fields{
- "method": method,
- "url": request.URL.String(),
- "duration_ms": time.Since(start) / time.Millisecond,
+ "method": method,
+ "url": request.URL.String(),
+ "duration_ms": time.Since(start) / time.Millisecond,
}
logger := log.WithContextFields(ctx, fields)
diff --git a/client/httpclient.go b/client/httpclient.go
index bcf81dd..f2e82e5 100644
--- a/client/httpclient.go
+++ b/client/httpclient.go
@@ -13,8 +13,8 @@ import (
"time"
"gitlab.com/gitlab-org/labkit/correlation"
- "gitlab.com/gitlab-org/labkit/tracing"
"gitlab.com/gitlab-org/labkit/log"
+ "gitlab.com/gitlab-org/labkit/tracing"
)
const (
diff --git a/cmd/gitlab-sshd/main.go b/cmd/gitlab-sshd/main.go
index 4cc5f69..d1cc84e 100644
--- a/cmd/gitlab-sshd/main.go
+++ b/cmd/gitlab-sshd/main.go
@@ -1,10 +1,10 @@
package main
import (
+ "context"
"flag"
"os"
"os/signal"
- "context"
"syscall"
"time"
@@ -13,8 +13,8 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/internal/logger"
"gitlab.com/gitlab-org/gitlab-shell/internal/sshd"
- "gitlab.com/gitlab-org/labkit/monitoring"
"gitlab.com/gitlab-org/labkit/log"
+ "gitlab.com/gitlab-org/labkit/monitoring"
)
var (
diff --git a/internal/config/config.go b/internal/config/config.go
index ba21219..5aa99de 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -109,7 +109,6 @@ func (c *Config) HttpClient() *client.HttpClient {
tr := client.Transport
client.Transport = promhttp.InstrumentRoundTripperDuration(metrics.HttpRequestDuration, tr)
-
c.httpClient = client
})
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 521dd35..5fa8e66 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -4,11 +4,11 @@ import (
"os"
"testing"
- "github.com/stretchr/testify/require"
"github.com/prometheus/client_golang/prometheus"
+ "github.com/stretchr/testify/require"
- "gitlab.com/gitlab-org/gitlab-shell/internal/testhelper"
"gitlab.com/gitlab-org/gitlab-shell/client/testserver"
+ "gitlab.com/gitlab-org/gitlab-shell/internal/testhelper"
)
func TestConfigApplyGlobalState(t *testing.T) {
diff --git a/internal/handler/exec.go b/internal/handler/exec.go
index 89856f7..27031b1 100644
--- a/internal/handler/exec.go
+++ b/internal/handler/exec.go
@@ -18,10 +18,10 @@ import (
gitalyauth "gitlab.com/gitlab-org/gitaly/v14/auth"
"gitlab.com/gitlab-org/gitaly/v14/client"
pb "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
- grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc"
- grpctracing "gitlab.com/gitlab-org/labkit/tracing/grpc"
"gitlab.com/gitlab-org/labkit/correlation"
+ grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc"
"gitlab.com/gitlab-org/labkit/log"
+ grpctracing "gitlab.com/gitlab-org/labkit/tracing/grpc"
)
// GitalyHandlerFunc implementations are responsible for making
diff --git a/internal/sshd/sshd.go b/internal/sshd/sshd.go
index d3b5ec1..7f96bef 100644
--- a/internal/sshd/sshd.go
+++ b/internal/sshd/sshd.go
@@ -7,10 +7,10 @@ import (
"fmt"
"io/ioutil"
"net"
+ "net/http"
"strconv"
- "time"
"sync"
- "net/http"
+ "time"
"github.com/pires/go-proxyproto"
"golang.org/x/crypto/ssh"
@@ -18,13 +18,13 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/authorizedkeys"
- "gitlab.com/gitlab-org/labkit/log"
"gitlab.com/gitlab-org/labkit/correlation"
+ "gitlab.com/gitlab-org/labkit/log"
)
type status int
-const(
+const (
StatusStarting status = iota
StatusReady
StatusOnShutdown
@@ -34,9 +34,9 @@ const(
type Server struct {
Config *config.Config
- status status
+ status status
statusMu sync.Mutex
- wg sync.WaitGroup
+ wg sync.WaitGroup
listener net.Listener
}
@@ -71,7 +71,7 @@ func (s *Server) MonitoringServeMux() *http.ServeMux {
})
mux.HandleFunc(s.Config.Server.LivenessProbe, func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
+ w.WriteHeader(http.StatusOK)
})
return mux
@@ -191,7 +191,6 @@ func (s *Server) initConfig(ctx context.Context) (*ssh.ServerConfig, error) {
return sshCfg, nil
}
-
func (s *Server) handleConn(ctx context.Context, sshCfg *ssh.ServerConfig, nconn net.Conn) {
remoteAddr := nconn.RemoteAddr().String()
diff --git a/internal/sshd/sshd_test.go b/internal/sshd/sshd_test.go
index 9187140..e5f6111 100644
--- a/internal/sshd/sshd_test.go
+++ b/internal/sshd/sshd_test.go
@@ -1,10 +1,10 @@
package sshd
import (
- "testing"
"context"
- "path"
"net/http/httptest"
+ "path"
+ "testing"
"time"
"github.com/stretchr/testify/require"
@@ -75,7 +75,7 @@ func setupServer(t *testing.T) *Server {
url := testserver.StartSocketHttpServer(t, []testserver.TestRequestHandler{})
srvCfg := config.ServerConfig{
- Listen: serverUrl,
+ Listen: serverUrl,
HostKeyFiles: []string{path.Join(testhelper.TestRoot, "certs/valid/server.key")},
}
@@ -85,7 +85,7 @@ func setupServer(t *testing.T) *Server {
}
func verifyStatus(t *testing.T, s *Server, st status) {
- for i := 5; i < 500; i+=50 {
+ for i := 5; i < 500; i += 50 {
if s.getStatus() == st {
break
}
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go
index c2c7826..933da00 100644
--- a/internal/testhelper/testhelper.go
+++ b/internal/testhelper/testhelper.go
@@ -6,8 +6,8 @@ import (
"os"
"path"
"runtime"
- "time"
"testing"
+ "time"
"github.com/otiai10/copy"
"github.com/sirupsen/logrus"