<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Go语言精进之路 on Tony Bai</title><link>https://tonybai.com/tags/go%E8%AF%AD%E8%A8%80%E7%B2%BE%E8%BF%9B%E4%B9%8B%E8%B7%AF/</link><description>Recent content in Go语言精进之路 on Tony Bai</description><generator>Hugo</generator><language>zh-cn</language><copyright>2004-2026 Tony Bai. 版权所有.</copyright><lastBuildDate>Thu, 28 Aug 2025 00:00:00 +0800</lastBuildDate><atom:link href="https://tonybai.com/tags/go%E8%AF%AD%E8%A8%80%E7%B2%BE%E8%BF%9B%E4%B9%8B%E8%B7%AF/index.xml" rel="self" type="application/rss+xml"/><item><title>我的 Gopher “长期主义”：从《Go语言第一课》新书说起</title><link>https://tonybai.com/2025/08/28/go-primer-published/</link><pubDate>Thu, 28 Aug 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/08/28/go-primer-published/</guid><description>本文永久链接 – https://tonybai.com/2025/08/28/go-primer-published 大家好，我是Tony Bai。 前不久，在知乎上看到一个关于 Go 社区的帖子，其中一条评论让我感慨良多： &amp;gt; **“GopherChina 都没了，国内还有几人坚持？Tony Bai好像还在更新”** 短短一句话，道尽了社区的变迁与坚持的不易。这句来自读者的回答，让我内心欣慰，...</description></item><item><title>世界读书日：如何高效阅读“砖头”技术书？我的心法分享（文末赠书）</title><link>https://tonybai.com/2025/04/23/tips-for-reading-technical-books/</link><pubDate>Wed, 23 Apr 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/04/23/tips-for-reading-technical-books/</guid><description>世界读书日：如何高效阅读“砖头”技术书？我的心法分享（文末赠书） - Tony Bai =============== Tony Bai 一个程序员的心路历程 * Google Go语言编码风格规范 * Google Go语言编码风格规范：指南篇 * Google Go语言编码风格规范：决定篇 * Google Go语言编码风格规范：最佳实践篇 * Go语言第一课FAQ * Go语言进阶课FAQ ...</description></item><item><title>Go包构建：专家也未必了解的文件选择细节</title><link>https://tonybai.com/2024/11/21/go-source-file-selection-details-when-building-package/</link><pubDate>Thu, 21 Nov 2024 00:00:00 +0800</pubDate><guid>https://tonybai.com/2024/11/21/go-source-file-selection-details-when-building-package/</guid><description>本文永久链接 – https://tonybai.com/2024/11/21/go-source-file-selection-details-when-building-package 在Go语言开发中，包（package）是代码组织的基本单位，也是基本的构建单元。Go编译器会将每个包构建成一个目标文件(.a)，然后通过链接器将这些目标文件链接在一起，形成最终的可执行程序。 尽管Go包的构建过...</description></item><item><title>构建无密码认证：passkey入门与Go实现</title><link>https://tonybai.com/2024/11/01/introduction-to-passkey/</link><pubDate>Fri, 01 Nov 2024 00:00:00 +0800</pubDate><guid>https://tonybai.com/2024/11/01/introduction-to-passkey/</guid><description>本文永久链接 – https://tonybai.com/2024/11/01/introduction-to-passkey 传统的密码认证一直以来都是数字时代的主流身份验证方式。然而，用户常常选择易记的弱密码并重复使用，导致账号易受攻击。密码泄露、钓鱼攻击等安全问题层出不穷，超过80%的数据泄露与密码相关。 截图来自FIDO联盟官网 与此同时，频繁的密码管理和忘记密码情况严重影响用户体验。服务...</description></item><item><title>认知负荷对编程语言选择和学习的影响</title><link>https://tonybai.com/2024/10/24/cognitive-load-impact-on-programming-language-choice-and-study/</link><pubDate>Thu, 24 Oct 2024 00:00:00 +0800</pubDate><guid>https://tonybai.com/2024/10/24/cognitive-load-impact-on-programming-language-choice-and-study/</guid><description>认知负荷对编程语言选择和学习的影响 | Tony Bai =============== Tony Bai一个程序员的心路历程 * Google Go语言编码风格规范 * Google Go语言编码风格规范：指南篇 * Google Go语言编码风格规范：决定篇 * Google Go语言编码风格规范：最佳实践篇 * Go语言第一课FAQ * 关于我 * 文章列表 认知负荷对编程语言选择和学习的影...</description></item><item><title>与Thorsten Ball的共鸣：Go作为教学语言在技术写作中的优越性</title><link>https://tonybai.com/2024/10/09/resonating-with-thorsten-ball-on-go-in-technical-writing/</link><pubDate>Wed, 09 Oct 2024 00:00:00 +0800</pubDate><guid>https://tonybai.com/2024/10/09/resonating-with-thorsten-ball-on-go-in-technical-writing/</guid><description>与Thorsten Ball的共鸣：Go作为教学语言在技术写作中的优越性 | Tony Bai =============== Tony Bai一个程序员的心路历程 * Google Go语言编码风格规范 * Google Go语言编码风格规范：指南篇 * Google Go语言编码风格规范：决定篇 * Google Go语言编码风格规范：最佳实践篇 * Go语言第一课FAQ * 关于我 * 文章...</description></item><item><title>Go 1.23中的自定义迭代器与iter包</title><link>https://tonybai.com/2024/06/24/range-over-func-and-package-iter-in-go-1-23/</link><pubDate>Mon, 24 Jun 2024 00:00:00 +0800</pubDate><guid>https://tonybai.com/2024/06/24/range-over-func-and-package-iter-in-go-1-23/</guid><description>本文永久链接 – https://tonybai.com/2024/06/24/range-over-func-and-package-iter-in-go-1-23 在《Go 1.23新特性前瞻》一文中，我们提到了Go 1.23中增加的一个主要的语法特性就是**支持了用户自定义iterator**，即range over func试验特性的正式转正。为此，Go 1.23还在标准库中增加了iter...</description></item><item><title>Go 1.22新特性前瞻</title><link>https://tonybai.com/2023/12/25/go-1-22-foresight/</link><pubDate>Mon, 25 Dec 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/12/25/go-1-22-foresight/</guid><description>本文永久链接 – https://tonybai.com/2023/12/25/go-1-22-foresight 美国时间2023年12月20日，Go官方宣布Go 1.22rc1发布，开启了为期2个多月的、常规的公测之旅，Go 1.22预计将于2024.2月份正式发布！ 除了在官网下载Go 1.22rc1版本进行新特性体验之外，我们还可以通过在线的Go Playground选择“Go dev b...</description></item><item><title>通过实例理解Go Web身份认证的几种方式</title><link>https://tonybai.com/2023/10/23/understand-go-web-authn-by-example/</link><pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/10/23/understand-go-web-authn-by-example/</guid><description>本文永久链接 – https://tonybai.com/2023/10/23/understand-go-web-authn-by-example 在2023年Q1 Go官方用户调查报告中，API/RPC services、Websites/web services都位于使用Go开发的应用类别的头部(如下图)： 我个人使用Go开发已很多年，但一直从事底层基础设施、分布式中间件等方向，Web应用开...</description></item><item><title>Go项目目录该怎么组织？官方终于出指南了！</title><link>https://tonybai.com/2023/10/05/the-official-guide-of-organizing-go-project/</link><pubDate>Thu, 05 Oct 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/10/05/the-official-guide-of-organizing-go-project/</guid><description>本文永久链接 – https://tonybai.com/2023/10/05/the-official-guide-of-organizing-go-project 长久以来，在Go语言进阶的学习和实践之路上，Go项目目录究竟如何布局一直是困扰大家的一个问题，这是因为Go官方针对这个问题迟迟没有给出说法，更没有提供标准供大家参考。仅有Go语言项目技术负责人Russ Cox在一个开源项目的issu...</description></item><item><title>编译Go应用的黑盒挑战：无源码只有.a文件，你能搞定吗？</title><link>https://tonybai.com/2023/08/30/how-to-build-with-only-archive-in-go/</link><pubDate>Wed, 30 Aug 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/08/30/how-to-build-with-only-archive-in-go/</guid><description>本文永久链接 – https://tonybai.com/2023/08/30/how-to-build-with-only-archive-in-go 上周末，一个Gopher在微信上与我交流了一个有关Go程序编译的问题。他的述求说起来也不复杂，那就是合作公司提供的API包仅包括golang archive(使用go build -buildmode=archive构建的.a文件)，没有Go包的...</description></item><item><title>Go 1.21中值得关注的几个变化</title><link>https://tonybai.com/2023/08/20/some-changes-in-go-1-21/</link><pubDate>Sun, 20 Aug 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/08/20/some-changes-in-go-1-21/</guid><description>本文永久链接 – https://tonybai.com/2023/08/20/some-changes-in-go-1-21 美国时间2023年8月8日，Go团队在Go官博上正式发布了1.21版本！ 早在今年4月末，我就撰写了文章《Go 1.21新特性前瞻》，对Go 1.21可能引入的新特性、新优化和新标准库包做了粗略梳理。 在6月初举办的GopherChina 2023大会上，我又以“The ...</description></item><item><title>使用testify包辅助Go测试指南</title><link>https://tonybai.com/2023/07/16/the-guide-of-go-testing-with-testify-package/</link><pubDate>Sun, 16 Jul 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/07/16/the-guide-of-go-testing-with-testify-package/</guid><description>本文永久链接 – https://tonybai.com/2023/07/16/the-guide-of-go-testing-with-testify-package 我虽然算不上Go标准库的“清教徒”，但在测试方面还多是基于标准库testing包以及go test框架的，除了需要mock的时候，基本上没有用过第三方的Go测试框架。我在《Go语言精进之路》一书中对Go测试组织的讲解也是基于Go ...</description></item><item><title>Go语言反射编程指南</title><link>https://tonybai.com/2023/06/04/reflection-programming-guide-in-go/</link><pubDate>Sun, 04 Jun 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/06/04/reflection-programming-guide-in-go/</guid><description>本文永久链接 – https://tonybai.com/2023/06/04/reflection-programming-guide-in-go 反射是一种编程语言的高级特性，它允许程序在运行时检视自身的结构和行为。通过反射，程序可以动态地获取类型(type)与值(value)等信息，并对它们进行操作，诸如修改字段、调用方法等，这使得程序具有更大的灵活性和可扩展性。 不过，反射虽然具有强大的功...</description></item><item><title>单测时尽量用fake object</title><link>https://tonybai.com/2023/04/20/provide-fake-object-for-external-collaborators/</link><pubDate>Thu, 20 Apr 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/04/20/provide-fake-object-for-external-collaborators/</guid><description>本文永久链接 – https://tonybai.com/2023/04/20/provide-fake-object-for-external-collaborators 1\. 单元测试的难点：外部协作者(external collaborators)的存在 -------------------------------------------- 单元测试是软件开发的一个重要部分，它有助于在开...</description></item><item><title>使用go test框架驱动的自动化测试</title><link>https://tonybai.com/2023/03/30/automated-testing-driven-by-go-test/</link><pubDate>Thu, 30 Mar 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/03/30/automated-testing-driven-by-go-test/</guid><description>本文永久链接 – https://tonybai.com/2023/03/30/automated-testing-driven-by-go-test 一. 背景 ----- 团队的测试人员稀缺，无奈只能“自己动手，丰衣足食”，针对我们开发的系统进行自动化测试，这样**既节省的人力，又提高了效率，还增强了对系统质量保证的信心**。 我们的目标是让自动化测试覆盖三个环境，如下图所示： 我们看到这三个...</description></item><item><title>一文搞懂Go subtest</title><link>https://tonybai.com/2023/03/15/an-intro-of-go-subtest/</link><pubDate>Wed, 15 Mar 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/03/15/an-intro-of-go-subtest/</guid><description>&amp;gt; 注：本篇首图片基于lexica AI生成的图片二次加工而成。 本文永久链接 – https://tonybai.com/2023/03/15/an-intro-of-go-subtest 单元测试(unit testing)是软件开发中至关重要的一环，它存在的意义包括但不限于如下几个方面： * 提高代码质量：单元测试可以确保代码的正确性、可靠性和稳定性，从而减少代码缺陷和bug。 * 减少回归...</description></item><item><title>2022年博客回顾与总结</title><link>https://tonybai.com/2023/01/11/2022-blog-summary/</link><pubDate>Wed, 11 Jan 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/01/11/2022-blog-summary/</guid><description>本文永久链接 – https://tonybai.com/2023/01/11/2022-blog-summary 2022年对我来说，也是**十分忙碌和充实的一年**。尽管和2021年相比，成果物没那么多^\_^。 伴随着二宝的长大，我发现自己的闲暇时间被进一步“压缩”，还好大宝上初中后领悟到了自驱学习的重要性和相关方法后，她的学习现在基本不需要我过问了。 2022年初，《Go语言精进之路：从新...</description></item><item><title>通过实例理解Go标准库context包</title><link>https://tonybai.com/2022/11/08/understand-go-context-by-example/</link><pubDate>Tue, 08 Nov 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/11/08/understand-go-context-by-example/</guid><description>* **原weibo账号处于jy状态，临时先用小号 https://weibo.com/u/6484441286，欢迎大家关注！** * “Gopher部落”知识星球双十一新人特惠，领劵加入即享立减88元优惠 – https://t.zsxq.com/078E1QTjM 本文永久链接 – https://tonybai.com/2022/11/08/understand-go-context-by...</description></item><item><title>使用Go基于国密算法实现双向认证</title><link>https://tonybai.com/2022/07/17/two-way-authentication-using-go-and-sm-algorithm/</link><pubDate>Sun, 17 Jul 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/07/17/two-way-authentication-using-go-and-sm-algorithm/</guid><description>本文永久链接 – https://tonybai.com/2022/07/17/two-way-authentication-using-go-and-sm-algorithm 国内做2B(to Biz)或2G(to Gov)产品和解决方案的企业都绕不过**国密算法**，越来越多的国内甲方在采购需求中包含了基于国密算法的认证、签名、加密等需求。对于国内的车联网平台来说，支持基于国密的双向认证也是大...</description></item><item><title>GoCN社区Go读书会第二期：《Go语言精进之路》</title><link>https://tonybai.com/2022/07/07/gocn-community-go-book-club-issue2-go-programming-from-beginner-to-master/</link><pubDate>Thu, 07 Jul 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/07/07/gocn-community-go-book-club-issue2-go-programming-from-beginner-to-master/</guid><description>本文永久链接 – https://tonybai.com/2022/07/07/gocn-community-go-book-club-issue2-go-programming-from-beginner-to-master 本文是2022年6月26日我在**GoCN社区的Go读书会第二期《Go语言精进之路》直播的文字稿**。本文对直播的内容做了重新整理与修订，供喜欢阅读文字的朋友们在收看直播后...</description></item><item><title>评点2021-2022年上市的那些Go语言新书</title><link>https://tonybai.com/2022/06/01/reviewing-those-new-go-language-books-coming-out-in-2021-2022/</link><pubDate>Wed, 01 Jun 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/06/01/reviewing-those-new-go-language-books-coming-out-in-2021-2022/</guid><description>本文永久链接 – https://tonybai.com/2022/06/01/reviewing-those-new-go-language-books-coming-out-in-2021-2022 计算机科学与技术这个工业大类与传统工业类别相比还很“年轻”，并且由于历史原因，整个计算机科学与技术学科的奠基都是由欧美人完成的，因此但凡诞生一门新IT技术或新编程语言，我们首先参考的都是来自欧美的...</description></item><item><title>绞尽脑汁，帮你理解方法本质并选择正确的receiver类型</title><link>https://tonybai.com/2022/05/17/understand-the-nature-of-go-method-and-how-to-choose-the-correct-receiver-type/</link><pubDate>Tue, 17 May 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/05/17/understand-the-nature-of-go-method-and-how-to-choose-the-correct-receiver-type/</guid><description>本文永久链接 – https://tonybai.com/2022/05/17/understand-the-nature-of-go-method-and-how-to-choose-the-correct-receiver-type Go语言虽然不支持经典的面向对象语法元素，比如：类、对象、继承等，但Go语言也有方法（method）。和函数相比，Go语言中的方法在声明形式上仅仅多了一个参数，G...</description></item><item><title>我来告诉你Go项目标准结构如何布局</title><link>https://tonybai.com/2022/04/28/the-standard-layout-of-go-project/</link><pubDate>Thu, 28 Apr 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/04/28/the-standard-layout-of-go-project/</guid><description>本文永久链接 – https://tonybai.com/2022/04/28/the-standard-layout-of-go-project 每当我们编写一个非hello world的实用Go程序或库时，我们都会在项目结构、代码风格以及标识符命名这三个“门槛”前面踯躅徘徊许久，甚至始终得不到满意答案。 本文将通过《Go语言精进之路：从新手到高手的编程思想、方法与技巧》这本书的内容来详细看一看...</description></item><item><title>世界读书日：带你走近Go语言编程思维</title><link>https://tonybai.com/2022/04/23/taking-a-closer-look-at-programming-thinking-in-go/</link><pubDate>Sat, 23 Apr 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/04/23/taking-a-closer-look-at-programming-thinking-in-go/</guid><description>本文永久链接 – https://tonybai.com/2022/04/23/taking-a-closer-look-at-programming-thinking-in-go 经过十几年的演化和发展，Go语言在全世界范围内已经拥有了百万级别的拥趸，在这些开发者当中，除了一部分新入行的编程语言初学者之外，更多的是从其他编程语言阵营转过来的开发者。由于Go语言上手容易，在转Go的初期大家很快就掌...</description></item><item><title>Go字符串比较，终于有人讲清楚了</title><link>https://tonybai.com/2022/04/18/inside-go-string-comparison/</link><pubDate>Mon, 18 Apr 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/04/18/inside-go-string-comparison/</guid><description>本文永久链接 – https://tonybai.com/2022/04/18/inside-go-string-comparison 西娅(Thea)是一个刚刚入门Go语言的妹子程序员，今天她遇到了一个让她“surprise”的问题。下面就是那段让妹子西娅困惑的Go代码： func main() { s1 := &amp;#34;12345&amp;#34; s2 := &amp;#34;2&amp;#34; fmt.Println(`&amp;#34;12345&amp;#34; &amp;gt; &amp;#34;...</description></item><item><title>Go社区主流Kafka客户端简要对比</title><link>https://tonybai.com/2022/03/28/the-comparison-of-the-go-community-leading-kakfa-clients/</link><pubDate>Mon, 28 Mar 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/03/28/the-comparison-of-the-go-community-leading-kakfa-clients/</guid><description>本文永久链接 – https://tonybai.com/2022/03/28/the-comparison-of-the-go-community-leading-kakfa-clients 一. 背景 众所周知，Kafka是Apache开源基金会下的明星级开源项目，作为一个开源的分布式事件流平台，它被成千上万的公司用于高性能数据管道、流分析、数据集成和关键任务应用。在国内，无论大厂小厂，无论是...</description></item><item><title>Go是否支持增量构建？我来告诉你！</title><link>https://tonybai.com/2022/03/21/go-native-support-incremental-build/</link><pubDate>Mon, 21 Mar 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/03/21/go-native-support-incremental-build/</guid><description>本文永久链接 – https://tonybai.com/2022/03/21/go-native-support-incremental-build Go语言**以编译速度快闻名于码农界**。这缘于Go在设计之初就选择抛弃其祖辈C语言的头文件包含机制，选择了以包(package)作为基本编译单元。Go语言的这种以包为基本构建单元的构建模型使得依赖分析变得十分简单，避免了C语言那种通过头文件分析依...</description></item><item><title>Go语言map类型变量背后的那些事儿</title><link>https://tonybai.com/2022/03/15/the-underlying-of-a-map-type-variable/</link><pubDate>Tue, 15 Mar 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/03/15/the-underlying-of-a-map-type-variable/</guid><description>本文永久链接 – https://tonybai.com/2022/03/15/the-underlying-of-a-map-type-variable 切片(slice)和map是Go语言中最常用的两种原生复合数据类型，同时也是最容易使初学者感觉迷惑和“掉坑”的两个类型，这很大程度是因为Go runtime层的存在。什么是Go runtime层？可以参考我在《Go语言第一课FAQ》中的解释。 ...</description></item><item><title>Go究竟是否为空切片分配了底层数组</title><link>https://tonybai.com/2022/02/15/whether-go-allocate-underlying-array-for-empty-slice/</link><pubDate>Tue, 15 Feb 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/02/15/whether-go-allocate-underlying-array-for-empty-slice/</guid><description>本文永久链接 – https://tonybai.com/2022/02/15/whether-go-allocate-underlying-array-for-empty-slice 这周在“Go语言第一课”的留言区看到一位同学的这样一个问题： 切片是Go语言中的一个重要的语法元素，也是日常Go开发中使用最为频繁的语法元素。有过Go语言开发经验的童鞋估计大多都知道空切片(empty slice)...</description></item><item><title>2021年Go语言盘点：厉兵秣马强技能，蓄势待发新征程</title><link>https://tonybai.com/2022/01/16/the-2021-review-of-go-programming-language/</link><pubDate>Sun, 16 Jan 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/01/16/the-2021-review-of-go-programming-language/</guid><description>本文永久链接 – https://tonybai.com/2022/01/16/the-2021-review-of-go-programming-language 由于日常忙工作，闲时忙专栏，我早已策划的**2021年Go语言盘点**这篇文章一直拖到了2022年元旦之后才开始落笔。 2021年，Go迈过了其开源的第12个年头。虽然已经演进了10余年，但在编程语言这个领域中，Go依旧属于“小字辈”...</description></item><item><title>Go语言精进之路：为Gopher们准备的“知识年货”</title><link>https://tonybai.com/2022/01/15/go-programming-from-beginners-to-masters-is-published/</link><pubDate>Sat, 15 Jan 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/01/15/go-programming-from-beginners-to-masters-is-published/</guid><description>本文永久链接 – https://tonybai.com/2022/01/15/go-programming-from-beginners-to-masters-is-published 历时三年多编写的Go语言进阶类图书《Go语言精进之路：从新手到高手的编程思想、方法和技巧》系列1、2册终于在2021年12月17日出版了！ 2021年的最后一天，我收到了机械工业出版社华章分社编辑罗词亮老师从微信...</description></item></channel></rss>