From cd10d8eaa4711d5f3ccd55f13d0d43b136c781b1 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Fri, 15 Jan 2021 15:32:21 +0100 Subject: [PATCH] Move server => cli Signed-off-by: Guillaume Tardif --- cli/cmd/serve.go | 4 ++-- {server => cli/server}/contextserverstream.go | 0 {server => cli/server}/interceptor.go | 2 +- {server => cli/server}/interceptor_test.go | 0 {server => cli/server}/metrics.go | 2 +- {server => cli/server}/metrics_test.go | 2 +- {server => cli/server}/proxy/compose.go | 0 {server => cli/server}/proxy/containers.go | 2 +- {server => cli/server}/proxy/containers_test.go | 0 {server => cli/server}/proxy/contexts.go | 0 {server => cli/server}/proxy/contexts_test.go | 0 {server => cli/server}/proxy/proxy.go | 2 +- {server => cli/server}/proxy/streams.go | 2 +- {server => cli/server}/proxy/streams/io.go | 0 {server => cli/server}/proxy/streams/logs.go | 0 {server => cli/server}/proxy/streams/logs_test.go | 0 {server => cli/server}/proxy/streams/stream.go | 0 {server => cli/server}/proxy/streams/stream_test.go | 0 {server => cli/server}/proxy/volumes.go | 0 {server => cli/server}/server.go | 0 {server => cli/server}/socket_unix.go | 0 {server => cli/server}/socket_windows.go | 0 import-restrictions.yaml | 8 -------- 23 files changed, 8 insertions(+), 16 deletions(-) rename {server => cli/server}/contextserverstream.go (100%) rename {server => cli/server}/interceptor.go (98%) rename {server => cli/server}/interceptor_test.go (100%) rename {server => cli/server}/metrics.go (98%) rename {server => cli/server}/metrics_test.go (98%) rename {server => cli/server}/proxy/compose.go (100%) rename {server => cli/server}/proxy/containers.go (99%) rename {server => cli/server}/proxy/containers_test.go (100%) rename {server => cli/server}/proxy/contexts.go (100%) rename {server => cli/server}/proxy/contexts_test.go (100%) rename {server => cli/server}/proxy/proxy.go (97%) rename {server => cli/server}/proxy/streams.go (96%) rename {server => cli/server}/proxy/streams/io.go (100%) rename {server => cli/server}/proxy/streams/logs.go (100%) rename {server => cli/server}/proxy/streams/logs_test.go (100%) rename {server => cli/server}/proxy/streams/stream.go (100%) rename {server => cli/server}/proxy/streams/stream_test.go (100%) rename {server => cli/server}/proxy/volumes.go (100%) rename {server => cli/server}/server.go (100%) rename {server => cli/server}/socket_unix.go (100%) rename {server => cli/server}/socket_windows.go (100%) diff --git a/cli/cmd/serve.go b/cli/cmd/serve.go index d11e47a0e..e2ba148ac 100644 --- a/cli/cmd/serve.go +++ b/cli/cmd/serve.go @@ -23,13 +23,13 @@ import ( "github.com/sirupsen/logrus" "github.com/spf13/cobra" + "github.com/docker/compose-cli/cli/server" + "github.com/docker/compose-cli/cli/server/proxy" composev1 "github.com/docker/compose-cli/protos/compose/v1" containersv1 "github.com/docker/compose-cli/protos/containers/v1" contextsv1 "github.com/docker/compose-cli/protos/contexts/v1" streamsv1 "github.com/docker/compose-cli/protos/streams/v1" volumesv1 "github.com/docker/compose-cli/protos/volumes/v1" - "github.com/docker/compose-cli/server" - "github.com/docker/compose-cli/server/proxy" ) type serveOpts struct { diff --git a/server/contextserverstream.go b/cli/server/contextserverstream.go similarity index 100% rename from server/contextserverstream.go rename to cli/server/contextserverstream.go diff --git a/server/interceptor.go b/cli/server/interceptor.go similarity index 98% rename from server/interceptor.go rename to cli/server/interceptor.go index 17165a10e..4cbcec642 100644 --- a/server/interceptor.go +++ b/cli/server/interceptor.go @@ -25,10 +25,10 @@ import ( "google.golang.org/grpc/metadata" "github.com/docker/compose-cli/api/client" + "github.com/docker/compose-cli/cli/server/proxy" "github.com/docker/compose-cli/config" apicontext "github.com/docker/compose-cli/context" "github.com/docker/compose-cli/context/store" - "github.com/docker/compose-cli/server/proxy" ) // key is the key where the current docker context is stored in the metadata diff --git a/server/interceptor_test.go b/cli/server/interceptor_test.go similarity index 100% rename from server/interceptor_test.go rename to cli/server/interceptor_test.go diff --git a/server/metrics.go b/cli/server/metrics.go similarity index 98% rename from server/metrics.go rename to cli/server/metrics.go index bde81f9bb..8dd5065e3 100644 --- a/server/metrics.go +++ b/cli/server/metrics.go @@ -22,7 +22,7 @@ import ( "google.golang.org/grpc" "github.com/docker/compose-cli/cli/metrics" - "github.com/docker/compose-cli/server/proxy" + "github.com/docker/compose-cli/cli/server/proxy" ) var ( diff --git a/server/metrics_test.go b/cli/server/metrics_test.go similarity index 98% rename from server/metrics_test.go rename to cli/server/metrics_test.go index 4185cf541..87ec5abaa 100644 --- a/server/metrics_test.go +++ b/cli/server/metrics_test.go @@ -34,13 +34,13 @@ import ( "github.com/docker/compose-cli/api/secrets" "github.com/docker/compose-cli/api/volumes" "github.com/docker/compose-cli/cli/metrics" + "github.com/docker/compose-cli/cli/server/proxy" "github.com/docker/compose-cli/errdefs" composev1 "github.com/docker/compose-cli/protos/compose/v1" containersv1 "github.com/docker/compose-cli/protos/containers/v1" contextsv1 "github.com/docker/compose-cli/protos/contexts/v1" streamsv1 "github.com/docker/compose-cli/protos/streams/v1" volumesv1 "github.com/docker/compose-cli/protos/volumes/v1" - "github.com/docker/compose-cli/server/proxy" ) func TestAllMethodsHaveCorrespondingCliCommand(t *testing.T) { diff --git a/server/proxy/compose.go b/cli/server/proxy/compose.go similarity index 100% rename from server/proxy/compose.go rename to cli/server/proxy/compose.go diff --git a/server/proxy/containers.go b/cli/server/proxy/containers.go similarity index 99% rename from server/proxy/containers.go rename to cli/server/proxy/containers.go index 03ed13867..8a6e18c46 100644 --- a/server/proxy/containers.go +++ b/cli/server/proxy/containers.go @@ -25,9 +25,9 @@ import ( specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/docker/compose-cli/api/containers" + "github.com/docker/compose-cli/cli/server/proxy/streams" "github.com/docker/compose-cli/formatter" containersv1 "github.com/docker/compose-cli/protos/containers/v1" - "github.com/docker/compose-cli/server/proxy/streams" ) func portsToGrpc(ports []containers.Port) []*containersv1.Port { diff --git a/server/proxy/containers_test.go b/cli/server/proxy/containers_test.go similarity index 100% rename from server/proxy/containers_test.go rename to cli/server/proxy/containers_test.go diff --git a/server/proxy/contexts.go b/cli/server/proxy/contexts.go similarity index 100% rename from server/proxy/contexts.go rename to cli/server/proxy/contexts.go diff --git a/server/proxy/contexts_test.go b/cli/server/proxy/contexts_test.go similarity index 100% rename from server/proxy/contexts_test.go rename to cli/server/proxy/contexts_test.go diff --git a/server/proxy/proxy.go b/cli/server/proxy/proxy.go similarity index 97% rename from server/proxy/proxy.go rename to cli/server/proxy/proxy.go index 89f46b6ad..bccd14532 100644 --- a/server/proxy/proxy.go +++ b/cli/server/proxy/proxy.go @@ -21,13 +21,13 @@ import ( "sync" "github.com/docker/compose-cli/api/client" + "github.com/docker/compose-cli/cli/server/proxy/streams" "github.com/docker/compose-cli/config" composev1 "github.com/docker/compose-cli/protos/compose/v1" containersv1 "github.com/docker/compose-cli/protos/containers/v1" contextsv1 "github.com/docker/compose-cli/protos/contexts/v1" streamsv1 "github.com/docker/compose-cli/protos/streams/v1" volumesv1 "github.com/docker/compose-cli/protos/volumes/v1" - "github.com/docker/compose-cli/server/proxy/streams" ) type clientKey struct{} diff --git a/server/proxy/streams.go b/cli/server/proxy/streams.go similarity index 96% rename from server/proxy/streams.go rename to cli/server/proxy/streams.go index dee404d3c..aeeb954cd 100644 --- a/server/proxy/streams.go +++ b/cli/server/proxy/streams.go @@ -21,8 +21,8 @@ import ( "github.com/sirupsen/logrus" "google.golang.org/grpc/metadata" + "github.com/docker/compose-cli/cli/server/proxy/streams" streamsv1 "github.com/docker/compose-cli/protos/streams/v1" - "github.com/docker/compose-cli/server/proxy/streams" ) func (p *proxy) NewStream(stream streamsv1.Streaming_NewStreamServer) error { diff --git a/server/proxy/streams/io.go b/cli/server/proxy/streams/io.go similarity index 100% rename from server/proxy/streams/io.go rename to cli/server/proxy/streams/io.go diff --git a/server/proxy/streams/logs.go b/cli/server/proxy/streams/logs.go similarity index 100% rename from server/proxy/streams/logs.go rename to cli/server/proxy/streams/logs.go diff --git a/server/proxy/streams/logs_test.go b/cli/server/proxy/streams/logs_test.go similarity index 100% rename from server/proxy/streams/logs_test.go rename to cli/server/proxy/streams/logs_test.go diff --git a/server/proxy/streams/stream.go b/cli/server/proxy/streams/stream.go similarity index 100% rename from server/proxy/streams/stream.go rename to cli/server/proxy/streams/stream.go diff --git a/server/proxy/streams/stream_test.go b/cli/server/proxy/streams/stream_test.go similarity index 100% rename from server/proxy/streams/stream_test.go rename to cli/server/proxy/streams/stream_test.go diff --git a/server/proxy/volumes.go b/cli/server/proxy/volumes.go similarity index 100% rename from server/proxy/volumes.go rename to cli/server/proxy/volumes.go diff --git a/server/server.go b/cli/server/server.go similarity index 100% rename from server/server.go rename to cli/server/server.go diff --git a/server/socket_unix.go b/cli/server/socket_unix.go similarity index 100% rename from server/socket_unix.go rename to cli/server/socket_unix.go diff --git a/server/socket_windows.go b/cli/server/socket_windows.go similarity index 100% rename from server/socket_windows.go rename to cli/server/socket_windows.go diff --git a/import-restrictions.yaml b/import-restrictions.yaml index 7b3445576..6e03d9038 100644 --- a/import-restrictions.yaml +++ b/import-restrictions.yaml @@ -5,29 +5,21 @@ - github.com/docker/compose-cli/ecs - github.com/docker/compose-cli/example - github.com/docker/compose-cli/local - - github.com/docker/compose-cli/metrics - - github.com/docker/compose-cli/server - path: ./ecs forbiddenImports: - github.com/docker/compose-cli/aci - github.com/docker/compose-cli/cli - github.com/docker/compose-cli/example - github.com/docker/compose-cli/local - - github.com/docker/compose-cli/metrics - - github.com/docker/compose-cli/server - path: ./example forbiddenImports: - github.com/docker/compose-cli/aci - github.com/docker/compose-cli/cli - github.com/docker/compose-cli/ecs - github.com/docker/compose-cli/local - - github.com/docker/compose-cli/metrics - - github.com/docker/compose-cli/server - path: ./local forbiddenImports: - github.com/docker/compose-cli/aci - github.com/docker/compose-cli/cli - github.com/docker/compose-cli/ecs - github.com/docker/compose-cli/example - - github.com/docker/compose-cli/metrics - - github.com/docker/compose-cli/server