Skip to content

Commit b5bd831

Browse files
authored
Merge pull request #1111 from taofzen/master
refactor: replace HasSuffix+TrimSuffix with CutSuffix
2 parents a575053 + 7df46a9 commit b5bd831

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

rocketpool-cli/node/commands.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ func RegisterCommands(app *cli.Command, name string, aliases []string) {
365365
// Validate flags
366366
amount := c.String("amount")
367367
if amount != "" {
368-
if strings.HasSuffix(amount, "%") {
369-
trimmedAmount := strings.TrimSuffix(amount, "%")
368+
if trimmedAmount, ok := strings.CutSuffix(amount, "%"); ok {
370369
stakePercent, err := strconv.ParseFloat(trimmedAmount, 64)
371370
if err != nil || stakePercent <= 0 {
372371
return fmt.Errorf("invalid percentage value: %s", amount)

0 commit comments

Comments
 (0)