-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditionally compiled on windows targets and makes use of the runtime.GOARCH and runtime.GOOS constants instead of executing uname to get the arch and os. Signed-off-by: Johannes Tegnér <[email protected]>
- Loading branch information
1 parent
3b27f27
commit 39db32c
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) arkade author(s) 2022. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
//go:build windows | ||
// +build windows | ||
|
||
package env | ||
|
||
import ( | ||
"os" | ||
"path" | ||
"runtime" | ||
"strings" | ||
) | ||
|
||
// GetClientArch returns a pair of arch and os | ||
func GetClientArch() (arch string, os string) { | ||
arch = runtime.GOARCH | ||
os = strings.ToLower(runtime.GOOS) | ||
return arch, os | ||
} | ||
|
||
func LocalBinary(name, subdir string) string { | ||
home := os.Getenv("HOME") | ||
val := path.Join(home, ".arkade/bin/") | ||
if len(subdir) > 0 { | ||
val = path.Join(val, subdir) | ||
} | ||
|
||
return path.Join(val, name) | ||
} |