Skip to content

Commit

Permalink
Use strings.CutSuffix
Browse files Browse the repository at this point in the history
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
  • Loading branch information
mtrmac committed Mar 9, 2024
1 parent 5bd6473 commit a8b03dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ func decompressDir(t *testing.T, dir string) {
rawLayer["size"] = uncompressedSize
var mimeType string
getRawMapField(t, rawLayer, "mediaType", &mimeType)
if strings.HasSuffix(mimeType, ".gzip") { // This should use CutSuffix with Go ≥1.20
rawLayer["mediaType"] = strings.TrimSuffix(mimeType, ".gzip")
if uncompressedMIMEType, ok := strings.CutSuffix(mimeType, ".gzip"); ok {
rawLayer["mediaType"] = uncompressedMIMEType
}

rawLayers[i] = rawLayer
Expand Down

0 comments on commit a8b03dc

Please sign in to comment.