7 days golang programs from scratch

7 days golang programs from scratch

CodeSize LICENSE

README 中文版本

7天用Go从零实现系列

7天能写什么呢?类似 gin 的 web 框架?类似 groupcache 的分布式缓存?或者一个简单的 Python 解释器?希望这个仓库能给你答案。

推荐先阅读 Go 语言简明教程,一篇文章了解Go的基本语法、并发编程,依赖管理等内容。

推荐 Go 语言笔试面试题,加深对 Go 语言的理解。

推荐 Go 语言高性能编程(项目地址),写出高性能的 Go 代码。

期待关注我的「知乎专栏」和「微博」,查看最近的文章和动态。

7天用Go从零实现Web框架 - Gee

Gee 是一个模仿 gin 实现的 Web 框架,Go Gin简明教程可以快速入门。

7天用Go从零实现分布式缓存 GeeCache

GeeCache 是一个模仿 groupcache 实现的分布式缓存系统

7天用Go从零实现ORM框架 GeeORM

GeeORM 是一个模仿 gormxorm 的 ORM 框架

gorm 准备推出完全重写的 v2 版本(目前还在开发中),相对 gorm-v1 来说,xorm 的设计更容易理解,所以 geeorm 接口设计上主要参考了 xorm,一些细节实现上参考了 gorm。

7天用Go从零实现RPC框架 GeeRPC

GeeRPC 是一个基于 net/rpc 开发的 RPC 框架 GeeRPC 是基于 Go 语言标准库 net/rpc 实现的,添加了协议交换、服务注册与发现、负载均衡等功能,代码约 1k。

WebAssembly 使用示例

具体的实践过程记录在 Go WebAssembly 简明教程

  • 示例一:Hello World | Code
  • 示例二:注册函数 | Code
  • 示例三:操作 DOM | Code
  • 示例四:回调函数 | Code

What can be accomplished in 7 days? A gin-like web framework? A distributed cache like groupcache? Or a simple Python interpreter? Hope this repo can give you the answer.

Web Framework - Gee

Gee is a gin-like framework

  • Day 1 - http.Handler Interface Basic Code
  • Day 2 - Design a Flexiable Context Code
  • Day 3 - Router with Trie-Tree Algorithm Code
  • Day 4 - Group Control Code
  • Day 5 - Middleware Mechanism Code
  • Day 6 - Embeded Template Support Code
  • Day 7 - Panic Recover & Make it Robust Code

Distributed Cache - GeeCache

GeeCache is a groupcache-like distributed cache

  • Day 1 - LRU (Least Recently Used) Caching Strategy Code
  • Day 2 - Single Machine Concurrent Cache Code
  • Day 3 - Launch a HTTP Server Code
  • Day 4 - Consistent Hash Algorithm Code
  • Day 5 - Communication between Distributed Nodes Code
  • Day 6 - Cache Breakdown & Single Flight | Code
  • Day 7 - Use Protobuf as RPC Data Exchange Type | Code

Object Relational Mapping - GeeORM

GeeORM is a gorm-like and xorm-like object relational mapping library

Xorm's desgin is easier to understand than gorm-v1, so the main designs references xorm and some detailed implementions references gorm-v1.

  • Day 1 - database/sql Basic | Code
  • Day 2 - Object Schame Mapping | Code
  • Day 3 - Insert and Query | Code
  • Day 4 - Chain, Delete and Update | Code
  • Day 5 - Support Hooks | Code
  • Day 6 - Support Transaction | Code
  • Day 7 - Migrate Database | Code

RPC Framework - GeeRPC

GeeRPC is a net/rpc-like RPC framework

Based on golang standard library net/rpc, GeeRPC implements more features. eg, protocol exchange, service registration and discovery, load balance, etc.

  • Day 1 - Server Message Codec | Code
  • Day 2 - Concurrent Client | Code
  • Day 3 - Service Register | Code
  • Day 4 - Timeout Processing | Code
  • Day 5 - Support HTTP Protocol | Code
  • Day 6 - Load Balance | Code
  • Day 7 - Discovery and Registry | Code

Golang WebAssembly Demo

  • Demo 1 - Hello World Code
  • Demo 2 - Register Functions Code
  • Demo 3 - Manipulate DOM Code
  • Demo 4 - Callback Code
Similar Resources

Building a shoe store with golang to learn more about this language :)

shoestore-go Building a shoe store with golang to learn more about this language :) TODO Create a basic webpage with the pages: home : to show homepag

Jan 24, 2022

Golang Learning resources

golang Golang Learning resources Data type detection dataFields interface{} dtype := reflect.TypeOf(dataFields).Kind().String() var c Company fmt.Prin

Dec 14, 2022

A complete guide to undersatnd golang programming language, web requests, JSON and creating web APIs with mongodb

Golang series A complete guide to undersatnd golang programming language, web requests, JSON and creating web APIs with mongodb LearnCodeonline.in 01

Jan 1, 2023

An e-book on building network applications using golang

Network programming with Go

Dec 7, 2021

Golang Clean Architecture based on Uncle Bob's Clean Architecture and Summer internship in 2021

clean-architecture-api Description This is an example of implemention of Clean Architecture in Golang projects. This project has 4 layer : Infrastruct

Feb 20, 2022

Golang practice

practice Golang practice Move all files except one cut evrything from current directory and paste into stdinout/ directory mv !(stdinout) stdinout/ an

Dec 31, 2021

Programming Paradigm With Golang

Programming Paradigm With Golang

Programming-Paradigm After running python3 1_22.py you'll get a prompt: which, after entering start and the end of the interval, should create next wi

Oct 16, 2021

A practical journey into the Golang Programming Language

OneTutorial - A practical journey into the Golang Programming Language This little project will help you touch many topics around Golang, in a small a

Oct 21, 2021

Clean Architecture in Go (Golang) projects-DDD

Clean Architecture in Go (Golang) projects-DDD

go-clean-arch Changelog v1: checkout to the v1 branch Proposed on 2017, archived to v1 branch on 2018 Desc: Initial proposal by me. The story can be r

Oct 11, 2021
100 days of Go learning
100 days of Go learning

This repository is a journal of my path to learning GO. By the end of the 100 days, you should be able to follow along by day and learn Go as well.

Oct 27, 2022
Golang - A collection of small Go programs used as learning exercises

This repo is a collection of small Go programs used as learning exercises Some o

Dec 31, 2021
This is my first golang project. The main reason for its existence is the need for practice. I will be studying golang while writing this project

My first GoLang project Project Aim The goal of this project is to develop the most simple golang bot to learn how to work with this programming langu

Jan 7, 2022
Golang 设计模式
Golang 设计模式

Golang设计模式思想 前言 一切设计模式都是灵活应用struct的组合模式,以及go隐形继承接口的特性 go中的interface就是一些方法装饰, 而struct并不依赖于接口 设计模式类型 创建模式 建造者模式(Builder Pattern) 将一个复杂对象的构建与它的表示分离, 使得同样

Dec 29, 2022
Examples of Golang compared to Node.js for learning
Examples of Golang compared to Node.js for learning

This guide full of examples is intended for people learning Go that are coming from Node.js, although the vice versa can work too. This is not meant to be a complete guide and it is assumed that you've gone through the Tour of Go tutorial. This guide is meant to be barely good enough to help you at a high level understand how to do X in Y and doing further learning on your own is of course required.

Jan 9, 2023
Golang && Back-end Stack , Continually updated

Stack Here Golang OS Net Note Tool Delve Authentication Paper Paper ?? Link GO官方文档 GO Official Doc GO官方博客 GO Official Blog GO官方仓库

Nov 8, 2022
The Ultimate Workshop Track for #golang Developer
The Ultimate Workshop Track  for #golang Developer

layout title nav_order description permalink default An Ultimate GopherLabs Hands-on Labs 1 An Ultimate GopherLabs Hands-on Labs / Join GopherLabs Com

Dec 7, 2022
high performance coding with golang(Go 语言高性能编程,Go 语言陷阱,Gotchas,Traps)
high performance coding with golang(Go 语言高性能编程,Go 语言陷阱,Gotchas,Traps)

Go 语言高性能编程 订阅 最新动态可以关注:知乎 Go语言 或微博 极客兔兔 订阅方式:watch geektutu/blog ,每篇文章都能收到邮件通知,或通过 RSS 订阅。

Dec 28, 2022
Go-Notebook is inspired by Jupyter Project (link) in order to document Golang code.
Go-Notebook is inspired by Jupyter Project (link) in order to document Golang code.

Go-Notebook Go-Notebook is an app that was developed using go-echo-live-view framework, developed also by us. GitHub repository is here. For this proj

Jan 9, 2023
Crash Course about the programming language Go / Golang.
Crash Course about the programming language Go / Golang.

Crash Course about the programming language Go / Golang. In this course I have covered some important concepts and topics in programming.

Oct 10, 2022