Golang教程中我不清楚如何将Golang代码放到Github中,以便能够在稍后从Github中将该代码作为一个包导入。如何将Golang项目(一组包)放到Github上?
这是从Golang教程http://golang.org/doc/code.html一个例子项目工作区(目录结构):
bin/
hello # command executable
pkg/
linux_amd64/ # this will reflect your OS and architecture
github.com/user/
newmath.a # package object
src/
github.com/user/
hello/
hello.go # command source
newmath/
sqrt.go # package source
那么,什么才是我需要做的,我在哪里需要git init
在此工作空间,能够后来:
只导入
newmath
包到我的一些单独的项目。通过这种方式:import "github.com/user/newmath"
要获得唯一
hello.exe
可执行文件。获取整个项目工作区(所有目录:bin,pkg,src)。