forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move from io/ioutil to io and os package (go-gitea#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 <[email protected]> Co-authored-by: techknowlogick <[email protected]>
- Loading branch information
1 parent
aa631d8
commit f2e7d54
Showing
103 changed files
with
261 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.