aboutsummaryrefslogtreecommitdiff
path: root/internal/db
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db')
-rw-r--r--internal/db/ssh_key.go5
-rw-r--r--internal/db/wiki.go3
2 files changed, 3 insertions, 5 deletions
diff --git a/internal/db/ssh_key.go b/internal/db/ssh_key.go
index 3cddab97..50ac324f 100644
--- a/internal/db/ssh_key.go
+++ b/internal/db/ssh_key.go
@@ -10,7 +10,6 @@ import (
"encoding/binary"
"errors"
"fmt"
- "io/ioutil"
"math/big"
"os"
"path"
@@ -181,7 +180,7 @@ func parseKeyString(content string) (string, error) {
// writeTmpKeyFile writes key content to a temporary file
// and returns the name of that file, along with any possible errors.
func writeTmpKeyFile(content string) (string, error) {
- tmpFile, err := ioutil.TempFile(conf.SSH.KeyTestPath, "gogs_keytest")
+ tmpFile, err := os.CreateTemp(conf.SSH.KeyTestPath, "gogs_keytest")
if err != nil {
return "", fmt.Errorf("TempFile: %v", err)
}
@@ -377,7 +376,7 @@ func addKey(e Engine, key *PublicKey) (err error) {
// Calculate fingerprint.
tmpPath := strings.ReplaceAll(path.Join(os.TempDir(), fmt.Sprintf("%d", time.Now().Nanosecond()), "id_rsa.pub"), "\\", "/")
_ = os.MkdirAll(path.Dir(tmpPath), os.ModePerm)
- if err = ioutil.WriteFile(tmpPath, []byte(key.Content), 0644); err != nil {
+ if err = os.WriteFile(tmpPath, []byte(key.Content), 0644); err != nil {
return err
}
diff --git a/internal/db/wiki.go b/internal/db/wiki.go
index 1e1e0cbc..eae55d09 100644
--- a/internal/db/wiki.go
+++ b/internal/db/wiki.go
@@ -6,7 +6,6 @@ package db
import (
"fmt"
- "io/ioutil"
"net/url"
"os"
"path"
@@ -122,7 +121,7 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes
// The new file we created will be in normal text format.
os.Remove(filename)
- if err = ioutil.WriteFile(filename, []byte(content), 0666); err != nil {
+ if err = os.WriteFile(filename, []byte(content), 0666); err != nil {
return fmt.Errorf("WriteFile: %v", err)
}