Skip to content

Commit

Permalink
Created new 'env_windows' file.
Browse files Browse the repository at this point in the history
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
Johannestegner committed Oct 24, 2023
1 parent 3b27f27 commit 284bdd4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/env/env.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// 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 (
Expand Down
29 changes: 29 additions & 0 deletions pkg/env/env_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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"
)

// GetClientArch returns a pair of arch and os
func GetClientArch() (arch string, os string) {
arch = runtime.GOARCH
return arch, "ming"
}

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)
}

0 comments on commit 284bdd4

Please sign in to comment.