Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gofumpt scripts #12867

Merged
merged 2 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 2 additions & 4 deletions channels/pkg/channels/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func Test_Replacement(t *testing.T) {
New *ChannelVersion
Replaces bool
}{
//Test ManifestHash Changes
// Test ManifestHash Changes
{
Old: &ChannelVersion{Id: "a", ManifestHash: hash1},
New: &ChannelVersion{Id: "a", ManifestHash: hash1},
Expand Down Expand Up @@ -319,7 +319,6 @@ func Test_NeedsRollingUpdate(t *testing.T) {
}

}

}

func Test_InstallPKI(t *testing.T) {
Expand Down Expand Up @@ -348,7 +347,7 @@ func Test_InstallPKI(t *testing.T) {
t.Errorf("unexpected error: %v", err)
}

//Two consecutive calls should work since multiple CP nodes can update at the same time
// Two consecutive calls should work since multiple CP nodes can update at the same time
err = addon.installPKI(ctx, fakek8s, fakecm)
if err != nil {
t.Errorf("unexpected error: %v", err)
Expand All @@ -358,5 +357,4 @@ func Test_InstallPKI(t *testing.T) {
if err != nil {
t.Errorf("unexpected error: %v", err)
}

}
2 changes: 1 addition & 1 deletion channels/pkg/channels/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Apply(data []byte) error {
}()

localManifestFile := path.Join(tmpDir, "manifest.yaml")
if err := os.WriteFile(localManifestFile, data, 0600); err != nil {
if err := os.WriteFile(localManifestFile, data, 0o600); err != nil {
return fmt.Errorf("error writing temp file: %v", err)
}

Expand Down
3 changes: 1 addition & 2 deletions channels/pkg/channels/channel_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func (c *Channel) GetInstalledVersion(ctx context.Context, k8sClient kubernetes.
}

func (c *Channel) IsPKIInstalled(ctx context.Context, k8sClient kubernetes.Interface, cmClient certmanager.Interface) (bool, error) {

_, err := k8sClient.CoreV1().Secrets("kube-system").Get(ctx, c.Name+"-ca", metav1.GetOptions{})
if errors.IsNotFound(err) {
return false, nil
Expand All @@ -174,12 +173,12 @@ func (c *Channel) IsPKIInstalled(ctx context.Context, k8sClient kubernetes.Inter
}

return true, nil

}

type annotationPatch struct {
Metadata annotationPatchMetadata `json:"metadata,omitempty"`
}

type annotationPatchMetadata struct {
Annotations map[string]string `json:"annotations,omitempty"`
}
Expand Down
1 change: 0 additions & 1 deletion channels/pkg/channels/channel_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,4 @@ func Test_IsPKIInstalled(t *testing.T) {
if !isInstalled {
t.Error("claims PKI is not installed when it is")
}

}
3 changes: 1 addition & 2 deletions channels/pkg/cmd/get_addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ import (
"k8s.io/kops/util/pkg/tables"
)

type GetAddonsOptions struct {
}
type GetAddonsOptions struct{}

func NewCmdGetAddons(f Factory, out io.Writer) *cobra.Command {
var options GetAddonsOptions
Expand Down
1 change: 0 additions & 1 deletion channels/pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package cmd
import (
goflag "flag"
"fmt"

"io"

"github.com/spf13/cobra"
Expand Down
1 change: 1 addition & 0 deletions cloudmock/aws/mockautoscaling/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (m *MockAutoscaling) AttachLoadBalancersWithContext(aws.Context, *autoscali
klog.Fatalf("Not implemented")
return nil, nil
}

func (m *MockAutoscaling) AttachLoadBalancersRequest(*autoscaling.AttachLoadBalancersInput) (*request.Request, *autoscaling.AttachLoadBalancersOutput) {
klog.Fatalf("Not implemented")
return nil, nil
Expand Down
2 changes: 2 additions & 0 deletions cloudmock/aws/mockautoscaling/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ func (m *MockAutoscaling) DescribeAutoScalingGroupsWithContext(aws.Context, *aut
klog.Fatalf("Not implemented")
return nil, nil
}

func (m *MockAutoscaling) DescribeAutoScalingGroupsRequest(*autoscaling.DescribeAutoScalingGroupsInput) (*request.Request, *autoscaling.DescribeAutoScalingGroupsOutput) {
klog.Fatalf("Not implemented")
return nil, nil
Expand Down Expand Up @@ -332,6 +333,7 @@ func (m *MockAutoscaling) DeleteAutoScalingGroupWithContext(aws.Context, *autosc
klog.Fatalf("Not implemented")
return nil, nil
}

func (m *MockAutoscaling) DeleteAutoScalingGroupRequest(*autoscaling.DeleteAutoScalingGroupInput) (*request.Request, *autoscaling.DeleteAutoScalingGroupOutput) {
klog.Fatalf("Not implemented")
return nil, nil
Expand Down
2 changes: 2 additions & 0 deletions cloudmock/aws/mockec2/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,11 @@ func (m *MockEC2) DescribeAddresses(request *ec2.DescribeAddressesInput) (*ec2.D
func (m *MockEC2) ReleaseAddressRequest(*ec2.ReleaseAddressInput) (*request.Request, *ec2.ReleaseAddressOutput) {
panic("Not implemented")
}

func (m *MockEC2) ReleaseAddressWithContext(aws.Context, *ec2.ReleaseAddressInput, ...request.Option) (*ec2.ReleaseAddressOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) ReleaseAddress(request *ec2.ReleaseAddressInput) (*ec2.ReleaseAddressOutput, error) {
m.mutex.Lock()
defer m.mutex.Unlock()
Expand Down
6 changes: 6 additions & 0 deletions cloudmock/aws/mockec2/dhcpoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (m *MockEC2) DescribeDhcpOptions(request *ec2.DescribeDhcpOptionsInput) (*e
func (m *MockEC2) DescribeDhcpOptionsWithContext(aws.Context, *ec2.DescribeDhcpOptionsInput, ...request.Option) (*ec2.DescribeDhcpOptionsOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DescribeDhcpOptionsRequest(*ec2.DescribeDhcpOptionsInput) (*request.Request, *ec2.DescribeDhcpOptionsOutput) {
panic("Not implemented")
}
Expand Down Expand Up @@ -108,9 +109,11 @@ func (m *MockEC2) AssociateDhcpOptions(request *ec2.AssociateDhcpOptionsInput) (

return response, nil
}

func (m *MockEC2) AssociateDhcpOptionsWithContext(aws.Context, *ec2.AssociateDhcpOptionsInput, ...request.Option) (*ec2.AssociateDhcpOptionsOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) AssociateDhcpOptionsRequest(*ec2.AssociateDhcpOptionsInput) (*request.Request, *ec2.AssociateDhcpOptionsOutput) {
panic("Not implemented")
}
Expand Down Expand Up @@ -154,9 +157,11 @@ func (m *MockEC2) CreateDhcpOptions(request *ec2.CreateDhcpOptionsInput) (*ec2.C
copy.Tags = m.getTags(ec2.ResourceTypeDhcpOptions, *dhcpOptions.DhcpOptionsId)
return &ec2.CreateDhcpOptionsOutput{DhcpOptions: &copy}, nil
}

func (m *MockEC2) CreateDhcpOptionsWithContext(aws.Context, *ec2.CreateDhcpOptionsInput, ...request.Option) (*ec2.CreateDhcpOptionsOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) CreateDhcpOptionsRequest(*ec2.CreateDhcpOptionsInput) (*request.Request, *ec2.CreateDhcpOptionsOutput) {
panic("Not implemented")
}
Expand All @@ -180,6 +185,7 @@ func (m *MockEC2) DeleteDhcpOptions(request *ec2.DeleteDhcpOptionsInput) (*ec2.D
func (m *MockEC2) DeleteDhcpOptionsWithContext(aws.Context, *ec2.DeleteDhcpOptionsInput, ...request.Option) (*ec2.DeleteDhcpOptionsOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DeleteDhcpOptionsRequest(*ec2.DeleteDhcpOptionsInput) (*request.Request, *ec2.DeleteDhcpOptionsOutput) {
panic("Not implemented")
}
2 changes: 2 additions & 0 deletions cloudmock/aws/mockec2/egressonlyinternetgateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func (m *MockEC2) DescribeEgressOnlyInternetGateways(request *ec2.DescribeEgress

return response, nil
}

func (m *MockEC2) DeleteEgressOnlyInternetGateway(request *ec2.DeleteEgressOnlyInternetGatewayInput) (*ec2.DeleteEgressOnlyInternetGatewayOutput, error) {
m.mutex.Lock()
defer m.mutex.Unlock()
Expand All @@ -182,6 +183,7 @@ func (m *MockEC2) DeleteEgressOnlyInternetGateway(request *ec2.DeleteEgressOnlyI
func (m *MockEC2) DeleteEgressOnlyInternetGatewayWithContext(aws.Context, *ec2.DeleteEgressOnlyInternetGatewayInput, ...request.Option) (*ec2.DeleteEgressOnlyInternetGatewayOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DeleteEgressOnlyInternetGatewayRequest(*ec2.DeleteEgressOnlyInternetGatewayInput) (*request.Request, *ec2.DeleteEgressOnlyInternetGatewayOutput) {
panic("Not implemented")
}
7 changes: 7 additions & 0 deletions cloudmock/aws/mockec2/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@ import (
func (m *MockEC2) DescribeImageAttributeRequest(*ec2.DescribeImageAttributeInput) (*request.Request, *ec2.DescribeImageAttributeOutput) {
panic("Not implemented")
}

func (m *MockEC2) DescribeImageAttributeWithContext(aws.Context, *ec2.DescribeImageAttributeInput, ...request.Option) (*ec2.DescribeImageAttributeOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DescribeImageAttribute(*ec2.DescribeImageAttributeInput) (*ec2.DescribeImageAttributeOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DescribeImagesRequest(*ec2.DescribeImagesInput) (*request.Request, *ec2.DescribeImagesOutput) {
panic("Not implemented")
}

func (m *MockEC2) DescribeImagesWithContext(aws.Context, *ec2.DescribeImagesInput, ...request.Option) (*ec2.DescribeImagesOutput, error) {
panic("Not implemented")
}
Expand Down Expand Up @@ -70,12 +74,15 @@ func (m *MockEC2) DescribeImages(request *ec2.DescribeImagesInput) (*ec2.Describ

return response, nil
}

func (m *MockEC2) DescribeImportImageTasksRequest(*ec2.DescribeImportImageTasksInput) (*request.Request, *ec2.DescribeImportImageTasksOutput) {
panic("Not implemented")
}

func (m *MockEC2) DescribeImportImageTasksWithContext(aws.Context, *ec2.DescribeImportImageTasksInput, ...request.Option) (*ec2.DescribeImportImageTasksOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DescribeImportImageTasks(*ec2.DescribeImportImageTasksInput) (*ec2.DescribeImportImageTasksOutput, error) {
panic("Not implemented")
}
Expand Down
2 changes: 2 additions & 0 deletions cloudmock/aws/mockec2/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func (m *MockEC2) DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeI
func (m *MockEC2) DescribeInstancesWithContext(aws.Context, *ec2.DescribeInstancesInput, ...request.Option) (*ec2.DescribeInstancesOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DescribeInstancesRequest(*ec2.DescribeInstancesInput) (*request.Request, *ec2.DescribeInstancesOutput) {
panic("Not implemented")
}
Expand All @@ -46,6 +47,7 @@ func (m *MockEC2) DescribeInstancesPages(request *ec2.DescribeInstancesInput, ca

return nil
}

func (m *MockEC2) DescribeInstancesPagesWithContext(aws.Context, *ec2.DescribeInstancesInput, func(*ec2.DescribeInstancesOutput, bool) bool, ...request.Option) error {
panic("Not implemented")
}
Expand Down
4 changes: 3 additions & 1 deletion cloudmock/aws/mockec2/internetgateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ func (m *MockEC2) AttachInternetGateway(request *ec2.AttachInternetGatewayInput)
}

return nil, fmt.Errorf("InternetGateway not found")

}

func (m *MockEC2) AttachInternetGatewayWithContext(aws.Context, *ec2.AttachInternetGatewayInput, ...request.Option) (*ec2.AttachInternetGatewayOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) AttachInternetGatewayRequest(*ec2.AttachInternetGatewayInput) (*request.Request, *ec2.AttachInternetGatewayOutput) {
panic("Not implemented")
}
Expand Down Expand Up @@ -215,6 +215,7 @@ func (m *MockEC2) DetachInternetGateway(request *ec2.DetachInternetGatewayInput)
func (m *MockEC2) DetachInternetGatewayWithContext(aws.Context, *ec2.DetachInternetGatewayInput, ...request.Option) (*ec2.DetachInternetGatewayOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DetachInternetGatewayRequest(*ec2.DetachInternetGatewayInput) (*request.Request, *ec2.DetachInternetGatewayOutput) {
panic("Not implemented")
}
Expand All @@ -238,6 +239,7 @@ func (m *MockEC2) DeleteInternetGateway(request *ec2.DeleteInternetGatewayInput)
func (m *MockEC2) DeleteInternetGatewayWithContext(aws.Context, *ec2.DeleteInternetGatewayInput, ...request.Option) (*ec2.DeleteInternetGatewayOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DeleteInternetGatewayRequest(*ec2.DeleteInternetGatewayInput) (*request.Request, *ec2.DeleteInternetGatewayOutput) {
panic("Not implemented")
}
8 changes: 8 additions & 0 deletions cloudmock/aws/mockec2/keypairs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ import (
func (m *MockEC2) DescribeKeyPairsRequest(*ec2.DescribeKeyPairsInput) (*request.Request, *ec2.DescribeKeyPairsOutput) {
panic("MockEC2 DescribeKeyPairsRequest not implemented")
}

func (m *MockEC2) DescribeKeyPairsWithContext(aws.Context, *ec2.DescribeKeyPairsInput, ...request.Option) (*ec2.DescribeKeyPairsOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) ImportKeyPairRequest(*ec2.ImportKeyPairInput) (*request.Request, *ec2.ImportKeyPairOutput) {
panic("MockEC2 ImportKeyPairRequest not implemented")
}

func (m *MockEC2) ImportKeyPairWithContext(aws.Context, *ec2.ImportKeyPairInput, ...request.Option) (*ec2.ImportKeyPairOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) ImportKeyPair(request *ec2.ImportKeyPairInput) (*ec2.ImportKeyPairOutput, error) {
m.mutex.Lock()
defer m.mutex.Unlock()
Expand Down Expand Up @@ -71,12 +75,15 @@ func (m *MockEC2) ImportKeyPair(request *ec2.ImportKeyPairInput) (*ec2.ImportKey

return response, nil
}

func (m *MockEC2) CreateKeyPairRequest(*ec2.CreateKeyPairInput) (*request.Request, *ec2.CreateKeyPairOutput) {
panic("MockEC2 CreateKeyPairRequest not implemented")
}

func (m *MockEC2) CreateKeyPairWithContext(aws.Context, *ec2.CreateKeyPairInput, ...request.Option) (*ec2.CreateKeyPairOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) CreateKeyPair(*ec2.CreateKeyPairInput) (*ec2.CreateKeyPairOutput, error) {
panic("MockEC2 CreateKeyPair not implemented")
}
Expand Down Expand Up @@ -164,6 +171,7 @@ func (m *MockEC2) DeleteKeyPair(request *ec2.DeleteKeyPairInput) (*ec2.DeleteKey
func (m *MockEC2) DeleteKeyPairWithContext(aws.Context, *ec2.DeleteKeyPairInput, ...request.Option) (*ec2.DeleteKeyPairOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DeleteKeyPairRequest(*ec2.DeleteKeyPairInput) (*request.Request, *ec2.DeleteKeyPairOutput) {
panic("Not implemented")
}
6 changes: 6 additions & 0 deletions cloudmock/aws/mockec2/natgateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ func (m *MockEC2) WaitUntilNatGatewayAvailable(request *ec2.DescribeNatGatewaysI

return nil
}

func (m *MockEC2) WaitUntilNatGatewayAvailableWithContext(aws.Context, *ec2.DescribeNatGatewaysInput, ...request.WaiterOption) error {
panic("Not implemented")
}

func (m *MockEC2) CreateNatGatewayWithContext(aws.Context, *ec2.CreateNatGatewayInput, ...request.Option) (*ec2.CreateNatGatewayOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) CreateNatGatewayRequest(*ec2.CreateNatGatewayInput) (*request.Request, *ec2.CreateNatGatewayOutput) {
panic("Not implemented")
}
Expand Down Expand Up @@ -160,16 +162,19 @@ func (m *MockEC2) DescribeNatGateways(request *ec2.DescribeNatGatewaysInput) (*e

return response, nil
}

func (m *MockEC2) DescribeNatGatewaysWithContext(aws.Context, *ec2.DescribeNatGatewaysInput, ...request.Option) (*ec2.DescribeNatGatewaysOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DescribeNatGatewaysRequest(*ec2.DescribeNatGatewaysInput) (*request.Request, *ec2.DescribeNatGatewaysOutput) {
panic("Not implemented")
}

func (m *MockEC2) DescribeNatGatewaysPages(*ec2.DescribeNatGatewaysInput, func(*ec2.DescribeNatGatewaysOutput, bool) bool) error {
panic("Not implemented")
}

func (m *MockEC2) DescribeNatGatewaysPagesWithContext(aws.Context, *ec2.DescribeNatGatewaysInput, func(*ec2.DescribeNatGatewaysOutput, bool) bool, ...request.Option) error {
panic("Not implemented")
}
Expand All @@ -193,6 +198,7 @@ func (m *MockEC2) DeleteNatGateway(request *ec2.DeleteNatGatewayInput) (*ec2.Del
func (m *MockEC2) DeleteNatGatewayWithContext(aws.Context, *ec2.DeleteNatGatewayInput, ...request.Option) (*ec2.DeleteNatGatewayOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DeleteNatGatewayRequest(*ec2.DeleteNatGatewayInput) (*request.Request, *ec2.DeleteNatGatewayOutput) {
panic("Not implemented")
}
5 changes: 5 additions & 0 deletions cloudmock/aws/mockec2/routetable.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (m *MockEC2) CreateRouteTableWithId(request *ec2.CreateRouteTableInput, id
func (m *MockEC2) CreateRouteTableWithContext(aws.Context, *ec2.CreateRouteTableInput, ...request.Option) (*ec2.CreateRouteTableOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) CreateRouteTableRequest(*ec2.CreateRouteTableInput) (*request.Request, *ec2.CreateRouteTableOutput) {
panic("Not implemented")
}
Expand Down Expand Up @@ -171,9 +172,11 @@ func (m *MockEC2) CreateRoute(request *ec2.CreateRouteInput) (*ec2.CreateRouteOu
rt.Routes = append(rt.Routes, r)
return &ec2.CreateRouteOutput{Return: aws.Bool(true)}, nil
}

func (m *MockEC2) CreateRouteWithContext(aws.Context, *ec2.CreateRouteInput, ...request.Option) (*ec2.CreateRouteOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) CreateRouteRequest(*ec2.CreateRouteInput) (*request.Request, *ec2.CreateRouteOutput) {
panic("Not implemented")
}
Expand All @@ -193,9 +196,11 @@ func (m *MockEC2) DeleteRouteTable(request *ec2.DeleteRouteTableInput) (*ec2.Del

return &ec2.DeleteRouteTableOutput{}, nil
}

func (m *MockEC2) DeleteRouteTableWithContext(aws.Context, *ec2.DeleteRouteTableInput, ...request.Option) (*ec2.DeleteRouteTableOutput, error) {
panic("Not implemented")
}

func (m *MockEC2) DeleteRouteTableRequest(*ec2.DeleteRouteTableInput) (*request.Request, *ec2.DeleteRouteTableOutput) {
panic("Not implemented")
}
Loading