Go操作OSS === ### 上传 ~~~ func TestUpload(t *testing.T) { filename := "hes.text" ossPath := "oss/" + filename // oss 不能以/开头 file, _ := os.Open(filename) err := oss.Bucket().PutObject(ossPath, file) if err != nil { t.Log("上传oss失败") return } } ~~~ ### 临时下载授权 (生成下载url) ~~~ // 临时下载授权 func TestDownUrl(t *testing.T) { filepath := "oss/hes.text" url, e := oss.Bucket().SignURL(filepath, oss2.HTTPGet, 3600) if e != nil { t.Log(e.Error()) return } t.Log(url) } ~~~