This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Answer these questions to demonstrate what you've learned:
What's the idiomatic way to handle errors in Go?
Use a try/catch block.
Use an if condition for a function that returns multiple values. The last value is the error.
Use an if condition and check if the response is nil.
Let the program terminate.
Which function can you use to create an error variable?
errors.New('Employee not found!')
fmt.Errorf('Employee not found!')
error.New('Employee not found!')
log.Error('Employee not found!')
Which of the following functions are in the log package?
log.Print, log.Error, log.Info
log.Fatal, log.Print, log.Panic
log.Info, log.Warn, log.Fatal
log.Printf, log.Warning, log.Error
Which function can you use to configure logging to a file?
Why would you want to use a logging framework?
To configure logging levels, multiple outputs, and global contexts.
To make your programs run slower.
To simply configure structured logging.
To write less code.
You must answer all questions before checking your work.
Need help? See our troubleshooting guide or provide specific feedback by reporting an issue.
Was this page helpful?