Interfaces in Go. An interface is a collection of method receivers. It’s not that Interfaces are hard or complex, but learning the habit to use them and the mindset seem to confuse many. In this article I will try to use a lot of examples so that we not only learn how to use them, but also when.
Let’s dissect interfaces and be come masters of the trade
I feel obliged to make an article about interfaces since it’s one of the features in Go that amazed me the most. I’m not gonna lie, it took me a while to get comfortable using them, but when I passed the learning threshold I started loving them.
It’s not that Interfaces are hard or complex, but learning the habit to use them and the mindset seem to confuse many. In this article I will try to use a lot of examples so that we not only learn how to use them, but also when.
Let’s start at the beginning and review the basics before we move on.
An interface is a collection of method receivers. What that means is that we define a rule, that any type that has ALL methods described, is part of an interface. It might be worth reminding people what a method receiver is as well. It’s when we apply a method to a type. The gist below shows an example, this works for both pointers and non-pointers.
Go announced Go 1.15 version on 11 Aug 2020. Highlighted updates and features include Substantial improvements to the Go linker, Improved allocation for small objects at high core counts, X.509 CommonName deprecation, GOPROXY supports skipping proxies that return errors, New embedded tzdata package, Several Core Library improvements and more.
In this article, we are going to look at some of the basic APIs of the http package to create and initialize HTTPS servers in Go
Go is praised by everyone for achieving extremely high concurrent performance, but Why? In this Golang (Go) tutorial, I’ll introduce how the Go program to achieve extremely high concurrent performance, and its internal scheduler implementation architecture (G-P-M model). I’ll also explain how Go can make full use of computing resources, and how the Go scheduler deals with threads step by step
In this article, we are going to see the four important collection types built into the language. we start with humble Arrays, Maps, Slices
An Introduction to the basics of Go programming language. I will try to introduce some of the basic concepts of Go: Variables and Constants; Loops and Conditional Statements; Functions; Structs, arrays, slices, and maps; ...