logoalt Hacker News

wcrossbowyesterday at 8:09 AM2 repliesview on HN

I'm not a go developer and this kind of thing is far from my area of expertise. Do you mind giving some examples?

As far as I can tell skimming the code, and as I said, without knowledge of Go or the domain, the "shape" of the code isn't bad. If I got any vibes (:))from it, it was lack of error handling and over reliance on exactly matching strings. Generally speaking, it looks quite fragile.

FWIW I don't think the conclusion is wrong. With limited knowledge he managed to build a useful program for himself to solve a problem he had. Without AI tools that wouldn't have happened.


Replies

alias_neoyesterday at 8:28 AM

There's a lot about it that isn't great. It treats Go like a scripting language, it's got no structure (1000+ lines in a single file), nothing is documented, the models are flat, no methods, it hard codes lots of strings, even the flags are string comparisons instead of using the proper tool, regex compiles and use inlined, limited device support based on some pre-configured, hard-coded strings, some assumptions made on storage device speeds based on its device name: nvme=fast, hdd=slow, etc.

On the whole, it might work for now, but it'll need recompiling for new devices, and is a mess to maintain if any of the structure of the data changes.

If a junior in my team asked me to review this, they'd be starting again; if anyone above junior PRd it, they'd be fired.

nottorpyesterday at 9:03 AM

> Generally speaking, it looks quite fragile

I have a usb to sata plugged in and it's labeled as [Problem].