The current weekly release has (and Go v1 will have) runtime.NumCPU() so you can do runtime.GOMAXPROCS(runtime.NumCPU())
And then in the code for handling the error, you can do switch err.(type) { case db.IOError: // Database exception here case io.FileNotFoundError: // File exception default: // Pass it to our caller for them to handle.…
In Go, the accepted way to report errors is to take advantage of multiple returns, such as: result, err := somePotentiallyFailingFunction() if err != nil { // Try to recover here ... // Not recoverable? panic() } And…
12. I was coding JavaScript for ProBoards. I shudder just thinking about it.
The current weekly release has (and Go v1 will have) runtime.NumCPU() so you can do runtime.GOMAXPROCS(runtime.NumCPU())
And then in the code for handling the error, you can do switch err.(type) { case db.IOError: // Database exception here case io.FileNotFoundError: // File exception default: // Pass it to our caller for them to handle.…
In Go, the accepted way to report errors is to take advantage of multiple returns, such as: result, err := somePotentiallyFailingFunction() if err != nil { // Try to recover here ... // Not recoverable? panic() } And…
12. I was coding JavaScript for ProBoards. I shudder just thinking about it.