From 965ea1ccfdd98a4811af0f652c4b6e9c79052e90 Mon Sep 17 00:00:00 2001 From: Dario Maiocchi Date: Fri, 10 Nov 2017 19:07:52 +0100 Subject: comment on exported function should Start with name of the function --- libvirt/cloudinit_def.go | 3 ++- libvirt/libvirt_interfaces.go | 2 +- libvirt/network_def.go | 2 +- libvirt/pool_sync.go | 6 +++--- libvirt/utils.go | 4 ++-- libvirt/utils_net.go | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) (limited to 'libvirt') diff --git a/libvirt/cloudinit_def.go b/libvirt/cloudinit_def.go index 37f4afb4..2c08c2be 100644 --- a/libvirt/cloudinit_def.go +++ b/libvirt/cloudinit_def.go @@ -19,8 +19,9 @@ import ( "gopkg.in/yaml.v2" ) -// names of the files expected by cloud-init +// USERDATA is the name of file expected by cloud-init const USERDATA string = "user-data" +// METADATA is the name of file expected by cloud-init const METADATA string = "meta-data" type CloudInitUserData struct { diff --git a/libvirt/libvirt_interfaces.go b/libvirt/libvirt_interfaces.go index 77449034..4c2b4fcd 100644 --- a/libvirt/libvirt_interfaces.go +++ b/libvirt/libvirt_interfaces.go @@ -2,7 +2,7 @@ package libvirt import "github.com/libvirt/libvirt-go" -// Interface used to expose a libvirt.Domain +// LibVirtDomain Interface used to expose a libvirt.Domain // Used to allow testing type LibVirtDomain interface { QemuAgentCommand(command string, timeout libvirt.DomainQemuAgentCommandTimeout, flags uint32) (string, error) diff --git a/libvirt/network_def.go b/libvirt/network_def.go index dcfa7eb0..e62bdfc2 100644 --- a/libvirt/network_def.go +++ b/libvirt/network_def.go @@ -7,7 +7,7 @@ import ( "github.com/libvirt/libvirt-go-xml" ) -// Check if the network has a DHCP server managed by libvirt +// HasDHCP Check if the network has a DHCP server managed by libvirt func HasDHCP(net libvirtxml.Network) bool { if net.Forward != nil { if net.Forward.Mode == "nat" || net.Forward.Mode == "route" || net.Forward.Mode == "" { diff --git a/libvirt/pool_sync.go b/libvirt/pool_sync.go index 8c53ac05..5349b6fe 100644 --- a/libvirt/pool_sync.go +++ b/libvirt/pool_sync.go @@ -13,7 +13,7 @@ type LibVirtPoolSync struct { internalMutex sync.Mutex } -// Allocate a new instance of LibVirtPoolSync +// NewLibVirtPoolSync Allocate a new instance of LibVirtPoolSync func NewLibVirtPoolSync() LibVirtPoolSync { pool := LibVirtPoolSync{} pool.PoolLocks = make(map[string]*sync.Mutex) @@ -21,7 +21,7 @@ func NewLibVirtPoolSync() LibVirtPoolSync { return pool } -// Acquire a lock for the specified pool +// AcquireLock Acquire a lock for the specified pool func (ps LibVirtPoolSync) AcquireLock(pool string) { ps.internalMutex.Lock() defer ps.internalMutex.Unlock() @@ -35,7 +35,7 @@ func (ps LibVirtPoolSync) AcquireLock(pool string) { lock.Lock() } -// Release the look for the specified pool +// ReleaseLock Release the look for the specified pool func (ps LibVirtPoolSync) ReleaseLock(pool string) { ps.internalMutex.Lock() defer ps.internalMutex.Unlock() diff --git a/libvirt/utils.go b/libvirt/utils.go index 0851fb8f..a0dea21c 100644 --- a/libvirt/utils.go +++ b/libvirt/utils.go @@ -29,7 +29,7 @@ func DiskLetterForIndex(i int) string { var WAIT_SLEEP_INTERVAL time.Duration = 1 * time.Second var WAIT_TIMEOUT time.Duration = 5 * time.Minute -// wait for success and timeout after 5 minutes. +// WaitForSuccess wait for success and timeout after 5 minutes. func WaitForSuccess(errorMessage string, f func() error) error { start := time.Now() for { @@ -57,7 +57,7 @@ func xmlMarshallIndented(b interface{}) (string, error) { return buf.String(), nil } -// Remove the volume identified by `key` from libvirt +// RemoveVolume Remove the volume identified by `key` from libvirt func RemoveVolume(virConn *libvirt.Connect, key string) error { volume, err := virConn.LookupStorageVolByKey(key) if err != nil { diff --git a/libvirt/utils_net.go b/libvirt/utils_net.go index efb0d725..8cadcc9a 100644 --- a/libvirt/utils_net.go +++ b/libvirt/utils_net.go @@ -55,7 +55,7 @@ func FreeNetworkInterface(basename string) (string, error) { return "", fmt.Errorf("could not obtain a free network interface") } -// Calculates the first and last IP addresses in an IPNet +// NetworkRange Calculates the first and last IP addresses in an IPNet func NetworkRange(network *net.IPNet) (net.IP, net.IP) { netIP := network.IP.To4() lastIP := net.IPv4(0, 0, 0, 0).To4() -- cgit v1.2.3