zoukankan      html  css  js  c++  java
  • go get: zip for github.com/aliyun/aliyun-oss-go-sdk@v2.0.0 has unexpected file github.com/aliyun/aliyun-oss-go-sdk@v0.0.0-20190618055949-e8251f77f2ba/.travis.yml

    如使用 go get 时往往会速度很慢或者压根无法下载下来,如下所示:

    E:gosrccodeBlock>go get github.com/aliyun/aliyun-oss-go-sdk/oss
    go: downloading github.com/aliyun/aliyun-oss-go-sdk v2.0.0
    go get github.com/aliyun/aliyun-oss-go-sdk/oss: zip for github.com/aliyun/aliyun-oss-go-sdk@v2.0.0 has unexpected file github.com/aliyun/aliyun-oss-go-sdk@v0.0.0-20190618055949-e8251f77f2ba/.travis.yml
    

    先查看版本

    go version
    go version go1.12.4 linux/amd64
    

    解决方案

    go env -w GO111MODULE=on
    go env -w GOPROXY="https://goproxy.io,direct"
    
    # Set environment variable allow bypassing the proxy for selected modules (optional)
    go env -w GOPRIVATE="*.corp.example.com"
    
    # Set environment variable allow bypassing the proxy for specified organizations (optional)
    go env -w GOPRIVATE="example.com/org_name"
    

    Go version <= 1.12

    Bash (Linux or macOS)

    # Enable the go modules feature
    export GO111MODULE="on"
    # Set the GOPROXY environment variable
    export GOPROXY="https://goproxy.io"
    

    或者将以上内容写进 .profile 或者 .bash_profile 文件。

    PowerShell (Windows)

    # Enable the go modules feature
    $env:GO111MODULE="on"
    # Set the GOPROXY environment variable
    $env:GOPROXY="https://goproxy.io"
    

    参考官网教程: https://goproxy.io/

    下载完后

    运行以下代码:

    package main
    
    import (
    	"fmt"
    
    	"github.com/aliyun/aliyun-oss-go-sdk/oss"
    )
    
    func main() {
    	fmt.Println("OSS Go SDK Version: ", oss.Version)
    }
    

    输出:

    OSS Go SDK Version:  v2.1.2
    
    自知者不怨人,知命者不怨天。
  • 相关阅读:
    最短路详解
    树状数组基础
    并查集初步
    python shell的交互模式和文本编辑模式
    基于python的selenium自动化测试环境搭建
    Nagios基本搭建
    mysql错误代码对照表较完整
    搭建phpMyAdmin
    Cent OS 7 搭建MySQL
    详解封装源码包成RPM包
  • 原文地址:https://www.cnblogs.com/liqingbo/p/14922737.html
Copyright © 2011-2022 走看看