Skip to content
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: mkwinsyscall isn't diagnosable if format.Source fails #57925

Closed
dagood opened this issue Jan 19, 2023 · 2 comments
Closed

x/sys/windows: mkwinsyscall isn't diagnosable if format.Source fails #57925

dagood opened this issue Jan 19, 2023 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Milestone

Comments

@dagood
Copy link
Contributor

dagood commented Jan 19, 2023

I'm working on the x/sys/windows main branch (6e4d1c53), and tried to add a new syscall, but mkwinsyscall failed because of a Go syntax error in the generated code:

44:8: expected ';', found '-' (and 10 more errors)

However, there is no file with a line 44, so I can't see what it's referring to, or the additional errors. format.Source(buf.Bytes()) fails, and the generated source is only in memory at that point, so it is lost.

Expected result

When mkwinsyscall hits a formatting error, it should write the pre-formatted source to a temporary file so the error can be diagnosed.

Background

The error I hit in this case was a - in the DLL name, and fixing that is tracked over here:

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 19, 2023
@gopherbot gopherbot added this to the Unreleased milestone Jan 19, 2023
@dagood
Copy link
Contributor Author

dagood commented Jan 19, 2023

I'm planning to submit a CL soon with a fix.

@qmuntal qmuntal added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 20, 2023
@gopherbot
Copy link

Change https://go.dev/cl/463216 mentions this issue: windows/mkwinsyscall: write source to temp file if formatting fails

@golang golang locked and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Projects
None yet
Development

No branches or pull requests

3 participants