Skip to content

Commit

Permalink
osbuild.OSBuildVersion: return version without trailing newline
Browse files Browse the repository at this point in the history
The version string returned by the `OSBuildVersion()` function contained
a trailing newline. Ensure that it is removed.

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza authored and achilleas-k committed Sep 22, 2023
1 parent c77832b commit 1318eb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/osbuild/osbuild-exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,8 @@ func OSBuildVersion() (string, error) {
}

// osbuild --version prints the version in the form of "osbuild VERSION". Extract the version.
return strings.TrimPrefix(stdoutBuffer.String(), "osbuild "), nil
version := strings.TrimPrefix(stdoutBuffer.String(), "osbuild ")
// Remove the trailing newline.
version = strings.TrimSpace(version)
return version, nil
}

0 comments on commit 1318eb3

Please sign in to comment.