Go 语言中文社区成立

February 3rd, 2010 BianJiang No comments
Go 中文社区
  1. Go官方网站
  2. Go中文官网
  3. 中文论坛(测试中…)
  4. 中文用户讨论组(邮件)
  5. 中文翻译(SVN)
  6. GitHub与Google Code同步(GIT)
  7. QQ群: 102319854(申请加入请到中文论坛留言)

Go中文文档翻译计划

  1. Install Go 初稿完成
  2. Go Tutorial 初稿完成
  3. Effective Go 初稿25%

翻译的详细信息参考 翻译计划

TODO

1. 创建一个wiki用于资料的收集和整理

2. 把翻译的中文文档发送给Go官方。

3. 翻译PKG相关的文档。

4. 创建一个Blog用于发布有关Go的新闻

5. 用Go做个具体的开源项目。

Categories: golang Tags: , , ,

传说中的中文编程

January 31st, 2010 BianJiang No comments
border@ubuntu:~/work/go/tutorial$ cat helloworld.go
package main
import fmt “fmt”
func 输出函数(s string) {
fmt.Printf(s)
}
func main() {
fmt.Printf(”Hello, 中文\n”)
变量 := “传说中的中文编程\n”
输出函数(变量)
}
border@ubuntu:~/work/go/tutorial$ 8g helloworld.go
border@ubuntu:~/work/go/tutorial$ 8l -o helloworld helloworld.8
border@ubuntu:~/work/go/tutorial$ ./helloworld
Hello, 中文
传说中的中文编程
GO中文资料参考: http://golang-china.org


Bian Jiang
Blog:  http://www.wifihack.net/

Categories: golang Tags: , , , ,

Go语言中的type 和 interface 相关的问题

January 30th, 2010 BianJiang No comments
在Go语言中,每个type都是不同的,这里的type和c语言中的typedef还是有些区别的,
在Go中不能用type派生出来的int类型数据去替换内置的int类型. 比如:
———————————————————-
border@wifihack:~/work/go/tutorial$ cat type1.go
package main
import “fmt”
type MyTypeA int
func printInt(i int) {
fmt.Printf(”%d\n”, i)
}
func main() {
var a MyTypeA = 0
printInt(a)
}
border@wifihack:~/work/go/tutorial$ 8g type1.go
type1.go:13: cannot use a (type MyTypeA) as type int in function argument
———————————————————-
你不能把type派生出来的int类型的MyTypeA传递给printInt(i int)函数。所以 MyTypeA 与 int 不能直接替换。
同样的道理如果你自己定义了2个相同的类型比如:
type MyTypeA int
type MyTypeB int
var a MyTypeA = 0
var b MyTypeB = 0
a = b 或 b = a 都是错误的,编译不通过。
如果你非要使用printInt(i int)这个函数也行,但是必须把传进去的数据类型转换为int类型。
printInt(a)
替换成
printInt(int(a))
就可以解决编译问题,但是Go提供了另一种解决方法接口(interface),你可以通过一个空接口来实现, 例如:
———————————————————-
border@wifihack:~/work/go/tutorial$ cat type2.go
package main
import “fmt”
type MyTypeA int
type Empty interface {}
func printInt(i Empty) {
fmt.Printf(”%d\n”, i)
}
func main() {
var a MyTypeA = 0
printInt(a)
}
border@wifihack:~/work/go/tutorial$ 8g type2.go
border@wifihack:~/work/go/tutorial$ 8l -o type2 type2.8
border@wifihack:~/work/go/tutorial$ ./type2
0
———————————————————-
如果使用接口(interface)就和类型无关,你也可以在printInt函数里面输出字符串看看效果:
———————————————————-
package main
import “fmt”
type MyTypeA int
type MyTypeB int
func printInt(i interface{}) {
fmt.Printf(”%d\n”, i)
fmt.Printf(”%s\n”, i)
}
func main() {
var a MyTypeA = 0
var b MyTypeB = 2
printInt(a)
printInt(b)
var s string = “Hello, 中文”
printInt(s)
}
border@wifihack:~/work/go/tutorial$ ./type
0
%s(main.MyTypeA=0)
2
%s(main.MyTypeB=2)
%d(string=Hello, 中文)
Hello, 中文
———————————————————-

参考: https://groups.google.com/group/golang-nuts/browse_thread/thread/bf4174fc5cbafa13#870a9034b11a8651

GO中文资料参考: http://golang-china.org

Bian Jiang
Blog:  http://www.wifihack.net/
Categories: golang Tags: , , , ,

GCC宣布对Google Go语言的支持

January 28th, 2010 BianJiang No comments

GCC项目组织宣布bumper320x180 允许gccgo(Google 推出的新语言GO)增加到gcc的主分支,更详细的信息可能要在GCC4.5或之后的版本中体现。 也就是说在不远的将来GO语言将是Linux的标配。

GO语言: http://www.golang.org

GO中文资料参考: http://golang-china.org

GO中文用户组: https://groups.google.com/group/golang-china/

Categories: OpenSource, golang Tags: , , ,

Google Code 与 Github代码同步

January 26th, 2010 BianJiang No comments
git config --global user.name "Bian Jiang"
git config --global user.email borderj@gmail.com
git svn clone https://golang-china.googlecode.com/svn/trunk -s
git remote add origin git@github.com:border/golang-china.git
git push origin master
git svn rebase // 本地与Goolge Code 代码同步
git push // 上传本地的代码到github
git svn dcommit // 上传本地的代码到Google Code 

在Github上创建ssh授权参考: http://wifihack.net/blog/2008/12/permission-denied-on-github/

–EOF–
http://www.wifihack.net

Categories: Tech.Notes Tags: , , , ,

百度被黑,被定向到伊朗网军网站

January 12th, 2010 BianJiang No comments

Baidu is suddenly unavailable, with sources all over China confirming this.

It seems that China’s most popular search engine, with a market share of over 77% has been hacked by Iranian hackers.

At present, the website is unavailable, but we have found a screenshot from Twitter user Budi Putra.

It seems that the website has had its DNS hacked by the “Iranian cyber Army”, the same guys that hacked Twitter a few weeks ago. The process, called DNS cache poisoning, is the corruption of an Internet server’s domain name system (DNS) table by replacing an Internet address with that of another, rogue address, in this case what the Iranian Cyber Army want you to see.

Exactly why The Iranian Cyber Army has decided to target Baidu.com is unknown but sources say it might be in relation to Iran’s nuclear ambitions, although no one is certain.

Can someone read Persian and translate this?

Update:

We’re being told the site is now accessible from some parts of the world. Still not so from Europe. Please let us know in the comments.

中文参考: http://solidot.org/articles/10/01/12/0046222.shtml

原文: http://thenextweb.com/asia/2010/01/12/breaking-baidu-hacked-iranian/

- Bian Jiang

http://www.wifihack.net