Skip to content

Commit

Permalink
Run Go fmt over the files
Browse files Browse the repository at this point in the history
  • Loading branch information
fwiesel committed May 15, 2023
1 parent 8168ed8 commit d1c066a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion internal/discovery/ironic_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func init() {
Register(ironicDiscovery, NewIronicDiscovery)
}

//NewIronicDiscovery creates a new Ironic Discovery
// NewIronicDiscovery creates a new Ironic Discovery
func NewIronicDiscovery(disc interface{}, ctx context.Context, opts config.Options, l log.Logger) (d Discovery, err error) {
var cfg ironicConfig
if err := UnmarshalHandler(disc, &cfg, nil); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/discovery/netbox_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func init() {
Register(netboxDiscovery, NewNetboxDiscovery)
}

//NewNetboxDiscovery creates
// NewNetboxDiscovery creates
func NewNetboxDiscovery(disc interface{}, ctx context.Context, opts config.Options, l log.Logger) (d Discovery, err error) {
var cfg netboxConfig
configValues := configValues{Region: opts.Region}
Expand Down
4 changes: 2 additions & 2 deletions pkg/clients/ironic.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ func (c IronicClient) GetNodes() ([]IronicNode, error) {
////////////////////////////////////////////////////////////////////////////////
// OpenStack is being inconsistent with itself again

//For fields that are sometimes missing, sometimes an integer, sometimes a string.
// For fields that are sometimes missing, sometimes an integer, sometimes a string.
type veryFlexibleUint64 uint64

//UnmarshalJSON implements the json.Unmarshaler interface.
// UnmarshalJSON implements the json.Unmarshaler interface.
func (value *veryFlexibleUint64) UnmarshalJSON(buf []byte) error {
if string(buf) == "null" {
*value = 0
Expand Down
10 changes: 5 additions & 5 deletions pkg/netbox/netbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (nb *Netbox) Servers(rackID string) ([]models.DeviceWithConfigContext, erro

}

//DevicesByRegion retrieves devices by region, manufacturer and status
// DevicesByRegion retrieves devices by region, manufacturer and status
func (nb *Netbox) DevicesByRegion(query, manufacturer, region, status string) (res []models.DeviceWithConfigContext, err error) {
res = make([]models.DeviceWithConfigContext, 0)
params := dcim.NewDcimDevicesListParams()
Expand Down Expand Up @@ -183,7 +183,7 @@ func (nb *Netbox) DevicesByRegion(query, manufacturer, region, status string) (r
return res, err
}

//DevicesByRegion retrieves devices by region, manufacturer and status
// DevicesByRegion retrieves devices by region, manufacturer and status
func (nb *Netbox) DevicesByParams(params dcim.DcimDevicesListParams) (res []models.DeviceWithConfigContext, err error) {
res = make([]models.DeviceWithConfigContext, 0)
limit := int64(100)
Expand Down Expand Up @@ -211,7 +211,7 @@ func (nb *Netbox) DevicesByParams(params dcim.DcimDevicesListParams) (res []mode
return res, err
}

//DevicesByRegion retrieves devices by region, manufacturer and status
// DevicesByRegion retrieves devices by region, manufacturer and status
func (nb *Netbox) DeviceByParams(params dcim.DcimDevicesListParams) (res models.DeviceWithConfigContext, err error) {
limit := int64(1)
params.WithLimit(&limit)
Expand All @@ -229,7 +229,7 @@ func (nb *Netbox) DeviceByParams(params dcim.DcimDevicesListParams) (res models.
return res, err
}

//VMsByTag retrieves devices by region, manufacturer and status
// VMsByTag retrieves devices by region, manufacturer and status
func (nb *Netbox) VMsByParams(params virtualization.VirtualizationVirtualMachinesListParams) (res []models.VirtualMachineWithConfigContext, err error) {
res = make([]models.VirtualMachineWithConfigContext, 0)
params.WithTimeout(30 * time.Second)
Expand All @@ -256,7 +256,7 @@ func (nb *Netbox) VMsByParams(params virtualization.VirtualizationVirtualMachine
return res, err
}

//VMsByTag retrieves devices by region, manufacturer and status
// VMsByTag retrieves devices by region, manufacturer and status
func (nb *Netbox) VMsByTag(query, status, tag string) (res []models.VirtualMachineWithConfigContext, err error) {
res = make([]models.VirtualMachineWithConfigContext, 0)
params := virtualization.NewVirtualizationVirtualMachinesListParams()
Expand Down
20 changes: 10 additions & 10 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ var DefaultBackoff = wait.Backoff{
// write. Callers should preserve previous executions if they wish to retry changes. It performs an
// exponential backoff.
//
// var pod *api.Pod
// err := RetryOnConflict(DefaultBackoff, func() (err error) {
// pod, err = c.Pods("mynamespace").UpdateStatus(podStatus)
// return
// })
// if err != nil {
// // may be conflict if max retries were hit
// return err
// }
// ...
// var pod *api.Pod
// err := RetryOnConflict(DefaultBackoff, func() (err error) {
// pod, err = c.Pods("mynamespace").UpdateStatus(podStatus)
// return
// })
// if err != nil {
// // may be conflict if max retries were hit
// return err
// }
// ...
//
// TODO: Make Backoff an interface?
func RetryOnConflict(backoff wait.Backoff, fn func() error) error {
Expand Down

0 comments on commit d1c066a

Please sign in to comment.