No it does not, at least not completely. When you carry around pointers to struct implementing interfaces, it does not check for anything at compile time.
> Or just use any of the popular Go code editors/plugins which give you a "show me all implementations".
Does not work all the time, hence my use of the ‶rickety″ adjective.
> This makes understanding what a piece of code is doing much easier, while simplifying mocking as well.
That's a design problem, not an interface problem. Split you giant 30-methods interface into smaller ones if need be, that the whole point of interfaces: not be a 1-1 mapping to methods, but a semantic (sub)group of them.
It really isn't. This way it becomes a guessing game "Which methods will be used with which other ones?".
Even if I have a KVStore interface with 4 methods: Get, Set, List and Delete, it's a huge value to future code readers if my new structure only accepts an interface with List and Get, or List and Delete.
The other commenter already responded to your static typing assertion, so leaving that for there (it absolutely does check it).
But that's not specific to golang. You can use the same approach in Java, Kotlin, C#, etc
The first one is a lot of boilerplate, the second one is not always possible.
What exactly do you mean here? You can't assign a value that doesn't implement an interface Foo to a variable of type Foo. That will cause a compile time error.
And me thinking the Go culture is against languages that tend to come with IDEs...
I prefer to use an editor/IDE and don't think it's pleasant to work with any language (including Go) without them.
"Well obviously you need a proper IDE to protect you from Go's fuckups"
Cool.
The language has static type-checking. If to you it's a regular thing that something like this blows up in your face, maybe it's the code base doing too many things dynamically, and not the language?
> Great, now I'll have to pull a rickety 3rd-package or ‶just grep bro″ through the whole code base to find what types implement this interface.
Or just use any of the popular Go code editors/plugins which give you a "show me all implementations".
In general, implicit interfaces let structures and functions require much less by defining their needed functionality subset, instead of requiring the whole "domain interface" from somewhere else.
If you have a struct that only needs to list an S3 bucket, it's nice to accept an interface that only requires listing, and not the other 30 methods the AWS library "full" interface has. This makes understanding what a piece of code is doing much easier, while simplifying mocking as well.
I do agree that enums, or even better, sum types, would be desirable. It's not a big issue in my day to day, though.