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/playground: do the "vet" check along with running a program #24576
Comments
No way. Refusing to run perfectly correct programs isn't what one expects of a playground, for Zeus's sake.
|
It is not supposed that "vet" errors will prevent from executing the program. Errors from vet must be displayed along with output from the program. However how to present it clearly, I don't know. |
Back end protocol aside (that can be worked out either way), it does seem nice to just show the vet output alongside the normal output, instead of having yet another button. Unlike |
Now that the playground supports Regarding back end, what makes most sense to me at the moment is separate vet and compile endpoints that the UI can use from the same button click. What happens when the compile fails with errors though? Does vet only run after the compile succeeds and the output (begins) to display? (Keeping in mind |
To clarify EDIT: removed spammy examples from here. |
Change https://golang.org/cl/107455 mentions this issue: |
Change https://golang.org/cl/100776 mentions this issue: |
All of these formats seem to rely on differences in color, which might not work so well for someone with red-green colorblindness, although I suppose that's also an existing issue. To distinguish That way the warning isn't buried at the end of the output, but also doesn't bury the output. On the other hand, line-wrapping makes things a bit dicey for small windows, long code lines, and/or long error lines. |
Red/black can look a lot like black/black or black/nearly-black for various forms of color blindness and mostly for red-green color blindness which is the most prevalent form. Another way to distinguish the vet output is to leave it where it is but draw a box around it labeled something like "vet output". The red issue also applies to stdout vs stderr. Maybe adding unhighlightable {out, err} labels where line numbers would go in addition to the red? They could be made smallish since they'd essentially be icons. The lack of either on vet warnings would probably be enough to make it clear where things start and stop along with a little more spacing between the vet output and the program output. |
More screenshots for my proposed solution/design above: https://imgur.com/a/Jn3qx. Thanks for the feedback. I will meditate on it. Feel free to add more. For some reason I am not satisfied with my proposed design anymore. It has apparent flaws. 7 years of pure programming have put too much rust on my design/layout skills. |
I don't want to add graphics for this feature. I really like simple or minimal design as it is right now. Also I want vet errors to be on the top, that they urge a user to fix the code and get rid of them. They must be annoying in some sense. Is current design friendly to color blind people? If go vet returned no errors, then first 3 lines are not displayed. |
The explicit delimiter works. It's not friendly, per se—but it's not antagonistic. |
One more observation:
produces
But in fact the program was not running at all. Error came from the go build. So the output could be:
|
"Go build failed." might be clearer. It always exits. |
We should ensure that vet results show up in the Tour, too. That might save some folks a lot of time while they're learning. |
I agree. Tour is a different thing and does things differently. It uses I have updated https://go-review.googlesource.com/c/tools/+/107455 with the proposal I made above. I think this is the best design retaining simplicity I can think of. Examples are here. |
@andybons, please take a look at https://go-review.googlesource.com/c/tools/+/107455. |
This change adds an option to run "go vet" for the playground program and display errors before any output. To enable this, the playground function has to be supplied with opts.enableVet set to true. Vet check is performed only for succesfully run programs, meaning that the "/compile" endpoint returned no errors. This change highlights lines printed to stderr as errors (in red). There is a corresponding change for the Playground: CL 100776. Updates golang/go#7597 Updates golang/go#24576 Change-Id: I8c0f8c1189c461338b5bce57777b12aecab268fb Reviewed-on: https://go-review.googlesource.com/107455 Run-TryBot: Yury Smolsky <yury@smolsky.by> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
"vet" is implemented as a separate button. Consider if we can remove that button and do the "vet" check whenever a user pushes the "run" button.
Comments from CL 100776:
https://go-review.googlesource.com/c/playground/+/100776/5/edit.html#115
The text was updated successfully, but these errors were encountered: