Skip to content

Commit cae9126

Browse files
committed
Bring back vendoring kr/pretty
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.
1 parent 47634ac commit cae9126

20 files changed

+986
-29
lines changed

args.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"runtime"
1515
"strings"
1616
"unicode/utf8"
17+
18+
"github.com/kr/pretty"
1719
)
1820

1921
// argName returns the source text of the given argument if it's a variable or
@@ -125,7 +127,7 @@ func exprToString(arg ast.Expr) string {
125127
func formatArgs(args ...interface{}) []string {
126128
formatted := make([]string, 0, len(args))
127129
for _, a := range args {
128-
s := colorize(Sprint(a), cyan)
130+
s := colorize(pretty.Sprint(a), cyan)
129131
formatted = append(formatted, s)
130132
}
131133
return formatted

args_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"fmt"
99
"go/ast"
1010
"testing"
11+
12+
"github.com/kr/pretty"
1113
)
1214

1315
// TestExtractingArgsFromSourceText verifies that exprToString() and argName()
@@ -599,7 +601,7 @@ func TestIsQCall(t *testing.T) {
599601
t.Fatalf(
600602
"\nTEST %d\nisQCall(%s)\ngot: %v\nwant: %v",
601603
tc.id,
602-
Sprint(tc.expr),
604+
pretty.Sprint(tc.expr),
603605
got,
604606
tc.want,
605607
)

go.mod

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
module github.com/y0ssar1an/q
2+
3+
go 1.12
4+
5+
require github.com/kr/pretty v0.1.0

go.sum

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
2+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
3+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
4+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
5+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=

pretty.go

-27
This file was deleted.

vendor/github.com/kr/pretty/.gitignore

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/kr/pretty/License

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/kr/pretty/Readme

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/kr/pretty/diff.go

+265
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)