remove unused
This commit is contained in:
parent
1e8537b8d4
commit
bdfea50cc8
|
@ -46,11 +46,6 @@ var HiddenCommands map[string]struct{}
|
|||
// Ui is the cli.Ui used for communicating to the outside world.
|
||||
var Ui cli.Ui
|
||||
|
||||
const (
|
||||
ErrorPrefix = "e:"
|
||||
OutputPrefix = "o:"
|
||||
)
|
||||
|
||||
func initCommands(
|
||||
originalWorkingDir string,
|
||||
config *cliconfig.Config,
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type synchronizedWriter struct {
|
||||
io.Writer
|
||||
mutex *sync.Mutex
|
||||
}
|
||||
|
||||
// synchronizedWriters takes a set of writers and returns wrappers that ensure
|
||||
// that only one write can be outstanding at a time across the whole set.
|
||||
func synchronizedWriters(targets ...io.Writer) []io.Writer {
|
||||
mutex := &sync.Mutex{}
|
||||
ret := make([]io.Writer, len(targets))
|
||||
for i, target := range targets {
|
||||
ret[i] = &synchronizedWriter{
|
||||
Writer: target,
|
||||
mutex: mutex,
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (w *synchronizedWriter) Write(p []byte) (int, error) {
|
||||
w.mutex.Lock()
|
||||
defer w.mutex.Unlock()
|
||||
return w.Writer.Write(p)
|
||||
}
|
Loading…
Reference in New Issue