Skip to content

Commit

Permalink
Replace io/ioutils as it is deprecated (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
kavir1698 authored May 16, 2024
1 parent 44c353f commit 8750a2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cmd/datasetIngestor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -217,7 +216,7 @@ func main() {
folders = append(folders, sourceFolder)
} else {
// get folders from file
folderlist, err := ioutil.ReadFile(folderlistingPath)
folderlist, err := os.ReadFile(folderlistingPath)
if err != nil {
log.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions datasetIngestor/checkMetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"github.com/paulscherrerinstitute/scicat/datasetUtils"
"io/ioutil"
"io"
"log"
"net"
"net/http"
Expand Down Expand Up @@ -61,7 +61,7 @@ func CheckMetadata(client *http.Client, APIServer string, metadatafile string, u

// readMetadataFromFile reads the metadata from the file and unmarshals it into a map.
func readMetadataFromFile(metadatafile string) (map[string]interface{}, error) {
b, err := ioutil.ReadFile(metadatafile) // just pass the file name
b, err := os.ReadFile(metadatafile) // just pass the file name
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -330,7 +330,7 @@ func checkMetadataValidity(client *http.Client, APIServer string, metaDataMap ma
return fmt.Errorf("unexpected status code: %d", resp.StatusCode)
}

_, err = ioutil.ReadAll(resp.Body)
_, err = io.ReadAll(resp.Body)
if err != nil {
return err
}
Expand Down

0 comments on commit 8750a2c

Please sign in to comment.