Skip to content

Commit

Permalink
Replace deprecated ioutil pkg with os & io
Browse files Browse the repository at this point in the history
As of Go 1.16, the same functionality is now provided by package io or
package os, and those implementations should be preferred in new code.

So replacing all usage of ioutil pkg with io & os.
  • Loading branch information
abhinavnair committed Jun 26, 2022
1 parent 44860a9 commit 7ba840c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package apimanagement_test
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"

Expand All @@ -20,7 +20,7 @@ type ApiManagementApiSchemaResource struct{}
func TestAccApiManagementApiSchema_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_api_management_api_schema", "test")
r := ApiManagementApiSchemaResource{}
schema, _ := ioutil.ReadFile("testdata/api_management_api_schema.xml")
schema, _ := os.ReadFile("testdata/api_management_api_schema.xml")

data.ResourceTest(t, r, []acceptance.TestStep{
{
Expand All @@ -37,7 +37,7 @@ func TestAccApiManagementApiSchema_basic(t *testing.T) {
func TestAccApiManagementApiSchema_basicSwagger(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_api_management_api_schema", "test")
r := ApiManagementApiSchemaResource{}
schema, _ := ioutil.ReadFile("testdata/api_management_api_schema_swagger.json")
schema, _ := os.ReadFile("testdata/api_management_api_schema_swagger.json")

data.ResourceTest(t, r, []acceptance.TestStep{
{
Expand Down
4 changes: 2 additions & 2 deletions internal/services/appservice/helpers/publish_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"time"
Expand Down Expand Up @@ -182,7 +182,7 @@ func checkZipDeploymentStatusRefresh(r *http.Request) pluginsdk.StateRefreshFunc
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusAccepted {
return nil, "", fmt.Errorf("failed to read Zip Deployment status: %s", resp.Status)
}
respBody, err := ioutil.ReadAll(resp.Body)
respBody, err := io.ReadAll(resp.Body)
if err != nil {
return nil, "", fmt.Errorf("reading status response body for Zip Deploy")
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/storage/storage_account_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package storage_test
import (
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"testing"
Expand Down Expand Up @@ -960,7 +960,7 @@ func TestAccAzureRMStorageAccount_sharePropertiesUpdate(t *testing.T) {
func TestAccAzureRMStorageAccount_shareSoftDelete(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_storage_account", "test")
r := StorageAccountResource{}
sourceBlob, err := ioutil.TempFile("", "")
sourceBlob, err := os.CreateTemp("", "")
if err != nil {
t.Fatalf("Failed to create local source blob file")
}
Expand Down

0 comments on commit 7ba840c

Please sign in to comment.