I noticed that the first 4 revisions f6182e5abf5e
, b66d0bf8da3e
, ac3363d7e788
, 172d32922e72
of the Go source are all from long before Golang was even proposed, the oldest being from 1972. They are also all credited to Brian Kernighan of AWK-ward fame. They seem to be hello, world
implementations in C. Is this an easter-egg or is there some practical purpose?
Go的修订历史背后的故事是什么?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- douxi3432 2014-02-24 07:06关注
That thread mentions:
Homage, Easter egg, inside joke, take your pick :). Notice the authors of the commits in question too
Said thread references this commit as the starting point, but also points out to the actual first commit of the Golang project, with the first revision of the Go spec.
The (alleged) "author" of the four first commits is Brian Kernighan.
Rob Pike has worked with Brian in the 1980's, at Bell Labs, so this can be viewed as a reference to his professional origin.The idea of this Easter egg is to illustrate an evolution of an
Hello World
program in C:(See more with this recent GopherCon April 2014 talk
hellogophers.slide
- Rob Pike)
Hello, World
hg log -r 0:4 changeset: 0:f6182e5abf5e user: Brian Kernighan <bwk> date: Tue Jul 18 19:05:45 1972 -0500 summary: hello, world $ hg update -r 0 $ cat src/pkg/debug/macho/testdata/hello.b main( ) { extrn a, b, c; putchar(a); putchar(b); putchar(c); putchar('!*n'); } a 'hell'; b 'o, w'; c 'orld';
Convert to C
changeset: 1:b66d0bf8da3e user: Brian Kernighan <bwk> date: Sun Jan 20 01:02:03 1974 -0400 summary: convert to C $ hg update -r 1 $ cat src/pkg/debug/macho/testdata/hello.c main() { printf("hello, world"); }
Convert to Draft-Proposed ANSI C
changeset: 2:ac3363d7e788 user: Brian Kernighan <research!bwk> date: Fri Apr 01 02:02:04 1988 -0500 summary: convert to Draft-Proposed ANSI C $ hg update -r 2 $ cat src/pkg/debug/macho/testdata/hello.c #include <stdio.h> main() { printf("hello, world "); }
Last-minute fix: convert to ANSI C
changeset: 3:172d32922e72 user: Brian Kernighan <bwk@research.att.com> date: Fri Apr 01 02:03:04 1988 -0500 summary: last-minute fix: convert to ANSI C $ hg update -r 3 cat src/pkg/debug/macho/testdata/hello.c #include <stdio.h> int main(void) { printf("hello, world "); return 0; }
Go spec starting point
changeset: 4:4e9a5b095532 user: Robert Griesemer <gri@golang.org> date: Sun Mar 02 20:47:34 2008 -0800 summary: Go spec starting point.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
- ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
- ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
- ¥20 腾讯企业邮箱邮件可以恢复么
- ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
- ¥15 错误 LNK2001 无法解析的外部符号
- ¥50 安装pyaudiokits失败
- ¥15 计组这些题应该咋做呀
- ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
- ¥15 让node服务器有自动加载文件的功能