aboutsummaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorEng Zer Jun <engzerjun@gmail.com>2021-09-22 13:38:34 +0800
committerGitHub <noreply@github.com>2021-09-22 13:38:34 +0800
commitf2e7d5477f076789da5d0e95fe61a56ddb939f5a (patch)
tree922ca8769761c30e93f3b4deaf27858026b27ebf /integrations
parentaa631d8cd18251aa9b18ce72f75c8d8c7090e5e7 (diff)
downloadgitea-f2e7d5477f076789da5d0e95fe61a56ddb939f5a.tar.gz
gitea-f2e7d5477f076789da5d0e95fe61a56ddb939f5a.zip
refactor: move from io/ioutil to io and os package (#17109)
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_helper_for_declarative_test.go6
-rw-r--r--integrations/api_repo_test.go6
-rw-r--r--integrations/create_no_session_test.go3
-rw-r--r--integrations/git_clone_wiki_test.go6
-rw-r--r--integrations/git_helper_for_declarative_test.go9
-rw-r--r--integrations/git_smart_http_test.go4
-rw-r--r--integrations/git_test.go16
-rw-r--r--integrations/gpg_git_test.go3
-rw-r--r--integrations/lfs_getobject_test.go4
-rw-r--r--integrations/lfs_local_endpoint_test.go7
-rw-r--r--integrations/migrate_test.go5
-rw-r--r--integrations/migration-test/migration_test.go4
-rw-r--r--integrations/oauth_test.go12
-rw-r--r--integrations/repo_tag_test.go4
-rw-r--r--integrations/ssh_key_test.go16
15 files changed, 50 insertions, 55 deletions
diff --git a/integrations/api_helper_for_declarative_test.go b/integrations/api_helper_for_declarative_test.go
index 5d44cde5bf..8745ada96d 100644
--- a/integrations/api_helper_for_declarative_test.go
+++ b/integrations/api_helper_for_declarative_test.go
@@ -7,9 +7,9 @@ package integrations
import (
"context"
"fmt"
- "io/ioutil"
"net/http"
"net/url"
+ "os"
"testing"
"time"
@@ -163,7 +163,7 @@ func doAPICreateUserKey(ctx APITestContext, keyname, keyFile string, callback ..
return func(t *testing.T) {
urlStr := fmt.Sprintf("/api/v1/user/keys?token=%s", ctx.Token)
- dataPubKey, err := ioutil.ReadFile(keyFile + ".pub")
+ dataPubKey, err := os.ReadFile(keyFile + ".pub")
assert.NoError(t, err)
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateKeyOption{
Title: keyname,
@@ -199,7 +199,7 @@ func doAPICreateDeployKey(ctx APITestContext, keyname, keyFile string, readOnly
return func(t *testing.T) {
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/keys?token=%s", ctx.Username, ctx.Reponame, ctx.Token)
- dataPubKey, err := ioutil.ReadFile(keyFile + ".pub")
+ dataPubKey, err := os.ReadFile(keyFile + ".pub")
assert.NoError(t, err)
req := NewRequestWithJSON(t, "POST", urlStr, api.CreateKeyOption{
Title: keyname,
diff --git a/integrations/api_repo_test.go b/integrations/api_repo_test.go
index 63da373827..b93319be33 100644
--- a/integrations/api_repo_test.go
+++ b/integrations/api_repo_test.go
@@ -6,9 +6,9 @@ package integrations
import (
"fmt"
- "io/ioutil"
"net/http"
"net/url"
+ "os"
"testing"
"code.gitea.io/gitea/models"
@@ -356,7 +356,7 @@ func testAPIRepoMigrateConflict(t *testing.T, u *url.URL) {
httpContext := baseAPITestContext
httpContext.Reponame = "repo-tmp-17"
- dstPath, err := ioutil.TempDir("", httpContext.Reponame)
+ dstPath, err := os.MkdirTemp("", httpContext.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
t.Run("CreateRepo", doAPICreateRepository(httpContext, false))
@@ -419,7 +419,7 @@ func testAPIRepoCreateConflict(t *testing.T, u *url.URL) {
httpContext := baseAPITestContext
httpContext.Reponame = "repo-tmp-17"
- dstPath, err := ioutil.TempDir("", httpContext.Reponame)
+ dstPath, err := os.MkdirTemp("", httpContext.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
t.Run("CreateRepo", doAPICreateRepository(httpContext, false))
diff --git a/integrations/create_no_session_test.go b/integrations/create_no_session_test.go
index d6b3634268..a76ff1eaaf 100644
--- a/integrations/create_no_session_test.go
+++ b/integrations/create_no_session_test.go
@@ -5,7 +5,6 @@
package integrations
import (
- "io/ioutil"
"net/http"
"net/http/httptest"
"os"
@@ -69,7 +68,7 @@ func TestSessionFileCreation(t *testing.T) {
config.Provider = "file"
// Now create a temporaryDirectory
- tmpDir, err := ioutil.TempDir("", "sessions")
+ tmpDir, err := os.MkdirTemp("", "sessions")
assert.NoError(t, err)
defer func() {
if _, err := os.Stat(tmpDir); !os.IsNotExist(err) {
diff --git a/integrations/git_clone_wiki_test.go b/integrations/git_clone_wiki_test.go
index 4e48df69f5..2139ce5fe0 100644
--- a/integrations/git_clone_wiki_test.go
+++ b/integrations/git_clone_wiki_test.go
@@ -7,8 +7,8 @@ package integrations
import (
"context"
"fmt"
- "io/ioutil"
"net/url"
+ "os"
"path/filepath"
"testing"
@@ -24,7 +24,7 @@ func assertFileExist(t *testing.T, p string) {
}
func assertFileEqual(t *testing.T, p string, content []byte) {
- bs, err := ioutil.ReadFile(p)
+ bs, err := os.ReadFile(p)
assert.NoError(t, err)
assert.EqualValues(t, content, bs)
}
@@ -33,7 +33,7 @@ func TestRepoCloneWiki(t *testing.T) {
onGiteaRun(t, func(t *testing.T, u *url.URL) {
defer prepareTestEnv(t)()
- dstPath, err := ioutil.TempDir("", "clone_wiki")
+ dstPath, err := os.MkdirTemp("", "clone_wiki")
assert.NoError(t, err)
r := fmt.Sprintf("%suser2/repo1.wiki.git", u.String())
diff --git a/integrations/git_helper_for_declarative_test.go b/integrations/git_helper_for_declarative_test.go
index 5a5b1314c6..9da5c05f94 100644
--- a/integrations/git_helper_for_declarative_test.go
+++ b/integrations/git_helper_for_declarative_test.go
@@ -7,7 +7,6 @@ package integrations
import (
"context"
"fmt"
- "io/ioutil"
"net"
"net/http"
"net/url"
@@ -28,7 +27,7 @@ import (
func withKeyFile(t *testing.T, keyname string, callback func(string)) {
- tmpDir, err := ioutil.TempDir("", "key-file")
+ tmpDir, err := os.MkdirTemp("", "key-file")
assert.NoError(t, err)
defer util.RemoveAll(tmpDir)
@@ -39,7 +38,7 @@ func withKeyFile(t *testing.T, keyname string, callback func(string)) {
err = ssh.GenKeyPair(keyFile)
assert.NoError(t, err)
- err = ioutil.WriteFile(path.Join(tmpDir, "ssh"), []byte("#!/bin/bash\n"+
+ err = os.WriteFile(path.Join(tmpDir, "ssh"), []byte("#!/bin/bash\n"+
"ssh -o \"UserKnownHostsFile=/dev/null\" -o \"StrictHostKeyChecking=no\" -o \"IdentitiesOnly=yes\" -i \""+keyFile+"\" \"$@\""), 0700)
assert.NoError(t, err)
@@ -125,7 +124,7 @@ func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
func doGitCloneFail(u *url.URL) func(*testing.T) {
return func(t *testing.T) {
- tmpDir, err := ioutil.TempDir("", "doGitCloneFail")
+ tmpDir, err := os.MkdirTemp("", "doGitCloneFail")
assert.NoError(t, err)
defer util.RemoveAll(tmpDir)
assert.Error(t, git.Clone(u.String(), tmpDir, git.CloneRepoOptions{}))
@@ -139,7 +138,7 @@ func doGitInitTestRepository(dstPath string) func(*testing.T) {
return func(t *testing.T) {
// Init repository in dstPath
assert.NoError(t, git.InitRepository(dstPath, false))
- assert.NoError(t, ioutil.WriteFile(filepath.Join(dstPath, "README.md"), []byte(fmt.Sprintf("# Testing Repository\n\nOriginally created in: %s", dstPath)), 0644))
+ assert.NoError(t, os.WriteFile(filepath.Join(dstPath, "README.md"), []byte(fmt.Sprintf("# Testing Repository\n\nOriginally created in: %s", dstPath)), 0644))
assert.NoError(t, git.AddChanges(dstPath, true))
signature := git.Signature{
Email: "test@example.com",
diff --git a/integrations/git_smart_http_test.go b/integrations/git_smart_http_test.go
index 9a4e3689c1..c049f71c30 100644
--- a/integrations/git_smart_http_test.go
+++ b/integrations/git_smart_http_test.go
@@ -5,7 +5,7 @@
package integrations
import (
- "io/ioutil"
+ "io"
"net/http"
"net/url"
"testing"
@@ -62,7 +62,7 @@ func testGitSmartHTTP(t *testing.T, u *url.URL) {
assert.NoError(t, err)
defer resp.Body.Close()
assert.EqualValues(t, kase.code, resp.StatusCode)
- _, err = ioutil.ReadAll(resp.Body)
+ _, err = io.ReadAll(resp.Body)
assert.NoError(t, err)
})
}
diff --git a/integrations/git_test.go b/integrations/git_test.go
index 72e01d3753..9a264c9448 100644
--- a/integrations/git_test.go
+++ b/integrations/git_test.go
@@ -7,10 +7,10 @@ package integrations
import (
"encoding/hex"
"fmt"
- "io/ioutil"
"math/rand"
"net/http"
"net/url"
+ "os"
"path"
"path/filepath"
"strconv"
@@ -52,7 +52,7 @@ func testGit(t *testing.T, u *url.URL) {
httpContext.Reponame = "repo-tmp-17"
forkedUserCtx.Reponame = httpContext.Reponame
- dstPath, err := ioutil.TempDir("", httpContext.Reponame)
+ dstPath, err := os.MkdirTemp("", httpContext.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
@@ -102,7 +102,7 @@ func testGit(t *testing.T, u *url.URL) {
sshURL := createSSHUrl(sshContext.GitPath(), u)
//Setup clone folder
- dstPath, err := ioutil.TempDir("", sshContext.Reponame)
+ dstPath, err := os.MkdirTemp("", sshContext.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
@@ -128,7 +128,7 @@ func testGit(t *testing.T, u *url.URL) {
}
func ensureAnonymousClone(t *testing.T, u *url.URL) {
- dstLocalPath, err := ioutil.TempDir("", "repo1")
+ dstLocalPath, err := os.MkdirTemp("", "repo1")
assert.NoError(t, err)
defer util.RemoveAll(dstLocalPath)
t.Run("CloneAnonymous", doGitClone(dstLocalPath, u))
@@ -311,7 +311,7 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin
buffer := make([]byte, bufSize)
- tmpFile, err := ioutil.TempFile(repoPath, prefix)
+ tmpFile, err := os.CreateTemp(repoPath, prefix)
if err != nil {
return "", err
}
@@ -558,7 +558,7 @@ func doPushCreate(ctx APITestContext, u *url.URL) func(t *testing.T) {
u.Path = ctx.GitPath()
// Create a temporary directory
- tmpDir, err := ioutil.TempDir("", ctx.Reponame)
+ tmpDir, err := os.MkdirTemp("", ctx.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(tmpDir)
@@ -636,7 +636,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
t.Run("CreateHeadBranch", doGitCreateBranch(dstPath, headBranch))
t.Run("AddCommit", func(t *testing.T) {
- err := ioutil.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0666)
+ err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0666)
if !assert.NoError(t, err) {
return
}
@@ -710,7 +710,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
}
t.Run("AddCommit2", func(t *testing.T) {
- err := ioutil.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content \n ## test content 2"), 0666)
+ err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content \n ## test content 2"), 0666)
if !assert.NoError(t, err) {
return
}
diff --git a/integrations/gpg_git_test.go b/integrations/gpg_git_test.go
index 11d9a0e2a5..2cfb883fd9 100644
--- a/integrations/gpg_git_test.go
+++ b/integrations/gpg_git_test.go
@@ -7,7 +7,6 @@ package integrations
import (
"encoding/base64"
"fmt"
- "io/ioutil"
"net/url"
"os"
"testing"
@@ -28,7 +27,7 @@ func TestGPGGit(t *testing.T) {
username := "user2"
// OK Set a new GPG home
- tmpDir, err := ioutil.TempDir("", "temp-gpg")
+ tmpDir, err := os.MkdirTemp("", "temp-gpg")
assert.NoError(t, err)
defer util.RemoveAll(tmpDir)
diff --git a/integrations/lfs_getobject_test.go b/integrations/lfs_getobject_test.go
index 063f72b25c..d179428c6d 100644
--- a/integrations/lfs_getobject_test.go
+++ b/integrations/lfs_getobject_test.go
@@ -7,7 +7,7 @@ package integrations
import (
"archive/zip"
"bytes"
- "io/ioutil"
+ "io"
"net/http"
"net/http/httptest"
"testing"
@@ -74,7 +74,7 @@ func checkResponseTestContentEncoding(t *testing.T, content *[]byte, resp *httpt
assert.Contains(t, contentEncoding, "gzip")
gzippReader, err := gzipp.NewReader(resp.Body)
assert.NoError(t, err)
- result, err := ioutil.ReadAll(gzippReader)
+ result, err := io.ReadAll(gzippReader)
assert.NoError(t, err)
assert.Equal(t, *content, result)
}
diff --git a/integrations/lfs_local_endpoint_test.go b/integrations/lfs_local_endpoint_test.go
index eda418c429..7e0166b381 100644
--- a/integrations/lfs_local_endpoint_test.go
+++ b/integrations/lfs_local_endpoint_test.go
@@ -6,7 +6,6 @@ package integrations
import (
"fmt"
- "io/ioutil"
"net/url"
"os"
"path/filepath"
@@ -25,14 +24,14 @@ func str2url(raw string) *url.URL {
func TestDetermineLocalEndpoint(t *testing.T) {
defer prepareTestEnv(t)()
- root, _ := ioutil.TempDir("", "lfs_test")
+ root, _ := os.MkdirTemp("", "lfs_test")
defer os.RemoveAll(root)
- rootdotgit, _ := ioutil.TempDir("", "lfs_test")
+ rootdotgit, _ := os.MkdirTemp("", "lfs_test")
defer os.RemoveAll(rootdotgit)
os.Mkdir(filepath.Join(rootdotgit, ".git"), 0700)
- lfsroot, _ := ioutil.TempDir("", "lfs_test")
+ lfsroot, _ := os.MkdirTemp("", "lfs_test")
defer os.RemoveAll(lfsroot)
// Test cases
diff --git a/integrations/migrate_test.go b/integrations/migrate_test.go
index e79be238d5..c0d5d4fc75 100644
--- a/integrations/migrate_test.go
+++ b/integrations/migrate_test.go
@@ -5,7 +5,6 @@
package integrations
import (
- "io/ioutil"
"os"
"testing"
@@ -25,14 +24,14 @@ func TestMigrateLocalPath(t *testing.T) {
old := setting.ImportLocalPaths
setting.ImportLocalPaths = true
- lowercasePath, err := ioutil.TempDir("", "lowercase") // may not be lowercase because TempDir creates a random directory name which may be mixedcase
+ lowercasePath, err := os.MkdirTemp("", "lowercase") // may not be lowercase because MkdirTemp creates a random directory name which may be mixedcase
assert.NoError(t, err)
defer os.RemoveAll(lowercasePath)
err = migrations.IsMigrateURLAllowed(lowercasePath, adminUser)
assert.NoError(t, err, "case lowercase path")
- mixedcasePath, err := ioutil.TempDir("", "mIxeDCaSe")
+ mixedcasePath, err := os.MkdirTemp("", "mIxeDCaSe")
assert.NoError(t, err)
defer os.RemoveAll(mixedcasePath)
diff --git a/integrations/migration-test/migration_test.go b/integrations/migration-test/migration_test.go
index 66aca0ef70..43dc2a8348 100644
--- a/integrations/migration-test/migration_test.go
+++ b/integrations/migration-test/migration_test.go
@@ -9,7 +9,7 @@ import (
"context"
"database/sql"
"fmt"
- "io/ioutil"
+ "io"
"os"
"path"
"path/filepath"
@@ -113,7 +113,7 @@ func readSQLFromFile(version string) (string, error) {
}
defer gr.Close()
- bytes, err := ioutil.ReadAll(gr)
+ bytes, err := io.ReadAll(gr)
if err != nil {
return "", err
}
diff --git a/integrations/oauth_test.go b/integrations/oauth_test.go
index c97db777be..c36aab652b 100644
--- a/integrations/oauth_test.go
+++ b/integrations/oauth_test.go
@@ -6,7 +6,7 @@ package integrations
import (
"bytes"
- "io/ioutil"
+ "io"
"testing"
"code.gitea.io/gitea/modules/json"
@@ -240,20 +240,20 @@ func TestRefreshTokenInvalidation(t *testing.T) {
"refresh_token": parsed.RefreshToken,
})
- bs, err := ioutil.ReadAll(refreshReq.Body)
+ bs, err := io.ReadAll(refreshReq.Body)
assert.NoError(t, err)
- refreshReq.Body = ioutil.NopCloser(bytes.NewReader(bs))
+ refreshReq.Body = io.NopCloser(bytes.NewReader(bs))
MakeRequest(t, refreshReq, 200)
- refreshReq.Body = ioutil.NopCloser(bytes.NewReader(bs))
+ refreshReq.Body = io.NopCloser(bytes.NewReader(bs))
MakeRequest(t, refreshReq, 200)
// test with invalidation
setting.OAuth2.InvalidateRefreshTokens = true
- refreshReq.Body = ioutil.NopCloser(bytes.NewReader(bs))
+ refreshReq.Body = io.NopCloser(bytes.NewReader(bs))
MakeRequest(t, refreshReq, 200)
- refreshReq.Body = ioutil.NopCloser(bytes.NewReader(bs))
+ refreshReq.Body = io.NopCloser(bytes.NewReader(bs))
MakeRequest(t, refreshReq, 400)
}
diff --git a/integrations/repo_tag_test.go b/integrations/repo_tag_test.go
index 05505a644d..abbc2c02fc 100644
--- a/integrations/repo_tag_test.go
+++ b/integrations/repo_tag_test.go
@@ -5,8 +5,8 @@
package integrations
import (
- "io/ioutil"
"net/url"
+ "os"
"testing"
"code.gitea.io/gitea/models"
@@ -55,7 +55,7 @@ func TestCreateNewTagProtected(t *testing.T) {
username := "user2"
httpContext := NewAPITestContext(t, username, "repo1")
- dstPath, err := ioutil.TempDir("", httpContext.Reponame)
+ dstPath, err := os.MkdirTemp("", httpContext.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
diff --git a/integrations/ssh_key_test.go b/integrations/ssh_key_test.go
index 91774f6335..f9c807413a 100644
--- a/integrations/ssh_key_test.go
+++ b/integrations/ssh_key_test.go
@@ -6,9 +6,9 @@ package integrations
import (
"fmt"
- "io/ioutil"
"net/http"
"net/url"
+ "os"
"path/filepath"
"testing"
"time"
@@ -28,7 +28,7 @@ func doCheckRepositoryEmptyStatus(ctx APITestContext, isEmpty bool) func(*testin
func doAddChangesToCheckout(dstPath, filename string) func(*testing.T) {
return func(t *testing.T) {
- assert.NoError(t, ioutil.WriteFile(filepath.Join(dstPath, filename), []byte(fmt.Sprintf("# Testing Repository\n\nOriginally created in: %s at time: %v", dstPath, time.Now())), 0644))
+ assert.NoError(t, os.WriteFile(filepath.Join(dstPath, filename), []byte(fmt.Sprintf("# Testing Repository\n\nOriginally created in: %s at time: %v", dstPath, time.Now())), 0644))
assert.NoError(t, git.AddChanges(dstPath, true))
signature := git.Signature{
Email: "test@example.com",
@@ -61,7 +61,7 @@ func testPushDeployKeyOnEmptyRepo(t *testing.T, u *url.URL) {
t.Run("CreatePushDeployKey", doAPICreateDeployKey(ctx, keyname, keyFile, false))
// Setup the testing repository
- dstPath, err := ioutil.TempDir("", "repo-tmp-deploy-key-empty-repo-1")
+ dstPath, err := os.MkdirTemp("", "repo-tmp-deploy-key-empty-repo-1")
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
@@ -107,7 +107,7 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) {
withKeyFile(t, keyname, func(keyFile string) {
var userKeyPublicKeyID int64
t.Run("KeyCanOnlyBeUser", func(t *testing.T) {
- dstPath, err := ioutil.TempDir("", ctx.Reponame)
+ dstPath, err := os.MkdirTemp("", ctx.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
@@ -133,7 +133,7 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) {
})
t.Run("KeyCanBeAnyDeployButNotUserAswell", func(t *testing.T) {
- dstPath, err := ioutil.TempDir("", ctx.Reponame)
+ dstPath, err := os.MkdirTemp("", ctx.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
@@ -151,7 +151,7 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) {
t.Run("FailToPush", doGitPushTestRepositoryFail(dstPath, "origin", "master"))
otherSSHURL := createSSHUrl(otherCtx.GitPath(), u)
- dstOtherPath, err := ioutil.TempDir("", otherCtx.Reponame)
+ dstOtherPath, err := os.MkdirTemp("", otherCtx.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstOtherPath)
@@ -168,7 +168,7 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) {
t.Run("DeleteRepositoryShouldReleaseKey", func(t *testing.T) {
otherSSHURL := createSSHUrl(otherCtx.GitPath(), u)
- dstOtherPath, err := ioutil.TempDir("", otherCtx.Reponame)
+ dstOtherPath, err := os.MkdirTemp("", otherCtx.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstOtherPath)
@@ -190,7 +190,7 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) {
userKeyPublicKeyID = publicKey.ID
}))
- dstPath, err := ioutil.TempDir("", ctx.Reponame)
+ dstPath, err := os.MkdirTemp("", ctx.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)