diff --git a/libs/dyn/path.go b/libs/dyn/path.go index ec12d322c..76377e2dc 100644 --- a/libs/dyn/path.go +++ b/libs/dyn/path.go @@ -91,11 +91,8 @@ func (p Path) HasPrefix(q Path) bool { // String returns a string representation of the path. func (p Path) String() string { - if len(p) == 0 { - return "." - } - var buf bytes.Buffer + for i, c := range p { if i > 0 && c.key != "" { buf.WriteRune('.') diff --git a/libs/dyn/path_test.go b/libs/dyn/path_test.go index d55e16ebb..44df2050b 100644 --- a/libs/dyn/path_test.go +++ b/libs/dyn/path_test.go @@ -72,7 +72,3 @@ func TestPathString(t *testing.T) { p3 := dyn.NewPath(dyn.Key("foo"), dyn.Index(1), dyn.Key("bar"), dyn.Index(2), dyn.Key("baz")) assert.Equal(t, "foo[1].bar[2].baz", p3.String()) } - -func TestPathStringEmpty(t *testing.T) { - assert.Equal(t, ".", dyn.EmptyPath.String()) -}