Skip to content

Commit

Permalink
Removed deprecated package
Browse files Browse the repository at this point in the history
  • Loading branch information
breathbath committed Feb 17, 2021
1 parent a0158d4 commit a398d39
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"context"
"fmt"

"github.com/cloudradar-monitoring/rportcli/internal/pkg/cli"

"github.com/cloudradar-monitoring/rportcli/internal/pkg/api"
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ require (
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf
)
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,13 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
Expand Down
3 changes: 2 additions & 1 deletion internal/pkg/api/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"github.com/breathbath/go_utils/utils/env"
"io"
"io/ioutil"
"net/http"
"net/http/httputil"
"time"

"github.com/breathbath/go_utils/utils/env"

"github.com/sirupsen/logrus"
)

Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/config/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package config
import (
"bufio"
"fmt"
"golang.org/x/crypto/ssh/terminal"
"os"
"strings"
"syscall"

"golang.org/x/term"

"github.com/cloudradar-monitoring/rportcli/internal/pkg/cli"

"github.com/fatih/color"
Expand All @@ -28,7 +29,7 @@ func (dr *DefaultReader) ReadString(delim byte) (string, error) {
}

func (dr *DefaultReader) ReadPassword() (string, error) {
inputBytes, err := terminal.ReadPassword(syscall.Stdin)
inputBytes, err := term.ReadPassword(syscall.Stdin)
return string(inputBytes), err
}

Expand Down
10 changes: 5 additions & 5 deletions internal/pkg/config/prompt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
)

type PromptReaderMock struct {
ReadCount int
ReadCount int
PasswordReadCount int
ReadOutputs []string
ReadOutputs []string
PasswordReadOutputs []string
ErrToGive error
ErrToGive error
}

func (prm *PromptReaderMock) ReadString(delim byte) (string, error) {
Expand Down Expand Up @@ -87,7 +87,7 @@ func TestPromptRequiredValues(t *testing.T) {

func TestPromptPassword(t *testing.T) {
readerMock := &PromptReaderMock{
PasswordReadCount: 0,
PasswordReadCount: 0,
PasswordReadOutputs: []string{"123"},
}

Expand All @@ -109,7 +109,7 @@ func TestPromptPassword(t *testing.T) {
assert.Equal(
t,
map[string]string{
"password": "123",
"password": "123",
},
actualKV,
)
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/output/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"io"
"regexp"

"golang.org/x/term"

"github.com/breathbath/go_utils/utils/testing"

"github.com/olekukonko/tablewriter"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh/terminal"
)

var columnsCountToTerminalWidthMap = []tableWidthColumnsCountMapping{
Expand Down Expand Up @@ -58,7 +59,7 @@ func calcColumnsCount(widthMapping []tableWidthColumnsCountMapping) int {
return 0
}

actualTerminalWidth, _, err := terminal.GetSize(0)
actualTerminalWidth, _, err := term.GetSize(0)
if err != nil {
logrus.Warnf("cannot determine terminal width: %v", err)
return 0
Expand Down

0 comments on commit a398d39

Please sign in to comment.