dougang6821 2013-09-05 13:30
浏览 24
已采纳

去工作区中的多个项目

In Go, the workspace contains the src, pkg and bin directories. How do I create multiple projects in the workspace, each with its own src, pkg, bin directories, such that I can 'go get' packages into the pkg directory of a particular project.

  • 写回答

3条回答 默认 最新

  • douwengzao5790 2013-09-05 13:35
    关注

    You probably do not need that. Let's forget also the word "workspace" it's probably only confusing you.

    If you set your GOPATH environment variable that that's all you actually need to have multiple projects independently sitting on you hard disk.

    For example, having export GOPATH="$HOME", and performing

    $ go get github.com/foo/bar
    $ go get github.com/baz/qux
    

    Your directory tree will be

    $GOPATH/pkg...
            compiled packages
    $GOPATH/src/github.com/foo/bar
            bar.go
    $GOPATH/src/github.com/baz/qux
            qux.go
    

    More details here. Note that it does talk about workspaces, but I still consider that fact very unfortunate. The earlier versions of that doc did not use nor define the concept and they were useful anyway. That's IMO a proof of it (the workspace) being redundant.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容