导航

2013年4月23日

摘要: go build 通过go build加上要编译的Go源文件名,我们即可得到一个可执行文件,默认情况下这个文件的名字为源文件名字去掉.go后缀。 $ go build hellogo.go$ lshellogo* hellogo.go 当然我们也 可以通过-o选项来指定其他名字: $ go build -o myfirstgo hellogo.go$ lsmyfirstgo* hellogo.g... 阅读全文

posted @ 2013-04-23 17:59 蝈蝈俊 阅读(26558) 评论(0) 推荐(1)

摘要: 这个例子比较简单: 只有一个聊天室,大家进入的都是同一个聊天室。 没有用户登录,用户登录直接根据id给出匿名用户。 程序截图,UI我直接用的https://github.com/Niessy/websocket-golang-chat 这里给的例子的Html代码。 服务器端Golang代码: package mai... 阅读全文

posted @ 2013-04-23 17:37 蝈蝈俊 阅读(2303) 评论(0) 推荐(0)

摘要: 我们用Golang做网站时,必然会有这样的代码: http.Handle("/", http.FileServer(http.Dir("."))) 注意这里的http.Handle( 函数的第二个参数,Golang的源码中这个函数的描述如下: // Handle registers the handler for the given pattern // in the DefaultServeM... 阅读全文

posted @ 2013-04-23 15:32 蝈蝈俊 阅读(1863) 评论(0) 推荐(0)