Checking via len is more robust

because sometimes such APIs return nil slices, sometimes empty slices.
We want nothing to happen in both cases.
This commit is contained in:
Ingo Oeser 2015-08-22 23:52:09 +02:00
parent d81ea3f35c
commit f1a92ba9fc
3 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ import (
func main() {
files := general.GetChangedGoFiles()
if files == nil {
if len(files) == 0 {
os.Exit(0)
return
}

View File

@ -10,7 +10,7 @@ import (
func main() {
files := general.GetChangedGoFiles()
if files == nil {
if len(files) == 0 {
os.Exit(0)
return
}

View File

@ -9,7 +9,7 @@ import (
func main() {
files := general.GetChangedGoFiles()
if files == nil {
if len(files) == 0 {
os.Exit(0)
return
}