New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(jx) add the OS details to jx version
output
#2291
Conversation
It is useful to know the OS version of the client in reports so this change addes an "Operating System" column to the details listed by `jx version`
pkg/util/system/version_windows.go
Outdated
"golang.org/x/sys/windows/registry" | ||
) | ||
|
||
// returns a human friendly string of the current OS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported function GetOsVersion should be of the form "GetOsVersion ..."
pkg/util/system/version_unknown.go
Outdated
"runtime" | ||
) | ||
|
||
// returns a human friendly string of the current OS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported function GetOsVersion should be of the form "GetOsVersion ..."
pkg/util/system/version_linux.go
Outdated
text := string(data) | ||
text = strings.TrimSpace(text) | ||
if err != nil { | ||
return "", fmt.Errorf("Command failed '%s %s': %s %s\n", command, strings.Join(args, " "), text, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error strings should not be capitalized or end with punctuation or a newline
pkg/util/system/version_linux.go
Outdated
"strings" | ||
) | ||
|
||
// returns a human friendly string of the current OS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported function GetOsVersion should be of the form "GetOsVersion ..."
pkg/util/system/version_darwin.go
Outdated
text := string(data) | ||
text = strings.TrimSpace(text) | ||
if err != nil { | ||
return "", fmt.Errorf("Command failed '%s %s': %s %s\n", command, strings.Join(args, " "), text, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error strings should not be capitalized or end with punctuation or a newline
pkg/util/system/version_darwin.go
Outdated
"strings" | ||
) | ||
|
||
// returns a human friendly string of the current OS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported function GetOsVersion should be of the form "GetOsVersion ..."
pkg/jx/cmd/version.go
Outdated
@@ -201,6 +210,12 @@ func (o *VersionOptions) UpgradeCli() error { | |||
return options.Run() | |||
} | |||
|
|||
// returns a human friendly string of the current OS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported method VersionOptions.GetOsVersion should be of the form "GetOsVersion ..."
pkg/util/system/version_windows.go
Outdated
pn, err = getMajorMinorVersion(®key) | ||
if err != nil { | ||
return retVal, err | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if block ends with a return statement, so drop this else and outdent its block
/assign markawm |
} | ||
|
||
|
||
func runCommand(command string, args ...string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicated code - assume you've added both because of the conditional building, which means not dup'd in runtime, but still in src control.
There is already a very similar function in cmd.CommonOptions.RunCommand (though I think the way it interacts with the verbose flag is not ideal). I actually starting refactoring some of this into the util package (just util.RunCommandBackground). How about adding your version (i.e. one that cares about the output) as util.RunCommand()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So having thought about this some more, I can potentially see cases where we may want to get the OS version from the util
package and that would cause circular dependencies.
I could export this function in the system package and refactor all other usage from it but that seems a bit too much work for a this small piece of code.
/approve |
/approve |
/LGTM |
@jtnord: you cannot LGTM your own PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/approve |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jstrachan, jtnord, rawlingsj The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Submitter checklist
Description
It is useful to know the OS version of the client in reports so this
change addes an "Operating System" column to the details listed by
jx version
Special notes for the reviewer(s)
tested on
Windows 10 Pro 1803
,OSX
(some version),Bash on Ubuntu on Windows
andcentos
,debian
andalpine
docker images.Which issue this PR fixes