0

I was watching a tutorial on concurrency in golang and after hitting a race condition the program exited with status code 66.

  • What does 66 actually mean?
  • Where does this come from? (If there's no standardization, how can I find the source file that defines this?)

I understand you can set the status code with the Exit pkg: https://pkg.go.dev/github.com/carlmjohnson/exitcode#Exit

I found this resource for Linux, but it's missing 3-125 https://tldp.org/LDP/abs/html/exitcodes.html

ThomasRones
  • 657
  • 8
  • 29
  • 2
    For linux https://stackoverflow.com/questions/1101957/are-there-any-standard-exit-status-codes-in-linux should answer your question. – Umut Gerçek Jul 26 '22 at 05:39
  • 1
    There are few *consistent* uses for anything above 2 and below the values. – torek Jul 26 '22 at 06:08

1 Answers1

1

The exit code doesn't have a generic meaning -- not a meaning shared with the exit code of all linux programs.

The doc page for the race detector indicates that the 66 exit code is just a value the go developpers chose -- it is "non standard" enough to indicate that the cause was a race detection -- and that you can actually change it via the GORACE environment variable :

$ GORACE="exitcode=42" go run -race my_racey_program.go
...
exit status 42

As far as source code goes : the go repository contains a bunch of *.syso binary files under src/runtime/race/ (<- link to go1.18.4 posted),

and the comment at the beginning of src/runtime/race/race.go mentions :

...
The prebuilt race runtime lives in race_GOOS_GOARCH.syso.
Calls to the runtime are done directly from src/runtime/race.go.

LeGEC
  • 46,477
  • 5
  • 57
  • 104