veyron/tools: Merge the impl and main packages
This change gets rid of the impl packages and moves the impl.go files to
the main package for each tool under veyron/tools/.
Change-Id: Ieae4bc1dd02296f58f8cb6327b903d025cf833f5
diff --git a/tools/application/impl/impl.go b/tools/application/impl.go
similarity index 99%
rename from tools/application/impl/impl.go
rename to tools/application/impl.go
index a029ee8..6b99e92 100644
--- a/tools/application/impl/impl.go
+++ b/tools/application/impl.go
@@ -1,4 +1,4 @@
-package impl
+package main
import (
"bytes"
@@ -218,7 +218,7 @@
return nil
}
-func Root() *cmdline.Command {
+func root() *cmdline.Command {
return &cmdline.Command{
Name: "application",
Short: "Tool for interacting with the veyron application repository",
diff --git a/tools/application/impl/impl_test.go b/tools/application/impl_test.go
similarity index 97%
rename from tools/application/impl/impl_test.go
rename to tools/application/impl_test.go
index daca9ef..46d1966 100644
--- a/tools/application/impl/impl_test.go
+++ b/tools/application/impl_test.go
@@ -1,4 +1,4 @@
-package impl_test
+package main
import (
"bytes"
@@ -17,7 +17,6 @@
"veyron.io/veyron/veyron/profiles"
"veyron.io/veyron/veyron/services/mgmt/repository"
- "veyron.io/veyron/veyron/tools/application/impl"
)
var (
@@ -107,7 +106,7 @@
}
defer stopServer(t, server)
// Setup the command-line.
- cmd := impl.Root()
+ cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
appName := naming.JoinAddressName(endpoint.String(), "//myapp/1")
diff --git a/tools/application/main.go b/tools/application/main.go
index 3c9e43d..a99a159 100644
--- a/tools/application/main.go
+++ b/tools/application/main.go
@@ -13,10 +13,9 @@
"veyron.io/veyron/veyron2/rt"
_ "veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/application/impl"
)
func main() {
defer rt.Init().Cleanup()
- impl.Root().Main()
+ root().Main()
}
diff --git a/tools/binary/impl/impl.go b/tools/binary/impl.go
similarity index 98%
rename from tools/binary/impl/impl.go
rename to tools/binary/impl.go
index d43ebd3..1df2314 100644
--- a/tools/binary/impl/impl.go
+++ b/tools/binary/impl.go
@@ -1,4 +1,4 @@
-package impl
+package main
import (
"fmt"
@@ -82,7 +82,7 @@
return nil
}
-func Root() *cmdline.Command {
+func root() *cmdline.Command {
return &cmdline.Command{
Name: "binary",
Short: "Tool for interacting with the veyron binary repository",
diff --git a/tools/binary/impl/impl_test.go b/tools/binary/impl_test.go
similarity index 97%
rename from tools/binary/impl/impl_test.go
rename to tools/binary/impl_test.go
index fb95a89..8667c3d 100644
--- a/tools/binary/impl/impl_test.go
+++ b/tools/binary/impl_test.go
@@ -1,4 +1,4 @@
-package impl_test
+package main
import (
"bytes"
@@ -21,7 +21,6 @@
"veyron.io/veyron/veyron2/vlog"
"veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/binary/impl"
)
type server struct {
@@ -116,7 +115,7 @@
}
defer stopServer(t, server)
// Setup the command-line.
- cmd := impl.Root()
+ cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
diff --git a/tools/binary/main.go b/tools/binary/main.go
index dddeb0d..a99a159 100644
--- a/tools/binary/main.go
+++ b/tools/binary/main.go
@@ -13,12 +13,9 @@
"veyron.io/veyron/veyron2/rt"
_ "veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/binary/impl"
)
func main() {
- r := rt.Init()
- defer r.Cleanup()
-
- impl.Root().Main()
+ defer rt.Init().Cleanup()
+ root().Main()
}
diff --git a/tools/build/impl/impl.go b/tools/build/impl.go
similarity index 98%
rename from tools/build/impl/impl.go
rename to tools/build/impl.go
index 6126bfc..d047478 100644
--- a/tools/build/impl/impl.go
+++ b/tools/build/impl.go
@@ -1,4 +1,4 @@
-package impl
+package main
import (
"fmt"
@@ -36,8 +36,8 @@
Children: []*cmdline.Command{cmdBuild},
}
-// Root returns a command that represents the root of the veyron tool.
-func Root() *cmdline.Command {
+// root returns a command that represents the root of the veyron tool.
+func root() *cmdline.Command {
return cmdRoot
}
diff --git a/tools/build/impl/impl_test.go b/tools/build/impl_test.go
similarity index 96%
rename from tools/build/impl/impl_test.go
rename to tools/build/impl_test.go
index 6d120b9..15ef3eb 100644
--- a/tools/build/impl/impl_test.go
+++ b/tools/build/impl_test.go
@@ -1,4 +1,4 @@
-package impl_test
+package main
import (
"bytes"
@@ -14,7 +14,6 @@
"veyron.io/veyron/veyron2/vlog"
"veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/build/impl"
)
var errInternalError = verror.Internalf("internal error")
@@ -67,7 +66,7 @@
server, endpoint := startServer(t)
defer stopServer(t, server)
- cmd := impl.Root()
+ cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
diff --git a/tools/build/main.go b/tools/build/main.go
index 6b96081..a99a159 100644
--- a/tools/build/main.go
+++ b/tools/build/main.go
@@ -13,12 +13,9 @@
"veyron.io/veyron/veyron2/rt"
_ "veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/build/impl"
)
func main() {
- r := rt.Init()
- defer r.Cleanup()
-
- impl.Root().Main()
+ defer rt.Init().Cleanup()
+ root().Main()
}
diff --git a/tools/debug/impl/impl.go b/tools/debug/impl.go
similarity index 99%
rename from tools/debug/impl/impl.go
rename to tools/debug/impl.go
index cf882dc..0f49e85 100644
--- a/tools/debug/impl/impl.go
+++ b/tools/debug/impl.go
@@ -1,4 +1,4 @@
-package impl
+package main
import (
"bytes"
@@ -481,6 +481,6 @@
},
}
-func Root() *cmdline.Command {
+func root() *cmdline.Command {
return &cmdRoot
}
diff --git a/tools/debug/main.go b/tools/debug/main.go
index 41e29e5..a99a159 100644
--- a/tools/debug/main.go
+++ b/tools/debug/main.go
@@ -13,10 +13,9 @@
"veyron.io/veyron/veyron2/rt"
_ "veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/debug/impl"
)
func main() {
defer rt.Init().Cleanup()
- impl.Root().Main()
+ root().Main()
}
diff --git a/tools/mounttable/impl/impl.go b/tools/mounttable/impl.go
similarity index 98%
rename from tools/mounttable/impl/impl.go
rename to tools/mounttable/impl.go
index 6c2d56d..1ad5896 100644
--- a/tools/mounttable/impl/impl.go
+++ b/tools/mounttable/impl.go
@@ -1,4 +1,4 @@
-package impl
+package main
import (
"fmt"
@@ -169,7 +169,7 @@
return nil
}
-func Root() *cmdline.Command {
+func root() *cmdline.Command {
return &cmdline.Command{
Name: "mounttable",
Short: "Tool for interacting with a Veyron mount table",
diff --git a/tools/mounttable/impl/impl_test.go b/tools/mounttable/impl_test.go
similarity index 97%
rename from tools/mounttable/impl/impl_test.go
rename to tools/mounttable/impl_test.go
index bed5762..0d05b13 100644
--- a/tools/mounttable/impl/impl_test.go
+++ b/tools/mounttable/impl_test.go
@@ -1,4 +1,4 @@
-package impl_test
+package main
import (
"bytes"
@@ -15,7 +15,6 @@
"veyron.io/veyron/veyron2/vlog"
"veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/mounttable/impl"
)
type server struct {
@@ -95,7 +94,7 @@
}
defer stopServer(t, server)
// Setup the command-line.
- cmd := impl.Root()
+ cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
diff --git a/tools/mounttable/main.go b/tools/mounttable/main.go
index c9538b4..a99a159 100644
--- a/tools/mounttable/main.go
+++ b/tools/mounttable/main.go
@@ -13,10 +13,9 @@
"veyron.io/veyron/veyron2/rt"
_ "veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/mounttable/impl"
)
func main() {
defer rt.Init().Cleanup()
- impl.Root().Main()
+ root().Main()
}
diff --git a/tools/namespace/impl/impl.go b/tools/namespace/impl.go
similarity index 99%
rename from tools/namespace/impl/impl.go
rename to tools/namespace/impl.go
index 2d80389..0980229 100644
--- a/tools/namespace/impl/impl.go
+++ b/tools/namespace/impl.go
@@ -1,4 +1,4 @@
-package impl
+package main
import (
"fmt"
@@ -195,7 +195,7 @@
return nil
}
-func Root() *cmdline.Command {
+func root() *cmdline.Command {
return &cmdline.Command{
Name: "namespace",
Short: "Tool for interacting with the Veyron namespace",
diff --git a/tools/namespace/main.go b/tools/namespace/main.go
index 9ed1881..3c2043c 100644
--- a/tools/namespace/main.go
+++ b/tools/namespace/main.go
@@ -10,11 +10,10 @@
package main
import (
- "veyron.io/veyron/veyron/tools/namespace/impl"
"veyron.io/veyron/veyron2/rt"
)
func main() {
defer rt.Init().Cleanup()
- impl.Root().Main()
+ root().Main()
}
diff --git a/tools/profile/impl/impl.go b/tools/profile/impl.go
similarity index 98%
rename from tools/profile/impl/impl.go
rename to tools/profile/impl.go
index a0c0868..5ed96b1 100644
--- a/tools/profile/impl/impl.go
+++ b/tools/profile/impl.go
@@ -1,4 +1,4 @@
-package impl
+package main
import (
"fmt"
@@ -160,7 +160,7 @@
return nil
}
-func Root() *cmdline.Command {
+func root() *cmdline.Command {
return &cmdline.Command{
Name: "profile",
Short: "Tool for interacting with the veyron profile repository",
diff --git a/tools/profile/impl/impl_test.go b/tools/profile/impl_test.go
similarity index 97%
rename from tools/profile/impl/impl_test.go
rename to tools/profile/impl_test.go
index ce01fe8..d188d48 100644
--- a/tools/profile/impl/impl_test.go
+++ b/tools/profile/impl_test.go
@@ -1,4 +1,4 @@
-package impl_test
+package main
import (
"bytes"
@@ -17,7 +17,6 @@
"veyron.io/veyron/veyron/profiles"
"veyron.io/veyron/veyron/services/mgmt/profile"
"veyron.io/veyron/veyron/services/mgmt/repository"
- "veyron.io/veyron/veyron/tools/profile/impl"
)
var (
@@ -118,7 +117,7 @@
}
defer stopServer(t, server)
// Setup the command-line.
- cmd := impl.Root()
+ cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
exists := naming.JoinAddressName(endpoint.String(), "//exists")
diff --git a/tools/profile/main.go b/tools/profile/main.go
index 377b3d0..a99a159 100644
--- a/tools/profile/main.go
+++ b/tools/profile/main.go
@@ -13,12 +13,9 @@
"veyron.io/veyron/veyron2/rt"
_ "veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/profile/impl"
)
func main() {
- r := rt.Init()
- defer r.Cleanup()
-
- impl.Root().Main()
+ defer rt.Init().Cleanup()
+ root().Main()
}
diff --git a/tools/vrpc/impl/impl.go b/tools/vrpc/impl.go
similarity index 98%
rename from tools/vrpc/impl/impl.go
rename to tools/vrpc/impl.go
index 38ec550..1658ce3 100644
--- a/tools/vrpc/impl/impl.go
+++ b/tools/vrpc/impl.go
@@ -1,4 +1,4 @@
-package impl
+package main
import (
"bytes"
@@ -191,8 +191,8 @@
return nil
}
-// Root returns the root command for the vrpc tool.
-func Root() *cmdline.Command {
+// root returns the root command for the vrpc tool.
+func root() *cmdline.Command {
return &cmdline.Command{
Name: "vrpc",
Short: "Tool for interacting with Veyron RPC servers.",
diff --git a/tools/vrpc/impl/impl_test.go b/tools/vrpc/impl_test.go
similarity index 98%
rename from tools/vrpc/impl/impl_test.go
rename to tools/vrpc/impl_test.go
index b31ce5c..a1c27a5 100644
--- a/tools/vrpc/impl/impl_test.go
+++ b/tools/vrpc/impl_test.go
@@ -1,4 +1,4 @@
-package impl_test
+package main
import (
"bytes"
@@ -14,7 +14,6 @@
"veyron.io/veyron/veyron/lib/cmdline"
"veyron.io/veyron/veyron/profiles"
- "veyron.io/veyron/veyron/tools/vrpc/impl"
"veyron.io/veyron/veyron/tools/vrpc/test_base"
)
@@ -181,7 +180,7 @@
defer stopServer(t, server)
// Setup the command-line.
- cmd := impl.Root()
+ cmd := root()
var stdout, stderr bytes.Buffer
cmd.Init(nil, &stdout, &stderr)
diff --git a/tools/vrpc/main.go b/tools/vrpc/main.go
index 46a30c8..3c2043c 100644
--- a/tools/vrpc/main.go
+++ b/tools/vrpc/main.go
@@ -10,13 +10,10 @@
package main
import (
- "veyron.io/veyron/veyron/tools/vrpc/impl"
-
"veyron.io/veyron/veyron2/rt"
)
func main() {
- r := rt.Init()
- defer r.Cleanup()
- impl.Root().Main()
+ defer rt.Init().Cleanup()
+ root().Main()
}