diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-09-15 12:17:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-15 12:17:12 +0200 |
commit | 3b4ad9a81d7c2d194f4d3f2686d47d78857b65d7 (patch) | |
tree | fc635fda5032a7054f562025b4152ac54ba20f85 /pkg/channelwriter/channelwriter.go | |
parent | d5db2af340b94b9900cf194e35d57af40a695fe1 (diff) | |
parent | 146c68f3acdc01f393a6cfadf9bc98eec3e8de94 (diff) | |
download | podman-3b4ad9a81d7c2d194f4d3f2686d47d78857b65d7.tar.gz podman-3b4ad9a81d7c2d194f4d3f2686d47d78857b65d7.tar.bz2 podman-3b4ad9a81d7c2d194f4d3f2686d47d78857b65d7.zip |
Merge pull request #7452 from jwhonce/issues/7136
Refactor API build endpoint to be more compliant
Diffstat (limited to 'pkg/channelwriter/channelwriter.go')
-rw-r--r-- | pkg/channelwriter/channelwriter.go | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/pkg/channelwriter/channelwriter.go b/pkg/channelwriter/channelwriter.go deleted file mode 100644 index d51400eb3..000000000 --- a/pkg/channelwriter/channelwriter.go +++ /dev/null @@ -1,34 +0,0 @@ -package channelwriter - -import "github.com/pkg/errors" - -// Writer is an io.writer-like object that "writes" to a channel -// instead of a buffer or file, etc. It is handy for varlink endpoints when -// needing to handle endpoints that do logging "real-time" -type Writer struct { - ByteChannel chan []byte -} - -// NewChannelWriter creates a new channel writer and adds a -// byte slice channel into it. -func NewChannelWriter() *Writer { - byteChannel := make(chan []byte) - return &Writer{ - ByteChannel: byteChannel, - } -} - -// Write method for Writer -func (c *Writer) Write(w []byte) (int, error) { - if c.ByteChannel == nil { - return 0, errors.New("channel writer channel cannot be nil") - } - c.ByteChannel <- w - return len(w), nil -} - -// Close method for Writer -func (c *Writer) Close() error { - close(c.ByteChannel) - return nil -} |