Tag Archives: link
Golang’s sync.Map internals
Great article on the topic — https://victoriametrics.com/blog/go-sync-map/index.html. The whole series of articles is solid, so please take a look if you are interested. Let me share the most important insights. How it works Internal structure is:
1 2 3 4 5 6 |
type Map struct { mu Mutex read atomic.Pointer[readOnly] dirty map[any]*entry misses int } |
MVC, MVP, MVVM, MVVM-C, and VIPER architecture patterns comparison
Great diagram comparing MVC, MVP, MVVM, MVVM-C, and VIPER architecture patterns from ByteByteGo: They also provide the following description: — MVC, the oldest pattern, dates back almost 50 years — Every pattern has a «view» (V) responsible for displaying content and receiving user input — Most patterns include a «model» (M) to manage business data …
Maps internals in Go
Idea Map is passed as a value, but it consists of a pointer to hmap which has all the details on map implementation. So, if you change/add to map, it will be reflected everywhere. And that’s why you cannot assign to an uninitialized map (no memory allocated, no hash seed generated yet). runtime/map.go
1 2 3 4 5 6 7 8 9 |
type hmap struct { count int // # live cells == size of map. Must be first (used by len() builtin) B uint8 // log_2 of # of buckets (can hold up to loadFactor * 2^B items) hash0 uint32 // hash seed buckets unsafe.Pointer // array of 2^B Buckets. may be nil if count==0. oldbuckets unsafe.Pointer // previous bucket array of half the size, non-nil only when growing nevacuate uintptr // progress counter for evacuation (buckets less than this have been evacuated) } |
Buckets …
Backup your Spotify playlists and activity
* http://www.spotmybackup.com/ Simple tool to export all your data into a file. Also you can import it into your account. So it could be used to backup your Spotify data (uses json format, only track ids, no titles). * https://www.tunemymusic.com/ It allows to transfer data between different music services and also export to a csv …
Outline — simple and powerful vpn on your server
https://getoutline.org/ Just a couple of mouse clicks, and it will create a new droplet on DigitalOcean for you (or any other provider from the list). Very easy to install, and works good so far.
Integration tests with testcontainers-go
Here is the go library that simplifies integration tests with docker containers — https://github.com/testcontainers/testcontainers-go. That’s how you can use it to test sql — https://github.com/testcontainers/testcontainers-go/blob/master/docs/examples/cockroachdb.md. Project documentation — https://golang.testcontainers.org/features/docker_compose/ The idea is to prepare the environment, build your app, then make requests and check the DB state.
Test Push Notifications
https://github.com/onmyway133/PushNotifications
env-file parser for Goland
You can use env-file parser for running and debugging your app in Jetbrains’ products like Goland. It’s pretty simple and works. https://github.com/Ashald/EnvFile
What is teamlead’s first duty
Sarah Mei «We think awful code is written by awful devs. But in reality, it’s written by reasonable devs in awful circumstances.» (source) So, teamlead is there to improve circumstances.
Nice list of image resizer libs in go
With speedtests and other nice things. https://github.com/fawick/speedtest-resize I tried these two: https://github.com/disintegration/imaging https://github.com/bamiaux/rez They are quite the same talking about file sizes and imaging is muuch easier to use.