
Here's a fun bit of Go trivia for y'all which I believe perfectly demonstrates how, despite the absolute power of AI, it still codes like a over-eager-junior engineer straight out of CS 201 writing completely unmaintainable code. This was generated with GPT 6.1-sol while working on some experimental flag stuff akin to spf13/pflag: A "Count" type is defined like so: ``` // Count is an integer flag that increments 1 // when used without an argument. // With an argument, increments that amount. type Count int ``` And in the following "Set" method, a "+1" sentinel increments the counter flag (this is basically straight out of spf13/pflag) ``` // Set increments the count for "+1" // or sets it to the parsed integer. func (c *Count) Set(s string) error { if s == "+1" { if *c == Count(int(^uint(0)>>1)) { return fmt.Errorf("count overflows int") } *c++ return nil } value, err := strconv.ParseInt(s, 0, strconv.IntSize) if err == nil { *c = Count(value) } return err } ``` This path guards integer overflow and immediately made me raise an eyebrow: ``` if *c == Count(int(^uint(0)>>1)) ``` Step by step: by taking a zero value uint, flipping all its bits to 1, shifting it to the right by 1 (effectively removing the signing bit), then casting it to a Count, finally checking if it's equal to the current count -- we can effectively check if the count is at the given system's maximum signed int value and should error to prevent an overflow. On a 64 bit system, this is 2^63−1 (a massive number). ... this is all good except the agent completely ignored Go's "math.MaxInt" (I wouldn't even consider this "modern Go" since it's been around since Go 1.17) -- the complexity can be drastically reduced by simply doing: ``` if *c == math.MaxInt ``` This compiles without a "Count(...)" cast since, under the hood, this is an untyped const in the math package (essentially exactly what this std lib const is for). The complexity in understanding a one liner bit shift vs. just using the standard library cannot be over stated: even for agents, I'd argue that this exits the domain of "easy to maintain with agents" and would require lots and lots of resources (on the GPT 5.x tokenizer, the first implementation is 13 tokens and the second is 7 !!! ) Software engineering has always been about correctly combating and harnessing complexity in language, semantics, abstraction, construction, and creative expression. Using LLM tools did not change that and there's a very compelling argument to be made for beautiful, elegant, and correct code that enables BOTH the engineer and the tools to work better.




















