Skip to content

Commit bf299c7

Browse files
author
kaanyalti
committed
feature(4890): ran gofmt
1 parent 653548f commit bf299c7

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

internal/pkg/agent/cmd/upgrade.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ func newUpgradeCommandWithArgs(_ []string, streams *cli.IOStreams) *cobra.Comman
5555
cmd.Flags().String(flagPGPBytes, "", "PGP to use for package verification")
5656
cmd.Flags().String(flagPGPBytesURI, "", "Path to a web location containing PGP to use for package verification")
5757
cmd.Flags().String(flagPGPBytesPath, "", "Path to a file containing PGP to use for package verification")
58-
cmd.Flags().BoolP(flagForce, "f", false, "Advanced option to force an upgrade on a fleet managed agent")
59-
cmd.Flags().MarkHidden(flagForce)
58+
cmd.Flags().BoolP(flagForce, "f", false, "Advanced option to force an upgrade on a fleet managed agent")
59+
cmd.Flags().MarkHidden(flagForce)
6060

6161
return cmd
6262
}
@@ -69,39 +69,39 @@ func upgradeCmd(streams *cli.IOStreams, cmd *cobra.Command, args []string) error
6969
func shouldUpgrade(ctx context.Context, cmd *cobra.Command) (bool, error) {
7070
agentInfo, err := info.NewAgentInfoWithLog(ctx, "error", false)
7171
if err != nil {
72-
return false, fmt.Errorf("failed to retrieve agent info while tring to upgrade the agent")
72+
return false, fmt.Errorf("failed to retrieve agent info while tring to upgrade the agent: %w", err)
7373
}
7474

75-
if agentInfo.IsStandalone() {
76-
return true, nil
77-
}
75+
if agentInfo.IsStandalone() {
76+
return true, nil
77+
}
7878

7979
isAdmin, err := utils.HasRoot()
8080
if err != nil {
81-
return false, fmt.Errorf("failed checking root/Administrator rights while trying to upgrade the agent")
81+
return false, fmt.Errorf("failed checking root/Administrator rights while trying to upgrade the agent: %w", err)
8282
}
8383

84-
if !isAdmin {
85-
return false, fmt.Errorf("upgrade command needs to be executed as root for fleet managed agents")
86-
}
84+
if !isAdmin {
85+
return false, fmt.Errorf("upgrade command needs to be executed as root for fleet managed agents")
86+
}
8787

88-
force, err := cmd.Flags().GetBool(flagForce)
89-
if err != nil {
90-
return false, fmt.Errorf("failed to retrieve command flag information while trying to upgrade the agent")
91-
}
88+
force, err := cmd.Flags().GetBool(flagForce)
89+
if err != nil {
90+
return false, fmt.Errorf("failed to retrieve command flag information while trying to upgrade the agent: %w", err)
91+
}
9292

93-
if !force {
94-
return false, fmt.Errorf("upgrading fleet managed agents is not supported")
95-
}
93+
if !force {
94+
return false, fmt.Errorf("upgrading fleet managed agents is not supported")
95+
}
9696

97-
cf, err := cli.Confirm("Upgrading fleet managed agents is not supported. Would you still like to proceed?", false)
98-
if err != nil {
99-
return false, fmt.Errorf("failed while confirming action")
100-
}
97+
cf, err := cli.Confirm("Upgrading fleet managed agents is not supported. Would you still like to proceed?", false)
98+
if err != nil {
99+
return false, fmt.Errorf("failed while confirming action: %w", err)
100+
}
101101

102-
if !cf {
103-
return false, fmt.Errorf("upgrade not confirmed")
104-
}
102+
if !cf {
103+
return false, fmt.Errorf("upgrade not confirmed")
104+
}
105105

106106
return true, nil
107107
}

0 commit comments

Comments
 (0)