diff options
author | Eng Zer Jun <engzerjun@gmail.com> | 2021-09-22 13:38:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-22 13:38:34 +0800 |
commit | f2e7d5477f076789da5d0e95fe61a56ddb939f5a (patch) | |
tree | 922ca8769761c30e93f3b4deaf27858026b27ebf /modules/setting/setting.go | |
parent | aa631d8cd18251aa9b18ce72f75c8d8c7090e5e7 (diff) | |
download | gitea-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 'modules/setting/setting.go')
-rw-r--r-- | modules/setting/setting.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 02f5cd8548..b054f27c59 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -9,7 +9,6 @@ import ( "encoding/base64" "fmt" "io" - "io/ioutil" "math" "net" "net/url" @@ -764,7 +763,7 @@ func NewContext() { if len(trustedUserCaKeys) > 0 && SSH.AuthorizedPrincipalsEnabled { fname := sec.Key("SSH_TRUSTED_USER_CA_KEYS_FILENAME").MustString(filepath.Join(SSH.RootPath, "gitea-trusted-user-ca-keys.pem")) - if err := ioutil.WriteFile(fname, + if err := os.WriteFile(fname, []byte(strings.Join(trustedUserCaKeys, "\n")), 0600); err != nil { log.Fatal("Failed to create '%s': %v", fname, err) } @@ -1030,7 +1029,7 @@ func loadInternalToken(sec *ini.Section) string { } defer fp.Close() - buf, err := ioutil.ReadAll(fp) + buf, err := io.ReadAll(fp) if err != nil { log.Fatal("Failed to read InternalTokenURI (%s): %v", uri, err) } |