Skip to content

Commit

Permalink
go-fmt: apply formatting with golang 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
r4f4 committed Oct 19, 2022
1 parent 5a9ad4c commit 66953ce
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 36 deletions.
28 changes: 14 additions & 14 deletions pkg/asset/agent/manifests/network-scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ package manifests
// /etc/assisted/network in the following structure:
// /etc/assisted/network/
//
// +-- host1
// | +--- *.nmconnection
// | +--- mac_interface.ini
// +-- host2
// +--- *.nmconnection
// +--- mac_interface.ini
// 1. *.nmconnections - files generated by nmstate based on yaml files provided by the user
// 2. mac_interface.ini - the file contains mapping of mac-address to logical interface name.
// There are two usages for the file:
// a. Map logical interface name to MAC Address of the host. The logical interface name is a
// name provided by the user for the interface. It will be replaced by the script with the
// actual network interface name.
// b. Identify the host directory which belongs to the current host by matching a MAC Address
// from the mapping file with host network interfaces.
// +-- host1
// | +--- *.nmconnection
// | +--- mac_interface.ini
// +-- host2
// +--- *.nmconnection
// +--- mac_interface.ini
// 1. *.nmconnections - files generated by nmstate based on yaml files provided by the user
// 2. mac_interface.ini - the file contains mapping of mac-address to logical interface name.
// There are two usages for the file:
// a. Map logical interface name to MAC Address of the host. The logical interface name is a
// name provided by the user for the interface. It will be replaced by the script with the
// actual network interface name.
// b. Identify the host directory which belongs to the current host by matching a MAC Address
// from the mapping file with host network interfaces.
//
// Applying the network configuration of each host will be done by:
// 1. Associate the current host with its matching hostX directory. The association will be done by
Expand Down
17 changes: 11 additions & 6 deletions pkg/destroy/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ func (o *ClusterUninstaller) RunWithContext(ctx context.Context) ([]string, erro
}

// findResourcesToDelete returns the resources that should be deleted.
// tagClients - clients of the tagging API to use to search for resources.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
//
// tagClients - clients of the tagging API to use to search for resources.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func (o *ClusterUninstaller) findResourcesToDelete(
ctx context.Context,
tagClients []*resourcegroupstaggingapi.ResourceGroupsTaggingAPI,
Expand Down Expand Up @@ -313,8 +314,9 @@ func (o *ClusterUninstaller) findResourcesToDelete(
}

// findResourcesByTag returns the resources with tags that satisfy the filters.
// tagClients - clients of the tagging API to use to search for resources.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
//
// tagClients - clients of the tagging API to use to search for resources.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func (o *ClusterUninstaller) findResourcesByTag(
ctx context.Context,
tagClient *resourcegroupstaggingapi.ResourceGroupsTaggingAPI,
Expand Down Expand Up @@ -353,7 +355,8 @@ func (o *ClusterUninstaller) findResourcesByTag(
}

// findUntaggableResources returns the resources for the cluster that cannot be tagged.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
//
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func (o *ClusterUninstaller) findUntaggableResources(ctx context.Context, iamClient *iam.IAM, deleted sets.String) (sets.String, error) {
resources := sets.NewString()
o.Logger.Debug("search for IAM instance profiles")
Expand All @@ -375,7 +378,9 @@ func (o *ClusterUninstaller) findUntaggableResources(ctx context.Context, iamCli
}

// deleteResources deletes the specified resources.
// resources - the resources to be deleted.
//
// resources - the resources to be deleted.
//
// The first return is the ARNs of the resources that were successfully deleted
func (o *ClusterUninstaller) deleteResources(ctx context.Context, awsSession *session.Session, resources []string, tracker *errorTracker) (sets.String, error) {
deleted := sets.NewString()
Expand Down
3 changes: 2 additions & 1 deletion pkg/destroy/aws/ec2helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import (
// findEC2Instances returns the EC2 instances with tags that satisfy the filters.
// returns two lists, first one is the list of all resources that are not terminated and are not in shutdown
// stage and the second list is the list of resources that are not terminated.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
//
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func findEC2Instances(ctx context.Context, ec2Client *ec2.EC2, deleted sets.String, filters []Filter, logger logrus.FieldLogger) ([]string, []string, error) {
if ec2Client.Config.Region == nil {
return nil, nil, errors.New("EC2 client does not have region configured")
Expand Down
6 changes: 4 additions & 2 deletions pkg/destroy/aws/iamhelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ func (search *iamUserSearch) arns(ctx context.Context) ([]string, error) {
}

// findIAMRoles returns the IAM roles for the cluster.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
//
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func findIAMRoles(ctx context.Context, search *iamRoleSearch, deleted sets.String, logger logrus.FieldLogger) (sets.String, error) {
logger.Debug("search for IAM roles")
resources, _, err := search.find(ctx)
Expand All @@ -144,7 +145,8 @@ func findIAMRoles(ctx context.Context, search *iamRoleSearch, deleted sets.Strin
}

// findIAMUsers returns the IAM users for the cluster.
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
//
// deleted - the resources that have already been deleted. Any resources specified in this set will be ignored.
func findIAMUsers(ctx context.Context, search *iamUserSearch, deleted sets.String, logger logrus.FieldLogger) (sets.String, error) {
logger.Debug("search for IAM users")
resources, err := search.arns(ctx)
Expand Down
16 changes: 8 additions & 8 deletions pkg/lineprinter/lineprinter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
// Print is a type that can hold fmt.Print and other implementations
// which match that signature. For example, you can use:
//
// trimmer := &lineprinter.Trimmer{WrappedPrint: logrus.StandardLogger().Debug}
// linePrinter := &linePrinter{Print: trimmer.Print}
// trimmer := &lineprinter.Trimmer{WrappedPrint: logrus.StandardLogger().Debug}
// linePrinter := &linePrinter{Print: trimmer.Print}
//
// to connect the line printer to logrus at the debug level.
type Print func(args ...interface{})
Expand All @@ -24,12 +24,12 @@ type Print func(args ...interface{})
// One use-case is connecting a subprocess's standard streams to a
// logger:
//
// linePrinter := &linePrinter{
// Print: &Trimmer{WrappedPrint: logrus.StandardLogger().Debug}.Print,
// }
// defer linePrinter.Close()
// cmd := exec.Command(...)
// cmd.Stdout = linePrinter
// linePrinter := &linePrinter{
// Print: &Trimmer{WrappedPrint: logrus.StandardLogger().Debug}.Print,
// }
// defer linePrinter.Close()
// cmd := exec.Command(...)
// cmd.Stdout = linePrinter
//
// LinePrinter buffers the subcommand's byte stream and splits it into
// lines for the logger. Sometimes we might have a partial line
Expand Down
2 changes: 1 addition & 1 deletion pkg/migrate/azure/privatedns.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func newLegacyDNSClient(session *azconfig.Session, resourceGroup string) *legacy
// Takes a subscription ID and parses the resource group out of it.
// A subscription ID has the format "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxx-xxxxx-rg/providers/...".
// Splitting the string on '/' gives us the following slice:
// parts[0] = ''
// parts[0] =
// parts[1] = 'subscriptions'
// parts[2] = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
// parts[3] = 'resourceGroups'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ func Get(networkClient *gophercloud.ServiceClient) ([]extensions.Extension, erro
// `standard-attr-tag` extension.
//
// We need to check that:
// 1. `standard-attr-tag` extension is enabled
// 2. `standard-attr-tag` covers all the necessary resources (from the
// extension description) or that the `tag` and `tag-ext`
// extensions are enabled as well
// 1. `standard-attr-tag` extension is enabled
// 2. `standard-attr-tag` covers all the necessary resources (from the
// extension description) or that the `tag` and `tag-ext`
// extensions are enabled as well
func Validate(availableExtensions []extensions.Extension) error {
var (
standardAttrTagEnabled = false
Expand Down

0 comments on commit 66953ce

Please sign in to comment.