zoukankan      html  css  js  c++  java
  • 【GoLang】golang 报管理工具 Godep 介绍

    使用方法:

     

    提交:
    cd ${GOPATH}/src/github.com/junneyang/xcloud
    godep save -v ./...
    rm -rf vendor/
    git checkout --force


    git init
    git pull https://github.com/junneyang/xcloud.git master
    git add --all
    git commit -m "initial commit"
    git remote add origin https://github.com/junneyang/xcloud.git
    git push origin master


    使用:
    mkdir -p ${GOPATH}/src/github.com/junneyang
    cd $_ && git clone https://github.com/junneyang/xcloud.git -b release3.1
    cd ${GOPATH}/src/github.com/junneyang/xcloud

    godep get -v ./...
    godep/None go install -v ./...
    godep/None go test -v ./...

     

    参考开源项目codis

    https://github.com/CodisLabs/codis

    安装godep

    官方的安装文档是使用go get github.com/tools/godep,很可惜,因为“网络”问题会报一个找不到golang.org/x/tools/go/vcs的错误。

    https://github.com/golang/tools 是 golang.org/x/tools的一个镜像,代码是一样的,所以我是如下安装的。

    • go get github.com/golang/tools

    • GOPATHsrcgithub.com目录下就有tools文件夹。

    • src下和github.com平级新建golang.org文件下,在此文件夹下建x文件夹,然后将tools都复制进去。

    • 然后再执行go get github.com/tools/godep

    • 此时godep安装在你的GOPATHin目录下。

    使用godep

    建立一个演示项目来演示godep。

    • 此演示项目的路径要加入到GOPATH

    • 依赖的项目和项目本身都应该是个git repository

      • cd skeletonsrcwiselyman.orgapp

        git init 
        git add .
        git commit
        
      • cd skeletonsrcxx.orgdep

        git init
        git add .   
        git commit   
        
    • 项目目录及代码如图所示

     

    • skeletonsrcwiselyman.orgapp目录下,执行godep save,此时会生成Godeps文件夹

    • 这时你可以移除xx.org目录了。

    • 继续使用将用以下命令

    godep go run main.go
    godep go build
    godep go install
    godep go test



    参考资料:
    http://studygolang.com/articles/2147
    http://www.01happy.com/golang-package-tool-godep/
    https://github.com/tools/godep
    http://daozhao.goflytoday.com/2015/01/golang-godep/
    https://segmentfault.com/a/1190000003781342

    官方文档:https://github.com/tools/godep


  • 相关阅读:
    高二下期末考试
    LG月赛.7
    CF1187E
    P5440 【XR-2】奇迹
    P1084 疫情控制
    P1083 借教室
    P2680 运输计划
    P3128 [USACO15DEC]最大流Max Flow
    博弈入门
    HDU 1907
  • 原文地址:https://www.cnblogs.com/junneyang/p/6084974.html
Copyright © 2011-2022 走看看