go-sdk
go-sdk copied to clipboard
获取指定前缀的文件列表接口在docker环境中报错
下面这段代码在本地正常运行
mac := auth.New(accessKey, secretKey)
cfg := storage.Config{
// 是否使用https域名进行资源管理
UseHTTPS: false,
}
bm := storage.NewBucketManager(mac, &cfg)
entries, _, _, _, err := bm.ListFiles(bucket, prefix, delimiter, "", limit)
if err != nil {
mylog.Log.Error(err)
return
}
部署到docker环境中自动切换为https,之后报tls的错误,错误内容如下: query region error, Get "https://kodo-config.qiniuapi.com/v2/query?ak=X&bucket=X": tls: failed to verify certificate: x509: certificate signed by unknown authority
@yejia414 是否没有安装 ca-certificates
确实没有安装ca-certificates,但我已声明不使用HTTPS,UseHTTPS: false,是写法上有问题或者不支持非https访问?
将SDK升级到v7.21.1版本后报错如下:
panic: runtime error: index out of range [1] with length 1
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
golang.org/x/sync/singleflight.newPanicError({0x817680?, 0xc0000282a0})
/go/pkg/mod/golang.org/x/[email protected]/singleflight/singleflight.go:44 +0x2c
golang.org/x/sync/singleflight.(*Group).doCall.func2.1()
/go/pkg/mod/golang.org/x/[email protected]/singleflight/singleflight.go:193 +0x3b
panic({0x817680, 0xc0000282a0})
/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/matishsiao/goInfo.GetInfo()
/go/pkg/mod/github.com/matishsiao/[email protected]/goInfo_linux.go:21 +0x274
github.com/qiniu/go-sdk/v7/storagev2/internal/uplog.getOsVersion.func1()
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storagev2/internal/uplog/uplog.go:69 +0x58
sync.(*Once).doSlow(0x0?, 0x1?)
/usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:65
github.com/qiniu/go-sdk/v7/storagev2/internal/uplog.getOsVersion()
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storagev2/internal/uplog/uplog.go:68 +0x31
github.com/qiniu/go-sdk/v7/storagev2/internal/uplog.NewRequestUplog({0x842d53, 0xd}, {0x842780, 0xc}, {0x0, 0x0}, 0x0)
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storagev2/internal/uplog/request_uplog.go:69 +0x86
github.com/qiniu/go-sdk/v7/storagev2/apis.(*Storage).QueryBucketV2(0xc000012088, {0x8e14e8, 0xc000134020}, 0xc0001875f8, 0xc000029600?)
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storagev2/apis/api_query_bucket_v2.go:66 +0x436
github.com/qiniu/go-sdk/v7/storage._getRegionByV2WithoutCache({0xc00013c240, 0x28}, {0x842780, 0xc}, {0x1, 0x0, {0x0, 0x0, 0x0}, 0x0, ...})
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/region_uc_v2.go:315 +0x14b
github.com/qiniu/go-sdk/v7/storage.getRegionByV2.func2()
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/region_uc_v2.go:286 +0xbb
golang.org/x/sync/singleflight.(*Group).doCall.func2(0xc00018784e, 0xc00008a0a0, 0x7f68fb7fe101?)
/go/pkg/mod/golang.org/x/[email protected]/singleflight/singleflight.go:198 +0x6f
golang.org/x/sync/singleflight.(*Group).doCall(0x7d1500?, 0xc000024450?, {0xc0000d4000?, 0x56?}, 0x7bd800?)
/go/pkg/mod/golang.org/x/[email protected]/singleflight/singleflight.go:200 +0xa5
golang.org/x/sync/singleflight.(*Group).Do(0xb27000, {0xc0000d4000, 0x56}, 0xc?)
/go/pkg/mod/golang.org/x/[email protected]/singleflight/singleflight.go:113 +0x165
github.com/qiniu/go-sdk/v7/storage.getRegionByV2({0xc00013c240, 0x28}, {0x842780, 0xc}, {0x1, 0x0, {0x0, 0x0, 0x0}, 0x0, ...})
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/region_uc_v2.go:285 +0x28a
github.com/qiniu/go-sdk/v7/storage.GetRegionWithOptions(...)
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/region.go:298
github.com/qiniu/go-sdk/v7/storage.GetRegion({0xc00013c240?, 0xc000187ae8?}, {0x842780?, 0x40d0e8?})
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/region.go:293 +0x5f
github.com/qiniu/go-sdk/v7/storage.GetZone(...)
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/zone.go:10
github.com/qiniu/go-sdk/v7/storage.(*BucketManager).Zone(0x7bc780?, {0x842780?, 0xb583e8?})
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/bucket.go:1106 +0x65
github.com/qiniu/go-sdk/v7/storage.(*BucketManager).RsfHost(0xc000000180, {0x842780, 0xc})
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/bucket.go:1058 +0x2c
github.com/qiniu/go-sdk/v7/storage.(*BucketManager).RsfReqHost(0xc000000180, {0x842780?, 0x0?})
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/bucket.go:852 +0x34
github.com/qiniu/go-sdk/v7/storage.(*BucketManager).ListFilesWithContext(0xc000000180, {0x8e14e8, 0xc000134020}, {0x842780, 0xc}, {0xc000187cb8, 0x4, 0x0?})
/go/pkg/mod/github.com/qiniu/go-sdk/[email protected]/storage/bucket_list.go:175 +0x172
github.com/qiniu/go-sdk/v7/storage.(*BucketManager).ListFiles(0x0?, {0x842780?, 0x0?}, {0xc0000ce000?, 0x0?}, {0x0?, 0x0?}, {0x0?, 0x0?}, 0x3c)
@yejia414 这个问题在新的版本中已经解决。