Saturday, December 17, 2022

[FIXED] What is this "err.(*exec.ExitError)" thing in Go code?

Issue

For instance, in this answer:

https://stackoverflow.com/a/10385867/20654

...
if exiterr, ok := err.(*exec.ExitError); ok {
...

What is that err.(*exec.ExitError) called? How does it work?


Solution

It's type assertion. I can't explain it better than the spec.



Answered By - Mostafa
Answer Checked By - Senaida (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.