Go语言的workspace

一个典型的Golang workspace包含3个文件夹:

src contains Go source files organized into packages (one package per directory),  
pkg contains package objects, and  
bin contains executable commands.

src包含这个工程的所有源码文件(包含依赖的第三方package的源码),pkg包含编译生成的package目标文件,而bin包含最后生成的可执行文件。下面是一个例子:

bin/
    hello                          # command executable
    outyet                         # command executable
pkg/
    linux_amd64/
        github.com/golang/example/
            stringutil.a           # package object
src/
    github.com/golang/example/
        .git/                      # Git repository metadata
    hello/
        hello.go               # command source
    outyet/
        main.go                # command source
        main_test.go           # test source
    stringutil/
        reverse.go             # package source
        reverse_test.go        # test source  

参考资料:
Workspaces

 

发表评论

邮箱地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.