zoukankan      html  css  js  c++  java
  • go mod 模式下安装cobra

    go mod 模式下安装cobra

    只有指明版本号才能成功安装

    ➜  ~ go get -u github.com/spf13/cobra/cobra@v1.0.0
    go: finding github.com/spf13/cobra/cobra v1.0.0
    go: finding github.com v1.0.0
    go: finding github.com/spf13 v1.0.0
    go: extracting github.com/spf13/viper v1.4.0
    go: downloading github.com/mitchellh/go-homedir v1.1.0
    go: extracting github.com/spf13/pflag v1.0.3
    go: extracting github.com/spf13/afero v1.1.2
    go: extracting github.com/spf13/cast v1.3.0
    go: extracting github.com/mitchellh/go-homedir v1.1.0
    go: downloading golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
    go: extracting golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
    go: finding github.com/pelletier/go-toml v1.8.0
    go: finding github.com/magiconair/properties v1.8.2
    go: finding golang.org/x/sys latest
    go: finding github.com/spf13/viper v1.7.1
    go: finding github.com/mitchellh/mapstructure v1.3.3
    go: finding github.com/spf13/afero v1.3.4
    go: downloading github.com/spf13/viper v1.7.1
    go: extracting github.com/spf13/viper v1.7.1
    go: downloading github.com/magiconair/properties v1.8.2
    go: downloading github.com/pelletier/go-toml v1.8.0
    go: downloading github.com/mitchellh/mapstructure v1.3.3
    go: downloading github.com/spf13/afero v1.3.4
    go: downloading golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8
    go: extracting github.com/mitchellh/mapstructure v1.3.3
    go: extracting github.com/pelletier/go-toml v1.8.0
    go: extracting github.com/magiconair/properties v1.8.2
    go: extracting github.com/spf13/afero v1.3.4
    go: extracting golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8
    go: finding gopkg.in/ini.v1 v1.60.1
    go: downloading gopkg.in/ini.v1 v1.60.1
    go: extracting gopkg.in/ini.v1 v1.60.1
    

    有了 go get 为什么还要 go install

    1. 概述
      玩 Go 的同学应该都见过这两条命令:go get 和 go install,他们功能类似,那么为什么要有这两条命令呢?本文将对他们的差异进行一个介绍。

    2. 两条命令的作用
      go get 的作用可以分为这么几个步骤:

    将源代码下载到本地, 编译下载的代码,并且安装到 GOPATH 中
    这里和 go install 的区别在会不会下载,所以 go install 的功能为:
    编译指定的代码,然后安装到 GOPATH 中

    1. 常用模式
      所以在很多时候,一个常用的操作模式是:

    通过 go get -d 下载模块代码
    修改下载下来的代码
    通过 go install 安装

    1. 其他说明
      go get 还通常用于在 Go Module 中添加依赖使用
      go get 的代码被下载到 $GOPATH/pkg/mod 目录下
    © 2017-2020 版权属于 QXQZX &
  • 相关阅读:
    ASP.NET操作DataTable各种方法总结(给Datatable添加行列、DataTable选择排序等)
    SharePoint服务器端对象模型 之 使用CAML进展数据查询
    django-rest_framwork 序列化
    django模型中的抽象类
    微博与本地用户绑定
    微博三方登陆--回调接口
    微博三方登陆开发平台新建APP
    生成微博授权的url(二维码登陆页面)
    博客第三方登陆原理
    redis的pipeline使用
  • 原文地址:https://www.cnblogs.com/iQXQZX/p/13568816.html
Copyright © 2011-2022 走看看