Skip to content

Commit 8de8df3

Browse files
committed
Remove litter dep
1 parent 25b5649 commit 8de8df3

File tree

6 files changed

+11
-18
lines changed

6 files changed

+11
-18
lines changed

cmd/exprdbg/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/antonmedv/expr/optimizer"
1515
"github.com/antonmedv/expr/parser"
1616
"github.com/antonmedv/expr/vm"
17-
"github.com/sanity-io/litter"
1817
)
1918

2019
var (
@@ -143,7 +142,7 @@ func runProgram() {
143142
out, err := vm.Run(program, nil)
144143
check(err)
145144

146-
litter.Dump(out)
145+
fmt.Printf("%#v", out)
147146
}
148147

149148
func startRepl() {
@@ -158,7 +157,7 @@ func startRepl() {
158157
goto prompt
159158
}
160159

161-
fmt.Printf("%v\n", litter.Sdump(out))
160+
fmt.Printf("%#v\n", out)
162161

163162
prompt:
164163
fmt.Print("> ")

docgen/docgen.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type TypeName string
2020
type Context struct {
2121
Variables map[Identifier]*Type `json:"variables"`
2222
Types map[TypeName]*Type `json:"types"`
23-
pkgPath string
23+
PkgPath string
2424
}
2525

2626
type Type struct {
@@ -53,7 +53,7 @@ func CreateDoc(i interface{}) *Context {
5353
c := &Context{
5454
Variables: make(map[Identifier]*Type),
5555
Types: make(map[TypeName]*Type),
56-
pkgPath: dereference(reflect.TypeOf(i)).PkgPath(),
56+
PkgPath: dereference(reflect.TypeOf(i)).PkgPath(),
5757
}
5858

5959
for name, t := range conf.CreateTypesTable(i) {
@@ -174,7 +174,7 @@ func (c *Context) use(t reflect.Type, ops ...option) *Type {
174174
appendix:
175175

176176
name := TypeName(t.String())
177-
if c.pkgPath == t.PkgPath() {
177+
if c.PkgPath == t.PkgPath() {
178178
name = TypeName(t.Name())
179179
}
180180
anonymous := t.Name() == ""

docgen/docgen_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package docgen_test
22

33
import (
44
. "github.com/antonmedv/expr/docgen"
5-
"github.com/sanity-io/litter"
65
"github.com/stretchr/testify/assert"
76
"github.com/stretchr/testify/require"
87
"math"
@@ -127,9 +126,10 @@ func TestCreateDoc(t *testing.T) {
127126
},
128127
},
129128
},
129+
PkgPath: "github.com/antonmedv/expr/docgen_test",
130130
}
131131

132-
assert.Equal(t, litter.Sdump(expected), litter.Sdump(doc))
132+
assert.EqualValues(t, expected, doc)
133133
}
134134

135135
type A struct {
@@ -193,9 +193,10 @@ func TestCreateDoc_Ambiguous(t *testing.T) {
193193
},
194194
},
195195
},
196+
PkgPath: "github.com/antonmedv/expr/docgen_test",
196197
}
197198

198-
assert.Equal(t, litter.Sdump(expected), litter.Sdump(doc))
199+
assert.EqualValues(t, expected, doc)
199200
}
200201

201202
func TestCreateDoc_FromMap(t *testing.T) {
@@ -244,7 +245,7 @@ func TestCreateDoc_FromMap(t *testing.T) {
244245
},
245246
}
246247

247-
require.Equal(t, litter.Sdump(expected), litter.Sdump(doc))
248+
require.EqualValues(t, expected, doc)
248249
}
249250

250251
func TestContext_Markdown(t *testing.T) {

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ go 1.13
55
require (
66
github.com/gdamore/tcell v1.3.0
77
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498
8-
github.com/sanity-io/litter v1.5.5
98
github.com/stretchr/testify v1.8.0
109
)

go.sum

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
2-
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
32
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
43
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
54
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -13,18 +12,14 @@ github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i
1312
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
1413
github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
1514
github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
16-
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1715
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1816
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1917
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498 h1:4CFNy7/q7P06AsIONZzuWy7jcdqEmYQvOZ9FAFZdbls=
2018
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498/go.mod h1:6lkG1x+13OShEf0EaOCaTQYyB7d5nSbb181KtjlS+84=
2119
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
2220
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
23-
github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQo=
24-
github.com/sanity-io/litter v1.5.5/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U=
2521
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2622
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
27-
github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
2823
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
2924
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
3025
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=

vm/debug/debugger.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
. "github.com/antonmedv/expr/vm"
66
"github.com/gdamore/tcell"
77
"github.com/rivo/tview"
8-
"github.com/sanity-io/litter"
98
"os"
109
"sort"
1110
"strconv"
@@ -43,7 +42,7 @@ func StartDebugger(program *Program, env interface{}) {
4342
result.
4443
SetBorder(true).
4544
SetTitle("Output")
46-
result.SetText(litter.Sdump(out))
45+
result.SetText(fmt.Sprintf("%#v", out))
4746
sub.AddItem(result, 0, 1, false)
4847
if err != nil {
4948
errorView := tview.NewTextView()

0 commit comments

Comments
 (0)