About this channel
In this channel I will publish useful libraries, tips, quizzes and other information for Go developers.
My GitHub: https://github.com/ankddev
Channel link: https://t.me/golang_tips
My other channels:
- Rust::Tips - @rust_code_tips - about Rust language
Official Go Discord server: https://discord.com/invite/golang
Hashtags:
#tip - useful tip about language or it's tools
#code - code example
#program - project, wrote on Go
#library - useful library
#resource - useful resource about language
#idiomatic - idiomatic code and patterns
#book - book about Go or it's tools/projects
#fact - interesting or fun fact about Go
#goroutins - related to goroutins
#errors - error handling
#advanced - advanced topics
#project and #showcase - projects written in Go
#news - Go-related news
...and some other hashtags about specific topic!
In this channel I will publish useful libraries, tips, quizzes and other information for Go developers.
My GitHub: https://github.com/ankddev
Channel link: https://t.me/golang_tips
My other channels:
- Rust::Tips - @rust_code_tips - about Rust language
Official Go Discord server: https://discord.com/invite/golang
Hashtags:
#tip - useful tip about language or it's tools
#code - code example
#program - project, wrote on Go
#library - useful library
#resource - useful resource about language
#idiomatic - idiomatic code and patterns
#book - book about Go or it's tools/projects
#fact - interesting or fun fact about Go
#goroutins - related to goroutins
#errors - error handling
#advanced - advanced topics
#project and #showcase - projects written in Go
#news - Go-related news
...and some other hashtags about specific topic!
Handle structured errors with
Use
#tip #code #errors
@golang_tips
errors.As
Use
errors.As
to extract specific error types from a chain for granular error handling.type NotFoundError struct{ Msg string }
func (e *NotFoundError) Error() string { return e.Msg }
err := fmt.Errorf("wrapped: %w", &NotFoundError{Msg: "User not found"})
var target *NotFoundError
if errors.As(err, &target) {
fmt.Println("Found:", target.Msg) // Output: Found: User not found
}
#tip #code #errors
@golang_tips