Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

构建报错:type *api.PutObjectArgs has no field or method ContentEncoding #64

Open
ChinaShrimp opened this issue Feb 3, 2020 · 2 comments

Comments

@ChinaShrimp
Copy link

平台: OSX 10.15.2
GO: go1.12.5 darwin/amd64
代码分支: master

步骤:

  1. git clone代码到本地;
  2. 代码根目录创建go.mod文件,里面添加一行内容"module github.com/TruthHun/DocHub"
  3. 执行go build

报错信息如下:

$ go build
go: finding golang.org/x/time/rate latest
go: finding golang.org/x/time latest
go: finding golang.org/x/sys/cpu latest
go: finding golang.org/x/sys latest
github.com/TruthHun/CloudStore
../../../go/pkg/mod/github.com/!truth!hun/!cloud!store@v0.0.0-20191230140227-5712bf67b129/bos.go:56:9: args.ContentEncoding undefined (type *api.PutObjectArgs has no field or method ContentEncoding)

分析:
前往CloudStore,发现bos.go中确实引用了ContentEncoding,但是百度最新的SDK中已经去除了这个域:
case "content-encoding": args.ContentEncoding = v

临时修改方法:

  1. Fork CloudStore;
  2. 去除bos.go中这两行;
  3. 将DocHub中引用到github.com/TruthHun/CloudStore,改为自己Fork的库

经过验证,如上修改后可以正常编译,相关功能测试并未进行。

@hawkwang
Copy link

一样的问题
issue

@jht385
Copy link

jht385 commented Feb 18, 2020

我也遇到这个问题了,上面老哥说的有用
可以是fork项目 或者 直接复制CloudStore项目到你的DocHub工程也可以
去除bos.go两行
/* case "content-encoding": args.ContentEncoding = v */
修改项目的引用为你自己的,具体就是 github.com/TruthHun/DocHub/helper 一些通用的工具类帮组类以外的业务相关代码都修改为你项目的包

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants