]> Cypherpunks repositories - gostls13.git/commitdiff
os: fix Args setup on Windows
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 24 Sep 2014 22:50:54 +0000 (18:50 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 24 Sep 2014 22:50:54 +0000 (18:50 -0400)
Should fix the Windows build. Untested.

on Windows, args are made by src/os/exec_windows.go, not package runtime.
runtimeĀ·goargs has if(Windows) return;

The two init funcs in pkg os were conflicting, with the second
overwriting Args back to an empty slice.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/143540044

src/os/proc.go

index b63c85ad9071490f06f819c3bbd649fbd46fe60e..774f09900ec58aac3c3897012bd545aa5247d81e 100644 (file)
@@ -6,12 +6,19 @@
 
 package os
 
-import "syscall"
+import (
+       "runtime"
+       "syscall"
+)
 
 // Args hold the command-line arguments, starting with the program name.
 var Args []string
 
 func init() {
+       if runtime.GOOS == "windows" {
+               // Initialized in exec_windows.go.
+               return
+       }
        Args = runtime_args()
 }