Go Core - Entity
|Word Count:0|Reading Time:1mins
Author: zhongmingmao
Copyright Notice: All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.
Related Articles

2022-05-15
Go Core - List + Ring

2022-05-15
Go Core - Array + Slice

2023-05-05
Go Engineering - Makefile
基础语法 https://github.com/seisman/how-to-write-makefile 规则语法 伪目标 变量赋值 特殊变量 自动化变量 功能设计Target Target Desc gen Generate all necessary files, such as error code files. format Gofmt (reformat) package sources (exclude vendor dir if existed). lint Check syntax and styling of go sources. test Run unit test. cover Run unit test and get test coverage. build Build source code for host platform. build.multiarch Build source code for multiple platforms. See option PLATFORMS. image Build docker im...

2022-03-27
Go Engineering - Specification - Workflow
集中式 在本地仓库的 master 分支开发,将修改后的代码 commit 到远程仓库,如有冲突先本地解决再提交 适合场景:团队人员少、开发不频繁、不需要同时维护多个版本的小项目 功能分支 12345678910# git checkout -b feature/rate-limiting# git add limit.go# git commit -m "add rate limiting"# git push origin feature/rate-limiting# Github: Compare & pull request -> Create pull request# Github: Code Review -> Merge pull request Merge PR Create a merge commit – 推荐 底层操作:git merge --no-ff With --no-ff, create a merge commit in all cases, even when the merge could instead be...

2022-10-11
Cloud Native Foundation - Go IO
阻塞 IO 阻塞:等待数据就绪 阻塞 + 同步 非阻塞 IO 非阻塞:等待数据就绪 轮询:效率不高 非阻塞 + 同步 IO 多路复用 (集中线程)阻塞 + 同步 当数据就绪后,集中线程会唤醒其他线程,阻塞的仅仅只是一个线程 select / poll 通过传参的形式来轮询 fd 列表,长度有上限(1024) epoll 通过 mmap 将用户态的内存和内核态的内存进行共享,不再需要传参,解决了 fd 长度受限的问题 基于事件侦听,而非轮询wq: wait queue, rdlist: ready list, rbr: red black tree Go HTTP:goroutine 与 fd 绑定 异步 IO 非阻塞 + 异步 异步:拷贝数据(Socket 缓冲区 -> 应用缓冲区)的过程也是由 Kernel 来完成

2023-05-03
Go Engineering - RESTful API
概念 Representational State Transfer REST 只是一种软件架构风格 REST 有一系列规范,满足这些规范的 API 称为 RESTful API REST 规范将所有内容都视为资源,REST 架构对资源的操作对应 HTTP 协议提供的方法 REST 风格适用于很多传输协议,并且 REST 天生与 HTTP 协议相辅相成 HTTP 协议成为了实现 RESTful API 的事实标准 REST 是一种规范,而 RESTful API 是满足 REST 规范的 API 接口 RESTful API 的核心是规范 特点 以资源为中心,所有东西都抽象成资源,所有行为都应该在资源上的 CRUD 操作 资源对应 OOP 中的对象 资源使用 URI 标识,每个资源实例都有唯一的 URI 标识 资源是有状态的,使用 JSON/XML 等在 HTTP Body 里表征资源的状态 客户端通过 HTTP 动词,对服务端资源进行操作,实现 Representational State Transfer 操作是无状态的,每个 RESTful API 请求都包...
Announcement
Things are always unexpected!






