Go 1.17 will be used instead of Go 1.4 as minimum required version for
bootstrap, so runtime.KeepAlive introduced in Go 1.7 can be used in
cmd/compile.
For #44505
Change-Id: I96bd6619c4476e36ee1d93ca049da622a3a78f97
Reviewed-on: https://go-review.googlesource.com/c/go/+/427114
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
import (
"os"
"reflect"
+ "runtime"
"syscall"
"unsafe"
)
length += x
buf, err := syscall.Mmap(int(f.Fd()), offset, int(length), syscall.PROT_READ, syscall.MAP_SHARED)
- keepAlive(f)
+ runtime.KeepAlive(f)
if err != nil {
return "", err
}
return res, nil
}
-
-// keepAlive is a reimplementation of runtime.KeepAlive, which wasn't
-// added until Go 1.7, whereas we need to compile with Go 1.4.
-var keepAlive = func(interface{}) {}