Skip to content

Commit

Permalink
Merge pull request #212 from Quasilyte/quasilyte/sloppyLen
Browse files Browse the repository at this point in the history
realize: don't guard against negative length
  • Loading branch information
asoseil authored Sep 18, 2018
2 parents c046dff + 1a7c6b7 commit bcf8507
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion realize.go
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ func start(c *cli.Context) (err error) {

}
// check project list length
if len(r.Schema.Projects) <= 0 {
if len(r.Schema.Projects) == 0 {
// create a new project based on given params
project := r.Schema.New(c)
// Add to projects list
Expand Down
2 changes: 1 addition & 1 deletion realize/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestRealize_Prefix(t *testing.T) {
r := Realize{}
input := "test"
result := r.Prefix(input)
if len(result) <= 0 && !strings.Contains(result, input) {
if len(result) == 0 && !strings.Contains(result, input) {
t.Error("Unexpected error")
}
}
Expand Down
2 changes: 1 addition & 1 deletion realize/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ L:

// Validate a file path
func (p *Project) Validate(path string, fcheck bool) bool {
if len(path) <= 0 {
if len(path) == 0 {
return false
}
// check if skip hidden
Expand Down
2 changes: 1 addition & 1 deletion realize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestRealize_add(t *testing.T) {
if err := m.add(); err != nil {
t.Error("Unexpected error")
}
if len(m.Projects) <= 0 {
if len(m.Projects) == 0 {
t.Error("Unexpected error")
}

Expand Down

0 comments on commit bcf8507

Please sign in to comment.