Skip to content

Commit

Permalink
fixed build failure on Travis CI, replace strings.ReplaceAll method t…
Browse files Browse the repository at this point in the history
…o strings.Replace method.
  • Loading branch information
tamada committed Apr 2, 2019
1 parent 0c180a3 commit 48753f4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion completions/rrh_completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ __rrh_add() {
elif [ "$2" = "-g" ] || [ "$2" = "--group" ]; then
groups="$(__rrh_groups)"
COMPREPLY=($(compgen -W "$groups" -- "$1"))
elif [ "$4" = "$2" ]; then
else
compopt -o filenames
COMPREPLY=($(compgen -d -- "$1"))
fi
Expand Down
2 changes: 1 addition & 1 deletion list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestSimpleResults(t *testing.T) {
}
})
result = strings.TrimSpace(result)
result = strings.ReplaceAll(result, "\n", ",")
result = strings.Replace(result, "\n", ",", -1)
if result != tc.result {
t.Errorf("%v: result did not match: wont: %s, got: %s", tc.args, tc.result, result)
}
Expand Down
19 changes: 10 additions & 9 deletions path/path_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,18 @@ func (path *PathCommand) perform(db *common.Database) int {
return 0
}

func (options *pathOptions) matchEach(id string, arg string) bool {
if options.partialMatch {
return strings.Contains(id, arg)
}
return id == arg
}

func (options *pathOptions) match(id string) bool {
for _, arg := range options.args {
if options.partialMatch {
var flag = strings.Contains(id, arg)
if flag {
return true
}
} else {
if id == arg {
return true
}
var bool = options.matchEach(id, arg)
if bool {
return true
}
}
return len(options.args) == 0
Expand Down
2 changes: 1 addition & 1 deletion path/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestPathCommand(t *testing.T) {
})
if tc.status == 0 {
output = strings.TrimSpace(output)
output = strings.ReplaceAll(output, "\n", ",")
output = strings.Replace(output, "\n", ",", -1)
if output != tc.results {
t.Errorf("%v: output did not match: wont: %s, got: %s", tc.args, tc.results, output)
}
Expand Down

0 comments on commit 48753f4

Please sign in to comment.