Skip to content

Commit

Permalink
Remove final references to internal packages (#1709)
Browse files Browse the repository at this point in the history
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
  • Loading branch information
dominikschulz authored Jan 14, 2021
1 parent a0f6005 commit ddfe7bf
Show file tree
Hide file tree
Showing 78 changed files with 85 additions and 83 deletions.
2 changes: 1 addition & 1 deletion cmd/gopass-git-credentials/git-credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"testing"

"github.com/fatih/color"
"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/gopass/apimock"
"github.com/gopasspw/gopass/pkg/termio"
"github.com/gopasspw/gopass/tests/gptest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
22 changes: 9 additions & 13 deletions cmd/gopass-hibp/hibp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"fmt"
"sort"

"github.com/gopasspw/gopass/internal/notify"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/debug"
"github.com/gopasspw/gopass/pkg/gopass"
Expand Down Expand Up @@ -51,7 +49,7 @@ func (s *hibp) CheckAPI(ctx context.Context, force bool) error {
}
}

return s.printMatches(ctx, matchList)
return s.printMatches(matchList)
}

// CheckDump checks your secrets against the provided HIBPv2 Dumps
Expand Down Expand Up @@ -81,7 +79,7 @@ func (s *hibp) CheckDump(ctx context.Context, force bool, dumps []string) error
}
}

return s.printMatches(ctx, matchList)
return s.printMatches(matchList)
}

func (s *hibp) precomputeHashes(ctx context.Context) (map[string]string, []string, error) {
Expand All @@ -99,7 +97,7 @@ func (s *hibp) precomputeHashes(ctx context.Context) (map[string]string, []strin
// display progress bar
bar := termio.NewProgressBar(int64(len(pwList)), ctxutil.IsHidden(ctx))

out.Print(ctx, "Computing SHA1 hashes of all your secrets ...")
fmt.Println("Computing SHA1 hashes of all your secrets ...")
for _, secret := range pwList {
// check for context cancelation
select {
Expand All @@ -116,7 +114,7 @@ func (s *hibp) precomputeHashes(ctx context.Context) (map[string]string, []strin
// go templates to extract and compare data from the body
sec, err := s.gp.Get(ctx, secret, "latest")
if err != nil {
out.Print(ctx, "\n"+color.YellowString("Failed to retrieve secret '%s': %s", secret, err))
fmt.Printf("\n" + color.YellowString("Failed to retrieve secret '%s': %s\n", secret, err))
continue
}

Expand All @@ -138,20 +136,18 @@ func (s *hibp) precomputeHashes(ctx context.Context) (map[string]string, []strin
return shaSums, sortedShaSums, nil
}

func (s *hibp) printMatches(ctx context.Context, matchList []string) error {
func (s *hibp) printMatches(matchList []string) error {
if len(matchList) < 1 {
_ = notify.Notify(ctx, name, "Good news - No matches found!")
out.Green(ctx, "Good news - No matches found!")
fmt.Println("Good news - No matches found!")
return nil
}

sort.Strings(matchList)
_ = notify.Notify(ctx, name, fmt.Sprintf("Oh no - found %d matches", len(matchList)))
out.Error(ctx, "Oh no - Found some matches:")
fmt.Println("Oh no - Found some matches:")
for _, m := range matchList {
out.Error(ctx, "\t- %s", m)
fmt.Printf("\t- %s\n", m)
}
out.Cyan(ctx, "The passwords in the listed secrets were included in public leaks in the past. This means they are likely included in many word-list attacks and provide only very little security. Strongly consider changing those passwords!")
fmt.Println("The passwords in the listed secrets were included in public leaks in the past. This means they are likely included in many word-list attacks and provide only very little security. Strongly consider changing those passwords!")
return fmt.Errorf("weak passwords found")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/gopass-hibp/hibp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"strings"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/gopass/apimock"
hibpapi "github.com/gopasspw/gopass/pkg/hibp/api"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/urfave/cli/v2"
Expand Down
2 changes: 1 addition & 1 deletion cmd/gopass-jsonapi/internal/jsonapi/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"testing"

"github.com/blang/semver"
"github.com/gopasspw/gopass/internal/otp"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/debug"
"github.com/gopasspw/gopass/pkg/gopass"
"github.com/gopasspw/gopass/pkg/gopass/apimock"
"github.com/gopasspw/gopass/pkg/gopass/secrets/secparse"
"github.com/gopasspw/gopass/pkg/otp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/gopass-jsonapi/internal/jsonapi/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"regexp"
"strings"

"github.com/gopasspw/gopass/internal/clipboard"
"github.com/gopasspw/gopass/internal/otp"
"github.com/gopasspw/gopass/pkg/clipboard"
"github.com/gopasspw/gopass/pkg/gopass"
"github.com/gopasspw/gopass/pkg/gopass/secrets"
"github.com/gopasspw/gopass/pkg/otp"
"github.com/gopasspw/gopass/pkg/pwgen"

"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion cmd/gopass-jsonapi/jsonapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
)
Expand Down
12 changes: 10 additions & 2 deletions cmd/gopass-summon-provider/summon-provider.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package main

import (
"github.com/gopasspw/gopass/internal/out"
"fmt"
"io"
"os"

"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/gopass"
"github.com/urfave/cli/v2"
)

var (
// Stdout is exported for tests
Stdout io.Writer = os.Stdout
)

type gc struct {
gp gopass.Store
}
Expand All @@ -20,6 +28,6 @@ func (s *gc) Get(c *cli.Context) error {
if err != nil {
return err
}
out.Print(ctx, secret.Password())
fmt.Fprintln(Stdout, secret.Password())
return nil
}
8 changes: 3 additions & 5 deletions cmd/gopass-summon-provider/summon-provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,27 @@ import (
"testing"

"github.com/fatih/color"
"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/gopass/apimock"
"github.com/gopasspw/gopass/pkg/termio"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestSummonProviderOutputsOnlySecret(t *testing.T) {

ctx := context.Background()
act := &gc{
gp: apimock.New(),
}
require.NoError(t, act.gp.Set(ctx, "foo", &apimock.Secret{Buf: []byte("bar\nbaz: zab")}))

buf := &bytes.Buffer{}
out.Stdout = buf
Stdout = buf
color.NoColor = true
defer func() {
out.Stdout = os.Stdout
termio.Stdin = os.Stdin
Stdout = os.Stdout
}()

assert.NoError(t, act.Get(gptest.CliCtx(ctx, t, "foo")))
Expand Down
2 changes: 1 addition & 1 deletion internal/action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/gopasspw/gopass/internal/backend"
"github.com/gopasspw/gopass/internal/backend/crypto/plain"
"github.com/gopasspw/gopass/internal/config"
"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/blang/semver"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/gopass/secrets"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/binary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"path/filepath"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"github.com/gopasspw/gopass/internal/backend"
git "github.com/gopasspw/gopass/internal/backend/storage/gitfs"
"github.com/gopasspw/gopass/internal/config"
"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/termio"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/blang/semver"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/tests/gptest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/urfave/cli/v2"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/fatih/color"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/create/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package create
import (
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/tests/gptest"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli/v2"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/action/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

"github.com/fatih/color"
"github.com/gopasspw/gopass/internal/action"
"github.com/gopasspw/gopass/internal/clipboard"
"github.com/gopasspw/gopass/internal/cui"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/clipboard"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/fsutil"
"github.com/gopasspw/gopass/pkg/gopass"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/gopass/secrets"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/edit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"runtime"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/tests/gptest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/action/find_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"strings"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/gopass/secrets"
"github.com/gopasspw/gopass/tests/gptest"
"github.com/urfave/cli/v2"

"github.com/fatih/color"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/fsck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"strings"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/fatih/color"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/gopasspw/gopass/internal/tree"
"github.com/gopasspw/gopass/pkg/gopass/secrets"

"github.com/gopasspw/gopass/internal/clipboard"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/clipboard"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/debug"
"github.com/gopasspw/gopass/pkg/gopass"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"testing"

"github.com/fatih/color"
"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/tests/gptest"
"github.com/urfave/cli/v2"

"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion internal/action/grep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"testing"

"github.com/gopasspw/gopass/internal/gptest"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/gopasspw/gopass/pkg/gopass/secrets"
"github.com/gopasspw/gopass/tests/gptest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
Loading

0 comments on commit ddfe7bf

Please sign in to comment.