~bigbes/ci-cacher

ref: 8a662e226904e90b79034c43f58b1a124770b17e ci-cacher/cmd/util.go -rw-r--r-- 416 bytes
8a662e22 — Eugene Blikh merge .builds/{unit,e2e}.yml into test.yml; cache go + garage image 2 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package cmd

import (
	"fmt"
	"io"
	"os"
)

// newWarnWriter forwards everything written to it to stderr, prefixed
// with a tag. Used to surface docker subcommand stderr in CI logs.
func newWarnWriter(tag string) io.Writer {
	return &warnWriter{tag: tag}
}

type warnWriter struct{ tag string }

func (w *warnWriter) Write(p []byte) (int, error) {
	fmt.Fprintf(os.Stderr, "[%s] %s", w.tag, p)
	return len(p), nil
}