Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yselkowitz opened this issue Oct 22, 2021 · 0 comments
Open

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

yselkowitz opened this issue Oct 22, 2021 · 0 comments

Comments

@yselkowitz
Copy link

@yselkowitz yselkowitz commented Oct 22, 2021

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.

@gopherbot gopherbot added this to the Unreleased milestone Oct 22, 2021
yselkowitz added a commit to multi-arch/oc that referenced this issue Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants