Go
Optimizing Go Applications in Containers
· β˜• 3 min read
1. Memory Alignment Arrange the fields inside a struct from largest to smallest. This reduces memory footprint. Install the fieldalignment tool 1 go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest Analyze and fix memory alignment 1 2 3 4 5 6 7 8 9 fieldalignment -fix ./... /Users/shaowenchen/Code/app/config/config.go:136:14: struct with 32 pointer bytes could be 24 /Users/shaowenchen/Code/app/config/config.

Some Tips for Optimizing Program Builds
· β˜• 3 min read
Continuously updated… 1. Golang Use trimpath to remove the build path, avoiding exposure of build path information 1 go build -gcflags="all=-trimpath=${PWD}" -asmflags="all=-trimpath=${PWD}" -o ./bin/opscli ./cmd/cli/main.go Before adding it, a panic prints the path /Users/shaowenchen/Code/Github/ops/main.go; after adding it, a panic prints main.go. -ldflags “-w -s” removes debug information and reduces the binary size 1 go build -ldflags "-w -s" -o .

Writing WebAssembly Programs in Go
· β˜• 6 min read
1. Introduction to WebAssembly Cross-platform: it can run on any platform that supports WebAssembly, including web browsers, servers, and mobile devices High performance: it uses a compact binary format that can be loaded and parsed quickly in the browser, improving application performance Security: it uses a sandbox model that isolates the code running inside it, protecting the system from malicious code

Developing an Istio WasmPlugin with TinyGo
· β˜• 3 min read
wasme only supports up to Istio 1.9, while I am using Istio 1.14, so this post goes straight to tinygo for verification and learning. 1. Installing tinygo Requirements Go v1.18+ Install tinygo 1 2 brew tap tinygo-org/tools brew install tinygo Check the version 1 2 3 tinygo version tinygo version 0.

Problems Using Go mod
· β˜• 1 min read
1. go.sum Version Mismatch After Upgrading Go Running the command go build reports an error. Error message: missing go.sum entry for module providing package golang.org/x/time/rate; to add Solution: Update go.sum before go build by running the command go mod tidy. 2. TLS Error Running the command go mod download reports an error.