zoukankan      html  css  js  c++  java
  • go module使用

    新建一个MODULE

    1、go mod init  project-name

    2、git push git-url

    3、git tag 版本

    4、本地使用获取 go get  git-url  版本号

    引入本地包

    本地包,只需要替换路径即可

    私有库,非正常引用

    1、配置 ssh 下载访问私有库

    2、配置 git config url."git@192.168.1.133:server/gosdk.git".insteadof "https://github.com/cninct/gosdk"   包git重定向

    3、项目中直接  go get   github.com/cninct/gosdk 

    或者

    require   github.com/cninct/gosdk  version即可使用

    版本

    go.mod中的包后面手动输入latest github.com/nfnt/resize latest,go将自动(go list)帮你生成一个版本号 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646

    引用别人的包的时候可以在go.mod 中指定version的版本,但是什么都不指定也可以,默认是latest,也就是你直接go get github.com/xx/app的时候它自动就是引入latest的版本了

    要指定某个版本,你在go.mod 改了就行

    无法使用goalng.org/x的包

    使用github上的镜像包 例如说是 github.com/golang/x/net/html 在你的项目的go.mod 中 加入 replace golang.org/x/net/html => github.com/golang/x/net/html

  • 相关阅读:
    STL中的string
    STL中的map
    STL中的set和multiset
    C++基础知识
    希尔排序
    桶排序
    归并排序
    堆排序
    数组左边奇数右边偶数算法O(n)
    背包问题 洛谷P1164 小A点菜
  • 原文地址:https://www.cnblogs.com/forgo/p/14648981.html
Copyright © 2011-2022 走看看