7月 152014
 

 

参考文档: http://blog.studygolang.com/tag/directory/

  1. gopath 下三个目录
    • bin目录需要通过 $GOBIN 环境变量指定后使用
    • src目录是源文件目录
    • pkg目录是编译后的 .a 文件,不是放源文件的
  2. 关于包目录、包名、文件名的含义: 对于 phpor/test/first.go  ,其中:
    • phpor是包的目录名,import时,需要使用 import “phpor/test”
    • test 是包名, 如果first.go中有function hello(); 则,调用方式为: test.hello()
      • test目录中可以包含子目录和second.go
      • 对于test目录下的所有的 *.go 在编译后,会在pkg/phpor目录生成 test.a
      • 如果test目录中有一个目录 xxx, 则,xxx 下面的文件编译后会生成 pkg/phpor/test/xxx.a
    • first.go 可以随便命名,只是第一行必须为: package test

 

GO语言最佳实践: http://blog.jobbole.com/44608/

视频资料: http://vimeo.com/69237265

 

 Posted by at 下午 4:46

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据