Fix failing checks

This commit is contained in:
Benj Fassbind
2022-04-05 11:28:24 +02:00
parent 0302e39d57
commit 8046fb1eb9
4 changed files with 17 additions and 12 deletions

View File

@@ -3,10 +3,10 @@ package console
import ( import (
"syscall" "syscall"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/term"
) )
// RunningOnTerminal checks whether stdout is terminal // RunningOnTerminal checks whether stdout is terminal
func RunningOnTerminal() bool { func RunningOnTerminal() bool {
return terminal.IsTerminal(syscall.Stdout) return term.IsTerminal(syscall.Stdout)
} }

1
go.mod
View File

@@ -40,6 +40,7 @@ require (
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29
golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64 golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11
google.golang.org/protobuf v1.28.0 // indirect google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c

View File

@@ -14,11 +14,13 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/crypto/openpgp" // TODO: replace crypto/openpgp since it is deprecated
"golang.org/x/crypto/openpgp/clearsign" // https://github.com/golang/go/issues/44226
openpgp_errors "golang.org/x/crypto/openpgp/errors" "golang.org/x/crypto/openpgp" //nolint:staticcheck
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/clearsign" //nolint:staticcheck
"golang.org/x/crypto/ssh/terminal" openpgp_errors "golang.org/x/crypto/openpgp/errors" //nolint:staticcheck
"golang.org/x/crypto/openpgp/packet" //nolint:staticcheck
"golang.org/x/term"
) )
// Test interface // Test interface
@@ -174,7 +176,7 @@ func (g *GoSigner) Init() error {
for attempt := 0; attempt < 3; attempt++ { for attempt := 0; attempt < 3; attempt++ {
fmt.Print("\nEnter passphrase: ") fmt.Print("\nEnter passphrase: ")
var bytePassphrase []byte var bytePassphrase []byte
bytePassphrase, err = terminal.ReadPassword(int(syscall.Stdin)) bytePassphrase, err = term.ReadPassword(int(syscall.Stdin))
if err != nil { if err != nil {
return errors.Wrap(err, "error reading passphare") return errors.Wrap(err, "error reading passphare")
} }

View File

@@ -11,10 +11,12 @@ import (
"strconv" "strconv"
"time" "time"
"golang.org/x/crypto/openpgp" // TODO: replace crypto/openpgp since it is deprecated
"golang.org/x/crypto/openpgp/armor" // https://github.com/golang/go/issues/44226
"golang.org/x/crypto/openpgp/errors" "golang.org/x/crypto/openpgp" //nolint:staticcheck
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/armor" //nolint:staticcheck
"golang.org/x/crypto/openpgp/errors" //nolint:staticcheck
"golang.org/x/crypto/openpgp/packet" //nolint:staticcheck
) )
// hashForSignature returns a pair of hashes that can be used to verify a // hashForSignature returns a pair of hashes that can be used to verify a