Skip to content

Commit bfa160b

Browse files
author
Edward Muller
committed
Collapse into a single deferred function / restore nil check
As per Ian Cottrell's review comments. I did it the way I did originally so at to not appear to couple the two things together for future readers, but it doesn't really matter to me. Revert the len() == 0 check to a nil check. Change-Id: I77376a5e2b10ad563a37ca3aa3e53f928e577e2d
1 parent c4c8686 commit bfa160b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

internal/lsp/cache/parse.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ func (imp *importer) parseFiles(filenames []string) ([]*ast.File, []error) {
6060

6161
wg.Add(1)
6262
go func(i int, filename string) {
63-
defer wg.Done()
64-
6563
ioLimit <- true // wait
6664
defer func() {
6765
<-ioLimit // signal done
66+
wg.Done()
6867
}()
6968

7069
if gof.ast != nil { // already have an ast
@@ -79,7 +78,7 @@ func (imp *importer) parseFiles(filenames []string) ([]*ast.File, []error) {
7978
}
8079

8180
src := gof.fc.Data
82-
if len(src) == 0 { // no source
81+
if src == nil { // no source
8382
parsed[i], errors[i] = nil, fmt.Errorf("No source for %v", filename)
8483
return
8584
}

0 commit comments

Comments
 (0)