mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
internal/getproviders: deprecate io/ioutil (#342)
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
This commit is contained in:
parent
6b1fe8b7a9
commit
40d6b4bd86
@ -6,7 +6,6 @@ import (
|
|||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/addrs"
|
||||||
@ -153,7 +152,7 @@ func FakePackageMeta(provider addrs.Provider, version Version, protocols Version
|
|||||||
// should call the callback even if this function returns an error, because
|
// should call the callback even if this function returns an error, because
|
||||||
// some error conditions leave a partially-created file on disk.
|
// some error conditions leave a partially-created file on disk.
|
||||||
func FakeInstallablePackageMeta(provider addrs.Provider, version Version, protocols VersionList, target Platform, execFilename string) (PackageMeta, func(), error) {
|
func FakeInstallablePackageMeta(provider addrs.Provider, version Version, protocols VersionList, target Platform, execFilename string) (PackageMeta, func(), error) {
|
||||||
f, err := ioutil.TempFile("", "terraform-getproviders-fake-package-")
|
f, err := os.CreateTemp("", "terraform-getproviders-fake-package-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return PackageMeta{}, func() {}, err
|
return PackageMeta{}, func() {}, err
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -443,7 +443,7 @@ func (c *registryClient) getFile(url *url.URL) ([]byte, error) {
|
|||||||
return nil, fmt.Errorf("%s returned from %s", resp.Status, HostFromRequest(resp.Request))
|
return nil, fmt.Errorf("%s returned from %s", resp.Status, HostFromRequest(resp.Request))
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := ioutil.ReadAll(resp.Body)
|
data, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return data, err
|
return data, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user