Nicolas

187 posts

Nicolas

Nicolas

@nzachow_

producing gluten-free golang code in the 21st century

Katılım Aralık 2024
59 Takip Edilen69 Takipçiler
Nicolas
Nicolas@nzachow_·
Have you noticed that you are the only real bottleneck in agentic coding?
English
0
0
0
22
Nicolas
Nicolas@nzachow_·
Common mistake: guessing hotspots in Go. Don't micro-optimize random code. Use pprof (net/http/pprof), capture a CPU profile, inspect top/callgraph. Add expvar counters for throughput/latency. Optimize what actually burns CPU.
English
0
1
6
422
Nicolas
Nicolas@nzachow_·
Common mistake in Go testing: treating coverage as proof of correctness. 100% coverage only means lines executed. Add boundary and negative cases (empty, first, last, middle, not-found) via table-driven tests, then use cover profiles to find gaps.
English
0
0
2
264
Nicolas
Nicolas@nzachow_·
@Oleksj1366220 I've recently learned about TRMNL, thought it was a cool idea and remembered I had an epaper display laying around. So I naturally thought 'how hard could it be to build my own display?' 🤣
English
0
0
1
26
Alex
Alex@Oleksj1366220·
@nzachow_ It’s really cool to meet someone who builds purely to sharpen their skills. That’s pretty rare these days! Would love to hear more about what sparked the idea if you’re up for sharing.
English
1
0
0
14
Nicolas
Nicolas@nzachow_·
Epaper displays are getting easier to use 🚀
Nicolas tweet media
English
1
0
1
630
Nicolas
Nicolas@nzachow_·
When writing Go tests, use t.Helper() for assertion/fixture helpers to report failures at the caller’s file:line for faster debugging. Add t.Logf for context (IDs, inputs) and run with 'go test -v'. Filter with '-run' to isolate failing cases.
English
0
0
4
313
Nicolas
Nicolas@nzachow_·
My custom dashboard is taking shape
Nicolas tweet media
English
0
0
1
42
Nicolas
Nicolas@nzachow_·
@iannuttall In my experience, your prompt should be simple to allow the model to one-shot it. Quality degrades the longer the conversation gets.
English
0
0
0
127
Ian Nuttall
Ian Nuttall@iannuttall·
Hot take 🌶️ Most of the anti-Claude sentiment is likely too much context bloat and switching to Codex removes that so it feels a lot “smarter” then slowly as you add MCP and prompts, Codex gets “dumber” and the cycle continues…
Ian Nuttall tweet media
English
115
29
606
74.6K
Nicolas
Nicolas@nzachow_·
Profile Go benchmarks to identify performance hotspots. Run 'go test -bench=. -cpuprofile=cpu.out', then analyze with 'go tool pprof -top' or '-list'. Optimize the main time-consuming sections, not rarely executed paths.
English
0
0
1
166
Nicolas
Nicolas@nzachow_·
Any ideas on how I could use this gadget? It's an esp32 + e-paper screen with a couple sensors.
Nicolas tweet media
English
0
0
3
86
Nicolas
Nicolas@nzachow_·
In Go, organize packages by dependency direction. Place domain types and logic in pkg/domain without I/O. Have repositories and clients depend on domain. Make transports (HTTP/gRPC) depend on services. Wire dependencies in cmd/<app>/main. Use internal/ to encapsulate adapters.
English
1
0
3
173
Nicolas
Nicolas@nzachow_·
Go modules allow flexible directory structures, removing GOPATH constraints. After cloning a repository, build from the module root containing go.mod to avoid import path errors. Alternatively, run `go install ./cmd/foo@latest` from any directory.
English
0
0
2
122
Nicolas
Nicolas@nzachow_·
In Go, define small interfaces from the consumer's perspective. Functions should accept interfaces to specify behavior and return concrete types. This minimizes coupling and ensures substitutability.
English
1
0
5
162
Nicolas
Nicolas@nzachow_·
In Go, for GC-friendly map tile caches, use sharded LRU to reduce lock contention, apply size-aware admission to exclude oversized tiles, and implement asynchronous batched evictions.
English
0
0
3
130
Nicolas
Nicolas@nzachow_·
Go pprof enables scoped CPU profiles via labels. Employ runtime/pprof.Labels and pprof.Do to tag targeted workloads. Filter with go tool pprof -tagfocus=<label>. Maintain low-cardinality label values to minimize overhead.
English
0
0
2
113
Nicolas
Nicolas@nzachow_·
Go pprof CPU profiler samples at approximately 100 Hz. Increasing the rate via runtime.SetCPUProfileRate adds overhead and may distort scheduling and garbage collection. For short bursts, extend profile duration or perform multiple captures.
English
0
0
1
87
Nicolas
Nicolas@nzachow_·
Pro tip: Design fan-in as func FanIn(ctx context.Context, ins ...<-chan T) <-chan T. Spawn one forwarder per input: for v := range in { select { case out <- v: case <-ctx.Done(): return } }. Directional chans prevent misuse; ctx avoids leaks if the consumer stops.
English
0
0
2
274
Nicolas
Nicolas@nzachow_·
CPU profiling with Go pprof collects samples from OS threads. Avoid profiling on loaded or thermally throttled systems, as data may be unreliable. Use an idle host with fixed CPU frequency and perform repeated before-and-after runs for consistent results.
English
0
0
7
398
Nicolas
Nicolas@nzachow_·
Pro tip: in Go, detecting goroutine leaks by checking runtime.NumGoroutine in tests is unreliable due to noise and race conditions. Instead, ensure goroutines respond to context cancellation via ctx.Done, synchronize with a WaitGroup and timeout.
English
0
2
17
898
Nicolas
Nicolas@nzachow_·
In Go testing, t.Skip terminates the test but executes deferred functions. To avoid resource waste from late invocation after setup or during cleanup, verify preconditions like environment, network, and binaries early and skip immediately.
English
0
0
13
508