-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.11.1 linux/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/guo/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/guo/go" GOPROXY="" GORACE="" GOROOT="/home/guo/go-version/go1.11.1" GOTMPDIR="" GOTOOLDIR="/home/guo/go-version/go1.11.1/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build480480625=/tmp/go-build -gno-record-gcc-switches"
What did you do?
cat test.go
package main
import (
"fmt"
"golang.org/x/sys/unix"
"os"
"time"
)
func statTimes(name string) (atime, mtime, ctime time.Time, err error) {
var stat unix.Stat_t
err = unix.Stat(name, &stat)
if err != nil {
return
}
atime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec))
mtime = time.Unix(int64(stat.Mtim.Sec), int64(stat.Mtim.Nsec))
ctime = time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec))
return
}
func main() {
fmt.Println(statTimes(os.Args[0]))
}linux
env GOPATH=`pwd` CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go run test.go
output
2019-04-29 09:16:40.531596746 +0800 CST 2019-04-29 09:16:40.52759687 +0800 CST 2019-04-29 09:16:40.52759687 +0800 CST <nil>
darwin
env GOPATH=`pwd` CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go run test.go
output
./test.go:17:30: stat.Atim undefined (type unix.Stat_t has no field or method Atim)
./test.go:18:30: stat.Mtim undefined (type unix.Stat_t has no field or method Mtim)
./test.go:19:30: stat.Ctim undefined (type unix.Stat_t has no field or method Ctim)
What did you expect to see?
Mac platform is the same as linux output
What did you see instead?
Mac platform error
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.