From 44366790d78c5496d623abcdfe122f36b1ac1e40 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 13 May 2015 15:00:16 -0700 Subject: [PATCH] unix: correct code for cover cmd This copies http://golang.org/cl/8723 from the syscall package. Quoting the original CL: This is clumsy, but currently cover tool fails as: $ go test -run=none -cover syscall syscall_linux_amd64.go:15: can only use //go:noescape with external func imp FAIL syscall [build failed] This happens because cover tool mishandles //go: comments. r and gri said that fixing cover is infeasible due to go/ast limitations. So at least fix the offending code so that coverage works. This come up in context of coverage-guided fuzzing which works best with program-wide coverage. Change-Id: Id9e243968a4eb7ae75a585877fdf3192c89e419c Reviewed-on: https://go-review.googlesource.com/10035 Reviewed-by: Rob Pike --- unix/syscall_linux_amd64.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/syscall_linux_amd64.go b/unix/syscall_linux_amd64.go index 0b035796..6adbc431 100644 --- a/unix/syscall_linux_amd64.go +++ b/unix/syscall_linux_amd64.go @@ -58,8 +58,6 @@ import "syscall" //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) -func Getpagesize() int { return 4096 } - //go:noescape func gettimeofday(tv *Timeval) (err syscall.Errno) @@ -71,6 +69,8 @@ func Gettimeofday(tv *Timeval) (err error) { return nil } +func Getpagesize() int { return 4096 } + func Time(t *Time_t) (tt Time_t, err error) { var tv Timeval errno := gettimeofday(&tv)