From f9ace65a794768574f5fc550a1ab1912e2e1846c Mon Sep 17 00:00:00 2001 From: Bassam Tabbara Date: Mon, 17 Oct 2016 09:27:55 -0700 Subject: [PATCH 1/2] make castle go gettable changed the cmd/castlectl pacakge to not have a main function and added main.go at the root of the tree. this makes the whole project go gettable. also fixed a number of makefile issues to deal with go files in the root of the tree. --- Makefile | 9 +++++---- build/makelib/golang.mk | 12 ++++++------ cmd/castlectl/block-create.go | 2 +- cmd/castlectl/block-create_test.go | 2 +- cmd/castlectl/block-list.go | 2 +- cmd/castlectl/block-list_test.go | 2 +- cmd/castlectl/block-mount.go | 2 +- cmd/castlectl/block-mount_test.go | 2 +- cmd/castlectl/block-unmount.go | 2 +- cmd/castlectl/block-unmount_test.go | 2 +- cmd/castlectl/block.go | 2 +- cmd/castlectl/castlectl.go | 4 ++-- cmd/castlectl/node-list.go | 2 +- cmd/castlectl/node-list_test.go | 2 +- cmd/castlectl/node.go | 2 +- cmd/castlectl/pool-create.go | 2 +- cmd/castlectl/pool-create_test.go | 2 +- cmd/castlectl/pool-list.go | 2 +- cmd/castlectl/pool-list_test.go | 2 +- cmd/castlectl/pool.go | 2 +- cmd/castled/{castled.go => main.go} | 0 main.go | 7 +++++++ 22 files changed, 37 insertions(+), 29 deletions(-) rename cmd/castled/{castled.go => main.go} (100%) create mode 100644 main.go diff --git a/Makefile b/Makefile index 3f5eabf82..2b91ca639 100644 --- a/Makefile +++ b/Makefile @@ -77,6 +77,8 @@ CLIENT_SERVER_PLATFORMS ?= linux_amd64 linux_arm64 CLIENT_ONLY_PLATFORMS ?= darwin_amd64 windows_amd64 ALL_PLATFORMS ?= $(CLIENT_SERVER_PLATFORMS) $(CLIENT_ONLY_PLATFORMS) +GO_PROJECT=github.com/quantum/castle + # ==================================================================================== # Setup Castled @@ -103,7 +105,7 @@ CEPHD_PLATFORM = $(GOOS)_$(GOARCH) # to force go to rebuild cephd CEPHD_TOUCH_ON_BUILD = pkg/cephmgr/cephd/dummy.cc -GO_CGO_PACKAGES=cmd/castled +GO_CGO_PACKAGES=$(GO_PROJECT)/cmd/castled CGO_LDFLAGS = -L$(abspath $(CEPHD_BUILD_DIR)/$(CEPHD_PLATFORM)/lib) CGO_PREREQS = cephd.build @@ -116,14 +118,13 @@ endif # ==================================================================================== # Setup Go projects -GO_PROJECT=github.com/quantum/castle GO_WORK_DIR = $(WORKDIR) GO_BIN_DIR = $(BIN_DIR) ifeq ($(STATIC),1) -GO_STATIC_PACKAGES=cmd/castlectl +GO_STATIC_PACKAGES=$(GO_PROJECT) else -GO_NONSTATIC_PACKAGES=cmd/castlectl +GO_NONSTATIC_PACKAGES=$(GO_PROJECT) endif GO_TOOL_FLAGS=$(BUILDFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' diff --git a/build/makelib/golang.mk b/build/makelib/golang.mk index 12015a43b..fa9eea2ab 100644 --- a/build/makelib/golang.mk +++ b/build/makelib/golang.mk @@ -101,15 +101,15 @@ endif .PHONY: go.build go.build: go.vet go.fmt $(CGO_PREREQS) - $(foreach p,$(GO_NONSTATIC_PACKAGES),@CGO_ENABLED=1 $(GO) build -v -i $(GO_PKG_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...) - $(foreach p,$(GO_CGO_PACKAGES),@CGO_ENABLED=1 $(GO) build -v -i $(GO_PKG_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...) - $(foreach p,$(GO_STATIC_PACKAGES),@CGO_ENABLED=0 $(GO) build -v -i $(GO_PKG_STATIC_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...) + $(foreach p,$(GO_NONSTATIC_PACKAGES),@CGO_ENABLED=1 $(GO) build -v -i $(GO_PKG_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(p)) + $(foreach p,$(GO_CGO_PACKAGES),@CGO_ENABLED=1 $(GO) build -v -i $(GO_PKG_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(p)) + $(foreach p,$(GO_STATIC_PACKAGES),@CGO_ENABLED=0 $(GO) build -v -i $(GO_PKG_STATIC_FLAGS) -o $(GO_OUT_DIR)/$(lastword $(subst /, ,$(p))) $(GO_TOOL_FLAGS) $(p)) .PHONY: go.install go.install: go.vet go.fmt $(CGO_PREREQS) - $(foreach p,$(GO_NONSTATIC_PACKAGES),@CGO_ENABLED=1 $(GO) install -v $(GO_PKG_FLAGS) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...) - $(foreach p,$(GO_CGO_PACKAGES),@CGO_ENABLED=1 $(GO) install -v $(GO_PKG_FLAGS) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...) - $(foreach p,$(GO_STATIC_PACKAGES),@CGO_ENABLED=0 $(GO) install -v $(GO_PKG_STATIC_FLAGS) $(GO_TOOL_FLAGS) $(GO_PROJECT)/$(p)/...) + $(foreach p,$(GO_NONSTATIC_PACKAGES),@CGO_ENABLED=1 $(GO) install -v $(GO_PKG_FLAGS) $(GO_TOOL_FLAGS) $(p)) + $(foreach p,$(GO_CGO_PACKAGES),@CGO_ENABLED=1 $(GO) install -v $(GO_PKG_FLAGS) $(GO_TOOL_FLAGS) $(p)) + $(foreach p,$(GO_STATIC_PACKAGES),@CGO_ENABLED=0 $(GO) install -v $(GO_PKG_STATIC_FLAGS) $(GO_TOOL_FLAGS) $(p)) .PHONY: go.test go.test: go.vet go.fmt $(CGO_PREREQS) diff --git a/cmd/castlectl/block-create.go b/cmd/castlectl/block-create.go index 7e1fa6be0..ee2de6a4f 100644 --- a/cmd/castlectl/block-create.go +++ b/cmd/castlectl/block-create.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/block-create_test.go b/cmd/castlectl/block-create_test.go index d61e2fa56..a956b3b6b 100644 --- a/cmd/castlectl/block-create_test.go +++ b/cmd/castlectl/block-create_test.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/block-list.go b/cmd/castlectl/block-list.go index f474ad9a3..9fbed8f58 100644 --- a/cmd/castlectl/block-list.go +++ b/cmd/castlectl/block-list.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "bytes" diff --git a/cmd/castlectl/block-list_test.go b/cmd/castlectl/block-list_test.go index 1f2f5704d..f44ca1efc 100644 --- a/cmd/castlectl/block-list_test.go +++ b/cmd/castlectl/block-list_test.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/block-mount.go b/cmd/castlectl/block-mount.go index 55e0b5750..77c82ccd7 100644 --- a/cmd/castlectl/block-mount.go +++ b/cmd/castlectl/block-mount.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/block-mount_test.go b/cmd/castlectl/block-mount_test.go index b824867f6..fe9746f33 100644 --- a/cmd/castlectl/block-mount_test.go +++ b/cmd/castlectl/block-mount_test.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/block-unmount.go b/cmd/castlectl/block-unmount.go index 2ba8919c0..a1cdb23fd 100644 --- a/cmd/castlectl/block-unmount.go +++ b/cmd/castlectl/block-unmount.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/block-unmount_test.go b/cmd/castlectl/block-unmount_test.go index a79e8af85..2efea5cb2 100644 --- a/cmd/castlectl/block-unmount_test.go +++ b/cmd/castlectl/block-unmount_test.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/block.go b/cmd/castlectl/block.go index 3434d5a81..f24002aa2 100644 --- a/cmd/castlectl/block.go +++ b/cmd/castlectl/block.go @@ -1,4 +1,4 @@ -package main +package castlectl import "github.com/spf13/cobra" diff --git a/cmd/castlectl/castlectl.go b/cmd/castlectl/castlectl.go index be8001d49..79fc6a380 100644 --- a/cmd/castlectl/castlectl.go +++ b/cmd/castlectl/castlectl.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" @@ -30,7 +30,7 @@ var rootCmd = &cobra.Command{ Long: `https://github.com/quantum/castle`, } -func main() { +func Main() { // set up logging to a log file instead of stdout (only command output and errors should go to stdout/stderr) if err := os.MkdirAll(logFileDir, 0744); err != nil { log.Fatalf("failed to create logging dir '%s': %+v", logFileDir, err) diff --git a/cmd/castlectl/node-list.go b/cmd/castlectl/node-list.go index bb4879f86..a92618a17 100644 --- a/cmd/castlectl/node-list.go +++ b/cmd/castlectl/node-list.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "bytes" diff --git a/cmd/castlectl/node-list_test.go b/cmd/castlectl/node-list_test.go index bb999089a..9c86eb4e8 100644 --- a/cmd/castlectl/node-list_test.go +++ b/cmd/castlectl/node-list_test.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/node.go b/cmd/castlectl/node.go index bcabf10d0..a665e85d4 100644 --- a/cmd/castlectl/node.go +++ b/cmd/castlectl/node.go @@ -1,4 +1,4 @@ -package main +package castlectl import "github.com/spf13/cobra" diff --git a/cmd/castlectl/pool-create.go b/cmd/castlectl/pool-create.go index b7c4da56b..4cccb4f15 100644 --- a/cmd/castlectl/pool-create.go +++ b/cmd/castlectl/pool-create.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/pool-create_test.go b/cmd/castlectl/pool-create_test.go index 5c1db070b..fa06b52ed 100644 --- a/cmd/castlectl/pool-create_test.go +++ b/cmd/castlectl/pool-create_test.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/pool-list.go b/cmd/castlectl/pool-list.go index 4c777b7b7..e43192169 100644 --- a/cmd/castlectl/pool-list.go +++ b/cmd/castlectl/pool-list.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "bytes" diff --git a/cmd/castlectl/pool-list_test.go b/cmd/castlectl/pool-list_test.go index ac0200aaf..218aff6ef 100644 --- a/cmd/castlectl/pool-list_test.go +++ b/cmd/castlectl/pool-list_test.go @@ -1,4 +1,4 @@ -package main +package castlectl import ( "fmt" diff --git a/cmd/castlectl/pool.go b/cmd/castlectl/pool.go index f95968c31..c4f6302c5 100644 --- a/cmd/castlectl/pool.go +++ b/cmd/castlectl/pool.go @@ -1,4 +1,4 @@ -package main +package castlectl import "github.com/spf13/cobra" diff --git a/cmd/castled/castled.go b/cmd/castled/main.go similarity index 100% rename from cmd/castled/castled.go rename to cmd/castled/main.go diff --git a/main.go b/main.go new file mode 100644 index 000000000..913a4655c --- /dev/null +++ b/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/quantum/castle/cmd/castlectl" + +func main() { + castlectl.Main() +} From 10f21a0119df25095178e2ddfd3a2932e0dbe228 Mon Sep 17 00:00:00 2001 From: Bassam Tabbara Date: Mon, 17 Oct 2016 13:58:00 -0700 Subject: [PATCH 2/2] rename castlectl to castle --- Documentation/getting-started.md | 6 +++--- build/release/binaries.sh | 2 +- build/release/common.sh | 2 +- cmd/{castlectl => castle}/block-create.go | 4 ++-- cmd/{castlectl => castle}/block-create_test.go | 4 ++-- cmd/{castlectl => castle}/block-list.go | 4 ++-- cmd/{castlectl => castle}/block-list_test.go | 4 ++-- cmd/{castlectl => castle}/block-mount.go | 4 ++-- cmd/{castlectl => castle}/block-mount_test.go | 4 ++-- cmd/{castlectl => castle}/block-unmount.go | 2 +- cmd/{castlectl => castle}/block-unmount_test.go | 2 +- cmd/{castlectl => castle}/block.go | 2 +- cmd/{castlectl/castlectl.go => castle/castle.go} | 8 ++++---- cmd/{castlectl => castle}/node-list.go | 4 ++-- cmd/{castlectl => castle}/node-list_test.go | 4 ++-- cmd/{castlectl => castle}/node.go | 2 +- cmd/{castlectl => castle}/pool-create.go | 4 ++-- cmd/{castlectl => castle}/pool-create_test.go | 4 ++-- cmd/{castlectl => castle}/pool-list.go | 4 ++-- cmd/{castlectl => castle}/pool-list_test.go | 4 ++-- cmd/{castlectl => castle}/pool.go | 2 +- main.go | 4 ++-- pkg/{castlectl => castle}/client/block.go | 0 pkg/{castlectl => castle}/client/client.go | 0 pkg/{castlectl => castle}/client/client_test.go | 0 pkg/{castlectl => castle}/client/node.go | 0 pkg/{castlectl => castle}/client/pool.go | 0 pkg/{castlectl => castle}/test/mockclient.go | 2 +- 28 files changed, 41 insertions(+), 41 deletions(-) rename cmd/{castlectl => castle}/block-create.go (96%) rename cmd/{castlectl => castle}/block-create_test.go (92%) rename cmd/{castlectl => castle}/block-list.go (96%) rename cmd/{castlectl => castle}/block-list_test.go (97%) rename cmd/{castlectl => castle}/block-mount.go (99%) rename cmd/{castlectl => castle}/block-mount_test.go (97%) rename cmd/{castlectl => castle}/block-unmount.go (99%) rename cmd/{castlectl => castle}/block-unmount_test.go (99%) rename cmd/{castlectl => castle}/block.go (94%) rename cmd/{castlectl/castlectl.go => castle/castle.go} (92%) rename cmd/{castlectl => castle}/node-list.go (94%) rename cmd/{castlectl => castle}/node-list_test.go (94%) rename cmd/{castlectl => castle}/node.go (91%) rename cmd/{castlectl => castle}/pool-create.go (97%) rename cmd/{castlectl => castle}/pool-create_test.go (98%) rename cmd/{castlectl => castle}/pool-list.go (95%) rename cmd/{castlectl => castle}/pool-list_test.go (95%) rename cmd/{castlectl => castle}/pool.go (93%) rename pkg/{castlectl => castle}/client/block.go (100%) rename pkg/{castlectl => castle}/client/client.go (100%) rename pkg/{castlectl => castle}/client/client_test.go (100%) rename pkg/{castlectl => castle}/client/node.go (100%) rename pkg/{castlectl => castle}/client/pool.go (100%) rename pkg/{castlectl => castle}/test/mockclient.go (97%) diff --git a/Documentation/getting-started.md b/Documentation/getting-started.md index c6f17a6c3..dc17aa51e 100644 --- a/Documentation/getting-started.md +++ b/Documentation/getting-started.md @@ -73,7 +73,7 @@ TODO: show how castle can be configured from cloud-init and started At this point the storage cluster is up and running. -### 3) Using castlectl +### 3) Using castle Now that the cluster is up and running, you can communicate with it using castletctl. First you need export an environment variable for the cluster url: @@ -91,7 +91,7 @@ export CASTLE_DISCOVERY_DNS=mycluster.acme.com Let's list the nodes that are part of the cluster: ``` -castlectl node ls +castle node ls ``` the output shows the nodes that are part of the cluster @@ -108,7 +108,7 @@ ADDRESS STATE CLUSTER SIZE LOCATION To create a volume run the following: ``` -castlectl volume create myvolume 100GiB +castle volume create myvolume 100GiB ``` This creates a volume that can be used as a block device from client nodes. diff --git a/build/release/binaries.sh b/build/release/binaries.sh index 9be8ac32d..5a02674cd 100755 --- a/build/release/binaries.sh +++ b/build/release/binaries.sh @@ -14,7 +14,7 @@ build() { local ext=".exe" fi - local files=( castlectl${ext} ) + local files=( castle${ext} ) if [[ ${type} == "both" ]]; then files+=( castled${ext} ) diff --git a/build/release/common.sh b/build/release/common.sh index 35919f7ff..b995e6b64 100644 --- a/build/release/common.sh +++ b/build/release/common.sh @@ -22,7 +22,7 @@ layout_root() { mkdir -p $dir/root/etc/ssl/certs cp $bindir/castled $dir/root/usr/bin - cp $bindir/castlectl $dir/root/usr/bin + cp $bindir/castle $dir/root/usr/bin cp /etc/ssl/certs/ca-certificates.crt $dir/root/etc/ssl/certs } diff --git a/cmd/castlectl/block-create.go b/cmd/castle/block-create.go similarity index 96% rename from cmd/castlectl/block-create.go rename to cmd/castle/block-create.go index ee2de6a4f..6aba08b0f 100644 --- a/cmd/castlectl/block-create.go +++ b/cmd/castle/block-create.go @@ -1,10 +1,10 @@ -package castlectl +package castle import ( "fmt" "net/http" - "github.com/quantum/castle/pkg/castlectl/client" + "github.com/quantum/castle/pkg/castle/client" "github.com/quantum/castle/pkg/model" "github.com/quantum/castle/pkg/util/flags" "github.com/spf13/cobra" diff --git a/cmd/castlectl/block-create_test.go b/cmd/castle/block-create_test.go similarity index 92% rename from cmd/castlectl/block-create_test.go rename to cmd/castle/block-create_test.go index a956b3b6b..b1b9dfa0b 100644 --- a/cmd/castlectl/block-create_test.go +++ b/cmd/castle/block-create_test.go @@ -1,10 +1,10 @@ -package castlectl +package castle import ( "fmt" "testing" - "github.com/quantum/castle/pkg/castlectl/test" + "github.com/quantum/castle/pkg/castle/test" "github.com/quantum/castle/pkg/model" "github.com/stretchr/testify/assert" ) diff --git a/cmd/castlectl/block-list.go b/cmd/castle/block-list.go similarity index 96% rename from cmd/castlectl/block-list.go rename to cmd/castle/block-list.go index 9fbed8f58..5e8cd736a 100644 --- a/cmd/castlectl/block-list.go +++ b/cmd/castle/block-list.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "bytes" @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/quantum/castle/pkg/castlectl/client" + "github.com/quantum/castle/pkg/castle/client" "github.com/quantum/castle/pkg/util/display" "github.com/quantum/castle/pkg/util/exec" "github.com/quantum/castle/pkg/util/flags" diff --git a/cmd/castlectl/block-list_test.go b/cmd/castle/block-list_test.go similarity index 97% rename from cmd/castlectl/block-list_test.go rename to cmd/castle/block-list_test.go index f44ca1efc..d395fa95b 100644 --- a/cmd/castlectl/block-list_test.go +++ b/cmd/castle/block-list_test.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "fmt" @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/quantum/castle/pkg/castlectl/test" + "github.com/quantum/castle/pkg/castle/test" "github.com/quantum/castle/pkg/model" exectest "github.com/quantum/castle/pkg/util/exec/test" ) diff --git a/cmd/castlectl/block-mount.go b/cmd/castle/block-mount.go similarity index 99% rename from cmd/castlectl/block-mount.go rename to cmd/castle/block-mount.go index 77c82ccd7..353c6dfbe 100644 --- a/cmd/castlectl/block-mount.go +++ b/cmd/castle/block-mount.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "fmt" @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/quantum/castle/pkg/castlectl/client" + "github.com/quantum/castle/pkg/castle/client" "github.com/quantum/castle/pkg/model" "github.com/quantum/castle/pkg/util/exec" "github.com/quantum/castle/pkg/util/flags" diff --git a/cmd/castlectl/block-mount_test.go b/cmd/castle/block-mount_test.go similarity index 97% rename from cmd/castlectl/block-mount_test.go rename to cmd/castle/block-mount_test.go index fe9746f33..a7693fc61 100644 --- a/cmd/castlectl/block-mount_test.go +++ b/cmd/castle/block-mount_test.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "fmt" @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/quantum/castle/pkg/castlectl/test" + "github.com/quantum/castle/pkg/castle/test" "github.com/quantum/castle/pkg/model" exectest "github.com/quantum/castle/pkg/util/exec/test" ) diff --git a/cmd/castlectl/block-unmount.go b/cmd/castle/block-unmount.go similarity index 99% rename from cmd/castlectl/block-unmount.go rename to cmd/castle/block-unmount.go index a1cdb23fd..5df33f989 100644 --- a/cmd/castlectl/block-unmount.go +++ b/cmd/castle/block-unmount.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "fmt" diff --git a/cmd/castlectl/block-unmount_test.go b/cmd/castle/block-unmount_test.go similarity index 99% rename from cmd/castlectl/block-unmount_test.go rename to cmd/castle/block-unmount_test.go index 2efea5cb2..dfd865010 100644 --- a/cmd/castlectl/block-unmount_test.go +++ b/cmd/castle/block-unmount_test.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "fmt" diff --git a/cmd/castlectl/block.go b/cmd/castle/block.go similarity index 94% rename from cmd/castlectl/block.go rename to cmd/castle/block.go index f24002aa2..2518f5d3d 100644 --- a/cmd/castlectl/block.go +++ b/cmd/castle/block.go @@ -1,4 +1,4 @@ -package castlectl +package castle import "github.com/spf13/cobra" diff --git a/cmd/castlectl/castlectl.go b/cmd/castle/castle.go similarity index 92% rename from cmd/castlectl/castlectl.go rename to cmd/castle/castle.go index 79fc6a380..04734d50e 100644 --- a/cmd/castlectl/castlectl.go +++ b/cmd/castle/castle.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "fmt" @@ -21,11 +21,11 @@ const ( outputTabWidth = 0 outputPadChar = ' ' logFileDir = "/tmp/castle/log" - logFileName = "castlectl.log" + logFileName = "castle.log" ) var rootCmd = &cobra.Command{ - Use: "castlectl", + Use: "castle", Short: "A command line client for working with a castle cluster", Long: `https://github.com/quantum/castle`, } @@ -45,7 +45,7 @@ func Main() { addCommands() if err := rootCmd.Execute(); err != nil { - fmt.Printf("castlectl error: %+v\n", err) + fmt.Printf("castle error: %+v\n", err) } } diff --git a/cmd/castlectl/node-list.go b/cmd/castle/node-list.go similarity index 94% rename from cmd/castlectl/node-list.go rename to cmd/castle/node-list.go index a92618a17..153f12a26 100644 --- a/cmd/castlectl/node-list.go +++ b/cmd/castle/node-list.go @@ -1,11 +1,11 @@ -package castlectl +package castle import ( "bytes" "fmt" "net/http" - "github.com/quantum/castle/pkg/castlectl/client" + "github.com/quantum/castle/pkg/castle/client" "github.com/quantum/castle/pkg/model" "github.com/quantum/castle/pkg/util/display" "github.com/spf13/cobra" diff --git a/cmd/castlectl/node-list_test.go b/cmd/castle/node-list_test.go similarity index 94% rename from cmd/castlectl/node-list_test.go rename to cmd/castle/node-list_test.go index 9c86eb4e8..2b5d51716 100644 --- a/cmd/castlectl/node-list_test.go +++ b/cmd/castle/node-list_test.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "fmt" @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/quantum/castle/pkg/castlectl/test" + "github.com/quantum/castle/pkg/castle/test" "github.com/quantum/castle/pkg/model" ) diff --git a/cmd/castlectl/node.go b/cmd/castle/node.go similarity index 91% rename from cmd/castlectl/node.go rename to cmd/castle/node.go index a665e85d4..a2b52151e 100644 --- a/cmd/castlectl/node.go +++ b/cmd/castle/node.go @@ -1,4 +1,4 @@ -package castlectl +package castle import "github.com/spf13/cobra" diff --git a/cmd/castlectl/pool-create.go b/cmd/castle/pool-create.go similarity index 97% rename from cmd/castlectl/pool-create.go rename to cmd/castle/pool-create.go index 4cccb4f15..ed42c54d3 100644 --- a/cmd/castlectl/pool-create.go +++ b/cmd/castle/pool-create.go @@ -1,10 +1,10 @@ -package castlectl +package castle import ( "fmt" "net/http" - "github.com/quantum/castle/pkg/castlectl/client" + "github.com/quantum/castle/pkg/castle/client" "github.com/quantum/castle/pkg/model" "github.com/quantum/castle/pkg/util/flags" "github.com/spf13/cobra" diff --git a/cmd/castlectl/pool-create_test.go b/cmd/castle/pool-create_test.go similarity index 98% rename from cmd/castlectl/pool-create_test.go rename to cmd/castle/pool-create_test.go index fa06b52ed..145e9a65f 100644 --- a/cmd/castlectl/pool-create_test.go +++ b/cmd/castle/pool-create_test.go @@ -1,10 +1,10 @@ -package castlectl +package castle import ( "fmt" "testing" - "github.com/quantum/castle/pkg/castlectl/test" + "github.com/quantum/castle/pkg/castle/test" "github.com/quantum/castle/pkg/model" "github.com/stretchr/testify/assert" ) diff --git a/cmd/castlectl/pool-list.go b/cmd/castle/pool-list.go similarity index 95% rename from cmd/castlectl/pool-list.go rename to cmd/castle/pool-list.go index e43192169..0e969a428 100644 --- a/cmd/castlectl/pool-list.go +++ b/cmd/castle/pool-list.go @@ -1,11 +1,11 @@ -package castlectl +package castle import ( "bytes" "fmt" "net/http" - "github.com/quantum/castle/pkg/castlectl/client" + "github.com/quantum/castle/pkg/castle/client" "github.com/quantum/castle/pkg/model" "github.com/quantum/castle/pkg/util/display" "github.com/quantum/castle/pkg/util/flags" diff --git a/cmd/castlectl/pool-list_test.go b/cmd/castle/pool-list_test.go similarity index 95% rename from cmd/castlectl/pool-list_test.go rename to cmd/castle/pool-list_test.go index 218aff6ef..2cb5fb6cb 100644 --- a/cmd/castlectl/pool-list_test.go +++ b/cmd/castle/pool-list_test.go @@ -1,4 +1,4 @@ -package castlectl +package castle import ( "fmt" @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/quantum/castle/pkg/castlectl/test" + "github.com/quantum/castle/pkg/castle/test" "github.com/quantum/castle/pkg/model" ) diff --git a/cmd/castlectl/pool.go b/cmd/castle/pool.go similarity index 93% rename from cmd/castlectl/pool.go rename to cmd/castle/pool.go index c4f6302c5..bff51a277 100644 --- a/cmd/castlectl/pool.go +++ b/cmd/castle/pool.go @@ -1,4 +1,4 @@ -package castlectl +package castle import "github.com/spf13/cobra" diff --git a/main.go b/main.go index 913a4655c..d4f208a79 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main -import "github.com/quantum/castle/cmd/castlectl" +import "github.com/quantum/castle/cmd/castle" func main() { - castlectl.Main() + castle.Main() } diff --git a/pkg/castlectl/client/block.go b/pkg/castle/client/block.go similarity index 100% rename from pkg/castlectl/client/block.go rename to pkg/castle/client/block.go diff --git a/pkg/castlectl/client/client.go b/pkg/castle/client/client.go similarity index 100% rename from pkg/castlectl/client/client.go rename to pkg/castle/client/client.go diff --git a/pkg/castlectl/client/client_test.go b/pkg/castle/client/client_test.go similarity index 100% rename from pkg/castlectl/client/client_test.go rename to pkg/castle/client/client_test.go diff --git a/pkg/castlectl/client/node.go b/pkg/castle/client/node.go similarity index 100% rename from pkg/castlectl/client/node.go rename to pkg/castle/client/node.go diff --git a/pkg/castlectl/client/pool.go b/pkg/castle/client/pool.go similarity index 100% rename from pkg/castlectl/client/pool.go rename to pkg/castle/client/pool.go diff --git a/pkg/castlectl/test/mockclient.go b/pkg/castle/test/mockclient.go similarity index 97% rename from pkg/castlectl/test/mockclient.go rename to pkg/castle/test/mockclient.go index d6b3081b8..38ee6a24f 100644 --- a/pkg/castlectl/test/mockclient.go +++ b/pkg/castle/test/mockclient.go @@ -3,7 +3,7 @@ package test import ( "net/http" - "github.com/quantum/castle/pkg/castlectl/client" + "github.com/quantum/castle/pkg/castle/client" "github.com/quantum/castle/pkg/model" )