Cleanup code and add comments

This commit is contained in:
Ivo Verberk 2016-01-20 00:02:17 +01:00
parent c1829e7f1f
commit 9c46eceeac
2 changed files with 7 additions and 3 deletions

View File

@ -450,11 +450,12 @@ func (c *Client) setupNode() error {
node = &structs.Node{}
c.config.Node = node
}
id, err := c.nodeID()
// Generate an iD for the node
var err error
node.ID, err = c.nodeID()
if err != nil {
return fmt.Errorf("node ID setup failed: %v", err)
}
node.ID = id
if node.Attributes == nil {
node.Attributes = make(map[string]string)
}

View File

@ -60,13 +60,16 @@ type monitor struct {
ui cli.Ui
client *api.Client
state *evalState
// length determines the number of characters for identifiers in the ui.
length int
sync.Mutex
}
// newMonitor returns a new monitor. The returned monitor will
// write output information to the provided ui.
// write output information to the provided ui. The length parameter determines
// the number of characters for identifiers in the ui.
func newMonitor(ui cli.Ui, client *api.Client, length int) *monitor {
mon := &monitor{
ui: &cli.PrefixedUi{