1
0
mirror of https://github.com/drakkan/sftpgo.git synced 2025-12-05 22:17:20 +02:00

Use new methods in the io and os packages instead of ioutil ones

ioutil is deprecated in Go 1.16 and SFTPGo is an application, not
a library, we have no reason to keep compatibility with old Go
versions.

Go 1.16 fix some cifs related issues too.
This commit is contained in:
Nicola Murino
2021-02-25 21:53:04 +01:00
parent 4b2edff6dd
commit ca3e15578e
37 changed files with 211 additions and 232 deletions

View File

@@ -17,7 +17,6 @@ import (
"fmt"
"html/template"
"io"
"io/ioutil"
"net"
"net/http"
"os"
@@ -240,7 +239,7 @@ func GenerateRSAKeys(file string) error {
if err != nil {
return err
}
return ioutil.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600)
return os.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600)
}
// GenerateECDSAKeys generate ecdsa private and public keys and write the
@@ -278,7 +277,7 @@ func GenerateECDSAKeys(file string) error {
if err != nil {
return err
}
return ioutil.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600)
return os.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600)
}
// GenerateEd25519Keys generate ed25519 private and public keys and write the
@@ -310,7 +309,7 @@ func GenerateEd25519Keys(file string) error {
if err != nil {
return err
}
return ioutil.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600)
return os.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600)
}
// GetDirsForSFTPPath returns all the directory for the given path in reverse order