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:
parent
d81ea3f35c
commit
f1a92ba9fc
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
func main() {
|
||||
files := general.GetChangedGoFiles()
|
||||
if files == nil {
|
||||
if len(files) == 0 {
|
||||
os.Exit(0)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
func main() {
|
||||
files := general.GetChangedGoFiles()
|
||||
if files == nil {
|
||||
if len(files) == 0 {
|
||||
os.Exit(0)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
func main() {
|
||||
files := general.GetChangedGoFiles()
|
||||
if files == nil {
|
||||
if len(files) == 0 {
|
||||
os.Exit(0)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user