Interfaces in Go

Interfaces in Go

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.

Inter — What now?

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.





programming golang go

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

What's new in the go 1.15

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.

Secure HTTPS servers in Go

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

Why Golang (Go) so Fast?

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

Learning Go — Array, Slice, Map

In this article, we are going to see the four important collection types built into the language. we start with humble Arrays, Maps, Slices

Golang Tutorial: Learn Go Programming Language for Beginners

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