The implementation and value of functional interfaces or interface-based functions in Go (golang). What is an interface-based function, and why wrap a function in an interface instead of passing the function directly as a parameter? How does Go's standard library net/http use interface-based functions?
A 7-day tutorial on implementing an RPC framework in Go/golang from scratch (7 days implement golang remote procedure call framework from scratch tutorial). Build an RPC framework modeled after the implementation of the golang standard library net/rpc, covering the server, an asynchronous and concurrent client, message encoding and decoding, service registration, and multiple transport protocols including TCP/Unix/HTTP. On Day 7, we implement a simple registry (registry) with capabilities such as timeout-based removal and heartbeat (heartbeat) reception, along with a simple service discovery (server discovery) module.
A 7-day tutorial on implementing an RPC framework in Go/golang from scratch (7 days implement golang remote procedure call framework from scratch tutorial). Build an RPC framework modeled after the implementation of the golang standard library net/rpc, covering the server, an asynchronous and concurrent client, message encoding and decoding, service registration, and multiple transport protocols including TCP/Unix/HTTP. On Day 6, we implement two simple load balancing (load balance) algorithms: random selection and Round Robin scheduling.
A 7-day tutorial on implementing the RPC framework GeeRPC in Go/golang from scratch (7 days implement golang remote procedure call framework from scratch tutorial). Build an RPC framework modeled after the implementation of Go's standard library net/rpc, covering the server, a client supporting asynchronous and concurrent calls, message encoding and decoding, service registration, and multiple transport protocols such as TCP/Unix/HTTP. Day 5 adds support for the HTTP protocol and provides a simple DEBUG page.
A 7-day tutorial on implementing the RPC framework GeeRPC in Go/golang from scratch (7 days implement golang remote procedure call framework from scratch tutorial). Build an RPC framework modeled after the implementation of Go's standard library net/rpc, covering the server, a client supporting asynchronous and concurrent calls, message encoding and decoding, service registration, and multiple transport protocols such as TCP/Unix/HTTP. Day 4 provides the RPC framework with the ability to handle timeouts (timeout processing).
A 7-day tutorial on implementing the RPC framework GeeRPC in Go/golang from scratch (7 days implement golang remote procedure call framework from scratch tutorial). Build an RPC framework modeled after the implementation of Go's standard library net/rpc, covering the server, a client supporting asynchronous and concurrent calls, message encoding and decoding, service registration, and multiple transport protocols such as TCP/Unix/HTTP. Day 3 implements service registration, mapping Go structs to services via reflection.
A 7-day tutorial on implementing an RPC framework in Go/golang from scratch (7 days implement golang remote procedure call framework from scratch tutorial). Build an RPC framework modeled after the implementation of the golang standard library net/rpc, covering the server, an asynchronous and concurrent client, message encoding and decoding, service registration, and multiple transport protocols including TCP/Unix/HTTP. On Day 2, we implement a client that supports asynchronous (asynchronous) and concurrent (concurrent) calls.
A 7-day tutorial on implementing an RPC framework in Go/golang from scratch (7 days implement golang remote procedure call framework from scratch tutorial). Build an RPC framework modeled after the implementation of the golang standard library net/rpc, covering the server, an asynchronous and concurrent client, message encoding and decoding, service registration, and multiple transport protocols including TCP/Unix/HTTP. On Day 1, we implement a simple server along with message encoding and decoding.
A 7-day tutorial on implementing an RPC framework in Go/golang from scratch (7 days implement golang remote procedure call framework from scratch tutorial). Build an RPC framework modeled after the implementation of the golang standard library net/rpc, covering the server, an asynchronous and concurrent client, message encoding and decoding, service registration, and multiple transport protocols including TCP/Unix/HTTP. On top of that, it adds features such as protocol exchange, a registry, service discovery, load balancing, and timeout processing.
WaitGroup and channels are two common ways to control concurrency, but for complex scenarios Context is a more elegant mechanism. Context provides four control mechanisms: WithCancel, WithValue, WithTimeout and WithDeadline.
mmap maps a file or device into memory — a one-to-one mapping between the file's on-disk address and a range of the process's virtual address space. Reading or writing that mapped memory reads or writes the file at the corresponding position. This tutorial shows how to use mmap in Go.
A 7-day tutorial on implementing an ORM framework GeeORM in Go/golang from scratch (7 days implement golang object relational mapping framework from scratch tutorial). Build an ORM framework modeled after the implementations of gorm and xorm. When a struct changes, the fields of the database table are migrated automatically; only adding and deleting fields is supported, changing field types is not.
A 7-day tutorial on implementing an ORM framework GeeORM in Go/golang from scratch (7 days implement golang object relational mapping framework from scratch tutorial). Build an ORM framework modeled after the implementations of gorm and xorm. Introduces transactions in databases; wraps transactions, using user-defined callback functions to implement atomic operations.
7 days to implement the ORM framework GeeORM in Go/golang from scratch tutorial (7 days implement golang object relational mapping framework from scratch tutorial), write an ORM framework by hand, modeled after gorm and xorm. Use reflection (reflect) to obtain the hooks (hooks) bound to a struct and invoke them; support calling hooks before and after CRUD (create, read, update, delete) operations.
7 days to implement the ORM framework GeeORM in Go/golang from scratch tutorial (7 days implement golang object relational mapping framework from scratch tutorial), write an ORM framework by hand, modeled after gorm and xorm. Support stacking query conditions (where, order by, limit, etc.) through chained (chain) operations; implement updating (update), deleting (delete) and counting (count) records.
7 days to implement the ORM framework GeeORM in Go/golang from scratch tutorial (7 days implement golang object relational mapping framework from scratch tutorial), write an ORM framework by hand, modeled after gorm and xorm. Implement inserting (insert) records; use reflection (reflect) to convert database records into the corresponding struct instances, implementing the query (select) feature.
A tutorial on implementing the ORM framework GeeORM in Go/golang from scratch in 7 days (7 days implement golang object relational mapping framework from scratch tutorial). Build an ORM framework by hand, modeled after gorm and xorm. This article uses reflection (reflect) to obtain the name and fields of an arbitrary struct object and map it to a table in the database; uses dialect to isolate the differences between databases for easy extension; and creates and drops database tables.
A tutorial on implementing the ORM framework GeeORM in Go/golang from scratch in 7 days (7 days implement golang object relational mapping framework from scratch tutorial). Build an ORM framework by hand, modeled after gorm and xorm. This article introduces basic SQLite operations (connecting to the database, creating tables, inserting and deleting records, etc.) and using the Go standard library database/sql to work with SQLite, including Exec, Query and QueryRow.
A tutorial on implementing the ORM framework GeeORM in Go/golang from scratch in 7 days (7 days implement golang object relational mapping framework from scratch tutorial). Build an ORM framework by hand, modeled after gorm and xorm. Features include two-way mapping between objects and table schemas, creating and dropping tables, CRUD operations on records, transaction support, database migration (migrate), hooks, and more.
A tutorial on implementing the distributed cache GeeCache from scratch in Go (7 days implement golang distributed cache from scratch tutorial), building a distributed cache modeled after groupcache. This article describes using protobuf (protocol buffer) for communication between nodes, encoding messages to improve efficiency.
A tutorial on implementing the distributed cache GeeCache from scratch in Go (7 days implement golang distributed cache from scratch tutorial), building a distributed cache modeled after groupcache. This article introduces the concepts of cache avalanche, cache breakdown and cache penetration, and implements and tests singleflight to prevent cache breakdown.
A tutorial on implementing the distributed cache GeeCache from scratch in Go (7 days implement golang distributed cache from scratch tutorial), building a distributed cache modeled after groupcache. This article adds node registration and node selection to GeeCache, and implements an HTTP client to communicate with the servers of remote nodes.
A tutorial on implementing the distributed cache GeeCache from scratch in Go (7 days implement golang distributed cache from scratch tutorial), building a distributed cache modeled after groupcache. This article introduces the principle of consistent hashing, its implementation, and related test cases: why consistent hashing can prevent cache avalanches, and why virtual nodes solve the problem of data skew.
gomock is the official Go mocking library for unit tests, useful when dependencies such as network requests, databases or file I/O are complex and hard to call directly. This tutorial covers matchers (Any, Nil, Not, Eq), return values (Do, Return, DoAndReturn), call counts (Times) and ordering (InOrder), and how to write mockable code.
7 Days Go Distributed Cache Tutorial Series from scratch (7 days implement golang distributed cache from scratch tutorial). Build a distributed cache by hand, modeled after the implementation of groupcache. This article introduces how to build an HTTP Server with the standard library http, set up an HTTP service for GeeCache's single-node instance, and run the related tests.
7 Days Go Distributed Cache Tutorial Series from scratch (7 days implement golang distributed cache from scratch tutorial). Build a distributed cache by hand, modeled after the implementation of groupcache. This article introduces the use of the sync.Mutex mutual exclusion lock to control concurrency for the LRU cache. It implements GeeCache's core data structure Group; when the cache misses, a callback function is invoked to fetch the source data.
7 Days Go Distributed Cache Tutorial Series from scratch (7 days implement golang distributed cache from scratch tutorial). Build a distributed cache by hand, modeled after the implementation of groupcache. This article introduces the three most common cache eviction (expiry) algorithms: First In First Out (FIFO), Least Frequently Used (LFU), and Least Recently Used (LRU), and implements the LRU algorithm along with the corresponding test code.
How to write unit tests in Go with the standard library testing package: subtests, table-driven tests, helper functions, setup and teardown, network/HTTP testing and benchmarks.
7 Days Go Distributed Cache Tutorial Series from scratch (7 days implement golang distributed cache from scratch tutorial). Build a distributed cache by hand, modeled after the implementation of groupcache. Features include single-node/distributed caching, LRU (Least Recently Used) cache eviction strategy, preventing cache breakdown, consistent hashing (Consistent Hash), protobuf-based communication, and more.
Front-end development with Go, WebAssembly and GopherJS: registering functions, interacting with browser JavaScript objects, manipulating DOM elements, asynchronous programming with callbacks, plus more advanced demos (games, rendering) and related projects and documentation.
Remote Procedure Call (RPC) in Go with the standard library net/rpc: synchronous and asynchronous calls, plus one-way and mutual authentication between server and client using TLS/SSL.
Protocol Buffers (protobuf) is a language- and platform-neutral, scalable and extensible way to serialize structured data — smaller and faster than JSON or XML. This tutorial covers Protocol Buffers 3 (proto3): installation, basic syntax and how to use it in Go.
A 7-day tutorial on implementing a Web framework from scratch in Go (7 days implement golang web framework from scratch tutorial). Build a Web framework from scratch with Go/golang, with Gin as the design prototype. This article explains how to add an error handling mechanism to the Web framework.
A 7-day tutorial on implementing a Web framework from scratch in Go (7 days implement golang web framework from scratch tutorial). Build a Web framework from scratch with Go/golang, with Gin as the design prototype. This article explains how to add HTML template (HTML Template) rendering and static file (Serve Static Files) serving to the Web framework.
A 7-day tutorial on implementing a Web framework from scratch in Go (7 days implement golang web framework from scratch tutorial). Build a Web framework from scratch with Go/golang, with Gin as the design prototype. This article explains how to add middleware support (middlewares) to the Web framework.
A 7-day tutorial on implementing a Web framework from scratch in Go (7 days implement golang web framework from scratch tutorial). Build a Web framework from scratch with Go/golang, with Gin as the design prototype. This article explains the significance of group control (Group Control) and the implementation of nested route groups.
A tutorial on implementing a Web framework from scratch in Go (7 days implement golang web framework from scratch tutorial), build a Web framework by hand in Go/golang, and design a Web framework from scratch modeled after Gin. This article introduces how to implement routes with a Trie prefix tree. It supports simple parameter parsing and wildcard scenarios.
A tutorial on implementing a Web framework from scratch in Go (7 days implement golang web framework from scratch tutorial), build a Web framework by hand in Go/golang, and design a Web framework from scratch modeled after Gin. This article introduces the design idea of the request context (Context), which wraps methods for returning JSON/String/Data/HTML and other types of responses.
What changes in Go 2 compared to Go 1: the latest design drafts covering packages, error handling, error values and generics, plus a short history of the Go language.
A tutorial on implementing a Web framework from scratch in Go (7 days implement golang web framework from scratch tutorial), build a Web framework by hand in Go/golang, and design a Web framework from scratch modeled after Gin. This article introduces the use of Go's standard library net/http and the http.Handler interface, intercepting all HTTP requests and handing them over to the Gee framework.
A tutorial on implementing a Web framework from scratch in Go (7 days implement golang web framework from scratch tutorial), build a Web framework by hand in Go/golang, and design a Web framework from scratch modeled after Gin.
A quick-start tutorial for the Gin web framework: installing Go and setting up the environment, hot reload, routing and route groups, HTML templates, and middleware.
Learn Go (Golang) with a single article — installation, basic types (strings, ints, arrays, slices, maps), control flow (if, for, for-range, switch), composite types (structs, interfaces, methods), concurrency (goroutines, channels, sync), error handling (panic, error), Go Modules and how to write unit tests.