Skip to content

Commit

Permalink
Bring back vendoring kr/pretty
Browse files Browse the repository at this point in the history
When we removed kr/pretty, we tried to copy the necessary files into
q. Unfortunately, we didn't copy enough, and q's output was changed.
The amount of code being vendored is trivial, so let's just vendor it.
  • Loading branch information
ryboe committed Mar 10, 2019
1 parent 47634ac commit cae9126
Show file tree
Hide file tree
Showing 20 changed files with 986 additions and 29 deletions.
4 changes: 3 additions & 1 deletion args.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"runtime"
"strings"
"unicode/utf8"

"github.com/kr/pretty"
)

// argName returns the source text of the given argument if it's a variable or
Expand Down Expand Up @@ -125,7 +127,7 @@ func exprToString(arg ast.Expr) string {
func formatArgs(args ...interface{}) []string {
formatted := make([]string, 0, len(args))
for _, a := range args {
s := colorize(Sprint(a), cyan)
s := colorize(pretty.Sprint(a), cyan)
formatted = append(formatted, s)
}
return formatted
Expand Down
4 changes: 3 additions & 1 deletion args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"fmt"
"go/ast"
"testing"

"github.com/kr/pretty"
)

// TestExtractingArgsFromSourceText verifies that exprToString() and argName()
Expand Down Expand Up @@ -599,7 +601,7 @@ func TestIsQCall(t *testing.T) {
t.Fatalf(
"\nTEST %d\nisQCall(%s)\ngot: %v\nwant: %v",
tc.id,
Sprint(tc.expr),
pretty.Sprint(tc.expr),
got,
tc.want,
)
Expand Down
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
module github.com/y0ssar1an/q

go 1.12

require github.com/kr/pretty v0.1.0
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
27 changes: 0 additions & 27 deletions pretty.go

This file was deleted.

4 changes: 4 additions & 0 deletions vendor/github.com/kr/pretty/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions vendor/github.com/kr/pretty/License

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions vendor/github.com/kr/pretty/Readme

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

265 changes: 265 additions & 0 deletions vendor/github.com/kr/pretty/diff.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cae9126

Please sign in to comment.