|  | diff -r 87dea3f5ebe7 src/cmd/go/build.go | 
        
          |  | --- a/src/cmd/go/build.go	Fri Nov 29 08:32:31 2013 +1100 | 
        
          |  | +++ b/src/cmd/go/build.go	Thu Dec 19 17:34:24 2013 +0100 | 
        
          |  | @@ -1928,9 +1928,9 @@ | 
        
          |  | ) | 
        
          |  |  | 
        
          |  | func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string, gxxfiles []string) (outGo, outObj []string, err error) { | 
        
          |  | -	if goos != toolGOOS { | 
        
          |  | -		return nil, nil, errors.New("cannot use cgo when compiling for a different operating system") | 
        
          |  | -	} | 
        
          |  | +	//if goos != toolGOOS { | 
        
          |  | +		//return nil, nil, errors.New("cannot use cgo when compiling for a different operating system") | 
        
          |  | +	//} | 
        
          |  |  | 
        
          |  | cgoCPPFLAGS := stringList(envList("CGO_CPPFLAGS"), p.CgoCPPFLAGS) | 
        
          |  | cgoCFLAGS := stringList(envList("CGO_CFLAGS"), p.CgoCFLAGS) | 
        
          |  | diff -r 87dea3f5ebe7 src/pkg/net/dnsconfig_android.go | 
        
          |  | --- /dev/null	Thu Jan 01 00:00:00 1970 +0000 | 
        
          |  | +++ b/src/pkg/net/dnsconfig_android.go	Thu Dec 19 17:34:24 2013 +0100 | 
        
          |  | @@ -0,0 +1,53 @@ | 
        
          |  | +// Copyright 2009 The Go Authors. All rights reserved. | 
        
          |  | +// Use of this source code is governed by a BSD-style | 
        
          |  | +// license that can be found in the LICENSE file. | 
        
          |  | + | 
        
          |  | +// +build android,linux | 
        
          |  | + | 
        
          |  | +package net | 
        
          |  | + | 
        
          |  | +import ( | 
        
          |  | +	"fmt" | 
        
          |  | +	"os/exec" | 
        
          |  | +) | 
        
          |  | + | 
        
          |  | +type dnsConfig struct { | 
        
          |  | +	servers	[]string // servers to use | 
        
          |  | +	search	 []string // suffixes to append to local name | 
        
          |  | +	ndots		int			// number of dots in name to trigger absolute lookup | 
        
          |  | +	timeout	int			// seconds before giving up on packet | 
        
          |  | +	attempts int			// lost packets before giving up on server | 
        
          |  | +	rotate	 bool		 // round robin among servers | 
        
          |  | +} | 
        
          |  | + | 
        
          |  | +// Using getprop since Android doesn't have resolv.conf | 
        
          |  | +func dnsReadConfig() (*dnsConfig, error) { | 
        
          |  | +	conf := new(dnsConfig) | 
        
          |  | +	conf.servers = make([]string, 3)[0:0] // small, but the standard limit | 
        
          |  | +	conf.search = make([]string, 0) | 
        
          |  | +	conf.ndots = 1 | 
        
          |  | +	conf.timeout = 5 | 
        
          |  | +	conf.attempts = 2 | 
        
          |  | +	conf.rotate = false | 
        
          |  | +	var ip string | 
        
          |  | + | 
        
          |  | +	for i := 1; i <= 4; i++ { | 
        
          |  | +		out, err := exec.Command("/system/bin/getprop", fmt.Sprintf("net.dns%v", i)).Output() | 
        
          |  | +		m := len(out) | 
        
          |  | +		if err != nil { | 
        
          |  | +			continue | 
        
          |  | +		} | 
        
          |  | +		if m < 2 { | 
        
          |  | +			continue | 
        
          |  | +		} | 
        
          |  | +		ip = string(out[:m-1]) | 
        
          |  | + | 
        
          |  | +		a := conf.servers | 
        
          |  | +		n := len(a) | 
        
          |  | +		a = a[0 : n+1] | 
        
          |  | +		a[n] = ip | 
        
          |  | +		conf.servers = a | 
        
          |  | +	} | 
        
          |  | + | 
        
          |  | +	return conf, nil | 
        
          |  | +} | 
        
          |  | diff -r 87dea3f5ebe7 src/pkg/net/dnsconfig_unix.go | 
        
          |  | --- a/src/pkg/net/dnsconfig_unix.go	Fri Nov 29 08:32:31 2013 +1100 | 
        
          |  | +++ b/src/pkg/net/dnsconfig_unix.go	Thu Dec 19 17:34:24 2013 +0100 | 
        
          |  | @@ -2,7 +2,7 @@ | 
        
          |  | // Use of this source code is governed by a BSD-style | 
        
          |  | // license that can be found in the LICENSE file. | 
        
          |  |  | 
        
          |  | -// +build darwin dragonfly freebsd linux netbsd openbsd | 
        
          |  | +// +build darwin dragonfly freebsd !android,linux netbsd openbsd | 
        
          |  |  | 
        
          |  | // Read system DNS config from /etc/resolv.conf | 
        
          |  |  | 
        
          |  | diff -r 87dea3f5ebe7 src/pkg/os/file_android.go | 
        
          |  | --- /dev/null	Thu Jan 01 00:00:00 1970 +0000 | 
        
          |  | +++ b/src/pkg/os/file_android.go	Thu Dec 19 17:34:24 2013 +0100 | 
        
          |  | @@ -0,0 +1,17 @@ | 
        
          |  | +// Copyright 2012 The Go Authors. All rights reserved. | 
        
          |  | +// Use of this source code is governed by a BSD-style | 
        
          |  | +// license that can be found in the LICENSE file. | 
        
          |  | + | 
        
          |  | +// +build android,linux | 
        
          |  | + | 
        
          |  | +package os | 
        
          |  | + | 
        
          |  | +// TempDir returns the default directory to use for temporary files. | 
        
          |  | +func TempDir() string { | 
        
          |  | +	dir := Getenv("TMPDIR") | 
        
          |  | +	if dir == "" { | 
        
          |  | +		dir = "/data/local/tmp" | 
        
          |  | +	} | 
        
          |  | +	return dir | 
        
          |  | +} | 
        
          |  | + | 
        
          |  | diff -r 87dea3f5ebe7 src/pkg/os/file_non_android.go | 
        
          |  | --- /dev/null	Thu Jan 01 00:00:00 1970 +0000 | 
        
          |  | +++ b/src/pkg/os/file_non_android.go	Thu Dec 19 17:34:24 2013 +0100 | 
        
          |  | @@ -0,0 +1,17 @@ | 
        
          |  | +// Copyright 2012 The Go Authors. All rights reserved. | 
        
          |  | +// Use of this source code is governed by a BSD-style | 
        
          |  | +// license that can be found in the LICENSE file. | 
        
          |  | + | 
        
          |  | +// +build darwin freebsd !android,linux netbsd openbsd | 
        
          |  | + | 
        
          |  | +package os | 
        
          |  | + | 
        
          |  | +// TempDir returns the default directory to use for temporary files. | 
        
          |  | +func TempDir() string { | 
        
          |  | +	dir := Getenv("TMPDIR") | 
        
          |  | +	if dir == "" { | 
        
          |  | +		dir = "/tmp" | 
        
          |  | +	} | 
        
          |  | +	return dir | 
        
          |  | +} | 
        
          |  | + | 
        
          |  | diff -r 87dea3f5ebe7 src/pkg/os/file_unix.go | 
        
          |  | --- a/src/pkg/os/file_unix.go	Fri Nov 29 08:32:31 2013 +1100 | 
        
          |  | +++ b/src/pkg/os/file_unix.go	Thu Dec 19 17:34:24 2013 +0100 | 
        
          |  | @@ -279,11 +279,3 @@ | 
        
          |  | return name | 
        
          |  | } | 
        
          |  |  | 
        
          |  | -// TempDir returns the default directory to use for temporary files. | 
        
          |  | -func TempDir() string { | 
        
          |  | -	dir := Getenv("TMPDIR") | 
        
          |  | -	if dir == "" { | 
        
          |  | -		dir = "/tmp" | 
        
          |  | -	} | 
        
          |  | -	return dir | 
        
          |  | -} |