<?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>Unsafe on Tony Bai</title><link>https://tonybai.com/tags/unsafe/</link><description>Recent content in Unsafe on Tony Bai</description><generator>Hugo</generator><language>zh-cn</language><copyright>2004-2026 Tony Bai. 版权所有.</copyright><lastBuildDate>Tue, 16 Jun 2026 00:00:00 +0800</lastBuildDate><atom:link href="https://tonybai.com/tags/unsafe/index.xml" rel="self" type="application/rss+xml"/><item><title>为什么说“编译通过，就能运行”？Google 专家 Alice 揭秘 Rust 的工程美学与底层逻辑</title><link>https://tonybai.com/2026/06/16/why-if-it-compiles-it-runs-rust-engineering-aesthetics-and-logic/</link><pubDate>Tue, 16 Jun 2026 00:00:00 +0800</pubDate><guid>https://tonybai.com/2026/06/16/why-if-it-compiles-it-runs-rust-engineering-aesthetics-and-logic/</guid><description>本文永久链接 – https://tonybai.com/2026/06/16/why-if-it-compiles-it-runs-rust-engineering-aesthetics-and-logic 大家好，我是Tony Bai。 在软件工程界，有一句流传甚广、近乎玄学的名言：“如果你的 Rust 代码通过了编译，那么它就已经可以正确运行了。” 对于被 Java 的空指针异常（NullP...</description></item><item><title>从入门到极致：VictoriaMetrics 教你写出最高效的 Go 代码</title><link>https://tonybai.com/2026/01/12/victoriametrics-guide-most-efficient-go-code/</link><pubDate>Mon, 12 Jan 2026 00:00:00 +0800</pubDate><guid>https://tonybai.com/2026/01/12/victoriametrics-guide-most-efficient-go-code/</guid><description>本文永久链接 – https://tonybai.com/2026/01/12/victoriametrics-guide-most-efficient-go-code 大家好，我是Tony Bai。 在 InfluxDB 转Rust 之后，**VictoriaMetrics** 迅速崛起，成为了 Go 生态中无可争议的第一时序数据库。凭借其惊人的写入性能、极低的内存占用以及对 Prometheu...</description></item><item><title>从“源码审计”到“能力审计”：Go 生态应对供应链攻击的范式转移</title><link>https://tonybai.com/2026/01/02/go-supply-chain-attack-source-code-to-capability-auditing-paradigm-shift/</link><pubDate>Fri, 02 Jan 2026 00:00:00 +0800</pubDate><guid>https://tonybai.com/2026/01/02/go-supply-chain-attack-source-code-to-capability-auditing-paradigm-shift/</guid><description>本文永久链接 – https://tonybai.com/2026/01/02/go-supply-chain-attack-source-code-to-capability-auditing-paradigm-shift 大家好，我是Tony Bai。 在软件供应链安全的传统认知中，我们默认遵循一个假设：“代码即真理”。如果你审查了 GitHub 上的源码，确认它是安全的，那么你部署的服务就应...</description></item><item><title>一次 unwrap() 引发的全球宕机：Cloudflare 故障报告背后的 Rust 安全反思</title><link>https://tonybai.com/2025/11/19/cloudflare-18-november-2025-outage/</link><pubDate>Wed, 19 Nov 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/11/19/cloudflare-18-november-2025-outage/</guid><description>本文永久链接 – https://tonybai.com/2025/11/19/cloudflare-18-november-2025-outage 大家好，我是Tony Bai。 2025 年 11 月 18 日，世界标准时间(UTC) 11:20，支撑着全球大量互联网流量的 Cloudflare 网络开始出现严重故障。无数网站和应用的用户，开始频繁地看到那令人心悸的“Internal Serv...</description></item><item><title>Go 零拷贝“最后一公里”：Peek API背后的设计哲学与权衡</title><link>https://tonybai.com/2025/10/10/proposal-add-buffer-peek/</link><pubDate>Fri, 10 Oct 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/10/10/proposal-add-buffer-peek/</guid><description>本文永久链接 – https://tonybai.com/2025/10/10/proposal-add-buffer-peek 大家好，我是Tony Bai。 在 Go 的世界里，io.Reader 是一个神圣的接口。它如同一条设计精良、四通八达的高速公路，为数据流的传输提供了统一、优雅的抽象。然而，在这条高速公路的尽头，当数据流的目的地就在眼前——一块已然存在的内存（[]byte）时，我们却常...</description></item><item><title>“可移植性”的隐藏成本：Go为何要重塑maphash并划定新的运行时边界？</title><link>https://tonybai.com/2025/09/23/go-maphash-portability-costs-and-runtime-boundaries/</link><pubDate>Tue, 23 Sep 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/09/23/go-maphash-portability-costs-and-runtime-boundaries/</guid><description>本文永久链接 – https://tonybai.com/2025/09/23/go-maphash-portability-costs-and-runtime-boundaries 大家好，我是Tony Bai。 对于大多数Go开发者来说，标准库似乎是一个浑然天成的整体。我们理所当然地使用着fmt、net/http和encoding/json，很少去思考它们内部的依赖关系和架构边界。然而，在标准...</description></item><item><title>purego 标签到底是什么意思？一场长达六年的社区辩论终于有了定论</title><link>https://tonybai.com/2025/08/01/proposal-purego/</link><pubDate>Fri, 01 Aug 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/08/01/proposal-purego/</guid><description>purego 标签到底是什么意思？一场长达六年的社区辩论终于有了定论 - Tony Bai Tony Bai 一个程序员的心路历程 * Google Go语言编码风格规范 * Google Go语言编码风格规范：指南篇 * Google Go语言编码风格规范：决定篇 * Google Go语言编码风格规范：最佳实践篇 * Go语言第一课FAQ * Go语言进阶课FAQ * 关于我 * 我的技术专栏...</description></item><item><title>Rust 的安全神话？数据库 CEO 为何在关键系统中仍选 C++</title><link>https://tonybai.com/2025/07/22/cedardb-choose-cpp-rather-than-rust/</link><pubDate>Tue, 22 Jul 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/07/22/cedardb-choose-cpp-rather-than-rust/</guid><description>Rust 的安全神话？数据库 CEO 为何在关键系统中仍选 C++ - Tony Bai Tony Bai 一个程序员的心路历程 * Google Go语言编码风格规范 * Google Go语言编码风格规范：指南篇 * Google Go语言编码风格规范：决定篇 * Google Go语言编码风格规范：最佳实践篇 * Go语言第一课FAQ * Go语言进阶课FAQ * 关于我 * 我的技术专栏 ...</description></item><item><title>解读“Cheating the Reaper”：在Go中与GC共舞的Arena黑科技</title><link>https://tonybai.com/2025/05/06/cheating-the-reaper-in-go/</link><pubDate>Tue, 06 May 2025 00:00:00 +0800</pubDate><guid>https://tonybai.com/2025/05/06/cheating-the-reaper-in-go/</guid><description>解读“Cheating the Reaper”：在Go中与GC共舞的Arena黑科技 - Tony Bai =============== Tony Bai 一个程序员的心路历程 * Google Go语言编码风格规范 * Google Go语言编码风格规范：指南篇 * Google Go语言编码风格规范：决定篇 * Google Go语言编码风格规范：最佳实践篇 * Go语言第一课FAQ * G...</description></item><item><title>Gopher的Rust第一课：Rust的那些事儿</title><link>https://tonybai.com/2024/04/22/gopher-rust-first-lesson-all-about-rust/</link><pubDate>Mon, 22 Apr 2024 00:00:00 +0800</pubDate><guid>https://tonybai.com/2024/04/22/gopher-rust-first-lesson-all-about-rust/</guid><description>本文永久链接 – https://tonybai.com/2024/04/22/gopher-rust-first-lesson-all-about-rust 要说这两年后端编程语言谁最火，Rust说自己第二，没人敢说第一。Rust连续8年霸榜stackoverflow最受推崇的编程语言，甚至被推特之父Jack Dorsey称为“完美的编程语言”： &amp;gt; 注：最火：仅代表人气最旺，最受欢迎，但并不代...</description></item><item><title>2023年Go语言盘点：稳中求新，稳中求变</title><link>https://tonybai.com/2023/12/31/the-2023-review-of-go-programming-language/</link><pubDate>Sun, 31 Dec 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/12/31/the-2023-review-of-go-programming-language/</guid><description>本文永久链接 – https://tonybai.com/2023/12/31/the-2023-review-of-go-programming-language 时光荏苒，转眼间已经是2023年的最后一天了。《2022年Go语言盘点：泛型落地，无趣很好，稳定为王》仿佛就写在昨天。 回首这一年，全球彻底从新冠大流行中得以复苏，Go语言也不例外，最直观的表现就是**全球各地的GopherCon技术...</description></item><item><title>理解unsafe-assume-no-moving-gc包</title><link>https://tonybai.com/2023/04/16/understanding-unsafe-assume-no-moving-gc/</link><pubDate>Sun, 16 Apr 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/04/16/understanding-unsafe-assume-no-moving-gc/</guid><description>本文永久链接 – https://tonybai.com/2023/04/16/understanding-unsafe-assume-no-moving-gc 1\. 背景 ------ 在之前的《Go与神经网络：张量计算》一文中，不知道大家是否发现了，所有例子代码执行时，前面都加了一个环境变量ASSUME\_NO\_MOVING\_GC\_UNSAFE\_RISK\_IT\_WITH，就像下面...</description></item><item><title>Go 1.20中值得关注的几个变化</title><link>https://tonybai.com/2023/02/08/some-changes-in-go-1-20/</link><pubDate>Wed, 08 Feb 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/02/08/some-changes-in-go-1-20/</guid><description>本文永久链接 – https://tonybai.com/2023/02/08/some-changes-in-go-1-20 美国时间2023年2月1日，唯一尚未退休的Go语言之父Robert Griesemer代表Go核心开发团队在Go官博撰文正式发布了Go 1.20版本。就像Russ Cox在2022 GopherCon大会所说的那样：**Go2永不会到来，Go 1.x.y将无限延续**！ ...</description></item><item><title>聊聊Prometheus Gauge的增减操作实现</title><link>https://tonybai.com/2023/01/10/how-prometheus-gauge-add-and-sub/</link><pubDate>Tue, 10 Jan 2023 00:00:00 +0800</pubDate><guid>https://tonybai.com/2023/01/10/how-prometheus-gauge-add-and-sub/</guid><description>本文永久链接 – https://tonybai.com/2023/01/10/how-prometheus-gauge-add-and-sub 1\. Gauge是啥？ 熟悉Prometheus的小伙伴们都知道Prometheus提供了四大指标类型： * Counter * Gauge * Histogram * Summary Histogram和Summary是一类，但理解起来稍复杂一些，这...</description></item><item><title>Go类型系统：有何与众不同</title><link>https://tonybai.com/2022/12/18/go-type-system/</link><pubDate>Sun, 18 Dec 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/12/18/go-type-system/</guid><description>本文永久链接 – https://tonybai.com/2022/12/18/go-type-system Go是一门强类型的静态编程语言。使用Go编程，我们的每一行代码几乎都离不开**类型**。因此，深入学习Go，我们首先要对Go的类型系统(type system)有一个全面和深入的认知。Go类型系统可以给予我们一个全局整体的视角，以帮助我们更好地学习和理解Go语言中那些具体的与类型相关的内容...</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>Go编程语言与环境：万字长文复盘导致Go语言成功的那些设计决策[译]</title><link>https://tonybai.com/2022/05/04/the-paper-of-go-programming-language-and-environment/</link><pubDate>Wed, 04 May 2022 00:00:00 +0800</pubDate><guid>https://tonybai.com/2022/05/04/the-paper-of-go-programming-language-and-environment/</guid><description>本文永久链接 – https://tonybai.com/2022/05/04/the-paper-of-go-programming-language-and-environment 美国计算机学会通讯(Communications of the ACM)期刊2022年5月第65卷第5期将发表一篇有关Go语言的综述类Paper：《Go编程语言与环境》，这类综述类文章只有资深的Go核心团队的人才“...</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>Go 1.17新特性详解：使用基于寄存器的调用惯例</title><link>https://tonybai.com/2021/08/20/using-register-based-calling-convention-in-go-1-17/</link><pubDate>Fri, 20 Aug 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/08/20/using-register-based-calling-convention-in-go-1-17/</guid><description>本文永久链接 – https://tonybai.com/2021/08/20/using-register-based-calling-convention-in-go-1-17 除了Go语言特性与go module有重要变化之外，Go编译器与Go运行时也都有着优化与改进，这两方面的变化对Go程序的构建与运行影响巨大。在这个系列的最后一篇中，我们来看看编译器与运行时中那些值得关注的变化。 1. ...</description></item><item><title>Go 1.17新特性详解：支持将切片转换为数组指针</title><link>https://tonybai.com/2021/08/18/go-language-specs-changes-in-go-1-17/</link><pubDate>Wed, 18 Aug 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/08/18/go-language-specs-changes-in-go-1-17/</guid><description>本文永久链接 – https://tonybai.com/2021/08/18/go-language-specs-changes-in-go-1-17 Go属于那种极简的语言，从诞生到现在语言自身特性变化很小，不会像其他主流语言那样走“你有的我也要有”的特性融合路线。因此新语言特性对于Gopher来说属于“稀缺品”，属于“供不应求”那类事物^\_^。这也直接导致了每次Go新版本发布，我们都要首先...</description></item><item><title>Go 1.17中值得关注的几个变化</title><link>https://tonybai.com/2021/08/17/some-changes-in-go-1-17/</link><pubDate>Tue, 17 Aug 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/08/17/some-changes-in-go-1-17/</guid><description>本文永久链接 – https://tonybai.com/2021/08/17/some-changes-in-go-1-17 Go核心开发团队在去年GopherCon大会上给Go泛型的定调是在2022年2月份的Go 1.18版本中发布，那可是自Go诞生以来语法规范变动最大的一次，这让包括笔者在内的全世界的Gopher们都满怀期待。 不过别忘了，在Go 1.18这个“网红版本”发布前，还有一个“实...</description></item><item><title>使用reflect包在反射世界里读写各类型变量</title><link>https://tonybai.com/2021/04/19/variable-operation-using-reflection-in-go/</link><pubDate>Mon, 19 Apr 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/04/19/variable-operation-using-reflection-in-go/</guid><description>本文永久链接 – https://tonybai.com/2021/mm/dd/variable-operation-using-reflection-in-go Go在标准库中提供的reflect包让Go程序具备运行时的反射能力(reflection)，但这种反射能力也是一把“双刃剑”，它在解决一类特定问题方面具有优势，但也带来了逻辑不清晰、性能问题以及难于发现问题和调试等不足。不过从Go诞生伊...</description></item><item><title>Go语言的“黑暗角落”：盘点学习Go语言时遇到的那些陷阱[译]（第二部分）</title><link>https://tonybai.com/2021/03/29/darker-corners-of-go-part2/</link><pubDate>Mon, 29 Mar 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/03/29/darker-corners-of-go-part2/</guid><description>本文翻译自Rytis Bieliunas的文章《Darker Corners of Go》。 第一部分参见[《Go语言的“黑暗角落”：盘点学习Go语言时遇到的那些陷阱\[译\]（第一部分）》](https://tonybai.com/2021/03/29/darker-corners-of-go-part1) 7\. 字符串和字节数组 ------------ 1) Go中的字符串 Go字符串的内...</description></item><item><title>Go语言的“黑暗角落”：盘点学习Go语言时遇到的那些陷阱[译]（第一部分）</title><link>https://tonybai.com/2021/03/29/darker-corners-of-go-part1/</link><pubDate>Mon, 29 Mar 2021 00:00:00 +0800</pubDate><guid>https://tonybai.com/2021/03/29/darker-corners-of-go-part1/</guid><description>本文翻译自Rytis Bieliunas的文章《Darker Corners of Go》。 &amp;gt; 译注：若干年前，Kyle Quest曾发过一篇名为“50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs”的文章，仿效著名的《C Traps and Pitfalls》编写了50条Go语言的陷阱与缺陷，一时在G...</description></item><item><title>Go 1.15中值得关注的几个变化</title><link>https://tonybai.com/2020/10/11/some-changes-in-go-1-15/</link><pubDate>Sun, 11 Oct 2020 00:00:00 +0800</pubDate><guid>https://tonybai.com/2020/10/11/some-changes-in-go-1-15/</guid><description>Go 1.15版本在8月12日就正式发布了，给我的感觉就是发布的挺痛快^\_^。这种感觉来自与之前版本发布时间的对比：Go 1.13版本发布于当年的9月4日，更早的Go 1.11版本发布于当年的8月25日。 不过这个时间恰与我家二宝出生和老婆月子时期有重叠，每天照顾孩子团团转的我实在抽不出时间研究Go 1.15的变化:(。如今，我逐渐从照顾二宝的工作中脱离出来^\_^，于是“Go x.xx版本值得...</description></item><item><title>Go 1.14中值得关注的几个变化</title><link>https://tonybai.com/2020/03/08/some-changes-in-go-1-14/</link><pubDate>Sun, 08 Mar 2020 00:00:00 +0800</pubDate><guid>https://tonybai.com/2020/03/08/some-changes-in-go-1-14/</guid><description>可能是得益于2020年2月26日Go 1.14的发布，在2020年3月份的TIOBE编程语言排行榜上，Go重新进入TOP 10，而去年同期Go仅排行在第18位。虽然Go语言以及其他主流语言在榜单上的“上蹿下跳”让这个榜单的权威性饱受质疑:)，但Go在这样的一个时间节点能进入TOP 10，对于Gopher和Go社区来说，总还是一个不错的结果。并且在一定层度上说明：Go在努力耕耘十年后，已经在世界主流...</description></item><item><title>Go 1.10中值得关注的几个变化</title><link>https://tonybai.com/2018/02/17/some-changes-in-go-1-10/</link><pubDate>Sat, 17 Feb 2018 00:00:00 +0800</pubDate><guid>https://tonybai.com/2018/02/17/some-changes-in-go-1-10/</guid><description>又到了Go语言新版本的发布时间窗口了！这次的主角是Go 1.10。 曾几何时， 这是很多Gopher在Go 1.8、Go 1.9时猜测是否存在的那个版本，毕竟minor version即将进化到两位数。从Go语言第一封设计mail发出到现在的十年间，尤其是Go语言经历了近几年的爆发式增长，基本奠定了云原生第一语言的位置之后，人们对Go语言有了更多新的、更为深刻的认知，同时对这门编程语言也有了更多的...</description></item></channel></rss>