Skip to content

Commit

Permalink
PR 358 - x/term.ReadPassword and os.Exit
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbcd committed Mar 4, 2021
1 parent c2a0461 commit 7e1d26c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions examples/createwithcustomfields/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"strings"
"syscall"

jira "github.com/andygrunwald/go-jira"
"github.com/trivago/tgo/tcontainer"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)

func main() {
Expand All @@ -23,7 +22,7 @@ func main() {
username, _ := r.ReadString('\n')

fmt.Print("Jira Password: ")
bytePassword, _ := terminal.ReadPassword(int(syscall.Stdin))
bytePassword, _ := term.ReadPassword(int(syscall.Stdin))
password := string(bytePassword)

fmt.Print("Custom field name (i.e. customfield_10220): ")
Expand All @@ -40,7 +39,7 @@ func main() {
client, err := jira.NewClient(tp.Client(), strings.TrimSpace(jiraURL))
if err != nil {
fmt.Printf("\nerror: %v\n", err)
return
os.Exit(1)
}

unknowns := tcontainer.NewMarshalMap()
Expand All @@ -66,9 +65,8 @@ func main() {
},
}

issue, resp, err := client.Issue.Create(&i)
issue, _, err := client.Issue.Create(&i)
if err != nil {
_, err := ioutil.ReadAll(resp.Body)
panic(err)
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ require (
github.com/pkg/errors v0.9.1
github.com/trivago/tgo v1.0.7
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d
)

0 comments on commit 7e1d26c

Please sign in to comment.