Skip to content

Commit

Permalink
Merge branch 'master' into run-command-errors-display
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengaDev committed Nov 24, 2022
2 parents 95ec386 + d611250 commit 1436a61
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ linters-settings:
- wrapperFunc
gocyclo:
min-complexity: 20
golint:
revive:
min-confidence: 0
gomnd:
settings:
Expand Down Expand Up @@ -62,7 +62,7 @@ linters:
- gocyclo
- gofmt
- goimports
- golint
- revive
- gomnd
- goprintffuncname
- gosec
Expand Down
11 changes: 5 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"os"

"github.com/alecthomas/kong"
Expand Down Expand Up @@ -60,7 +59,7 @@ func main() {
case "run <hash|url>":
// piping
var fin io.Reader = os.Stdin
s, err := ioutil.ReadAll(fin)
s, err := io.ReadAll(fin)
if err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
Expand All @@ -82,7 +81,7 @@ func main() {
case "check <hash|url>":
// piping
var fin io.Reader = os.Stdin
s, err := ioutil.ReadAll(fin)
s, err := io.ReadAll(fin)
if err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
Expand All @@ -101,7 +100,7 @@ func main() {
fmt.Print(content) // give back so piping can continue

case "check <hash|url> <cmd>":
s, err := ioutil.ReadFile(CLI.Check.Cmd[0])
s, err := os.ReadFile(CLI.Check.Cmd[0])
if err != nil {
fmt.Printf("cannot open %v: %v", CLI.Check.Cmd[0], err)
os.Exit(1)
Expand All @@ -120,7 +119,7 @@ func main() {

// XXX need some DRY
case "create":
s, err := ioutil.ReadAll(os.Stdin)
s, err := io.ReadAll(os.Stdin)
if err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
Expand All @@ -143,7 +142,7 @@ func main() {
fmt.Printf("%v=%v\n", CLI.Create.Digest, res.ActualDigest.For(CLI.Create.Digest))

case "create <file>":
s, err := ioutil.ReadFile(CLI.Create.File)
s, err := os.ReadFile(CLI.Create.File)
if err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
Expand Down
6 changes: 3 additions & 3 deletions pkg/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ package pkg
import (
//nolint
"crypto/md5"
"io"
"net/http"

//nolint
"crypto/sha1"
"crypto/sha256"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
Expand Down Expand Up @@ -215,7 +215,7 @@ func (a *Preflight) ExecPiped(script, sig string) error {

func (a *Preflight) Exec(args []string, sig string) error {
a.Porcelain.Start(a)
s, err := ioutil.ReadFile(args[0])
s, err := os.ReadFile(args[0])
if err != nil {
return fmt.Errorf("cannot open %v: %v", args[0], err)
}
Expand Down Expand Up @@ -249,7 +249,7 @@ func parsehashList(hashArg string) ([]Signature, error) {
return nil, fmt.Errorf("cannot parse hash URL: %v", err)
}
defer resp.Body.Close()
res, err := ioutil.ReadAll(resp.Body)
res, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("cannot read hash URL content: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/file_lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package pkg

import (
"fmt"
"io/ioutil"
"os"
"strings"
)

Expand All @@ -15,7 +15,7 @@ type FileLookup struct {
}

func NewFileLookup(f string) (Lookup, error) {
content, err := ioutil.ReadFile(f)
content, err := os.ReadFile(f)
if err != nil {
return nil, fmt.Errorf("file lookup: cannot read file: %v", err)
}
Expand Down

0 comments on commit 1436a61

Please sign in to comment.