Closed
Description
What version of Go are you using (go version
)?
Go 1.8.3
Does this issue reproduce with the latest release?
I am able to reproduce this with Go 1.8.3 which seems to be the latest stable version available from golang.org.
What operating system and processor architecture are you using (go env
)?
Windows 10 on x86_64
Output of go env
:
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\Users\spkillian@outlook.com\Dropbox\dev\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\SPKIL_~1\AppData\Local\Temp\go-build427541383=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
What did you do?
This is for a missing syscall
function, so I suppose a minimum reproducible program would be:
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
package main
import (
"fmt"
"os"
"syscall"
)
const (
anyFile = "any_file.txt"
)
func main() {
var creationTime syscall.Filetime
var lastAccessTime syscall.Filetime
var lastWriteTime syscall.Filetime
utf16FileName, err := syscall.UTF16FromString(anyFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to convert string %q to UTF16: %v", anyFile, err)
}
err = syscall.GetFileTime(utf16FileName, &creationTime, &lastAccessTime, &lastWriteTime)
if err != nil {
fmt.Fprintf(os.Stderr, "Error getting FileTime of file %v: %v", anyFile, err)
return
}
// do something with creationTime, lastAccessTime and/or lastWriteTime
return
}
What did you expect to see?
syscall.GetFileName
should be defined on Windows, like syscall.SetFileTime
What did you see instead?
PowerShell output:
github.com\skillian\getfiletime\expected.go:23: undefined: syscall.GetFileTime