> 文档中心 > 50年前,Hello World发明者第一次提交的Go代码长这样……

50年前,Hello World发明者第一次提交的Go代码长这样……


整理 | 郭露
出品 | CSDN(ID:CSDNnews)

作为Unix的研发者与传奇代码“Hello World”的发明者,普林斯顿大学计算机科学系教授布莱恩·克尼汉(Brian W. Kernighan)是编程界的传奇人物。他曾参与创造了AMPL(数学编程语言)和AWK(文本处理工具),也曾和C语言之父丹尼斯·里奇(Dennis MacAlistair Ritchie)共同编写《C程序设计语言》(The C Programming Language)。

不仅如此,据调查,Brian W. Kernighan竟在1972年7月18日首次提交Go代码。

commit 7d7c6a97f815e9279d08cfaea7d5efb5e90695a8Author: Brian Kernighan Date:   Tue Jul 18 19:05:45 1972 -0500    hello, world    R=ken    DELTA=7  (7 added, 0 deleted, 0 changed)diff --git a/src/pkg/debug/macho/testdata/hello.b b/src/pkg/debug/macho/testdata/hello.bnew file mode 100644index 0000000000..05c4140424--- /dev/null+++ b/src/pkg/debug/macho/testdata/hello.b@@ -0,0 +1,7 @@+main( ) {+extrn a, b, c;+putchar(a); putchar(b); putchar(c); putchar('!*n');+} +a 'hell';+b 'o, w';+c 'orld';

在接下来的十多年中,布莱恩仍在不断进行修改:

  • 1974年1月20日01:02:03:布莱恩提交了convert to C,将B语言的Hello World改为C语言实现;
  • 1988年4月1日02:02:04:提交convert to Draft-Proposed ANSI C,将Hello
    World改为草案中提出的ANSI C实现;
  • 1988年4月1日02:03:04:提交last-minute fix: convert to ANSI C,最后修改,改为ANSI C实现。

1988年,布莱恩团队决定暂停更新。直到20年后的2007年9月,罗伯特·格瑞史莫(Robert Griesemer),罗勃·派克(Rob Pike)和肯·汤普逊(Ken Thompson)开始设计Go,提交了Go spec starting point。
直到现在,这些早期提交的文件(即最终的ANSI C 版本)仍保留在Go repo中。

【参考资料】
https://repography.com/blog/go-first-commit
https://github.com/golang/go/commit/0bb0b61d6a85b2a1a33dcbc418089656f2754d32
https://github.com/golang/go/commit/0744ac969119db8a0ad3253951d375eb77cfce9e
https://github.com/golang/go/commit/d82b11e4a46307f1f1415024f33263e819c222b8