mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03: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:
@@ -1,7 +1,6 @@
|
||||
package telemetry
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
@@ -65,9 +64,9 @@ func TestInitialization(t *testing.T) {
|
||||
|
||||
certPath := filepath.Join(os.TempDir(), "test.crt")
|
||||
keyPath := filepath.Join(os.TempDir(), "test.key")
|
||||
err = ioutil.WriteFile(certPath, []byte(httpsCert), os.ModePerm)
|
||||
err = os.WriteFile(certPath, []byte(httpsCert), os.ModePerm)
|
||||
require.NoError(t, err)
|
||||
err = ioutil.WriteFile(keyPath, []byte(httpsKey), os.ModePerm)
|
||||
err = os.WriteFile(keyPath, []byte(httpsKey), os.ModePerm)
|
||||
require.NoError(t, err)
|
||||
|
||||
c.CertificateFile = certPath
|
||||
@@ -104,7 +103,7 @@ func TestShouldBind(t *testing.T) {
|
||||
func TestRouter(t *testing.T) {
|
||||
authUserFile := filepath.Join(os.TempDir(), "http_users.txt")
|
||||
authUserData := []byte("test1:$2y$05$bcHSED7aO1cfLto6ZdDBOOKzlwftslVhtpIkRhAtSa4GuLmk5mola\n")
|
||||
err := ioutil.WriteFile(authUserFile, authUserData, os.ModePerm)
|
||||
err := os.WriteFile(authUserFile, authUserData, os.ModePerm)
|
||||
require.NoError(t, err)
|
||||
|
||||
httpAuth, err = common.NewBasicAuthProvider(authUserFile)
|
||||
|
||||
Reference in New Issue
Block a user