Defer return
This commit is contained in:
parent
50dcef8631
commit
4dfeb751c6
@ -107,19 +107,17 @@ func Query(tags []string, j_max uint) (mr []Media, err error) {
|
||||
|
||||
func run_job(tags []string, pid uint, res chan result) {
|
||||
r := result{pid: pid}
|
||||
defer func(x result, c chan result) { c <- x }(r, res)
|
||||
|
||||
var rc io.ReadCloser
|
||||
if rc, r.err = fetch(tags, pid); r.err != nil {
|
||||
res <- r
|
||||
return
|
||||
}
|
||||
defer rc.Close()
|
||||
|
||||
if r.media, r.err = parse(rc); r.err != nil {
|
||||
res <- r
|
||||
return
|
||||
}
|
||||
res <- r
|
||||
}
|
||||
|
||||
func fetch(tags []string, pid uint) (rc io.ReadCloser, err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user