Permalink
Browse files

cmd/Go-Package-Store: 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 21925de commit 15eb607be781fcc0cef810d5e55b698e67c4cf2d
Showing with 2 additions and 3 deletions.
  1. +2 −3 cmd/Go-Package-Store/buildutil.go
@@ -10,7 +10,6 @@ import (
"strings"

"github.com/shurcooL/Go-Package-Store/workspace"
"github.com/shurcooL/go/trim"
"github.com/shurcooL/vcsstate"
"golang.org/x/tools/go/vcs"
)
@@ -90,13 +89,13 @@ func parseGitRepoFile(dir string) (remote string, commit string, _ error) {
if err != nil {
return "", "", err
}
remote = trim.LastNewline(string(remoteBytes))
remote = strings.TrimSuffix(string(remoteBytes), "\n")

commitBytes, err := exec.Command("git", "config", "--file", filepath.Join(dir, ".gitrepo"), "subrepo.commit").Output()
if err != nil {
return "", "", err
}
commit = trim.LastNewline(string(commitBytes))
commit = strings.TrimSuffix(string(commitBytes), "\n")

return remote, commit, nil
}

0 comments on commit 15eb607

Please sign in to comment.