-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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/sys/windows: missing GetFileTime function on Windows #21541
Comments
/cc @alexbrainman |
My use case is that I have a simple |
@skillian, yes, syscall package does not have SetFileTime Windows API implemented. Unfortunately, we cannot add SetFileTime to syscall package - it has been decided to freeze syscall package. But we can add SetFileTime to golang.org/x/sys/windows package. In fact you can do it yourself - https://golang.org/doc/contribute.html is how to contribute to Go project. Would you like to do it yourself? If not, I or others will do it. Alex |
@alexbrainman Thank you for looking into this. I don't mean to be pedantic, but I want to clarify that I'm looking at adding syscall.GetFileTime because syscall.SetFileTime is in fact implemented by syscall currently (just tested in 1.8.3):
That being said, I understand what you mean about syscall being frozen and will instead try to put this into golang.org/x/sys/windows like you said. I would love to contribute this myself and had begun following the directions on the contribute.html page you referenced, but I don't understand how the zsyscall_*.go files are emitted by EDIT: removed |
Correct. Sorry for confusing you. I made a mistake.
Please do. That was what I was suggesting.
When you run "go generate" command, it looks for "//go:generate" string anywhere in your source files in the current directory:
and then "go generate" command executes whatever command it finds. So in golang.org/x/sys/windows it will run
You can see what $GOROOT/src/syscall/mksyscall_windows.go program do. But it looks for lines starting with "//sys", and generates syscalls for each line and output them all into zsyscall_windows.go. For example, this:
is what "//sys" line for SetFileTime looks like. You should add similar line for GetFileTime and run "go generate", and that should do it. You can even do it in your own package, for example github.com/alexbrainman/winapi Alex |
|
Using the existing
|
Change https://go.dev/cl/528015 mentions this issue: |
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
: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.
Go Playground
What did you expect to see?
syscall.GetFileName
should be defined on Windows, likesyscall.SetFileTime
What did you see instead?
PowerShell output:
github.com\skillian\getfiletime\expected.go:23: undefined: syscall.GetFileTime
The text was updated successfully, but these errors were encountered: