aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/pktline/encoder_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2021-05-02 23:33:16 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2021-05-02 23:33:16 +0200
commitc69d5331743e49d3672897cf1c552e5e123d4509 (patch)
treedf503db7e8889cef313641b31808fc7404b400e3 /plumbing/format/pktline/encoder_test.go
parent67d34902b0c41ee5d6d283f4c5b6c2ad7db123fd (diff)
downloadgo-git-c69d5331743e49d3672897cf1c552e5e123d4509.tar.gz
plumbing: format, use os.UserHomeDir()
Diffstat (limited to 'plumbing/format/pktline/encoder_test.go')
-rw-r--r--plumbing/format/pktline/encoder_test.go37
1 files changed, 0 insertions, 37 deletions
diff --git a/plumbing/format/pktline/encoder_test.go b/plumbing/format/pktline/encoder_test.go
index 4a7c7b8..a6addd6 100644
--- a/plumbing/format/pktline/encoder_test.go
+++ b/plumbing/format/pktline/encoder_test.go
@@ -2,7 +2,6 @@ package pktline_test
import (
"bytes"
- "os"
"strings"
"testing"
@@ -211,39 +210,3 @@ func (s *SuiteEncoder) TestEncodef(c *C) {
expected := []byte("000c foo 42\n")
c.Assert(buf.Bytes(), DeepEquals, expected)
}
-
-func ExampleEncoder() {
- // Create an encoder that writes pktlines to stdout.
- e := pktline.NewEncoder(os.Stdout)
-
- // Encode some data as a new pkt-line.
- _ = e.Encode([]byte("data\n")) // error checks removed for brevity
-
- // Encode a flush-pkt.
- _ = e.Flush()
-
- // Encode a couple of byte slices and a flush in one go. Each of
- // them will end up as payloads of their own pktlines.
- _ = e.Encode(
- []byte("hello\n"),
- []byte("world!\n"),
- pktline.Flush,
- )
-
- // You can also encode strings:
- _ = e.EncodeString(
- "foo\n",
- "bar\n",
- pktline.FlushString,
- )
-
- // You can also format and encode a payload:
- _ = e.Encodef(" %s %d\n", "foo", 42)
- // Output:
- // 0009data
- // 0000000ahello
- // 000bworld!
- // 00000008foo
- // 0008bar
- // 0000000c foo 42
-}