@Lewhiskey254@MRMansang If he had the gun on him and used it,that is self-defense, but he went for it,closed the car door and shot at close range, three times,that is premeditated murder.
"Generated code does not need to be genius-level engineering. It needs to be understandable, stable, refactorable, and easy to verify.
And Go is proudly boring in exactly the right ways."
https://t.co/o63ffFmGlX < so well said by @pliutau.
A weighted average is just one accumulation loop — Σ(wᵢ·xᵢ) / Σ(wᵢ).The catch is the divide. Empty input → Σw = 0, and in Go 0.0/0.0 is NaN, not a panic — it silently poisons everything downstream.
Guard before you divide.
#golang
In Go you can overwrite a map's values while ranging over it — mutating existing keys mid-range is safe; only adding NEW keys is unspecified. Turned my sums map into the averages map in place.
#golang
I’m announcing this new project that I have been working on for a little while now called KeyData.
KeyData is a key-value store (similar to Redis) that I am building from scratch using golang.
#buildinpublic#100DaysOfCode#coding#backend#golang#redis
Population σ of one value is 0 by definition — so if n <= 1 { return 0 } isn't dodging an edge case, it's implementing the math. Best kind of early return.
#golang
TIL: math.Sin takes radians, period. Degrees · π/180 first — and name the converted variable (angleRad) so the units are visible in the code, not just in your head.
#golang
Go's sort.Slice takes a closure, not a comparator object. The whole "sort by energy DESC, then name ASC" spec is 4 lines: if unequal, return >; else return <. The less() function IS the sort order.
#golang
A vim-style TUI #PostgreSQL client built like lazygit — fast keyboard navigation, modal panes, and a focused workflow for browsing and querying your database from the terminal.
#golang
https://t.co/rhDyu9ZacT
Σ (watts/1000) · hours · price, looped over a slice of appliance structs.
TIL: when the answer is ONE number, accumulate in var total float64 — not a map. Typo a map key and it silently makes a new bucket; typo a variable and it won't compile.
#golang
p = m·v summed across a particle system.
TIL:
• struct literals {MassKg: 2} = kwargs, order-free
• range over a nil slice runs 0×
• pre-seeded map = all keys always exist
• bare switch = flat if/else-if
#GoLang
TIL: Go randomizes map iteration order on purpose — you literally can't rely on it. So "first appearance wins" means walking the original slice for order, and using the map only for the counts.
#GoLang
TIL (physics in Go): v = u + a·t — final velocity under constant acceleration. The neat part: make a negative and the same formula models braking. FinalVelocity(20, -4, 5) = 0,an object decelerating to a perfect stop. No special cases, just honest arithmetic.
#golang
TIL: Go won't auto-convert int → float64. math.Pow takes float64, so with years int you must write math.Pow(x, float64(years)). Coming from Python's free mixing, Go makes every numeric conversion explicit — annoying at first, but it kills a whole class of silent bugs.
#golang
TIL: Go const g = 9.81 is compile-time and immutable — define physics constants once at package level, not as magic numbers scattered through your formulas. Untyped consts even adapt to the float context they're used in.
#golang
Go Daily — distance between two points 📐
TIL: Go has math.Hypot(a, b) = √(a²+b²) built in. One call for Euclidean distance, and it avoids the overflow that aa + bb can hit. Also: x*x beats math.Pow(x, 2) for a simple square. #golang