3 ms·
Are you aware of the trick of "var _ foo.RequiredInterface = myType{}" to make the compiler enforce that a struct implements a given interface? Is what you see
by dagss 2y ago
Are you aware of the trick of "var _ foo.RequiredInterface = myType{}" to make the compiler enforce that a struct implements a given interface?
Is what you seek a nicer syntax for this or does what you speak of bring something more feature wise?
At least IntelliJ IDEs will always make it clear what interfaces all your structs implement.
- owlstuffing 2y ago>Are you aware of the trick Yes, and while it uses the compiler to ensure a type implements an interface, it's still a trick that exposes a large hole in the language... and begs for it to be filled. Most importantly, it still doesn't make the code much easier to read and understand. >At least IntelliJ IDEs will always make it clear (or less foggy) Indeed. Go benefits hugely from IntelliJ, or to be specific the IJ plugin API.