Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commit7d34771

Browse files
authored
refactor: use constants for OSs (#448)
1 parent582f213 commit7d34771

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-
ifruntime.GOOS=="windows" {
163+
ifruntime.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-
ifruntime.GOOS=="linux"||runtime.GOOS=="darwin" {
271+
ifruntime.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
varupdatedBinaryNamestring
184-
ifu.osF()=="windows" {
185+
ifu.osF()==goosWindows {
185186
updatedBinaryName="coder.exe"
186187
}else {
187188
updatedBinaryName="coder"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp