@@ -29,14 +29,14 @@ const (
29
29
)
30
30
31
31
type options struct {
32
- skipSync bool
33
- syncBack bool
34
- noOpen bool
35
- reuseConnection bool
36
- bindAddr string
37
- remotePort string
38
- sshFlags string
39
- codeServerPath string
32
+ skipSync bool
33
+ syncBack bool
34
+ noOpen bool
35
+ reuseConnection bool
36
+ bindAddr string
37
+ remotePort string
38
+ sshFlags string
39
+ uploadCodeServer string
40
40
}
41
41
42
42
func sshCode (host , dir string , o options ) error {
@@ -78,9 +78,9 @@ func sshCode(host, dir string, o options) error {
78
78
}
79
79
80
80
// Upload local code-server or download code-server from CI server.
81
- if o .codeServerPath != "" {
81
+ if o .uploadCodeServer != "" {
82
82
flog .Info ("uploading local code-server binary..." )
83
- err = copyCodeServerBinary (o .sshFlags , host , o .codeServerPath , codeServerPath )
83
+ err = copyCodeServerBinary (o .sshFlags , host , o .uploadCodeServer , codeServerPath )
84
84
if err != nil {
85
85
return xerrors .Errorf ("failed to upload local code-server binary to remote server: %w" , err )
86
86
}
@@ -428,7 +428,7 @@ func checkSSHMaster(sshMasterCmd *exec.Cmd, sshFlags string, host string) error
428
428
429
429
// copyCodeServerBinary copies a code-server binary from local to remote.
430
430
func copyCodeServerBinary (sshFlags string , host string , localPath string , remotePath string ) error {
431
- if err := ensureFile (localPath ); err != nil {
431
+ if err := validateIsFile (localPath ); err != nil {
432
432
return err
433
433
}
434
434
@@ -558,8 +558,8 @@ func ensureDir(path string) error {
558
558
return nil
559
559
}
560
560
561
- // ensureFile tries to stat the specified path and ensure it's a file.
562
- func ensureFile (path string ) error {
561
+ // validateIsFile tries to stat the specified path and ensure it's a file.
562
+ func validateIsFile (path string ) error {
563
563
info , err := os .Stat (path )
564
564
if err != nil {
565
565
return err
0 commit comments