fix: appease linter on darwin (#11154)

Fixing up some linting errors that show up on Darwin, but not in CI.
This commit is contained in:
Spike Curtis
2023-12-12 17:02:28 +04:00
committed by GitHub
parent 2883cad6ad
commit edeb9bb42a
8 changed files with 20 additions and 11 deletions
+4
View File
@@ -13,6 +13,10 @@ import (
func Get(username string) (string, error) {
// This command will output "UserShell: /bin/zsh" if successful, we
// can ignore the error since we have fallback behavior.
if !filepath.IsLocal(username) {
return "", xerrors.Errorf("username is nonlocal path: %s", username)
}
//nolint: gosec // input checked above
out, _ := exec.Command("dscl", ".", "-read", filepath.Join("/Users", username), "UserShell").Output()
s, ok := strings.CutPrefix(string(out), "UserShell: ")
if ok {