Skip to content

Commit

Permalink
fix: replace incorrect strings.Trim with TrimSuffix / TrimPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
nkraetzschmar committed Dec 18, 2024
1 parent 15db4fa commit 414dc07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion prepare_source
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import_src src
pkg=gardenlinux-update
version=0.5
version=0.6
4 changes: 2 additions & 2 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func getCname(path string) (string, string, error) {
return "", "", errors.New("GARDENLINUX_CNAME missing from os-release")
}

cname = strings.Trim(cname, "-"+version)
cname = strings.TrimSuffix(cname, "-"+version)

return cname, version, nil
}
Expand Down Expand Up @@ -322,7 +322,7 @@ func verifyManifest(repo *remote.Repository, ctx context.Context, digest, verifi
}

messageHashStr := signatureManifest.Layers[0].Digest
messageHashFromManifest, err := hex.DecodeString(strings.Trim(messageHashStr, "sha256:"))
messageHashFromManifest, err := hex.DecodeString(strings.TrimPrefix(messageHashStr, "sha256:"))
if err != nil {
fmt.Fprintln(os.Stderr, "Error:", err)
os.Exit(ERR_SYSTEM_FAILURE)
Expand Down

0 comments on commit 414dc07

Please sign in to comment.