Go code refactoring : the 23x performance hunt $ go test -bench=. -cpuprofile cpu.prof $ go tool pprof -svg cpu.prof > cpu.svg $ go test -bench=. -trace trace.out $ go tool trace trace.out
Links
All posts
Dockertest: A Fast Way to Set Up Integration Test Environments dockertest
Tcpdump Usage Summary Command usage tcpdump uses the command line. The command format is: tcpdump [ -AdDeflLnNOpqRStuUvxX ] [ -c count ] [ -C file_size ] [ -F file ] [ -i interface ] [ -m module ] [ -M secret …
Go High-Performance Programming Handbook (Long Read) Common data structures Reflection is nice, but don’t overuse it Prefer strconv over fmt A small amount of repetition is not worse than reflection Use …
How to Make an iPhone Ringtone: Turn an MP3 into a Ringtone or Alarm Video version of the iPhone ringtone steps Step 1: Prepare the MP3 you want to use as an iPhone ringtone First, prepare the music you want …
How to Choose a Go File Reading Approach Go provides one-shot methods for reading file content: os.ReadFile and ioutil.ReadFile. Starting from Go 1.16, ioutil.ReadFile is equivalent to os.ReadFile. The pros …
Convert a List to a List of Dicts list my_users: - aaa - bbb - ccc dict my_users: - Name: aaa - Name: bbb - Name: ccc playbook - name: Transform data vars: orig_users: - aaa - bbb - ccc my_users: [] set_fact: …
Misspelling, missing collection, or incorrect module path for fortios_system_config_backup_restore issue Hi, I’m trying to retrieve the configuration from a Fortigate using the module …
Struct Tricks Every Gopher Should Know NoCopy $ go vet aaa.go # command-line-arguments ./aaa.go:7:14: test passes lock by value: sync.WaitGroup contains sync.noCopy ./aaa.go:15:10: call of test copies lock …
How Nginx Hides Upstream Errors Nginx allows enabling next upstream for the following seven retryable error codes 403 Forbidden 404 Not Found 429 Too Many Requests 500 Internal Server Error 502 Bad Gateway 503 …
Argo CD ApplicationSet Controller: The World Turns for Me! Argo CD # Install kind; see the official docs for other platforms # Run a lightweight k8s cluster locally ~$ brew install kind # Install kubectx; see …
Go AES Encryption and Decryption in Three Modes (CBC/ECB/CFB) How to encrypt a file using Go