Skip to content

Examples and experiments when i am learning Go Lang.

Notifications You must be signed in to change notification settings

hankmor/go-learning

Repository files navigation

This map is showing the learning road line for all go developers, click here to show the whole and more maps if you will.

img.png

Learn the Basics

Learn the common concepts of Go like variables, loops, conditional statements, functions, data types, and so on. A good starting point for go basics is its Go’s official docs.

Visit the following resources to learn more:

Go advanced

Modules

Go modules are a group of related packages that are versioned and distributed together. They specify the requirements of our project, list all the required dependencies, and help us keep track of the specific versions of installed dependencies.

Modules are identified by a module path that is declared in the first line of the go.mod file in our project.

Visit the following resources to learn more:

Working with json

JSON (JavaScript Object Notation) is a simple data interchange format. Syntactically it resembles the objects and lists of JavaScript. It is most commonly used for communication between web back-ends and JavaScript programs running in the browser, but it is used in many other places, too.

Visit the following resources to learn more:

Types and type assertions

Type assertions in Golang provide access to the exact type of variable of an interface.

Visit the following resources to learn more:

Interfaces

An interface in Go, is a type that defines a set of methods. If we have a type (e.g. struct) that implements that set of methods, then we have a type that implements this interface.

Visit the following resources to learn more:

Context

The context package provides a standard way to solve the problem of managing the state during a request. The package satisfies the need for request-scoped data and provides a standardized way to handle: Deadlines, Cancellation Signals, etc.

Visit the following resources to learn more:

Goroutines

Goroutines allow us to write concurrent programs in Go. Things like web servers handling thousands of requests or a website rendering new pages while also concurrently making network requests are a few example of concurrency.

In Go, each of these concurrent tasks are calledGoroutines.

Visit the following resources to learn more:

Channels

Channels are the pipes that connect concurrent goroutines. You can send values into channels from one goroutine and receive those values into another goroutine.

Channels are a typed conduit through which you can send and receive values with the channel operator,<-.

Visit the following resources to learn more:

Buffer

Thebufferbelongs to the byte package of the Go language, and we can use these package to manipulate the byte of the string.

Visit the following resources to learn more:

Select

Theselectstatement lets a goroutine wait on multiple communication operations.

Aselectblocks until one of its cases can run, then it executes that case. It chooses one at random if multiple are ready. Theselectstatement is just like switch statement, but in the select statement, case statement refers to communication, i.e. sent or receive operation on the channel.

Visit the following resources to learn more:

Mutex

Go allows us to run code concurrently using goroutines. However, when concurrent processes access the same piece of data, it can lead torace conditions. Mutexes are data structures provided by thesyncpackage. They can help us place a lock on different sections of data so that only one goroutine can access it at a time.

Visit the following resources to learn more:

Building CLI Applications

Command line interfaces (CLIs), unlike graphical user interfaces (GUIs), are text-only. Cloud and infrastructure applications are primarily CLI-based due to their easy automation and remote capabilities.

Go applications are built into a single self contained binary making installing Go applications trivial; specifically, programs written in Go run on any system without requiring any existing libraries, runtimes, or dependencies. And programs written in Go have an immediate startup time—similar to C or C++ but unobtainable with other programming languages.

Visit the following resources to learn more:

click to show details

Cobra

Cobra is a library for creating powerful modern CLI applications.

Visit the following resources to learn more:

Urfave cli

Urfave cli is a simple, fast, and fun package for building command line apps in Go.

Visit the following resources to learn more:

Survey

A library for building interactive and accessible prompts on terminals supporting ANSI escape sequences.

ORMs

Object–relational mapping (ORM, O/RM, and O/R mapping tool) in computer science is a programming technique for converting data between type systems using object-oriented programming languages. This creates, in effect, a “virtual object database”, hence a layer of abstraction, that can be used from within the programming language.

Most common ORM library in Go is GORM.

Web Frameworks

There are several famous web frameworks for Go. Most common ones being:

Visit the following resources to learn more:

click to show details

Beego

Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend services. It is inspired by Tornado, Sinatra and Flask. beego has some Go-specific features such as interfaces and struct embedding.

Visit the following resources to learn more:

Gin

Gin is a high-performance HTTP web framework written in Golang (Go). Gin has a martini-like API and claims to be up to 40 times faster. Gin allows you to build web applications and microservices in Go.

Visit the following resources to learn more:

Revel

Revel organizes endpoints into Controllers. They provide easy data binding and form validation. Revel makes Go Templates simple to use at scale. Register functionality to be called before or after actions.

Visit the following resources to learn more:

Echo

Echo is a performance-focused, extensible, open-source Go web application framework. It is a minimalist web framework that stands between stdlib + router and a full-stack web framework.

Visit the following resources to learn more:

Gorilla

Gorilla is a web toolkit for the Go programming language that provides useful, composable packages for writing HTTP-based applications.

Visit the following resources to learn more:

Gofiber

Go Fiber is an Express-inspired framework for Golang. Go Fiber is a web framework built on top of fast HTTP. It can be used to handle operations such as routing/endpoints, middleware, server request, etc.

Visit the following resources to learn more:

Buffalo

Buffalo helps you to generate a web project that already has everything from front-end (JavaScript, SCSS, etc.) to the back-end (database, routing, etc.) already hooked up and ready to run. From there it provides easy APIs to build your web application quickly in Go.

Visit the following resources to learn more:

Logging

Go has built-in features to make it easier for programmers to implement logging. Third parties have also built additional tools to make logging easier.

Visit the following resources to learn more:

click to show details

Apex

Structured logging package for Go. Visit the following resources to learn more:

Zerolog

The zerolog package provides a fast and simple logger dedicated to JSON output.

Zerolog’s API is designed to provide both a great developer experience and stunning performance. Its unique chaining API allows zerolog to write JSON (or CBOR) log events by avoiding allocations and reflection.

Visit the following resources to learn more:

Zap

Blazing fast, structured, leveled logging in Go. Visit the following resources to learn more:

Go realtime communication

Melody

Melody is websocket framework based on github.com/gorilla/websocket that abstracts away the tedious parts of handling websockets. It gets out of your way so you can write real-time apps.

Visit the following resources to learn more:

Centrifugo

Centrifugo is an open-source scalable real-time messaging server. Centrifugo can instantly deliver messages to application online users connected over supported transports (WebSocket, HTTP-streaming, SSE/EventSource, GRPC, SockJS, WebTransport). Centrifugo has the concept of a channel – so it’s a user-facing PUB/SUB server.

Visit the following resources to learn more:

API Clients

An API client is a set of tools and protocols that operate from an application on a computer. They help you to bypass some operations when developing a web application rather than reinventing the wheel every time. Using a client API is a great way to speed up the development process.

Visit the following resources to learn more:

click to show details

REST

REST (Representational State Transfer) API (Application Programming Interface) is used to deliver user functionality when dealing with websites. HTTP requests are used to communicate with REST APIs so users can navigate a URL website. These URLs can return certain information that is stored as part of the API.

Visit the following resources to learn more:

Heimdall

Heimdall is an HTTP client that helps your application make a large number of requests, at scale. With Heimdall, you can:

  • Use a hystrix-like circuit breaker to control failing requests
  • Add synchronous in-memory retries to each request, with the option of setting your own retrier strategy
  • Create clients with different timeouts for every request

All HTTP methods are exposed as a fluent interface.

Visit the following resources to learn more:

Grequests

Golang implementation of Python Grequests library(one of well known HTTP Library in Python).

Features:

  • Responses can be serialized into JSON and XML
  • Easy file uploads
  • Easy file downloads
  • Support for the following HTTP verbs GET, HEAD, POST, PUT, DELETE, PATCH, OPTIONS

Visit the following resources to learn more:

Graphql

GraphQLis a query language forAPIs, it offers a service that prioritizes giving just the data that the client requested and no more.

Besides, you don’t need to be worried about breaking changes, versioning and backwards compatibility like REST APIs. Therefore you can implement your version and auto-document your API just by usingGraphQL.

Visit the following resources to learn more:

Graphql go

A GraphQL package forGo.

Visit the following resources to learn more:

Gqlgen

According to their documentation, it’s a Golang library for building GraphQL servers without much effort.

Visit the following resources to learn more:

Testing Go Code

Go has a built-in testing command that we can use to test our program.

Visit the following resources to learn more:

Microservices

Microservices are an architectural approach to software development that allows the creation of a distributed application from deployable services that allow communication through a well-defined API. Being a solution to monoliths.

Visit the following resources to learn more:

click to show details

Watermill

Watermill is an event streaming library for handling asynchronous requests in go. It provides multiple sets of implementations for pub/sub. e.g: You can use conventional pub/sub implementations like Kafka or RabbitMQ, but also HTTP or MySQL binlog, if that fits your use case.

Visit the following resources to learn more:

Rpcx

Rpcx is a RPC (Remote Procedure Call) framework like Alibaba Dubbo and Weibo Motan. Some of the advantages on using Rpcx:

  • Simple: easy to learn, easy to develop, easy to integrate and easy to deploy
  • Performance: high performance (>= grpc-go)
  • Cross-platform: support raw slice of bytes, JSON, Protobuf and MessagePack. Theoretically it can be used with java, php, python, c/c++, node.js, c# and other platforms
  • Service discovery and service governance: support zookeeper, etcd and consul.

Visit the following resources to learn more:

Go kit

Go kit is a programming toolkit for building microservices (or elegant monoliths) in Go. it solves common problems in distributed systems and application architecture so you can focus on delivering business value.

Visit the following resources to learn more:

Micro

It is an API first development platform. It leverages the microservices architecture pattern and provides a set of services which act as the building blocks of a platform.

Visit the following resources to learn more:

go-zero

go-zero is a web and rpc framework with lots of engineering best practices builtin. It’s born to ensure the stability of the busy services with resilience design, and has been serving sites with tens of millions users for years.

Visit the following resources to learn more:

Protocol buffers

Protocol Buffers(Protobuf) is a free, open-source, language-neutral, platform-neutral, extensible data format used to serialize structured data. It’s like JSON, except it’s smaller and faster, and it generates native language bindings.

Some of the advantages of using protocol buffers include:

  • Compact data storage
  • Fast parsing
  • Availability in many programming languages
  • Optimized functionality through automatically-generated classes

Visit the following resources to learn more:

gRPC Go

Go language implementation of gRPC(gRPC is a technology for implementing RPC APIs).

Visit the following resources to learn more:

Grpc gateway

gRPC-Gateway creates a layer over gRPC services that will act as a RESTful service to a client. It is a plugin of protoc. It reads a gRPC service definition and generates a reverse-proxy server which translates a RESTful JSON API into gRPC.

Visit the following resources to learn more:

Twirp

Twirp is a framework for service-to-service communication emphasizing simplicity and minimalism. It generates routing and serialization from API definition files and lets you focus on your application’s logic instead of thinking about folderol like HTTP methods and paths and JSON.

Twirp is similar to gRPC, but without the custom HTTP server and transport implementations: it runs on the standard library’s extremely-well-tested-and-high-performance net/http Server. It can run on HTTP 1.1, not just http/2, and supports JSON serialization for easy debugging.

Visit the following resources to learn more:

About

Examples and experiments when i am learning Go Lang.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published