diff options
author | philtay <philtay@users.noreply.github.com> | 2019-06-05 19:42:43 +0200 |
---|---|---|
committer | Brett Vickers <beevik@users.noreply.github.com> | 2019-06-05 10:42:43 -0700 |
commit | 6e5cd8a302168f3c32305811f9da1d4bd858be4c (patch) | |
tree | fdccbd5e3f19a1f8d8619bab8de41fac2a4cd057 | |
parent | ef86ce21ad3077a354d9a3447aa2e2d02cea3410 (diff) | |
download | go-etree-6e5cd8a302168f3c32305811f9da1d4bd858be4c.tar.gz |
Lint pass (#76)
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | etree.go | 12 | ||||
-rw-r--r-- | path.go | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml index f4cb25d..e12bb98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,12 @@ language: go sudo: false +env: + - GO111MODULE=on + go: - 1.11.x + - 1.12.x - tip matrix: @@ -337,7 +337,7 @@ func (d *Document) Indent(spaces int) { switch { case spaces < 0: indent = func(depth int) string { return "" } - case d.WriteSettings.UseCRLF == true: + case d.WriteSettings.UseCRLF: indent = func(depth int) string { return indentCRLF(depth*spaces, indentSpaces) } default: indent = func(depth int) string { return indentLF(depth*spaces, indentSpaces) } @@ -464,7 +464,7 @@ func (e *Element) Text() string { if text == "" { text = cd.Data } else { - text = text + cd.Data + text += cd.Data } } else { break @@ -501,7 +501,7 @@ func (e *Element) Tail() string { if text == "" { text = cd.Data } else { - text = text + cd.Data + text += cd.Data } } else { break @@ -1003,9 +1003,7 @@ func (e *Element) dup(parent *Element) Token { for i, t := range e.Child { ne.Child[i] = t.dup(ne) } - for i, a := range e.Attr { - ne.Attr[i] = a - } + copy(ne.Attr, e.Attr) return ne } @@ -1041,7 +1039,7 @@ func (e *Element) writeTo(w *bufio.Writer, s *WriteSettings) { a.writeTo(w, s) } if len(e.Child) > 0 { - w.WriteString(">") + w.WriteByte('>') for _, c := range e.Child { c.writeTo(w, s) } @@ -211,7 +211,7 @@ type compiler struct { func (c *compiler) parsePath(path string) []segment { // If path ends with //, fix it if strings.HasSuffix(path, "//") { - path = path + "*" + path += "*" } var segments []segment |