Merge pull request #10594 from filecoin-project/phi/v1210-rc2
build: release: v1.21.0-rc2
This commit is contained in:
@@ -2,14 +2,13 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func run() error {
|
||||
tfb, err := ioutil.ReadFile("./node/config/types.go")
|
||||
tfb, err := os.ReadFile("./node/config/types.go")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+1
-2
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
@@ -47,7 +46,7 @@ func FromFile(path string, opts ...LoadCfgOpt) (interface{}, error) {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close() //nolint:errcheck,staticcheck // The file is RO
|
||||
cfgBs, err := ioutil.ReadAll(file)
|
||||
cfgBs, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to read config for validation checks %w", err)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package config
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -50,7 +49,7 @@ func TestParitalConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
{
|
||||
f, err := ioutil.TempFile("", "config-*.toml")
|
||||
f, err := os.CreateTemp("", "config-*.toml")
|
||||
fname := f.Name()
|
||||
|
||||
assert.NoError(err, "tmp file shold not error")
|
||||
@@ -115,7 +114,7 @@ func TestValidateConfigSetsEnableSplitstore(t *testing.T) {
|
||||
assert.False(t, MatchEnableSplitstoreField(string(cfgCommentedOutEnableSS)))
|
||||
|
||||
// write config with commented out EnableSplitstore to file
|
||||
f, err := ioutil.TempFile("", "config.toml")
|
||||
f, err := os.CreateTemp("", "config.toml")
|
||||
fname := f.Name()
|
||||
assert.NoError(t, err)
|
||||
defer func() {
|
||||
@@ -132,7 +131,7 @@ func TestValidateConfigSetsEnableSplitstore(t *testing.T) {
|
||||
|
||||
// Loading without a config file and a default fails if the default fallback is disabled
|
||||
func TestFailToFallbackToDefault(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("", "dirWithNoFiles")
|
||||
dir, err := os.MkdirTemp("", "dirWithNoFiles")
|
||||
assert.NoError(t, err)
|
||||
defer assert.NoError(t, os.RemoveAll(dir))
|
||||
nonExistantFileName := dir + "/notarealfile"
|
||||
|
||||
@@ -3,7 +3,6 @@ package config
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
@@ -43,7 +42,7 @@ func WriteStorageFile(path string, config storiface.StorageConfig) error {
|
||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(path, b, 0644); err != nil {
|
||||
if err := os.WriteFile(path, b, 0644); err != nil {
|
||||
return xerrors.Errorf("persisting storage config (%s): %w", path, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"embed"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -77,7 +77,7 @@ func TestImportLocal(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
outBytes, err := ioutil.ReadFile(out1)
|
||||
outBytes, err := os.ReadFile(out1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, b, outBytes)
|
||||
|
||||
@@ -128,7 +128,7 @@ func TestImportLocal(t *testing.T) {
|
||||
err = files.WriteTo(file, exportedPath)
|
||||
require.NoError(t, err)
|
||||
|
||||
exportedBytes, err := ioutil.ReadFile(exportedPath)
|
||||
exportedBytes, err := os.ReadFile(exportedPath)
|
||||
require.NoError(t, err)
|
||||
|
||||
// compare original file to recreated unixfs file.
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@@ -147,7 +146,7 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, err
|
||||
if errors.Is(err, types.ErrKeyInfoNotFound) {
|
||||
log.Warn("Generating new API secret")
|
||||
|
||||
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||
sk, err := io.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/ipfs/go-blockservice"
|
||||
@@ -60,7 +59,7 @@ func MakeGenesis(outFile, genesisTemplate string) func(bs dtypes.ChainBlockstore
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fdata, err := ioutil.ReadFile(genesisTemplate)
|
||||
fdata, err := os.ReadFile(genesisTemplate)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("reading preseals json: %w", err)
|
||||
}
|
||||
|
||||
+7
-8
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -329,7 +328,7 @@ func (fsr *FsRepo) APIEndpoint() (multiaddr.Multiaddr, error) {
|
||||
}
|
||||
defer f.Close() //nolint: errcheck // Read only op
|
||||
|
||||
data, err := ioutil.ReadAll(f)
|
||||
data, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to read %q: %w", p, err)
|
||||
}
|
||||
@@ -354,7 +353,7 @@ func (fsr *FsRepo) APIToken() ([]byte, error) {
|
||||
}
|
||||
defer f.Close() //nolint: errcheck // Read only op
|
||||
|
||||
tb, err := ioutil.ReadAll(f)
|
||||
tb, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -582,7 +581,7 @@ func (fsr *fsLockedRepo) SetConfig(c func(interface{})) error {
|
||||
}
|
||||
|
||||
// write buffer of TOML bytes to config file
|
||||
err = ioutil.WriteFile(fsr.configPath, buf.Bytes(), 0644)
|
||||
err = os.WriteFile(fsr.configPath, buf.Bytes(), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -635,14 +634,14 @@ func (fsr *fsLockedRepo) SetAPIEndpoint(ma multiaddr.Multiaddr) error {
|
||||
if err := fsr.stillValid(); err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile(fsr.join(fsAPI), []byte(ma.String()), 0644)
|
||||
return os.WriteFile(fsr.join(fsAPI), []byte(ma.String()), 0644)
|
||||
}
|
||||
|
||||
func (fsr *fsLockedRepo) SetAPIToken(token []byte) error {
|
||||
if err := fsr.stillValid(); err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile(fsr.join(fsAPIToken), token, 0600)
|
||||
return os.WriteFile(fsr.join(fsAPIToken), token, 0600)
|
||||
}
|
||||
|
||||
func (fsr *fsLockedRepo) KeyStore() (types.KeyStore, error) {
|
||||
@@ -711,7 +710,7 @@ func (fsr *fsLockedRepo) Get(name string) (types.KeyInfo, error) {
|
||||
}
|
||||
defer file.Close() //nolint: errcheck // read only op
|
||||
|
||||
data, err := ioutil.ReadAll(file)
|
||||
data, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return types.KeyInfo{}, xerrors.Errorf("reading key '%s': %w", name, err)
|
||||
}
|
||||
@@ -760,7 +759,7 @@ func (fsr *fsLockedRepo) put(rawName string, info types.KeyInfo, retries int) er
|
||||
return xerrors.Errorf("encoding key '%s': %w", name, err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(keyPath, keyData, 0600)
|
||||
err = os.WriteFile(keyPath, keyData, 0600)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("writing key '%s': %w", name, err)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package repo
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
@@ -103,7 +102,7 @@ func (lmem *lockedMemRepo) Path() string {
|
||||
return lmem.mem.tempDir
|
||||
}
|
||||
|
||||
t, err := ioutil.TempDir(os.TempDir(), "lotus-memrepo-temp-")
|
||||
t, err := os.MkdirTemp(os.TempDir(), "lotus-memrepo-temp-")
|
||||
if err != nil {
|
||||
panic(err) // only used in tests, probably fine
|
||||
}
|
||||
@@ -142,7 +141,7 @@ func (lmem *lockedMemRepo) initSectorStore(t string) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(filepath.Join(t, "sectorstore.json"), b, 0644); err != nil {
|
||||
if err := os.WriteFile(filepath.Join(t, "sectorstore.json"), b, 0644); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user