diff --git a/config/config.go b/config/config.go index 9e555cdf..23647cb1 100644 --- a/config/config.go +++ b/config/config.go @@ -1,17 +1,16 @@ package config import ( - "log" - "encoding/json" "fmt" "io/ioutil" + "log" "strings" "sync" + "time" "github.com/aerokube/selenoid/session" "github.com/docker/docker/api/types/container" - "time" ) // Session - session id and vnc flag diff --git a/go.mod b/go.mod index d32140f3..4656a159 100644 --- a/go.mod +++ b/go.mod @@ -3,28 +3,31 @@ module github.com/aerokube/selenoid go 1.17 require ( - github.com/Microsoft/go-winio v0.4.12 // indirect github.com/aandryashin/matchers v0.0.0-20161126170413-435295ea180e github.com/aerokube/ggr v0.0.0-20181215175518-4a2e23fa1769 github.com/aerokube/util v0.0.0-20190701120823-161c21b50f69 github.com/aws/aws-sdk-go v1.20.12 - github.com/docker/distribution v2.7.1+incompatible // indirect github.com/docker/docker v0.7.3-0.20190629173937-e105a74c5419 github.com/docker/go-connections v0.4.0 github.com/docker/go-units v0.4.0 - github.com/gogo/protobuf v1.2.1 // indirect - github.com/golang/protobuf v1.2.0 // indirect github.com/gorilla/websocket v1.4.2 github.com/imdario/mergo v0.3.6 + github.com/mafredri/cdp v0.21.0 + github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c + github.com/pkg/errors v0.8.1 + golang.org/x/net v0.0.0-20190311183353-d8887717615a +) + +require ( + github.com/Microsoft/go-winio v0.4.12 // indirect + github.com/docker/distribution v2.7.1+incompatible // indirect + github.com/gogo/protobuf v1.2.1 // indirect + github.com/golang/protobuf v1.2.0 // indirect github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect - github.com/mafredri/cdp v0.21.0 github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/opencontainers/image-spec v1.0.1 // indirect - github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c - github.com/pkg/errors v0.8.1 github.com/sirupsen/logrus v1.4.2 // indirect - golang.org/x/net v0.0.0-20190311183353-d8887717615a golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb // indirect google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 // indirect google.golang.org/grpc v1.21.1 // indirect diff --git a/main.go b/main.go index 531e6df8..9759211b 100644 --- a/main.go +++ b/main.go @@ -4,27 +4,22 @@ import ( "context" "encoding/json" "flag" - "github.com/aerokube/selenoid/jsonerror" - "github.com/pkg/errors" + "fmt" "log" "net" "net/http" "os" "os/signal" "path" + "path/filepath" "strconv" "strings" "syscall" "time" - "golang.org/x/net/websocket" - - "fmt" - - "path/filepath" - ggr "github.com/aerokube/ggr/config" "github.com/aerokube/selenoid/config" + "github.com/aerokube/selenoid/jsonerror" "github.com/aerokube/selenoid/protect" "github.com/aerokube/selenoid/service" "github.com/aerokube/selenoid/session" @@ -32,6 +27,8 @@ import ( "github.com/aerokube/util" "github.com/aerokube/util/docker" "github.com/docker/docker/client" + "github.com/pkg/errors" + "golang.org/x/net/websocket" ) var ( diff --git a/metadata.go b/metadata.go index 2481a3e6..8d226e34 100644 --- a/metadata.go +++ b/metadata.go @@ -1,15 +1,17 @@ +//go:build metadata // +build metadata package main import ( "encoding/json" - "github.com/aerokube/selenoid/event" - "github.com/aerokube/selenoid/session" "io/ioutil" "log" "path/filepath" "time" + + "github.com/aerokube/selenoid/event" + "github.com/aerokube/selenoid/session" ) const metadataFileExtension = ".json" diff --git a/protect/queue.go b/protect/queue.go index abbddaf9..d6c3f28c 100644 --- a/protect/queue.go +++ b/protect/queue.go @@ -2,12 +2,12 @@ package protect import ( "errors" - "github.com/aerokube/selenoid/jsonerror" "log" "math" "net/http" "time" + "github.com/aerokube/selenoid/jsonerror" "github.com/aerokube/util" ) diff --git a/s3_test.go b/s3_test.go index c6e62a54..b8e14866 100644 --- a/s3_test.go +++ b/s3_test.go @@ -1,13 +1,10 @@ +//go:build s3 // +build s3 package main import ( "context" - . "github.com/aandryashin/matchers" - "github.com/aerokube/selenoid/event" - "github.com/aerokube/selenoid/session" - "github.com/aerokube/selenoid/upload" "io/ioutil" "net" "net/http" @@ -15,6 +12,11 @@ import ( "strings" "testing" "time" + + . "github.com/aandryashin/matchers" + "github.com/aerokube/selenoid/event" + "github.com/aerokube/selenoid/session" + "github.com/aerokube/selenoid/upload" ) var ( diff --git a/selenoid.go b/selenoid.go index 835584ae..12713670 100644 --- a/selenoid.go +++ b/selenoid.go @@ -9,10 +9,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/aerokube/selenoid/event" - "github.com/aerokube/selenoid/jsonerror" - "github.com/aerokube/selenoid/service" - "github.com/imdario/mergo" "io" "io/ioutil" "log" @@ -28,10 +24,14 @@ import ( "sync" "time" + "github.com/aerokube/selenoid/event" + "github.com/aerokube/selenoid/jsonerror" + "github.com/aerokube/selenoid/service" "github.com/aerokube/selenoid/session" "github.com/aerokube/util" "github.com/docker/docker/api/types" "github.com/docker/docker/pkg/stdcopy" + "github.com/imdario/mergo" "golang.org/x/net/websocket" ) diff --git a/selenoid_test.go b/selenoid_test.go index c9172dfa..9983d8d2 100644 --- a/selenoid_test.go +++ b/selenoid_test.go @@ -3,26 +3,24 @@ package main import ( "bytes" "context" + "encoding/json" "fmt" - "github.com/mafredri/cdp" - "github.com/mafredri/cdp/rpcc" "io/ioutil" "log" "net/http" "net/http/httptest" "os" + "path/filepath" "strings" "testing" "time" - "github.com/aerokube/selenoid/config" - - "encoding/json" - "path/filepath" - . "github.com/aandryashin/matchers" . "github.com/aandryashin/matchers/httpresp" ggr "github.com/aerokube/ggr/config" + "github.com/aerokube/selenoid/config" + "github.com/mafredri/cdp" + "github.com/mafredri/cdp/rpcc" ) var _ = func() bool { diff --git a/service/docker.go b/service/docker.go index a102f9cf..447309bc 100644 --- a/service/docker.go +++ b/service/docker.go @@ -3,11 +3,13 @@ package service import ( "context" "fmt" - "github.com/docker/go-units" "log" "net" "net/url" + "os" + "path/filepath" "strconv" + "strings" "time" "github.com/aerokube/selenoid/config" @@ -20,9 +22,7 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/pkg/stdcopy" "github.com/docker/go-connections/nat" - "os" - "path/filepath" - "strings" + "github.com/docker/go-units" ) const ( diff --git a/service/driver.go b/service/driver.go index 342b2de6..587d37cd 100644 --- a/service/driver.go +++ b/service/driver.go @@ -1,18 +1,18 @@ package service import ( + "errors" "fmt" "log" "net" "net/url" + "os" "os/exec" + "path/filepath" "time" - "errors" "github.com/aerokube/selenoid/session" "github.com/aerokube/util" - "os" - "path/filepath" ) // Driver - driver processes manager @@ -77,11 +77,11 @@ func (d *Driver) StartWithCancel() (*StartedService, error) { } log.Printf("[%d] [PROCESS_STARTED] [%d] [%.2fs]", requestId, cmd.Process.Pid, util.SecondsSince(s)) log.Printf("[%d] [PROXY_TO] [%s]", requestId, u.String()) - hp := session.HostPort{} - if d.Caps.VNC { - hp.VNC = "127.0.0.1:5900" - } - return &StartedService{Url: u, HostPort: hp, Cancel: func() { d.stopProcess(cmd) }}, nil + hp := session.HostPort{} + if d.Caps.VNC { + hp.VNC = "127.0.0.1:5900" + } + return &StartedService{Url: u, HostPort: hp, Cancel: func() { d.stopProcess(cmd) }}, nil } func (d *Driver) stopProcess(cmd *exec.Cmd) { diff --git a/service/driver_unix.go b/service/driver_unix.go index e0ff87f2..8f95e3d0 100644 --- a/service/driver_unix.go +++ b/service/driver_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package service @@ -8,7 +9,7 @@ import ( ) func stopProc(cmd *exec.Cmd) error { - exitCode := cmd.Process.Signal(syscall.SIGINT) - cmd.Wait() - return exitCode + exitCode := cmd.Process.Signal(syscall.SIGINT) + cmd.Wait() + return exitCode } diff --git a/service/driver_windows.go b/service/driver_windows.go index cff64adb..782bb1ab 100644 --- a/service/driver_windows.go +++ b/service/driver_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package service diff --git a/service_test.go b/service_test.go index 9d34cd68..40d3d51c 100644 --- a/service_test.go +++ b/service_test.go @@ -3,14 +3,6 @@ package main import ( "bytes" "fmt" - . "github.com/aandryashin/matchers" - "github.com/aerokube/selenoid/config" - "github.com/aerokube/selenoid/service" - "github.com/aerokube/selenoid/session" - "github.com/aerokube/util" - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/client" - "golang.org/x/net/websocket" "io" "io/ioutil" "net" @@ -21,6 +13,15 @@ import ( "sync" "testing" "time" + + . "github.com/aandryashin/matchers" + "github.com/aerokube/selenoid/config" + "github.com/aerokube/selenoid/service" + "github.com/aerokube/selenoid/session" + "github.com/aerokube/util" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/client" + "golang.org/x/net/websocket" ) var ( diff --git a/session/session.go b/session/session.go index 3aa53936..3327d77e 100644 --- a/session/session.go +++ b/session/session.go @@ -1,10 +1,11 @@ package session import ( - "github.com/imdario/mergo" "net/url" "sync" "time" + + "github.com/imdario/mergo" ) // Caps - user capabilities diff --git a/upload/s3.go b/upload/s3.go index 01ed6dd8..b54dfbf1 100644 --- a/upload/s3.go +++ b/upload/s3.go @@ -1,3 +1,4 @@ +//go:build s3 // +build s3 package upload @@ -5,18 +6,19 @@ package upload import ( "flag" "fmt" - "github.com/aerokube/selenoid/event" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - awssession "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/s3/s3manager" - "github.com/pkg/errors" "log" "mime" "os" "path/filepath" "strings" "time" + + "github.com/aerokube/selenoid/event" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + awssession "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3/s3manager" + "github.com/pkg/errors" ) func init() { diff --git a/upload/uploader.go b/upload/uploader.go index 7ce3d949..3bbb70b1 100644 --- a/upload/uploader.go +++ b/upload/uploader.go @@ -1,10 +1,11 @@ package upload import ( - "github.com/aerokube/selenoid/event" - "github.com/aerokube/util" "log" "time" + + "github.com/aerokube/selenoid/event" + "github.com/aerokube/util" ) var ( diff --git a/utils_test.go b/utils_test.go index d40a0457..160afdd6 100644 --- a/utils_test.go +++ b/utils_test.go @@ -5,8 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/aerokube/selenoid/protect" - "github.com/gorilla/websocket" "log" "net/http" "net/http/httptest" @@ -14,14 +12,14 @@ import ( "strconv" "strings" "sync" - - "time" - "testing" + "time" . "github.com/aandryashin/matchers" + "github.com/aerokube/selenoid/protect" "github.com/aerokube/selenoid/service" "github.com/aerokube/selenoid/session" + "github.com/gorilla/websocket" "github.com/pborman/uuid" )