Skip to content

Commit faa390e

Browse files
committed
Use new term package to password prompt
1 parent 13a1dfd commit faa390e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.PHONY: build
22
build:
3-
rm -rf ./out
43
mkdir -p ./out
54
go build -ldflags="-w -s" -o ./out/pbcli ./cmd/pbcli
65

@@ -12,13 +11,10 @@ test:
1211
fi
1312
go vet ./...
1413
gocyclo -over 10 $(shell find . -iname '*.go' -type f)
14+
staticcheck ./...
1515
go test -v -cover ./...
16-
stdout=$$(golint ./... 2>&1); \
17-
if [ "$$stdout" ]; then \
18-
exit 1; \
19-
fi
2016

2117
.PHONY: setup
2218
setup:
2319
go get -u github.com/fzipp/gocyclo/cmd/gocyclo
24-
go get -u golang.org/x/lint/golint
20+
go get -u honnef.co/go/tools/cmd/staticcheck

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ go 1.14
44

55
require (
66
github.com/jessevdk/go-flags v1.4.0
7-
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
7+
golang.org/x/term v0.0.0-20210503060354-a79de5458b56
88
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
77
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
88
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
99
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
10+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
11+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1012
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=
1113
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
14+
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w=
15+
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
1216
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

internal/ui/mod.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import (
66
"log"
77
"syscall"
88

9-
"golang.org/x/crypto/ssh/terminal"
9+
"golang.org/x/term"
1010
)
1111

1212
// GetPassword reads a password from the terminal.
1313
func GetPassword(prompt string) string {
1414
fmt.Print(prompt)
15-
passwordBytes, err := terminal.ReadPassword(int(syscall.Stdin))
15+
passwordBytes, err := term.ReadPassword(int(syscall.Stdin))
1616
fmt.Print("\n")
1717

1818
if err != nil {
@@ -28,7 +28,7 @@ func GetPassword(prompt string) string {
2828
return password
2929
}
3030

31-
// PrintJSON pretty-prints JSON to the terminal.
31+
// PrintJSON pretty-prints JSON to the term.
3232
func PrintJSON(obj interface{}) {
3333
pretty, err := json.MarshalIndent(obj, "", "\t")
3434

0 commit comments

Comments
 (0)