Remix.run Logo
BadBadJellyBean 6 hours ago

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.

avanai 5 hours ago | parent | next [-]

    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.
pdmccormick 2 hours ago | parent | next [-]

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.
BadBadJellyBean 4 hours ago | parent | prev [-]

That is helpful but I think that is still a fail for Go. This could and should be a simple annotation.

calcifer 6 hours ago | parent | prev [-]

> 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.

BadBadJellyBean 4 hours ago | parent [-]

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.