Skip to content

Commit bcf8507

Browse files
authored
Merge pull request oxequa#212 from Quasilyte/quasilyte/sloppyLen
realize: don't guard against negative length
2 parents c046dff + 1a7c6b7 commit bcf8507

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

realize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ func start(c *cli.Context) (err error) {
11351135

11361136
}
11371137
// check project list length
1138-
if len(r.Schema.Projects) <= 0 {
1138+
if len(r.Schema.Projects) == 0 {
11391139
// create a new project based on given params
11401140
project := r.Schema.New(c)
11411141
// Add to projects list

realize/cli_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func TestRealize_Prefix(t *testing.T) {
4444
r := Realize{}
4545
input := "test"
4646
result := r.Prefix(input)
47-
if len(result) <= 0 && !strings.Contains(result, input) {
47+
if len(result) == 0 && !strings.Contains(result, input) {
4848
t.Error("Unexpected error")
4949
}
5050
}

realize/projects.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ L:
343343

344344
// Validate a file path
345345
func (p *Project) Validate(path string, fcheck bool) bool {
346-
if len(path) <= 0 {
346+
if len(path) == 0 {
347347
return false
348348
}
349349
// check if skip hidden

realize_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestRealize_add(t *testing.T) {
5656
if err := m.add(); err != nil {
5757
t.Error("Unexpected error")
5858
}
59-
if len(m.Projects) <= 0 {
59+
if len(m.Projects) == 0 {
6060
t.Error("Unexpected error")
6161
}
6262

0 commit comments

Comments
 (0)