Skip to content

Commit 7dc79ae

Browse files
authored
Merge pull request #69 from cloudstruct/fix/replace-ioutil
fix: replace deprecated io/ioutil
2 parents 5571b71 + 02cb6da commit 7dc79ae

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

internal/api/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
swaggerFiles "github.com/swaggo/files" // swagger embed files
1616
ginSwagger "github.com/swaggo/gin-swagger" // gin-swagger middleware
1717
"golang.org/x/crypto/blake2b"
18-
"io/ioutil"
18+
"io"
1919
"time"
2020

2121
_ "github.com/cloudstruct/go-cardano-submit-api/docs" // docs is generated by Swag CLI
@@ -142,7 +142,7 @@ func handleSubmitTx(c *gin.Context) {
142142
return
143143
}
144144
// Read raw transaction bytes from the request body and store in a byte array
145-
txRawBytes, err := ioutil.ReadAll(c.Request.Body)
145+
txRawBytes, err := io.ReadAll(c.Request.Body)
146146
if err != nil {
147147
// Log the error, return an error to the user, and increment failed count
148148
logger.Errorf("failed to read request body: %s", err)

internal/config/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
ouroboros "github.com/cloudstruct/go-ouroboros-network"
77
"github.com/kelseyhightower/envconfig"
88
"gopkg.in/yaml.v2"
9-
"io/ioutil"
109
"os"
1110
)
1211

@@ -73,7 +72,7 @@ var globalConfig = &Config{
7372
func Load(configFile string) (*Config, error) {
7473
// Load config file as YAML if provided
7574
if configFile != "" {
76-
buf, err := ioutil.ReadFile(configFile)
75+
buf, err := os.ReadFile(configFile)
7776
if err != nil {
7877
return nil, fmt.Errorf("error reading config file: %s", err)
7978
}

0 commit comments

Comments
 (0)