Refactor names to avoid stutter (#1)

Since client code uses the package name as a prefix when referring to
the package contents, the names for those contents need not repeat the
package name.

- Rename base.BaseCommand to base.Command
- Rename base.BaseServer to base.Server
- Rename config.DevConfig() to config.Dev()
- Rename config.LoadConfigFile() to config.LoadFile()
- Rename config.NewConfig() to config.New()
- Rename config.ParseConfig() to config.Parse()
- Rename controller.ControllerCommand to controller.Command
- Rename controller.NewController() to controller.New()
- Rename dev.DevCommand to dev.Command
- Rename listener.ListenerFactory to listener.Factory
- Rename listener.NewListener() to listener.New()
- Rename version.GetVersion() to version.Get()
- Rename version.VersionInfo to version.Info

See:
- https://golang.org/doc/effective_go.html#package-names
- https://blog.golang.org/package-names#TOC_3.
- https://github.com/golang/go/wiki/CodeReviewComments#package-names
This commit is contained in:
Michael Gaffney authored and GitHub committed 2020-03-10 15:48:04 -04:00
1 parent 39c629631f
commit 5e5a56cac0
14 files changed
+91 -91

No files matched your search

+6 -6
View File
@@ -16,8 +16,8 @@ var Commands map[string]cli.CommandFactory
func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
/*
getBaseCommand := func() *base.BaseCommand {
return &base.BaseCommand{
getBaseCommand := func() *base.Command {
return &base.Command{
UI: ui,
Address: runOpts.Address,
}
@@ -26,8 +26,8 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
Commands = map[string]cli.CommandFactory{
"controller": func() (cli.Command, error) {
return &controller.ControllerCommand{
BaseCommand: &base.BaseCommand{
return &controller.Command{
Command: &base.Command{
UI: serverCmdUi,
Address: runOpts.Address,
},
@@ -37,8 +37,8 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
}, nil
},
"dev": func() (cli.Command, error) {
return &dev.DevCommand{
BaseCommand: &base.BaseCommand{
return &dev.Command{
Command: &base.Command{
UI: serverCmdUi,
Address: runOpts.Address,
},