Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 7d34771

Browse files
authored
refactor: use constants for OSs (#448)
1 parent 582f213 commit 7d34771

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

internal/cmd/configssh.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func binPath() (string, error) {
160160
// Bash and OpenSSH for Windows (used by Powershell and VS Code) to function
161161
// correctly. Check if the current executable is in $PATH, and warn the user
162162
// if it isn't.
163-
if runtime.GOOS == "windows" {
163+
if runtime.GOOS == goosWindows {
164164
binName := filepath.Base(exePath)
165165

166166
// We use safeexec instead of os/exec because os/exec returns paths in
@@ -268,7 +268,7 @@ func makeSSHConfig(binPath, workspaceName, privateKeyFilepath string, additional
268268
fmt.Sprintf("IdentityFile=%q", privateKeyFilepath),
269269
)
270270

271-
if runtime.GOOS == "linux" || runtime.GOOS == "darwin" {
271+
if runtime.GOOS == goosLinux || runtime.GOOS == goosDarwin {
272272
options = append(options,
273273
"ControlMaster auto",
274274
"ControlPath ~/.ssh/.connection-%r@%h:%p",

internal/cmd/update.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
const (
3737
goosWindows = "windows"
3838
goosLinux = "linux"
39+
goosDarwin = "darwin"
3940
apiPrivateVersion = "/api/private/version"
4041
)
4142

@@ -181,7 +182,7 @@ func (u *updater) Run(ctx context.Context, force bool, coderURLArg string, versi
181182
// TODO: validate the checksum of the downloaded file. GitHub does not currently provide this information
182183
// and we do not generate them yet.
183184
var updatedBinaryName string
184-
if u.osF() == "windows" {
185+
if u.osF() == goosWindows {
185186
updatedBinaryName = "coder.exe"
186187
} else {
187188
updatedBinaryName = "coder"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy