remove deprecated use of ioutil (#5205)

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2022-12-08 14:44:53 +01:00
committed by GitHub
parent 46cb910637
commit 53d15d329e
24 changed files with 57 additions and 67 deletions
@@ -3,7 +3,7 @@ package svc_test
import (
"context"
"encoding/json"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"time"
@@ -113,7 +113,7 @@ var _ = Describe("Driveitems", func() {
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drive/root/children", nil)
svc.GetRootDriveChildren(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
res := itemsList{}
+3 -4
View File
@@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"time"
@@ -825,7 +824,7 @@ var _ = Describe("Graph", func() {
svc.GetSingleDrive(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
drive := libregraph.Drive{}
@@ -864,7 +863,7 @@ var _ = Describe("Graph", func() {
svc.GetSingleDrive(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
drive := libregraph.Drive{}
@@ -925,7 +924,7 @@ var _ = Describe("Graph", func() {
svc.GetSingleDrive(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
drive := libregraph.Drive{}
+7 -7
View File
@@ -5,7 +5,7 @@ import (
"context"
"encoding/json"
"errors"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
@@ -92,7 +92,7 @@ var _ = Describe("Groups", func() {
svc.GetGroups(rr, r)
Expect(rr.Code).To(Equal(http.StatusBadRequest))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
odataerr := libregraph.OdataError{}
@@ -107,7 +107,7 @@ var _ = Describe("Groups", func() {
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/groups", nil)
svc.GetGroups(rr, r)
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
odataerr := libregraph.OdataError{}
@@ -123,7 +123,7 @@ var _ = Describe("Groups", func() {
svc.GetGroups(rr, r)
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
odataerr := libregraph.OdataError{}
@@ -139,7 +139,7 @@ var _ = Describe("Groups", func() {
svc.GetGroups(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
res := service.ListResponse{}
@@ -155,7 +155,7 @@ var _ = Describe("Groups", func() {
svc.GetGroups(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
res := groupList{}
@@ -385,7 +385,7 @@ var _ = Describe("Groups", func() {
svc.GetGroupMembers(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
var members []*libregraph.User
+2 -2
View File
@@ -3,8 +3,8 @@ package svc
import (
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net/http"
"os"
"strconv"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
@@ -113,7 +113,7 @@ func NewService(opts ...Option) Service {
}
}
certs := x509.NewCertPool()
pemData, err := ioutil.ReadFile(options.Config.Identity.LDAP.CACert)
pemData, err := os.ReadFile(options.Config.Identity.LDAP.CACert)
if err != nil {
options.Logger.Error().Err(err).Msgf("Error initializing LDAP Backend")
return nil
+7 -7
View File
@@ -4,7 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
@@ -125,7 +125,7 @@ var _ = Describe("Users", func() {
svc.GetUsers(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
res := userList{}
@@ -157,7 +157,7 @@ var _ = Describe("Users", func() {
svc.GetUsers(rec, r)
Expect(rec.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rec.Body)
data, err := io.ReadAll(rec.Body)
Expect(err).ToNot(HaveOccurred())
res := userList{}
@@ -238,7 +238,7 @@ var _ = Describe("Users", func() {
svc.GetUser(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
responseUser := &libregraph.User{}
err = json.Unmarshal(data, &responseUser)
@@ -279,7 +279,7 @@ var _ = Describe("Users", func() {
svc.GetUser(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
responseUser := &libregraph.User{}
err = json.Unmarshal(data, &responseUser)
@@ -314,7 +314,7 @@ var _ = Describe("Users", func() {
svc.GetUser(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := ioutil.ReadAll(rr.Body)
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
responseUser := &libregraph.User{}
err = json.Unmarshal(data, &responseUser)
@@ -517,7 +517,7 @@ var _ = Describe("Users", func() {
svc.PatchUser(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
data, err = ioutil.ReadAll(rr.Body)
data, err = io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
updatedUser := libregraph.User{}