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!
Which keyword is used to declare a constant in Go?
Anonymous Quiz
25%
var
75%
const
0%
let
0%
define
0%
constant
What does the `defer` keyword do in Go?
Anonymous Quiz
50%
Delays function call until surrounding function returns
25%
Stops execution
0%
Skips loops
25%
Deletes variable
Which built-in function can be used to allocate memory in Go?
Anonymous Quiz
67%
alloc
0%
malloc
33%
new
0%
mem
0%
all
What is the result of append([]int{}, 1) in Go?
Anonymous Quiz
0%
Runtime panic
50%
Compilation error
50%
[1]
0%
[]
What is the type of nil in Go?
Anonymous Quiz
0%
int
25%
string
0%
Any
50%
interface{}
25%
Undefined
What is the purpose of the fallthrough keyword in Go?
Anonymous Quiz
0%
Loop again
50%
Exit switch
0%
Skip cases
50%
Continue to next case
Use
Use
#tip #sync
@golang_tips
sync.Once
for Lazy InitializationUse
sync.Once
to ensure a function runs only once, even in concurrent scenarios. It's perfect for lazy initialization of shared resources.var once sync.Once
func initResource() {
fmt.Println("Initialized")
}
once.Do(initResource)
#tip #sync
@golang_tips
Use
Combine
#goroutins #tip
@golang_tips
time.After
for TimeoutsCombine
select
with time.After to handle timeouts in goroutines effectively.select {
case <-ch:
case <-time.After(time.Second):
fmt.Println("Timeout")
}
#goroutins #tip
@golang_tips