diff --git a/Dockerfile b/Dockerfile index ef9a7dce6..b9ed3d680 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ protobuf-compiler \ libprotobuf-dev RUN go get github.com/golang/protobuf/protoc-gen-go && \ + go get golang.org/x/tools/cmd/goimports && \ go get gotest.tools/gotestsum WORKDIR ${PWD} ADD go.* ${PWD} @@ -34,10 +35,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ make xbins FROM scratch AS protos -COPY --from=make-protos /go/src/github.com/docker/api/backend/v1/*.pb.go ./backend/v1/ -COPY --from=make-protos /go/src/github.com/docker/api/compose/v1/*.pb.go ./compose/v1/ -COPY --from=make-protos /go/src/github.com/docker/api/containers/v1/*.pb.go ./containers/v1/ -COPY --from=make-protos /go/src/github.com/docker/api/cli/v1/*.pb.go ./cli/v1/ +COPY --from=make-protos /go/src/github.com/docker/api . FROM scratch AS bins COPY --from=make-bins /go/src/github.com/docker/api/bin/* . diff --git a/Makefile b/Makefile index f662ce130..0ab84dfa7 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ xbins: xcli xexample protos: @protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS} + @goimports -w -local github.com/docker/api . cli: protos GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o bin/docker ./cli diff --git a/backend/v1/backend.pb.go b/backend/v1/backend.pb.go index 6a794f424..013dd4947 100644 --- a/backend/v1/backend.pb.go +++ b/backend/v1/backend.pb.go @@ -34,14 +34,15 @@ package v1 import ( context "context" + reflect "reflect" + sync "sync" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( diff --git a/cli/cmd/context.go b/cli/cmd/context.go index d6af64573..96d46ed00 100644 --- a/cli/cmd/context.go +++ b/cli/cmd/context.go @@ -33,8 +33,9 @@ import ( "os" "text/tabwriter" - "github.com/docker/api/context/store" "github.com/spf13/cobra" + + "github.com/docker/api/context/store" ) type CliContext struct { diff --git a/cli/cmd/ps.go b/cli/cmd/ps.go index e302ce012..118e44229 100644 --- a/cli/cmd/ps.go +++ b/cli/cmd/ps.go @@ -5,9 +5,10 @@ import ( "os" "text/tabwriter" - "github.com/docker/api/client" "github.com/pkg/errors" "github.com/spf13/cobra" + + "github.com/docker/api/client" ) var PsCommand = cobra.Command{ diff --git a/cli/cmd/serve.go b/cli/cmd/serve.go index 544aff3f2..b024ecbe8 100644 --- a/cli/cmd/serve.go +++ b/cli/cmd/serve.go @@ -4,13 +4,14 @@ import ( "context" "net" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + cliv1 "github.com/docker/api/cli/v1" containersv1 "github.com/docker/api/containers/v1" "github.com/docker/api/context/store" "github.com/docker/api/server" "github.com/docker/api/server/proxy" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cli/main.go b/cli/main.go index b44a78aad..499b646e9 100644 --- a/cli/main.go +++ b/cli/main.go @@ -40,12 +40,13 @@ import ( _ "github.com/docker/api/azure" _ "github.com/docker/api/example" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "github.com/docker/api/cli/cmd" apicontext "github.com/docker/api/context" "github.com/docker/api/context/store" "github.com/docker/api/util" - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" ) type mainOpts struct { diff --git a/cli/v1/cli.pb.go b/cli/v1/cli.pb.go index fb63b3d4d..a0faba286 100644 --- a/cli/v1/cli.pb.go +++ b/cli/v1/cli.pb.go @@ -34,14 +34,15 @@ package v1 import ( context "context" + reflect "reflect" + sync "sync" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( diff --git a/compose/v1/compose.pb.go b/compose/v1/compose.pb.go index afc98e3cf..fe2917e72 100644 --- a/compose/v1/compose.pb.go +++ b/compose/v1/compose.pb.go @@ -34,14 +34,15 @@ package v1 import ( context "context" + reflect "reflect" + sync "sync" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( diff --git a/containers/v1/containers.pb.go b/containers/v1/containers.pb.go index 41c8b5b5f..632e7b6b9 100644 --- a/containers/v1/containers.pb.go +++ b/containers/v1/containers.pb.go @@ -34,14 +34,15 @@ package v1 import ( context "context" + reflect "reflect" + sync "sync" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( diff --git a/server/server.go b/server/server.go index f99a2972f..7980f682c 100644 --- a/server/server.go +++ b/server/server.go @@ -31,15 +31,16 @@ import ( "context" "errors" - "github.com/docker/api/client" - apicontext "github.com/docker/api/context" - "github.com/docker/api/context/store" - "github.com/docker/api/server/proxy" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" "google.golang.org/grpc" "google.golang.org/grpc/health" "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/metadata" + + "github.com/docker/api/client" + apicontext "github.com/docker/api/context" + "github.com/docker/api/context/store" + "github.com/docker/api/server/proxy" ) // New returns a new GRPC server.