1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-29 01:44:39 +02:00
goreleaser/internal/gio/safe.go
Carlos Alexandro Becker bf19dc1079
feat: moving some cmd logs to debug (#2359)
* 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>
2021-07-23 12:09:29 +01:00

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)
}