mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-29 01:44:39 +02:00
bf19dc1079
* feat: moving some cmd logs to debug Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * feat: moving some cmd logs to debug Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
23 lines
315 B
Go
23 lines
315 B
Go
package gio
|
|
|
|
import (
|
|
"io"
|
|
"sync"
|
|
)
|
|
|
|
// Safe wraps the given writer to be thread-safe.
|
|
func Safe(w io.Writer) io.Writer {
|
|
return &safeWriter{w: w}
|
|
}
|
|
|
|
type safeWriter struct {
|
|
w io.Writer
|
|
m sync.Mutex
|
|
}
|
|
|
|
func (s *safeWriter) Write(p []byte) (int, error) {
|
|
s.m.Lock()
|
|
defer s.m.Unlock()
|
|
return s.w.Write(p)
|
|
}
|