From 515bf5ee9791dbab7a8c008c63aee59bb59d0605 Mon Sep 17 00:00:00 2001 From: leoshine <71440988+leo220yuyaodog@users.noreply.github.com> Date: Tue, 3 May 2022 17:41:14 +0800 Subject: [PATCH] feat: update qor to casdoor (#8) --- aliyun/aliyun.go | 2 +- aliyun/aliyun_test.go | 4 ++-- azureblob/azure.go | 2 +- azureblob/azure_test.go | 2 +- filesystem/filesystem.go | 2 +- filesystem/filesystem_test.go | 2 +- go.mod | 7 ++----- qiniu/qiniu.go | 6 +++--- qiniu/qiniu_test.go | 4 ++-- s3/s3.go | 2 +- s3/s3_test.go | 6 +++--- tencent/tencent.go | 19 ++++++++++--------- tencent/tencent_test.go | 11 +++++------ tests/tests.go | 2 +- 14 files changed, 34 insertions(+), 37 deletions(-) diff --git a/aliyun/aliyun.go b/aliyun/aliyun.go index dbf261d..83a87de 100644 --- a/aliyun/aliyun.go +++ b/aliyun/aliyun.go @@ -11,7 +11,7 @@ import ( "time" aliyun "github.com/aliyun/aliyun-oss-go-sdk/oss" - "github.com/qor/oss" + "github.com/casdoor/oss" ) // Client Aliyun storage diff --git a/aliyun/aliyun_test.go b/aliyun/aliyun_test.go index 87e7dc3..967e217 100644 --- a/aliyun/aliyun_test.go +++ b/aliyun/aliyun_test.go @@ -5,9 +5,9 @@ import ( "testing" aliyunoss "github.com/aliyun/aliyun-oss-go-sdk/oss" + "github.com/casdoor/oss/aliyun" + "github.com/casdoor/oss/tests" "github.com/jinzhu/configor" - "github.com/qor/oss/aliyun" - "github.com/qor/oss/tests" ) type Config struct { diff --git a/azureblob/azure.go b/azureblob/azure.go index 555b7b6..efeb014 100644 --- a/azureblob/azure.go +++ b/azureblob/azure.go @@ -33,7 +33,7 @@ import ( "time" "github.com/Azure/azure-storage-blob-go/azblob" - "github.com/qor/oss" + "github.com/casdoor/oss" ) // Client azure blob storage diff --git a/azureblob/azure_test.go b/azureblob/azure_test.go index 39f0862..c663341 100644 --- a/azureblob/azure_test.go +++ b/azureblob/azure_test.go @@ -20,7 +20,7 @@ import ( "io/ioutil" "testing" - "github.com/qor/oss/tests" + "github.com/casdoor/oss/tests" ) var client *Client diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 56934aa..e5ceaa9 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - "github.com/qor/oss" + "github.com/casdoor/oss" ) // FileSystem file system storage diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go index fff1976..8ed9157 100644 --- a/filesystem/filesystem_test.go +++ b/filesystem/filesystem_test.go @@ -3,7 +3,7 @@ package filesystem import ( "testing" - "github.com/qor/oss/tests" + "github.com/casdoor/oss/tests" ) func TestAll(t *testing.T) { diff --git a/go.mod b/go.mod index f90faa7..e6ce095 100644 --- a/go.mod +++ b/go.mod @@ -7,22 +7,19 @@ require ( github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible github.com/aws/aws-sdk-go v1.44.4 github.com/jinzhu/configor v1.2.1 - github.com/qor/oss v0.0.0-20210412121326-3c5583a62015 + github.com/qiniu/go-sdk/v7 v7.12.1 ) require ( github.com/Azure/azure-pipeline-go v0.2.3 // indirect github.com/BurntSushi/toml v0.3.1 // indirect github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/uuid v1.2.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/kr/pretty v0.3.0 // indirect github.com/mattn/go-ieproxy v0.0.1 // indirect - github.com/rogpeppe/go-internal v1.8.0 // indirect github.com/satori/go.uuid v1.2.0 // indirect - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect + golang.org/x/sync v0.0.0-20201207232520-09787c993a3a // indirect golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect diff --git a/qiniu/qiniu.go b/qiniu/qiniu.go index 2e5b5af..9a3cc30 100644 --- a/qiniu/qiniu.go +++ b/qiniu/qiniu.go @@ -16,9 +16,9 @@ import ( "strings" "time" - "github.com/qiniu/api.v7/auth/qbox" - "github.com/qiniu/api.v7/storage" - "github.com/qor/oss" + "github.com/casdoor/oss" + "github.com/qiniu/go-sdk/v7/auth/qbox" + "github.com/qiniu/go-sdk/v7/storage" ) // Client Qiniu storage diff --git a/qiniu/qiniu_test.go b/qiniu/qiniu_test.go index 4a4b299..756b0ac 100644 --- a/qiniu/qiniu_test.go +++ b/qiniu/qiniu_test.go @@ -3,9 +3,9 @@ package qiniu_test import ( "testing" + "github.com/casdoor/oss/qiniu" + "github.com/casdoor/oss/tests" "github.com/jinzhu/configor" - "github.com/qor/oss/qiniu" - "github.com/qor/oss/tests" ) type Config struct { diff --git a/s3/s3.go b/s3/s3.go index 3f66712..82ca132 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -22,7 +22,7 @@ import ( "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" - "github.com/qor/oss" + "github.com/casdoor/oss" ) // Client S3 storage diff --git a/s3/s3_test.go b/s3/s3_test.go index 4518452..2b0417a 100644 --- a/s3/s3_test.go +++ b/s3/s3_test.go @@ -5,9 +5,9 @@ import ( "testing" awss3 "github.com/aws/aws-sdk-go/service/s3" + "github.com/casdoor/oss/s3" + "github.com/casdoor/oss/tests" "github.com/jinzhu/configor" - "github.com/qor/oss/s3" - "github.com/qor/oss/tests" ) type Config struct { @@ -48,7 +48,7 @@ func TestToRelativePath(t *testing.T) { "https://qor-example.com/myobject.ext": "/myobject.ext", "//mybucket.s3.amazonaws.com/myobject.ext": "/myobject.ext", "http://mybucket.s3.amazonaws.com/myobject.ext": "/myobject.ext", - "myobject.ext": "/myobject.ext", + "myobject.ext": "/myobject.ext", } for url, path := range urlMap { diff --git a/tencent/tencent.go b/tencent/tencent.go index 89e424f..926e56d 100644 --- a/tencent/tencent.go +++ b/tencent/tencent.go @@ -1,19 +1,20 @@ package tencent import ( - "os" - "github.com/qor/oss" - "io" + "bytes" + "errors" "fmt" + "io" "io/ioutil" "net/http" + "net/url" + "os" "path/filepath" - "time" - "errors" - "strings" - "bytes" "regexp" - "net/url" + "strings" + "time" + + "github.com/casdoor/oss" ) var _ oss.StorageInterface = (*Client)(nil) @@ -73,7 +74,7 @@ func (client Client) GetStream(path string) (io.ReadCloser, error) { return nil, err } if resp.StatusCode != http.StatusOK { - return nil,errors.New("get file fail") + return nil, errors.New("get file fail") } return resp.Body, nil } diff --git a/tencent/tencent_test.go b/tencent/tencent_test.go index 15451b4..5cd138a 100644 --- a/tencent/tencent_test.go +++ b/tencent/tencent_test.go @@ -1,11 +1,12 @@ package tencent import ( - "testing" "bytes" - "io/ioutil" "fmt" - "github.com/qor/oss/tests" + "io/ioutil" + "testing" + + "github.com/casdoor/oss/tests" ) func TestClient_Get(t *testing.T) { @@ -26,7 +27,6 @@ func init() { }) } - func TestClient_Put(t *testing.T) { f, err := ioutil.ReadFile("/home/owen/Downloads/2.png") if err != nil { @@ -37,9 +37,8 @@ func TestClient_Put(t *testing.T) { client.Put("test.png", bytes.NewReader(f)) } - func TestClient_Put2(t *testing.T) { - tests.TestAll(client,t) + tests.TestAll(client, t) } func TestClient_Delete(t *testing.T) { diff --git a/tests/tests.go b/tests/tests.go index fb5d128..5ef70ff 100644 --- a/tests/tests.go +++ b/tests/tests.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/qor/oss" + "github.com/casdoor/oss" ) func TestAll(storage oss.StorageInterface, t *testing.T) {