internal: fix build breakage on windows

Also, disable tests on windows because
functionality of viewcore remains broken on windows.

Change-Id: Ifd0108865379e00c4e23b6eba7b1cc1fd8e6f738
Reviewed-on: https://go-review.googlesource.com/121295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/internal/core/core_test.go b/internal/core/core_test.go
index 341babf..3b56997 100644
--- a/internal/core/core_test.go
+++ b/internal/core/core_test.go
@@ -2,6 +2,8 @@
 // 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 solaris
+
 package core
 
 import (
diff --git a/internal/core/process.go b/internal/core/process.go
index 65c2fd4..f6c4a3e 100644
--- a/internal/core/process.go
+++ b/internal/core/process.go
@@ -121,6 +121,10 @@
 	return p.syms, p.symErr
 }
 
+var mapFile = func(fd int, offset int64, length int) (data []byte, err error) {
+	return nil, fmt.Errorf("file mapping is not implemented yet")
+}
+
 // Core takes the name of a core file and returns a Process that
 // represents the state of the inferior that generated the core file.
 func Core(coreFile, base, exePath string) (*Process, error) {
@@ -190,7 +194,7 @@
 		}
 
 		// Read data from file.
-		data, err := syscall.Mmap(int(m.f.Fd()), minOff, int(maxOff-minOff), syscall.PROT_READ, syscall.MAP_SHARED)
+		data, err := mapFile(int(m.f.Fd()), minOff, int(maxOff-minOff))
 		if err != nil {
 			return nil, fmt.Errorf("can't memory map %s at %x: %s\n", m.f.Name(), minOff, err)
 		}
diff --git a/internal/core/process_unix.go b/internal/core/process_unix.go
new file mode 100644
index 0000000..3817678
--- /dev/null
+++ b/internal/core/process_unix.go
@@ -0,0 +1,15 @@
+// Copyright 2018 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 dragonfly freebsd linux netbsd openbsd solaris
+
+package core
+
+import "syscall"
+
+func init() {
+	mapFile = func(fd int, offset int64, length int) (data []byte, err error) {
+		return syscall.Mmap(fd, offset, length, syscall.PROT_READ, syscall.MAP_SHARED)
+	}
+}
diff --git a/internal/gocore/dominator_test.go b/internal/gocore/dominator_test.go
index f3360b0..5607a9a 100644
--- a/internal/gocore/dominator_test.go
+++ b/internal/gocore/dominator_test.go
@@ -2,6 +2,8 @@
 // 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 solaris
+
 package gocore
 
 import (
diff --git a/internal/gocore/gocore_test.go b/internal/gocore/gocore_test.go
index cc90c65..8d4b96f 100644
--- a/internal/gocore/gocore_test.go
+++ b/internal/gocore/gocore_test.go
@@ -2,6 +2,8 @@
 // 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 solaris
+
 package gocore
 
 import (