From 3e5115a6e0936ed14cd0b542e6c1aafd49e03736 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Tue, 12 Apr 2016 11:25:17 -0700 Subject: [PATCH] bootcfg/: Rename and document packages with their purpose (#145) --- bootcfg/cli/doc.go | 2 ++ bootcfg/cli/error.go | 2 +- bootcfg/cli/format.go | 2 +- bootcfg/cli/group.go | 2 +- bootcfg/cli/group_create.go | 2 +- bootcfg/cli/group_describe.go | 2 +- bootcfg/cli/group_list.go | 2 +- bootcfg/cli/instance.go | 2 +- bootcfg/cli/instance_list.go | 2 +- bootcfg/cli/profile.go | 2 +- bootcfg/cli/profile_create.go | 2 +- bootcfg/cli/profile_describe.go | 2 +- bootcfg/cli/profile_list.go | 2 +- bootcfg/cli/root.go | 2 +- bootcfg/cli/version.go | 2 +- bootcfg/client/doc.go | 2 ++ bootcfg/{api => http}/cloud.go | 2 +- bootcfg/{api => http}/cloud_test.go | 2 +- bootcfg/{api => http}/context.go | 2 +- bootcfg/{api => http}/context_test.go | 2 +- bootcfg/http/doc.go | 2 ++ bootcfg/{api => http}/grub.go | 2 +- bootcfg/{api => http}/handlers.go | 2 +- bootcfg/{api => http}/handlers_test.go | 2 +- bootcfg/{api => http}/http.go | 2 +- bootcfg/{api => http}/http_test.go | 2 +- bootcfg/{api => http}/ignition.go | 2 +- bootcfg/{api => http}/ignition_test.go | 2 +- bootcfg/{api => http}/ipxe.go | 2 +- bootcfg/{api => http}/ipxe_test.go | 2 +- bootcfg/{api => http}/metadata.go | 2 +- bootcfg/{api => http}/metadata_test.go | 2 +- bootcfg/{api => http}/pixiecore.go | 2 +- bootcfg/{api => http}/pixiecore_test.go | 2 +- bootcfg/{api => http}/serialize.go | 2 +- bootcfg/{api => http}/serialize_test.go | 2 +- bootcfg/{api => http}/server.go | 2 +- bootcfg/{api => http}/test_fixtures.go | 2 +- bootcfg/rpc/doc.go | 2 ++ bootcfg/server/doc.go | 2 ++ bootcfg/sign/doc.go | 2 ++ bootcfg/storage/doc.go | 2 ++ cmd/bootcfg/main.go | 10 +++++----- cmd/bootcmd/main.go | 2 +- 44 files changed, 55 insertions(+), 41 deletions(-) create mode 100644 bootcfg/cli/doc.go create mode 100644 bootcfg/client/doc.go rename bootcfg/{api => http}/cloud.go (99%) rename bootcfg/{api => http}/cloud_test.go (99%) rename bootcfg/{api => http}/context.go (98%) rename bootcfg/{api => http}/context_test.go (98%) create mode 100644 bootcfg/http/doc.go rename bootcfg/{api => http}/grub.go (98%) rename bootcfg/{api => http}/handlers.go (99%) rename bootcfg/{api => http}/handlers_test.go (99%) rename bootcfg/{api => http}/http.go (99%) rename bootcfg/{api => http}/http_test.go (99%) rename bootcfg/{api => http}/ignition.go (99%) rename bootcfg/{api => http}/ignition_test.go (99%) rename bootcfg/{api => http}/ipxe.go (99%) rename bootcfg/{api => http}/ipxe_test.go (99%) rename bootcfg/{api => http}/metadata.go (98%) rename bootcfg/{api => http}/metadata_test.go (99%) rename bootcfg/{api => http}/pixiecore.go (98%) rename bootcfg/{api => http}/pixiecore_test.go (99%) rename bootcfg/{api => http}/serialize.go (98%) rename bootcfg/{api => http}/serialize_test.go (99%) rename bootcfg/{api => http}/server.go (99%) rename bootcfg/{api => http}/test_fixtures.go (96%) create mode 100644 bootcfg/rpc/doc.go create mode 100644 bootcfg/server/doc.go create mode 100644 bootcfg/sign/doc.go create mode 100644 bootcfg/storage/doc.go diff --git a/bootcfg/cli/doc.go b/bootcfg/cli/doc.go new file mode 100644 index 00000000..627042aa --- /dev/null +++ b/bootcfg/cli/doc.go @@ -0,0 +1,2 @@ +// Package cli provides a command line interface client. +package cli diff --git a/bootcfg/cli/error.go b/bootcfg/cli/error.go index 931bd039..b629afec 100644 --- a/bootcfg/cli/error.go +++ b/bootcfg/cli/error.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "fmt" diff --git a/bootcfg/cli/format.go b/bootcfg/cli/format.go index e110b3eb..4dad560a 100644 --- a/bootcfg/cli/format.go +++ b/bootcfg/cli/format.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "io" diff --git a/bootcfg/cli/group.go b/bootcfg/cli/group.go index 4631c27b..8575e1e9 100644 --- a/bootcfg/cli/group.go +++ b/bootcfg/cli/group.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "github.com/spf13/cobra" diff --git a/bootcfg/cli/group_create.go b/bootcfg/cli/group_create.go index a080b9b0..d914651c 100644 --- a/bootcfg/cli/group_create.go +++ b/bootcfg/cli/group_create.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "io/ioutil" diff --git a/bootcfg/cli/group_describe.go b/bootcfg/cli/group_describe.go index 9aa5bbef..d8c82907 100644 --- a/bootcfg/cli/group_describe.go +++ b/bootcfg/cli/group_describe.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "fmt" diff --git a/bootcfg/cli/group_list.go b/bootcfg/cli/group_list.go index 340e7ac5..cbf48d30 100644 --- a/bootcfg/cli/group_list.go +++ b/bootcfg/cli/group_list.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "fmt" diff --git a/bootcfg/cli/instance.go b/bootcfg/cli/instance.go index 6262bf78..aae4d7fb 100644 --- a/bootcfg/cli/instance.go +++ b/bootcfg/cli/instance.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "github.com/spf13/cobra" diff --git a/bootcfg/cli/instance_list.go b/bootcfg/cli/instance_list.go index 6305a89e..89b40831 100644 --- a/bootcfg/cli/instance_list.go +++ b/bootcfg/cli/instance_list.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "fmt" diff --git a/bootcfg/cli/profile.go b/bootcfg/cli/profile.go index 0bac3cd6..61cb92ed 100644 --- a/bootcfg/cli/profile.go +++ b/bootcfg/cli/profile.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "github.com/spf13/cobra" diff --git a/bootcfg/cli/profile_create.go b/bootcfg/cli/profile_create.go index 1fac2124..b1b9709f 100644 --- a/bootcfg/cli/profile_create.go +++ b/bootcfg/cli/profile_create.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "io/ioutil" diff --git a/bootcfg/cli/profile_describe.go b/bootcfg/cli/profile_describe.go index 217334e5..fe795863 100644 --- a/bootcfg/cli/profile_describe.go +++ b/bootcfg/cli/profile_describe.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "fmt" diff --git a/bootcfg/cli/profile_list.go b/bootcfg/cli/profile_list.go index ed253543..bfaadab9 100644 --- a/bootcfg/cli/profile_list.go +++ b/bootcfg/cli/profile_list.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "fmt" diff --git a/bootcfg/cli/root.go b/bootcfg/cli/root.go index c7f2b880..f6158579 100644 --- a/bootcfg/cli/root.go +++ b/bootcfg/cli/root.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "fmt" diff --git a/bootcfg/cli/version.go b/bootcfg/cli/version.go index 762f24ab..69e14817 100644 --- a/bootcfg/cli/version.go +++ b/bootcfg/cli/version.go @@ -1,4 +1,4 @@ -package cmd +package cli import ( "fmt" diff --git a/bootcfg/client/doc.go b/bootcfg/client/doc.go new file mode 100644 index 00000000..0f211393 --- /dev/null +++ b/bootcfg/client/doc.go @@ -0,0 +1,2 @@ +// Package client provides the bootcfg gRPC client. +package client diff --git a/bootcfg/api/cloud.go b/bootcfg/http/cloud.go similarity index 99% rename from bootcfg/api/cloud.go rename to bootcfg/http/cloud.go index b4a1f714..4e4507ac 100644 --- a/bootcfg/api/cloud.go +++ b/bootcfg/http/cloud.go @@ -1,4 +1,4 @@ -package api +package http import ( "bytes" diff --git a/bootcfg/api/cloud_test.go b/bootcfg/http/cloud_test.go similarity index 99% rename from bootcfg/api/cloud_test.go rename to bootcfg/http/cloud_test.go index 3cb442a6..18aab6f2 100644 --- a/bootcfg/api/cloud_test.go +++ b/bootcfg/http/cloud_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "net/http" diff --git a/bootcfg/api/context.go b/bootcfg/http/context.go similarity index 98% rename from bootcfg/api/context.go rename to bootcfg/http/context.go index af80d829..a7617cd4 100644 --- a/bootcfg/api/context.go +++ b/bootcfg/http/context.go @@ -1,4 +1,4 @@ -package api +package http import ( "errors" diff --git a/bootcfg/api/context_test.go b/bootcfg/http/context_test.go similarity index 98% rename from bootcfg/api/context_test.go rename to bootcfg/http/context_test.go index 75ef4753..08dc0013 100644 --- a/bootcfg/api/context_test.go +++ b/bootcfg/http/context_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "testing" diff --git a/bootcfg/http/doc.go b/bootcfg/http/doc.go new file mode 100644 index 00000000..43001401 --- /dev/null +++ b/bootcfg/http/doc.go @@ -0,0 +1,2 @@ +// Package http provides the bootcfg HTTP server +package http diff --git a/bootcfg/api/grub.go b/bootcfg/http/grub.go similarity index 98% rename from bootcfg/api/grub.go rename to bootcfg/http/grub.go index 465078c9..16e8c30e 100644 --- a/bootcfg/api/grub.go +++ b/bootcfg/http/grub.go @@ -1,4 +1,4 @@ -package api +package http import ( "bytes" diff --git a/bootcfg/api/handlers.go b/bootcfg/http/handlers.go similarity index 99% rename from bootcfg/api/handlers.go rename to bootcfg/http/handlers.go index 54ebc6d6..fd62946d 100644 --- a/bootcfg/api/handlers.go +++ b/bootcfg/http/handlers.go @@ -1,4 +1,4 @@ -package api +package http import ( "net/http" diff --git a/bootcfg/api/handlers_test.go b/bootcfg/http/handlers_test.go similarity index 99% rename from bootcfg/api/handlers_test.go rename to bootcfg/http/handlers_test.go index bd8ebe81..e800f1a3 100644 --- a/bootcfg/api/handlers_test.go +++ b/bootcfg/http/handlers_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "fmt" diff --git a/bootcfg/api/http.go b/bootcfg/http/http.go similarity index 99% rename from bootcfg/api/http.go rename to bootcfg/http/http.go index ffc93b42..2ed0084b 100644 --- a/bootcfg/api/http.go +++ b/bootcfg/http/http.go @@ -1,4 +1,4 @@ -package api +package http import ( "net" diff --git a/bootcfg/api/http_test.go b/bootcfg/http/http_test.go similarity index 99% rename from bootcfg/api/http_test.go rename to bootcfg/http/http_test.go index c8d98d7c..062ecb52 100644 --- a/bootcfg/api/http_test.go +++ b/bootcfg/http/http_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "fmt" diff --git a/bootcfg/api/ignition.go b/bootcfg/http/ignition.go similarity index 99% rename from bootcfg/api/ignition.go rename to bootcfg/http/ignition.go index 46e93be5..09c63f85 100644 --- a/bootcfg/api/ignition.go +++ b/bootcfg/http/ignition.go @@ -1,4 +1,4 @@ -package api +package http import ( "bytes" diff --git a/bootcfg/api/ignition_test.go b/bootcfg/http/ignition_test.go similarity index 99% rename from bootcfg/api/ignition_test.go rename to bootcfg/http/ignition_test.go index 83694ddc..c81bd0bb 100644 --- a/bootcfg/api/ignition_test.go +++ b/bootcfg/http/ignition_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "net/http" diff --git a/bootcfg/api/ipxe.go b/bootcfg/http/ipxe.go similarity index 99% rename from bootcfg/api/ipxe.go rename to bootcfg/http/ipxe.go index d7e9e8e8..31420c75 100644 --- a/bootcfg/api/ipxe.go +++ b/bootcfg/http/ipxe.go @@ -1,4 +1,4 @@ -package api +package http import ( "bytes" diff --git a/bootcfg/api/ipxe_test.go b/bootcfg/http/ipxe_test.go similarity index 99% rename from bootcfg/api/ipxe_test.go rename to bootcfg/http/ipxe_test.go index 37abd5c3..a1283958 100644 --- a/bootcfg/api/ipxe_test.go +++ b/bootcfg/http/ipxe_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "net/http" diff --git a/bootcfg/api/metadata.go b/bootcfg/http/metadata.go similarity index 98% rename from bootcfg/api/metadata.go rename to bootcfg/http/metadata.go index c57a1c60..6574ed7a 100644 --- a/bootcfg/api/metadata.go +++ b/bootcfg/http/metadata.go @@ -1,4 +1,4 @@ -package api +package http import ( "encoding/json" diff --git a/bootcfg/api/metadata_test.go b/bootcfg/http/metadata_test.go similarity index 99% rename from bootcfg/api/metadata_test.go rename to bootcfg/http/metadata_test.go index f074e2e8..03d0b6b9 100644 --- a/bootcfg/api/metadata_test.go +++ b/bootcfg/http/metadata_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "bufio" diff --git a/bootcfg/api/pixiecore.go b/bootcfg/http/pixiecore.go similarity index 98% rename from bootcfg/api/pixiecore.go rename to bootcfg/http/pixiecore.go index 9e6bcfa6..b2f28c77 100644 --- a/bootcfg/api/pixiecore.go +++ b/bootcfg/http/pixiecore.go @@ -1,4 +1,4 @@ -package api +package http import ( "net/http" diff --git a/bootcfg/api/pixiecore_test.go b/bootcfg/http/pixiecore_test.go similarity index 99% rename from bootcfg/api/pixiecore_test.go rename to bootcfg/http/pixiecore_test.go index 54d67c79..0c4d13d7 100644 --- a/bootcfg/api/pixiecore_test.go +++ b/bootcfg/http/pixiecore_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "net/http" diff --git a/bootcfg/api/serialize.go b/bootcfg/http/serialize.go similarity index 98% rename from bootcfg/api/serialize.go rename to bootcfg/http/serialize.go index f2a7a690..f19b8164 100644 --- a/bootcfg/api/serialize.go +++ b/bootcfg/http/serialize.go @@ -1,4 +1,4 @@ -package api +package http import ( "encoding/json" diff --git a/bootcfg/api/serialize_test.go b/bootcfg/http/serialize_test.go similarity index 99% rename from bootcfg/api/serialize_test.go rename to bootcfg/http/serialize_test.go index 44070b30..0abb3a7d 100644 --- a/bootcfg/api/serialize_test.go +++ b/bootcfg/http/serialize_test.go @@ -1,4 +1,4 @@ -package api +package http import ( "fmt" diff --git a/bootcfg/api/server.go b/bootcfg/http/server.go similarity index 99% rename from bootcfg/api/server.go rename to bootcfg/http/server.go index 07a656a8..9ec50cad 100644 --- a/bootcfg/api/server.go +++ b/bootcfg/http/server.go @@ -1,4 +1,4 @@ -package api +package http import ( "net/http" diff --git a/bootcfg/api/test_fixtures.go b/bootcfg/http/test_fixtures.go similarity index 96% rename from bootcfg/api/test_fixtures.go rename to bootcfg/http/test_fixtures.go index 3a97c309..6d384e28 100644 --- a/bootcfg/api/test_fixtures.go +++ b/bootcfg/http/test_fixtures.go @@ -1,4 +1,4 @@ -package api +package http import ( "github.com/coreos/coreos-baremetal/bootcfg/storage/storagepb" diff --git a/bootcfg/rpc/doc.go b/bootcfg/rpc/doc.go new file mode 100644 index 00000000..d46c3153 --- /dev/null +++ b/bootcfg/rpc/doc.go @@ -0,0 +1,2 @@ +// Package rpc provides the bootcfg gRPC server +package rpc diff --git a/bootcfg/server/doc.go b/bootcfg/server/doc.go new file mode 100644 index 00000000..53d48b64 --- /dev/null +++ b/bootcfg/server/doc.go @@ -0,0 +1,2 @@ +// Package server is a bootcfg library package for implementing servers. +package server diff --git a/bootcfg/sign/doc.go b/bootcfg/sign/doc.go new file mode 100644 index 00000000..72ed11f7 --- /dev/null +++ b/bootcfg/sign/doc.go @@ -0,0 +1,2 @@ +// Package sign adds signatures to bootcfg responses. +package sign diff --git a/bootcfg/storage/doc.go b/bootcfg/storage/doc.go new file mode 100644 index 00000000..5783d2a0 --- /dev/null +++ b/bootcfg/storage/doc.go @@ -0,0 +1,2 @@ +// Package storage defines bootcfg's storage and object types. +package storage diff --git a/cmd/bootcfg/main.go b/cmd/bootcfg/main.go index c312a73d..3628df0c 100644 --- a/cmd/bootcfg/main.go +++ b/cmd/bootcfg/main.go @@ -12,7 +12,7 @@ import ( "github.com/coreos/pkg/capnslog" "github.com/coreos/pkg/flagutil" - "github.com/coreos/coreos-baremetal/bootcfg/api" + web "github.com/coreos/coreos-baremetal/bootcfg/http" "github.com/coreos/coreos-baremetal/bootcfg/rpc" "github.com/coreos/coreos-baremetal/bootcfg/server" "github.com/coreos/coreos-baremetal/bootcfg/sign" @@ -100,13 +100,13 @@ func main() { Root: flags.dataPath, }) - bootcfgServer := server.NewServer(&server.Config{ + server := server.NewServer(&server.Config{ Store: store, }) // gRPC Server (feature hidden) if flags.rpcAddress != "" { - grpcServer, err := rpc.NewServer(bootcfgServer) + grpcServer, err := rpc.NewServer(server) if err != nil { log.Fatal(err) } @@ -120,13 +120,13 @@ func main() { } // HTTP Server - config := &api.Config{ + config := &web.Config{ Store: store, AssetsPath: flags.assetsPath, Signer: signer, ArmoredSigner: armoredSigner, } - httpServer := api.NewServer(config) + httpServer := web.NewServer(config) log.Infof("starting bootcfg HTTP server on %s", flags.address) err = http.ListenAndServe(flags.address, httpServer.HTTPHandler()) if err != nil { diff --git a/cmd/bootcmd/main.go b/cmd/bootcmd/main.go index 9b499b88..212e1b4b 100644 --- a/cmd/bootcmd/main.go +++ b/cmd/bootcmd/main.go @@ -3,5 +3,5 @@ package main import "github.com/coreos/coreos-baremetal/bootcfg/cli" func main() { - cmd.Execute() + cli.Execute() }