Quantcast
Channel: Tony Bai
Browsing all 509 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

聊聊godoc、go doc与pkgsite

本文永久链接 – https://tonybai.com/2023/03/20/godoc-vs-go-doc-vs-pkgsite 就像上一篇文章聊到的Go内置单元测试框架一样,既重视语言特性,又不忘对Go软件项目提供整体环境特性的Go在诞生伊始就定义了如何在源码中通过注释编写代码文档的格式,并提供了基于代码注释实时生成Go文档并支持文档查看的工具。...

View Article


Image may be NSFW.
Clik here to view.

聊聊Go语言的全局变量

本文永久链接 – https://tonybai.com/2023/03/22/global-variable-in-go 注:上面篇首配图的底图由百度文心一格生成。 C语言是Go语言的先祖之一,Go继承了很多C语言的语法与表达方式,这其中就包含了全局变量,虽然Go在其语法规范中并没有直接给出全局变量的定义。但是已经入门Go的童鞋都知道,在Go中包的导出变量(exported...

View Article


Image may be NSFW.
Clik here to view.

Go开发命令行程序指南

注:上面篇首配图的底图由百度文心一格生成。 本文永久链接 – https://tonybai.com/2023/03/25/the-guide-of-developing-cli-program-in-go 近期在Twitter上看到一个名为“Command Line Interface...

View Article

Image may be NSFW.
Clik here to view.

使用go test框架驱动的自动化测试

本文永久链接 – https://tonybai.com/2023/03/30/automated-testing-driven-by-go-test 一. 背景 团队的测试人员稀缺,无奈只能“自己动手,丰衣足食”,针对我们开发的系统进行自动化测试,这样既节省的人力,又提高了效率,还增强了对系统质量保证的信心。 我们的目标是让自动化测试覆盖三个环境,如下图所示: 我们看到这三个环境分别是:...

View Article

Image may be NSFW.
Clik here to view.

一文告诉你哪些map element类型支持就地更新

本文永久链接 – https://tonybai.com/2023/04/02/map-element-types-support-in-place-update 年初,我代表团队和人民邮电出版社签订了翻译《Go Fundamentals》一书的合同,本月底便是四分之一进度的交稿时间点,近期闲时我们都在忙着做交叉review。...

View Article


Image may be NSFW.
Clik here to view.

一文告诉你当module path为main时执行go test失败的真正原因

本文永久链接 – https://tonybai.com/2023/04/08/the-reason-why-go-test-fails-when-module-path-is-main 近期收到新加入“Gopher部落”知识星球的星友“凌风”的一个问题,内容如下: 在一个目录下,我编写了a.go和a_test.go,在go mod init main后执行go test,会报错:could...

View Article

Image may be NSFW.
Clik here to view.

理解unsafe-assume-no-moving-gc包

本文永久链接 – https://tonybai.com/2023/04/16/understanding-unsafe-assume-no-moving-gc 1. 背景 在之前的《Go与神经网络:张量计算》一文中,不知道大家是否发现了,所有例子代码执行时,前面都加了一个环境变量ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH,就像下面这样:...

View Article

Image may be NSFW.
Clik here to view.

单测时尽量用fake object

本文永久链接 – https://tonybai.com/2023/04/20/provide-fake-object-for-external-collaborators 1. 单元测试的难点:外部协作者(external collaborators)的存在...

View Article


Image may be NSFW.
Clik here to view.

Go 1.21新特性前瞻

本文永久链接 – https://tonybai.com/2023/04/26/go-1-21-foresight Go 1.21版本正在如火如荼地开发当中,按照Go核心团队的一年两次的发布节奏来算,Go 1.21版本预计将在2023年8月发布(Go 1.20版本是在2023年2月份发布的)。 本文将和大家一起看看Go...

View Article


Image may be NSFW.
Clik here to view.

Go:值与指针

本文永久链接 – https://tonybai.com/2023/05/05/go-value-and-pointer 1. 计算机中的值...

View Article

Image may be NSFW.
Clik here to view.

Go项目组织:在单一repo中管理多个Go module指南

本文永久链接 – https://tonybai.com/2023/05/10/a-guide-of-managing-multiple-go-modules-in-mono-repo 0. 单repo单module管理回顾 众所周知,Go在1.11版本中引入了go module,随着近几年Go module机制的逐渐成熟,它已经被Go团队确定为Go标准的依赖管理与构建方案,原先的GOPATH...

View Article

Image may be NSFW.
Clik here to view.

Go错误处理:错误链使用指南

本文永久链接 – https://tonybai.com/2023/05/14/a-guide-of-using-go-error-chain 0. Go错误处理简要回顾 Go是一种非常强调错误处理的编程语言。在Go中,错误被表示为实现了error接口的类型的值,error接口只有一个方法: type error interface { Error() string }...

View Article

Image may be NSFW.
Clik here to view.

Go与神经网络:张量运算

本文永久链接 – https://tonybai.com/2023/05/21/go-and-nn-part1-tensor-operations 0. 背景 2023年年初,我们很可能是见证了一次新工业革命的起点,也可能是见证了AGI(Artificial general...

View Article


Image may be NSFW.
Clik here to view.

聊聊Go语言的控制语句

本文永久链接 – https://tonybai.com/2023/05/27/control-flow-statement-in-go 在高级编程语言中,控制流语句(control-flow statement)是一类用于控制程序执行流程的语句,以下简称为控制语句。它们可以根据条件或循环执行相应的代码块,或者跳转到指定位置执行代码。 常见的控制语句包括:...

View Article

Image may be NSFW.
Clik here to view.

理解时序数据库的时间线

本文永久链接 – https://tonybai.com/2023/05/28/understand-time-series-of-tsdb...

View Article


Image may be NSFW.
Clik here to view.

Go语言反射编程指南

本文永久链接 – https://tonybai.com/2023/06/04/reflection-programming-guide-in-go 反射是一种编程语言的高级特性,它允许程序在运行时检视自身的结构和行为。通过反射,程序可以动态地获取类型(type)与值(value)等信息,并对它们进行操作,诸如修改字段、调用方法等,这使得程序具有更大的灵活性和可扩展性。...

View Article

Image may be NSFW.
Clik here to view.

Go GC:了解便利背后的开销

本文永久链接 – https://tonybai.com/2023/06/13/understand-go-gc-overhead-behind-the-convenience 注:本文部分摘录自GopherChina 2023前的《Go高级工程师训练营》课程。 1. 简介...

View Article


Image may be NSFW.
Clik here to view.

Go语言包设计指南

本文永久链接 – https://tonybai.com/2023/06/18/go-package-design-guide 1. Go包的认知 1.1 Go包是基本功能单元 我们知道Go包是Go编程语言中的一个重要概念,它是一组相关的Go源代码文件。并且,在Go中,每个Go源文件都必须属于一个包。...

View Article

Image may be NSFW.
Clik here to view.

Go语言开发者的Apache Arrow使用指南:数据类型

本文永久链接 – https://tonybai.com/2023/06/25/a-guide-of-using-apache-arrow-for-gopher-part1 如果你不是做大数据分析的,提到Arrow这个词,你可能会以为我要聊聊那个箭牌卫浴或是箭牌口香糖(注:其实箭牌口香糖使用的单词并非Arrow)。其实我要聊的是Apache的一个顶级项目:Arrow。...

View Article

Image may be NSFW.
Clik here to view.

Go语言开发者的Apache Arrow使用指南:内存管理

本文永久链接 – https://tonybai.com/2023/06/30/a-guide-of-using-apache-arrow-for-gopher-part2 如果你看了上一篇《Go语言开发者的Apache...

View Article
Browsing all 509 articles
Browse latest View live