Skip to content
Quiz · Errors · lesson 9 of 11

Quiz — errors.As through %w

What does the program print?

GO
package main

import "errors"
import "fmt"

type NotFound struct{ ID int }

func (e *NotFound) Error() string { return "not found" }
func main() {
    var nf *NotFound
    fmt.Println(errors.As(fmt.Errorf("load: %w", &NotFound{ID: 7}), &nf))
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way