Permalink
Browse files

Use strings.TrimSuffix(s, "\n") instead of trim.LastNewline(s).

This is simpler and more readable, since package strings is a part of
the standard library.

Done with:

	gofmt -w -r 'trim.LastNewline(s) -> strings.TrimSuffix(s, "\n")' .
	goimports -w .
  • Loading branch information...
dmitshur committed Dec 15, 2018
1 parent 67b40f7 commit 76a6b9a991267b6448fbf42ffe117e0d80afbc76
Showing with 2 additions and 2 deletions.
  1. +2 −2 main.go
@@ -11,8 +11,8 @@ import (
"os/exec"
"path/filepath"
"strconv"
"strings"

"github.com/shurcooL/go/trim"
"golang.org/x/tools/imports"

// We need go-goon to be available; this ensures getting goexec will get go-goon too.
@@ -60,7 +60,7 @@ func main() {
log.Fatalln(err)
}

cmd += "(" + trim.LastNewline(string(stdin)) + ")"
cmd += "(" + strings.TrimSuffix(string(stdin), "\n") + ")"
}
if !*quietFlag {
cmd = "goon.Dump(" + cmd + ")"

0 comments on commit 76a6b9a

Please sign in to comment.