Skip to content

x/exp/mmap: missing windows/arm64 support #49106

Closed
@yselkowitz

Description

@yselkowitz

What version of Go are you using (go version)?

$ go1.17.2 version
go version go1.17.2 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go1.17.2 env
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"

What did you do?

I was trying to port https://github.com/openshift/oc to windows/arm64, and this came up as a missing indirect dependency. But as a simple test case to illustrate the issue:

$ echo abcdefg > tmp.txt
$ cat main.go 
// https://github.com/handongyexingren/learnGo/tree/main/geektutu/mmap
package main

import (
	"fmt"
	"golang.org/x/exp/mmap"
)

func main() {
	at, _ := mmap.Open("./tmp.txt")
	buff := make([]byte, 2)
	_, _ = at.ReadAt(buff, 4)
	_ = at.Close()
	fmt.Println(string(buff))
}

$ go1.17.2 mod init
go: creating new go.mod: module $PWD/test
go: to add module requirements and sums:
	go mod tidy
$ go1.17.2 mod tidy
go: finding module for package golang.org/x/exp/mmap
go: found golang.org/x/exp/mmap in golang.org/x/exp v0.0.0-20211012155715-ffe10e552389
$ go1.17.2 build .
$ GOOS=windows GOARCH=amd64 go1.17.2 build .
$ GOOS=windows GOARCH=arm64 go1.17.2 build .

What did you expect to see?

Code compiles, creating an ARM64 test.exe

What did you see instead?

# golang.org/x/exp/mmap
$HOME/go/pkg/mod/golang.org/x/exp@v0.0.0-20211012155715-ffe10e552389/mmap/mmap_windows.go:111:12: [maxBytes]byte used as value
$HOME/go/pkg/mod/golang.org/x/exp@v0.0.0-20211012155715-ffe10e552389/mmap/mmap_windows.go:111:13: undefined: maxBytes

Notes

AFAICS the fix would be to add a mmap_windows_arm64.go file matching the contents of mmap_windows_amd64.go in golang.org/x/exp/mmap.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions