Fix golint errors

This commit is contained in:
Yuriy Taraday 2018-03-01 10:57:28 +04:00
parent 02e0818aef
commit 81923720d1
2 changed files with 6 additions and 8 deletions

View File

@ -170,8 +170,10 @@ type Proc struct {
WriteStreamIdx int // The index of read stream in function argument list WriteStreamIdx int // The index of read stream in function argument list
} }
// ProcMetaGenerate is a type for flags from @generate annotation
type ProcMetaGenerate int type ProcMetaGenerate int
// @generate annotation can be none, client, server or both
const ( const (
ProcMetaGenerateNone ProcMetaGenerate = iota ProcMetaGenerateNone ProcMetaGenerate = iota
ProcMetaGenerateClient ProcMetaGenerateClient
@ -179,8 +181,10 @@ const (
ProcMetaGenerateBoth ProcMetaGenerateBoth
) )
// ProcMetaPriority is a type for values from @priority annotation
type ProcMetaPriority int type ProcMetaPriority int
// @priority annotation can be low or high
const ( const (
ProcMetaPriorityLow ProcMetaPriority = iota ProcMetaPriorityLow ProcMetaPriority = iota
ProcMetaPriorityHigh ProcMetaPriorityHigh

12
rpc.go
View File

@ -343,18 +343,16 @@ func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out
if err != nil { if err != nil {
if err == io.EOF { if err == io.EOF {
err = l.sendPacket(serial, proc, program, nil, Stream, StatusOK) err = l.sendPacket(serial, proc, program, nil, Stream, StatusOK)
break
} else { } else {
// keep original error // keep original error
err := l.sendPacket(serial, proc, program, nil, Stream, StatusError) err := l.sendPacket(serial, proc, program, nil, Stream, StatusError)
if err != nil { if err != nil {
outStreamErr <- err outStreamErr <- err
return return
} else { }
}
break break
} }
}
}
if n > 0 { if n > 0 {
err = l.sendPacket(serial, proc, program, buf[:n], Stream, StatusContinue) err = l.sendPacket(serial, proc, program, buf[:n], Stream, StatusContinue)
if err != nil { if err != nil {
@ -438,11 +436,7 @@ func (l *Libvirt) sendPacket(serial uint32, proc uint32, program uint32, payload
} }
} }
if err := l.w.Flush(); err != nil { return l.w.Flush()
return err
}
return nil
} }
func (l *Libvirt) getResponse(c chan response) (response, error) { func (l *Libvirt) getResponse(c chan response) (response, error) {