Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package lib
import (
"flag"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"os"
Expand Down Expand Up @@ -57,7 +56,7 @@ func ConfigRead() error {
rand.Seed(rand.Int63() ^ time.Now().UnixNano())

// Read the config file
contents, err := ioutil.ReadFile(configSettingsPath())
contents, err := os.ReadFile(configSettingsPath())
if os.IsNotExist(err) {
ConfigReset()
err = nil
Expand Down
7 changes: 3 additions & 4 deletions notecard/binpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"bytes"
"crypto/md5"
"fmt"
"io/ioutil"
"os"
"os/user"
"path/filepath"
Expand Down Expand Up @@ -103,7 +102,7 @@
regionArray := []int{}
if !strings.HasSuffix(fnArg, ".zip") {
fnArray = append(fnArray, filepath.Base(fnArg))
bin, err := ioutil.ReadFile(fnArg)
bin, err := os.ReadFile(fnArg)
if err != nil {
return fmt.Errorf("%s: %s", fnArg, err)
}
Expand Down Expand Up @@ -308,7 +307,7 @@

// Read the ZIP contents
var zipContents []byte
zipContents, err = ioutil.ReadFile(path)
zipContents, err = os.ReadFile(path)
if err != nil {
return
}
Expand All @@ -335,7 +334,7 @@
err = err2
return
}
contents, err2 := ioutil.ReadAll(f)
contents, err2 := os.ReadAll(f)

Check failure on line 337 in notecard/binpack.go

View workflow job for this annotation

GitHub Actions / audit

undefined: os.ReadAll
f.Close()
if err != nil {
err = err2
Expand Down
4 changes: 2 additions & 2 deletions notecard/dfu.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"crypto/md5"
"fmt"
"hash/crc32"
"io/ioutil"
"os"
"strings"
"time"

Expand Down Expand Up @@ -44,7 +44,7 @@ func dfuSideload(filename string, verbose bool) (err error) {
// Read the file up-front so we can handle this common failure
// before we go into dfu mode
var bin []byte
bin, err = ioutil.ReadFile(filename)
bin, err = os.ReadFile(filename)
if err != nil {
return
}
Expand Down
5 changes: 2 additions & 3 deletions notecard/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"crypto/md5"
"flag"
"fmt"
"io/ioutil"
"os"
"os/signal"
"strings"
Expand Down Expand Up @@ -714,7 +713,7 @@ func main() {
// If we want to read the payload from a file, do so
if actionInput != "" {
var contents []byte
contents, err = ioutil.ReadFile(actionInput)
contents, err = os.ReadFile(actionInput)
if err == nil {
req.Payload = &contents
}
Expand Down Expand Up @@ -770,7 +769,7 @@ func main() {
// Write the payload to an output file if appropriate
if err == nil && actionOutput != "" {
if rsp.Payload != nil {
err = ioutil.WriteFile(actionOutput, *rsp.Payload, 0644)
err = os.WriteFile(actionOutput, *rsp.Payload, 0644)
if err != nil {
rsp.Payload = nil
}
Expand Down
3 changes: 1 addition & 2 deletions notecard/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"os/signal"
"os/user"
Expand Down Expand Up @@ -118,7 +117,7 @@ repl:
continue repl
case "history":
repl.writeHistory()
history, err := ioutil.ReadFile(repl.historyFilePath)
history, err := os.ReadFile(repl.historyFilePath)
if err != nil {
fmt.Printf("error: %s\n", err)
} else {
Expand Down
7 changes: 3 additions & 4 deletions notecard/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"
"time"
Expand Down Expand Up @@ -89,7 +88,7 @@ func scan(debugEnabled bool, init bool, fnSetup string, fnSetupSKU string, carri
// Read the file into an array that we'll keep ordered
var contents []byte
var scannedDevices []ScannedDevice
contents, err = ioutil.ReadFile(outfile)
contents, err = os.ReadFile(outfile)
if err != nil {
fmt.Printf("*** new file: %s\n", outfile)
} else {
Expand All @@ -110,7 +109,7 @@ func scan(debugEnabled bool, init bool, fnSetup string, fnSetupSKU string, carri

// Read the SIM file into an array that we'll keep ordered
var scannedSIMs []ScannedSIM
contents, err = ioutil.ReadFile(simfile)
contents, err = os.ReadFile(simfile)
if err != nil {
fmt.Printf("*** new file: %s\n", simfile)
} else {
Expand Down Expand Up @@ -397,7 +396,7 @@ func loadRequests(filename string) (requests []map[string]interface{}, err error

// Read the file into an array of requests
var contents []byte
contents, err = ioutil.ReadFile(filename)
contents, err = os.ReadFile(filename)
if err != nil {
return
}
Expand Down
3 changes: 1 addition & 2 deletions notecard/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
)
Expand All @@ -32,7 +31,7 @@

// Unmarshal the ping response
var webrspJSON []byte
webrspJSON, err = ioutil.ReadAll(webrsp.Body)
webrspJSON, err = os.ReadAll(webrsp.Body)

Check failure on line 34 in notecard/time.go

View workflow job for this annotation

GitHub Actions / audit

undefined: os
webrsp.Body.Close()
if err != nil {
return
Expand Down
5 changes: 2 additions & 3 deletions notecard/twilio.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -40,7 +39,7 @@
return
}
if httpRsp.StatusCode == http.StatusOK {
rspJSON, err = ioutil.ReadAll(httpRsp.Body)
rspJSON, err = os.ReadAll(httpRsp.Body)

Check failure on line 42 in notecard/twilio.go

View workflow job for this annotation

GitHub Actions / audit

undefined: os
if err == nil {
rsp := map[string]interface{}{}
err = json.Unmarshal(rspJSON, &rsp)
Expand Down Expand Up @@ -82,7 +81,7 @@
}
if httpRsp.StatusCode != http.StatusOK && httpRsp.StatusCode != http.StatusCreated {
fmt.Printf("status: %d %s\n", httpRsp.StatusCode, httpRsp.Status)
rspJSON, _ = ioutil.ReadAll(httpRsp.Body)
rspJSON, _ = os.ReadAll(httpRsp.Body)

Check failure on line 84 in notecard/twilio.go

View workflow job for this annotation

GitHub Actions / audit

undefined: os
fmt.Printf("%s\n", rspJSON)
rsp := map[string]interface{}{}
err = json.Unmarshal(rspJSON, &rsp)
Expand Down
4 changes: 2 additions & 2 deletions notehub/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"os"
"sort"
"strings"

Expand Down Expand Up @@ -277,7 +277,7 @@ func addScope(scope string, appMetadata *AppMetadata, scopeDevices *[]string, sc

// Process a file indirection
var contents []byte
contents, err = ioutil.ReadFile(indirectScope)
contents, err = os.ReadFile(indirectScope)
if err != nil {
return fmt.Errorf("%s: %s", indirectScope, err)
}
Expand Down
5 changes: 2 additions & 3 deletions notehub/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -128,7 +127,7 @@
err = fmt.Errorf("status %d", httpRsp.StatusCode)
return
}
rspJSON, err2 := ioutil.ReadAll(httpRsp.Body)
rspJSON, err2 := os.ReadAll(httpRsp.Body)

Check failure on line 130 in notehub/auth.go

View workflow job for this annotation

GitHub Actions / audit

undefined: os.ReadAll
if err2 != nil {
err = err2
return
Expand Down Expand Up @@ -215,7 +214,7 @@
err = fmt.Errorf("user is not signed in")
return
}
rspJSON, err2 := ioutil.ReadAll(httpRsp.Body)
rspJSON, err2 := os.ReadAll(httpRsp.Body)

Check failure on line 217 in notehub/auth.go

View workflow job for this annotation

GitHub Actions / audit

undefined: os.ReadAll
if err2 != nil {
err = err2
return
Expand Down
5 changes: 2 additions & 3 deletions notehub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"strings"

Expand Down Expand Up @@ -240,7 +239,7 @@ func main() {
// Process request starting with @ as a filename containing the request
if strings.HasPrefix(flagReq, "@") {
fn := strings.TrimPrefix(flagReq, "@")
contents, err := ioutil.ReadFile(fn)
contents, err := os.ReadFile(fn)
if err != nil {
fmt.Printf("Can't read request file '%s': %s\n", fn, err)
os.Exit(exitFail)
Expand Down Expand Up @@ -356,7 +355,7 @@ func main() {
template := Vars{}
if strings.HasPrefix(flagVarsSet, "@") {
var templateJSON []byte
templateJSON, err = ioutil.ReadFile(strings.TrimPrefix(flagVarsSet, "@"))
templateJSON, err = os.ReadFile(strings.TrimPrefix(flagVarsSet, "@"))
if err == nil {
err = note.JSONUnmarshal(templateJSON, &template)
}
Expand Down
5 changes: 2 additions & 3 deletions notehub/req.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -103,7 +102,7 @@
var fileLength int
buffer := bytes.NewBuffer(request)
if requestFile != "" {
fileContents, err = ioutil.ReadFile(requestFile)
fileContents, err = os.ReadFile(requestFile)

Check failure on line 105 in notehub/req.go

View workflow job for this annotation

GitHub Actions / audit

undefined: os
if err != nil {
return
}
Expand Down Expand Up @@ -254,7 +253,7 @@
fmt.Printf("STATUS %d\n", httpRsp.StatusCode)
}

response, err = ioutil.ReadAll(httpRsp.Body)
response, err = os.ReadAll(httpRsp.Body)

Check failure on line 256 in notehub/req.go

View workflow job for this annotation

GitHub Actions / audit

undefined: os
if err != nil {
return
}
Expand Down
Loading