From e643f4a454301cb2663079c2ea0b2460cf071649 Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Tue, 21 Mar 2017 13:55:52 +0000 Subject: [PATCH] Move Go code to `src/cmd` This does not get everything where we want it finally, see #1266 nor the optimal way of building, but it gets it out of top level. Added instructions to build if you have a Go installation. Not moving `vendor` yet. Signed-off-by: Justin Cormack --- Makefile | 4 ++-- README.md | 4 ++++ config.go => src/cmd/moby/config.go | 0 gcp.go => src/cmd/moby/gcp.go | 0 main.go => src/cmd/moby/main.go | 2 +- output.go => src/cmd/moby/output.go | 0 {pkg => src}/initrd/initrd.go | 2 +- {pkg => src}/pad4/pad4.go | 0 8 files changed, 8 insertions(+), 4 deletions(-) rename config.go => src/cmd/moby/config.go (100%) rename gcp.go => src/cmd/moby/gcp.go (100%) rename main.go => src/cmd/moby/main.go (99%) rename output.go => src/cmd/moby/output.go (100%) rename {pkg => src}/initrd/initrd.go (98%) rename {pkg => src}/pad4/pad4.go (100%) diff --git a/Makefile b/Makefile index dbd2b3c79..1b96288fb 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ all: default GO_COMPILE=mobylinux/go-compile:3afebc59c5cde31024493c3f91e6102d584a30b9@sha256:e0786141ea7df8ba5735b63f2a24b4ade9eae5a02b0e04c4fca33b425ec69b0a -MOBY_DEPS=$(wildcard *.go) pkg vendor +MOBY_DEPS=$(wildcard src/cmd/moby/*.go) GOOS=$(shell uname -s | tr '[:upper:]' '[:lower:]') GOARCH=amd64 ifneq ($(GOOS),linux) @@ -12,7 +12,7 @@ CROSS=-e GOOS=$(GOOS) -e GOARCH=$(GOARCH) endif bin/moby: $(MOBY_DEPS) | bin - tar cf - $(MOBY_DEPS) | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/docker/moby -o $@ | tar xf - + tar cf - vendor src/initrd src/pad4 -C src/cmd/moby . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/docker/moby -o $@ | tar xf - moby-initrd.img: bin/moby moby.yaml $^ diff --git a/README.md b/README.md index 6d5e7822b..282d509b3 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ Moby, a toolkit for building custom minimal, immutable Linux distributions. Simple build instructions: use `make` to build. This will build the Moby customisation tool and a Moby initrd image. +If you already have a Go build environment and installed the source in your `GOPATH` +you can do `go install github.com/docker/moby/cmd/moby` to install the `moby` tool +instead, and then use `moby moby.yaml` to build the example configuration. + #### Build requirements - GNU `make` diff --git a/config.go b/src/cmd/moby/config.go similarity index 100% rename from config.go rename to src/cmd/moby/config.go diff --git a/gcp.go b/src/cmd/moby/gcp.go similarity index 100% rename from gcp.go rename to src/cmd/moby/gcp.go diff --git a/main.go b/src/cmd/moby/main.go similarity index 99% rename from main.go rename to src/cmd/moby/main.go index 34f860af9..ff6c4319a 100644 --- a/main.go +++ b/src/cmd/moby/main.go @@ -12,7 +12,7 @@ import ( "os/exec" "path/filepath" - "github.com/docker/moby/pkg/initrd" + "github.com/docker/moby/src/initrd" ) const ( diff --git a/output.go b/src/cmd/moby/output.go similarity index 100% rename from output.go rename to src/cmd/moby/output.go diff --git a/pkg/initrd/initrd.go b/src/initrd/initrd.go similarity index 98% rename from pkg/initrd/initrd.go rename to src/initrd/initrd.go index ef470e9ed..528d7319f 100644 --- a/pkg/initrd/initrd.go +++ b/src/initrd/initrd.go @@ -7,7 +7,7 @@ import ( "errors" "io" - "github.com/docker/moby/pkg/pad4" + "github.com/docker/moby/src/pad4" "github.com/surma/gocpio" ) diff --git a/pkg/pad4/pad4.go b/src/pad4/pad4.go similarity index 100% rename from pkg/pad4/pad4.go rename to src/pad4/pad4.go