News for hackers. Stuff that matters.
Re:Just Fucking Use Go by BadBadJellyBean on Friday May 08, 2026 @10:04AM (#48063360)
I can write go but I don't prefer it. It's ... okay.

Things I dislike:

- if err != nil. Just give me some syntactic sugar instead of letting me write the same thing a bajillion time.

- no way to bind a struct to an interface. I'd like my IDE to tell me when I accidentally stopped implementing an interface

- some stdlib parts are too bare bones. Unpacking an archive requires me to handle all files, directories, links, etc. myself. There is no move command that can move a file or directory across fs boundaries. The little things.

Re:Just Fucking Use Go by avanai on Friday May 08, 2026 @10:14AM (#48063526)

    var _ MyInterface = &MyStruct{}

Now your compiler will tell you you stopped implementing the interface. Pretty? No. But it works. And gopls will even offer to implement stubs for missing methods.
Re:Just Fucking Use Go by BadBadJellyBean on Friday May 08, 2026 @11:18AM (#48064400)
That is helpful but I think that is still a fail for Go. This could and should be a simple annotation.
Re:Just Fucking Use Go by pdmccormick on Friday May 08, 2026 @01:51PM (#48066487)
This also works:

    var _ MyInterface = (*MyStruct)(nil)
In my mind as I read this, I am reminded that it is the receiver type *MyStruct that implements MyInterface. YMMV.
Re:Just Fucking Use Go by BadBadJellyBean on Friday May 08, 2026 @05:57PM (#48069282)
This is a useful hack but just imagine someone coming from another language reading this. They'd have no idea what it's for. It looks a bit like the things C people do to themselves. And all just because someone didn't want a keyword or another form of annotation to signal that a struct should implement an interface.

These are the small things that annoy me about go.

Re:Just Fucking Use Go by calcifer on Friday May 08, 2026 @10:11AM (#48063478)
> I'd like my IDE to tell me when I accidentally stopped implementing an interface

I don't know about others, but Goland's analyser is pretty powerful and can navigate from interface to implementation(s) and vice versa.

Re:Just Fucking Use Go by BadBadJellyBean on Friday May 08, 2026 @11:16AM (#48064386)
In my experience only when you implement it correctly. If I add a new method to the interface I can't navigate to the implementations anymore because they don't completely implement the interface.
Re:Just Fucking Use Go by calcifer on Saturday May 09, 2026 @02:53AM (#48072522)
That's surely the correct behaviour?
Re:Just Fucking Use Go by BadBadJellyBean on Saturday May 09, 2026 @05:36AM (#48073522)
It is. But it's also an inconvenience. In a language like Java I can just say that a class implements an interface. If the interface changes the compiler and the IDE tell me about the missing methods. Go not so much.