在Go项目中初始化git的位置

tom*_*456 4 go

作为Go的初学者,我不知道initGit 在哪里.

这里的文档https://golang.org/doc/code.html似乎在早期的hello目录之外建议,然后告诉我git inithello目录中运行.

对此提出任何建议都是有用的.

Von*_*onC 5

这个例子很清楚:

$ cd $GOPATH/src/github.com/user/hello
$ git init
Run Code Online (Sandbox Code Playgroud)

您在项目'hello'中初始化repo.
那样:


.git你看到的外面 hello(在同一页面上)是另一个项目:

src/
    github.com/golang/example/
        .git/                      # Git repository metadata
    hello/
        hello.go               # command source
Run Code Online (Sandbox Code Playgroud)

在这里,该项目是' example'并包括几个包,包括hello一个.