From 51a4b846ec19380c2f7748c312c68b53660b0bf1 Mon Sep 17 00:00:00 2001 From: Emmanuel Alejandro Parada Licea Date: Mon, 25 Nov 2024 16:53:11 -0600 Subject: [PATCH 1/2] fix(pubsub): update practices from deprecated ioutil to io --- pubsub/schemas/commit_avro_schema.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pubsub/schemas/commit_avro_schema.go b/pubsub/schemas/commit_avro_schema.go index bf19df0b0e..b2aea4b982 100644 --- a/pubsub/schemas/commit_avro_schema.go +++ b/pubsub/schemas/commit_avro_schema.go @@ -19,12 +19,12 @@ import ( "context" "fmt" "io" - "io/ioutil" + "os" "cloud.google.com/go/pubsub" ) -// commitAvroSchema commits a new avro schema revision to an existing schema. +// commitAvroSchema commits a new Avro schema revision to an existing schema. func commitAvroSchema(w io.Writer, projectID, schemaID, avscFile string) error { // projectID := "my-project-id" // schemaID := "my-schema-id" @@ -37,7 +37,7 @@ func commitAvroSchema(w io.Writer, projectID, schemaID, avscFile string) error { defer client.Close() // Read an Avro schema file formatted in JSON as a byte slice. - avscSource, err := ioutil.ReadFile(avscFile) + avscSource, err := os.ReadFile(avscFile) if err != nil { return fmt.Errorf("error reading from file: %s", avscFile) } From 298995d7b2386973f07a21152ef5dfe6673acd2b Mon Sep 17 00:00:00 2001 From: Emmanuel Alejandro Parada Licea Date: Tue, 26 Nov 2024 12:25:15 -0600 Subject: [PATCH 2/2] fix(storage): update practices from deprecated ioutil to io --- storage/objects/download_public_file.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/storage/objects/download_public_file.go b/storage/objects/download_public_file.go index 7fc31ae6d3..d262d371d2 100644 --- a/storage/objects/download_public_file.go +++ b/storage/objects/download_public_file.go @@ -19,7 +19,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "time" "cloud.google.com/go/storage" @@ -47,9 +46,9 @@ func downloadPublicFile(w io.Writer, bucket, object string) ([]byte, error) { } defer rc.Close() - data, err := ioutil.ReadAll(rc) + data, err := io.ReadAll(rc) if err != nil { - return nil, fmt.Errorf("ioutil.ReadAll: %w", err) + return nil, fmt.Errorf("io.ReadAll: %w", err) } fmt.Fprintf(w, "Blob %v downloaded.\n", object) return data, nil