Fix function comments based on best practices from Effective Go

Signed-off-by: CodeLingo Bot <bot@codelingo.io>
This commit is contained in:
CodeLingo Bot
2019-03-07 02:33:29 +00:00
parent 9592de82a0
commit b401e7b17e
10 changed files with 13 additions and 13 deletions

View File

@@ -143,7 +143,7 @@ func (cm *Docker) Loop() {
}
}
// Get a single container, creating one anew if not existing
// MustGet gets a single container, creating one anew if not existing
func (cm *Docker) MustGet(id string) *container.Container {
c, ok := cm.Get(id)
// append container struct for new containers
@@ -177,7 +177,7 @@ func (cm *Docker) delByID(id string) {
log.Infof("removed dead container: %s", id)
}
// Return array of all containers, sorted by field
// All returns array of all containers, sorted by field
func (cm *Docker) All() (containers container.Containers) {
cm.lock.Lock()
for _, c := range cm.containers {

View File

@@ -13,7 +13,7 @@ var (
enabled = make(map[string]func() Connector)
)
// return names for all enabled connectors on the current platform
// Enabled returns names for all enabled connectors on the current platform
func Enabled() (a []string) {
for k, _ := range enabled {
a = append(a, k)

View File

@@ -73,7 +73,7 @@ func (cs *Mock) Get(id string) (*container.Container, bool) {
return nil, false
}
// Return array of all containers, sorted by field
// All returns array of all containers, sorted by field
func (cs *Mock) All() container.Containers {
cs.containers.Sort()
cs.containers.Filter()

View File

@@ -168,7 +168,7 @@ func (cm *Runc) Loop() {
}
}
// Get a single ctop container in the map matching libc container, creating one anew if not existing
// MustGet gets a single ctop container in the map matching libc container, creating one anew if not existing
func (cm *Runc) MustGet(id string) *container.Container {
c, ok := cm.Get(id)
if !ok {
@@ -216,7 +216,7 @@ func (cm *Runc) delByID(id string) {
log.Infof("removed dead container: %s", id)
}
// Return array of all containers, sorted by field
// All returns array of all containers, sorted by field
func (cm *Runc) All() (containers container.Containers) {
cm.lock.Lock()
for _, c := range cm.containers {