Paul Di Gian
Paul Di Gian's Blog

Paul Di Gian's Blog

Follow
homebadgesnewsletter
Tag

100DaysOfCode

#100daysofcode

More content

Read more stories on Hashnode


Articles with this tag

Advanced go - Avoiding `if` for initialization using `sync.Once` and foot guns to watch out for

Nov 21, 20218 min read

We already discussed when to use constructors and when let the user of your library initialize their structures. The short version is that if the...

Advanced go - Avoiding `if` for initialization using `sync.Once` and foot guns to watch out for

Golang and context - an explanation

Nov 12, 202112 min read

The Golang standard library comes with a simple interface, context.Context, which is a little harder to understand and use than the others. The...

Golang and context - an explanation

Advanced go - Make synchronous code asynchronous with context.Context and channels

Nov 7, 20213 min read

Go standard library comes with a nice little structure that allows to stop long-running goroutines, when theirs result is not needed anymore:...

Advanced go - Make synchronous code asynchronous with context.Context and channels

Advanced go - Choosing between a constructor and declaring the type

Nov 4, 20213 min read

In go there are two ways to create structures. Either you instantiate the structure directly, populate its fields. Or you use a constructor, that will...

Advanced go - Choosing between a constructor and declaring the type

Advanced go - Use default value as your advantage, append to nil

Nov 3, 20211 min read

Today I found a small mistake in our codebase. The code was like this: type Foo struct { baz []int } // ... func (f *Foo) Fun(a int) { if...

Advanced go - Use default value as your advantage, append to nil