Go

Error Handling

Error type, error wrapping, errors.Is, errors.As, custom errors, panic/recover

20 āļ„āļģāļ–āļēāļĄāļŠāļąāļĄāļ āļēāļĐāļ“āđŒÂ·
Junior
1

What is the interface used to represent errors in Go?

āļ„āļģāļ•āļ­āļš

The error interface is the predefined interface in Go to represent error conditions. It contains a single Error() method that returns a string describing the error. The nil value represents no error. This is the conventional interface used by all standard library packages and Go developers to signal and propagate errors.

2

How to create a simple error with a static message in Go?

āļ„āļģāļ•āļ­āļš

The errors.New() function from the errors package creates a simple error with a static message. It returns an error type that implements the error interface with the provided message. This approach is recommended for creating sentinel errors (predefined errors like os.ErrNotExist) or simple errors without dynamic context. For dynamic messages, use fmt.Errorf().

3

Which function allows creating an error with a dynamically formatted message?

āļ„āļģāļ•āļ­āļš

The fmt.Errorf() function creates an error with a dynamically formatted message using format verbs (like %s, %d, %v). It also supports the special %w verb to wrap an existing error, preserving the error chain for later inspection. This is the recommended method for adding context to errors while keeping the original error.

4

Which format verb allows wrapping an error with fmt.Errorf()?

5

Which function checks if a wrapped error matches a specific error?

+17 āļ„āļģāļ–āļēāļĄāļŠāļąāļĄāļ āļēāļĐāļ“āđŒ

āļŦāļąāļ§āļ‚āđ‰āļ­āļŠāļąāļĄāļ āļēāļĐāļ“āđŒ Go āļ­āļ·āđˆāļ™āđ†

Go Basics

Junior
25 āļ„āļģāļ–āļēāļĄ

Go Data Structures

Junior
20 āļ„āļģāļ–āļēāļĄ

Go Interfaces

Junior
18 āļ„āļģāļ–āļēāļĄ

Goroutines Basics

Junior
20 āļ„āļģāļ–āļēāļĄ

Channels

Junior
22 āļ„āļģāļ–āļēāļĄ

Go Modules

Mid-Level
18 āļ„āļģāļ–āļēāļĄ

HTTP Server

Mid-Level
24 āļ„āļģāļ–āļēāļĄ

HTTP Client

Mid-Level
18 āļ„āļģāļ–āļēāļĄ

JSON Encoding

Mid-Level
20 āļ„āļģāļ–āļēāļĄ

database/sql

Mid-Level
22 āļ„āļģāļ–āļēāļĄ

Context Package

Mid-Level
20 āļ„āļģāļ–āļēāļĄ

Testing

Mid-Level
22 āļ„āļģāļ–āļēāļĄ

Concurrency Patterns

Mid-Level
24 āļ„āļģāļ–āļēāļĄ

Sync Primitives

Mid-Level
22 āļ„āļģāļ–āļēāļĄ

Go Web Frameworks

Mid-Level
20 āļ„āļģāļ–āļēāļĄ

REST API Design

Mid-Level
20 āļ„āļģāļ–āļēāļĄ

gRPC

Mid-Level
22 āļ„āļģāļ–āļēāļĄ

Reflection

Senior
20 āļ„āļģāļ–āļēāļĄ

Memory Management

Senior
24 āļ„āļģāļ–āļēāļĄ

Performance Optimization

Senior
22 āļ„āļģāļ–āļēāļĄ

Generics

Senior
20 āļ„āļģāļ–āļēāļĄ

Go Design Patterns

Senior
24 āļ„āļģāļ–āļēāļĄ

Microservices

Senior
24 āļ„āļģāļ–āļēāļĄ

Security & Authentication

Senior
24 āļ„āļģāļ–āļēāļĄ

Docker & Containerization

Senior
20 āļ„āļģāļ–āļēāļĄ

Kubernetes Basics

Senior
22 āļ„āļģāļ–āļēāļĄ

Advanced Go

Senior
20 āļ„āļģāļ–āļēāļĄ

CLI Development

Senior
20 āļ„āļģāļ–āļēāļĄ

āđ€āļŠāļĩāđˆāļĒāļ§āļŠāļēāļ Go āļŠāļģāļŦāļĢāļąāļšāļāļēāļĢāļŠāļąāļĄāļ āļēāļĐāļ“āđŒāļ„āļĢāļąāđ‰āļ‡āļ–āļąāļ”āđ„āļ›

āđ€āļ‚āđ‰āļēāļ–āļķāļ‡āļ„āļģāļ–āļēāļĄāļ—āļąāđ‰āļ‡āļŦāļĄāļ” flashcards āđāļšāļšāļ—āļ”āļŠāļ­āļšāđ€āļ—āļ„āļ™āļīāļ„ āđāļšāļšāļāļķāļāļŦāļąāļ” code review āđāļĨāļ°āļ•āļąāļ§āļˆāļģāļĨāļ­āļ‡āļŠāļąāļĄāļ āļēāļĐāļ“āđŒ

āđ€āļĢāļīāđˆāļĄāđƒāļŠāđ‰āļŸāļĢāļĩ