`
cakin24
  • 浏览: 1328310 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

go get常用标记的使用

    博客分类:
  • Go
阅读更多

一 简介

-d:只执行下载动作,而不执行安装工作。
-fix:在下载代码包后先执行修正工作,而后再进行编译和安装。一些用老版本编写的代码通常会采用这种方式。


 
-u:利用网络来更新已有的代码包及其依赖包。
 
二 实战
  1. [root@localhost ~]# rm -rf golib/src/*
  2. [root@localhost ~]# rm -rf golib/pkg/*
  3. [root@localhost ~]# go get -d -x github.com/go-errors/errors
  4. cd .
  5. git clone https://github.com/go-errors/errors /root/golib/src/github.com/go-errors/errors
  6. cd /root/golib/src/github.com/go-errors/errors
  7. git submodule update --init --recursive
  8. cd /root/golib/src/github.com/go-errors/errors
  9. git show-ref
  10. cd /root/golib/src/github.com/go-errors/errors
  11. git submodule update --init --recursive
  12. [root@localhost ~]# cd golib/
  13. [root@localhost golib]# cd src/
  14. [root@localhost src]# ds
  15. /root/golib/src:
  16. github.com/
  17. go-errors/
  18. errors/
  19. LICENSE.MIT
  20. README.md
  21. cover.out
  22. error.go
  23. error_test.go
  24. parse_panic.go
  25. parse_panic_test.go
  26. stackframe.go
  27. [root@localhost src]# cd ../pkg
  28. [root@localhost pkg]# ds
  29. /root/golib/pkg:
  30. [root@localhost pkg]# go get -x github.com/go-errors/errors
  31. WORK=/tmp/go-build522349256
  32. mkdir -p $WORK/github.com/go-errors/errors/_obj/
  33. mkdir -p $WORK/github.com/go-errors/
  34. cd /root/golib/src/github.com/go-errors/errors
  35. /usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/go-errors/errors.a -trimpath $WORK -p github.com/go-errors/errors -complete -buildid 78ef51b733174e3cd41e63b5cd6becb2a7555b58-D _/root/golib/src/github.com/go-errors/errors -I $WORK -pack ./error.go ./parse_panic.go ./stackframe.go
  36. mkdir -p /root/golib/pkg/linux_amd64/github.com/go-errors/
  37. mv $WORK/github.com/go-errors/errors.a /root/golib/pkg/linux_amd64/github.com/go-errors/errors.a
  38. [root@localhost pkg]# ds
  39. /root/golib/pkg:
  40. linux_amd64/
  41. github.com/
  42. go-errors/
  43. errors.a
  44. [root@localhost pkg]# go get -x github.com/go-errors/errors
  45. WORK=/tmp/go-build613833899
  46. [root@localhost pkg]# go get -x -u github.com/go-errors/errors
  47. cd /root/golib/src/github.com/go-errors/errors
  48. git config remote.origin.url
  49. cd /root/golib/src/github.com/go-errors/errors
  50. git pull --ff-only
  51. cd /root/golib/src/github.com/go-errors/errors
  52. git submodule update --init --recursive
  53. cd /root/golib/src/github.com/go-errors/errors
  54. git show-ref
  55. cd /root/golib/src/github.com/go-errors/errors
  56. git submodule update --init --recursive
  57. WORK=/tmp/go-build749454420
  • 大小: 84.1 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics