mirror of
https://github.com/golang/go
synced 2024-11-12 06:40:22 -07:00
net: fix windows build
R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/7429049
This commit is contained in:
parent
ed01f4be59
commit
b767556dd7
@ -8,12 +8,25 @@
|
|||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// testUnixAddr uses ioutil.TempFile to get a name that is unique.
|
||||||
|
func testUnixAddr() string {
|
||||||
|
f, err := ioutil.TempFile("", "nettest")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
addr := f.Name()
|
||||||
|
f.Close()
|
||||||
|
os.Remove(addr)
|
||||||
|
return addr
|
||||||
|
}
|
||||||
|
|
||||||
var condFatalf = func() func(*testing.T, string, ...interface{}) {
|
var condFatalf = func() func(*testing.T, string, ...interface{}) {
|
||||||
// A few APIs are not implemented yet on both Plan 9 and Windows.
|
// A few APIs are not implemented yet on both Plan 9 and Windows.
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
|
@ -8,7 +8,6 @@ package net
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -17,18 +16,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// testUnixAddr uses ioutil.TempFile to get a name that is unique.
|
|
||||||
func testUnixAddr() string {
|
|
||||||
f, err := ioutil.TempFile("", "nettest")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
addr := f.Name()
|
|
||||||
f.Close()
|
|
||||||
os.Remove(addr)
|
|
||||||
return addr
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestReadUnixgramWithUnnamedSocket(t *testing.T) {
|
func TestReadUnixgramWithUnnamedSocket(t *testing.T) {
|
||||||
addr := testUnixAddr()
|
addr := testUnixAddr()
|
||||||
la, err := ResolveUnixAddr("unixgram", addr)
|
la, err := ResolveUnixAddr("unixgram", addr)
|
||||||
|
Loading…
Reference in New Issue
Block a user