Enable golint part of #14756
pkg/broadcastwriter pkg/graphdb pkg/httputils pkg/ioutils Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
parent
fca8ba94b3
commit
fcb8d8d48e
11 changed files with 60 additions and 32 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"sync"
|
||||
)
|
||||
|
||||
// WriteFlusher wraps the Write and Flush operation.
|
||||
type WriteFlusher struct {
|
||||
sync.Mutex
|
||||
w io.Writer
|
||||
|
@ -30,12 +31,15 @@ func (wf *WriteFlusher) Flush() {
|
|||
wf.flusher.Flush()
|
||||
}
|
||||
|
||||
// Flushed returns the state of flushed.
|
||||
// If it's flushed, return true, or else it return false.
|
||||
func (wf *WriteFlusher) Flushed() bool {
|
||||
wf.Lock()
|
||||
defer wf.Unlock()
|
||||
return wf.flushed
|
||||
}
|
||||
|
||||
// NewWriteFlusher returns a new WriteFlusher.
|
||||
func NewWriteFlusher(w io.Writer) *WriteFlusher {
|
||||
var flusher http.Flusher
|
||||
if f, ok := w.(http.Flusher); ok {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue