Skip to content

Commit 6da3d2c

Browse files
committed
stream: fix godoc comment
1 parent 0a6ff30 commit 6da3d2c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

stream.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import (
1515
)
1616

1717
const (
18-
// "Header Content-Length" is the HTTP header name of the length of the content part in bytes. This header is required.
18+
// HeaderContentLength is the HTTP header name of the length of the content part in bytes. This header is required.
1919
// This entity header indicates the size of the entity-body, in bytes, sent to the recipient.
2020
//
2121
// RFC 7230, section 3.3.2: Content-Length:
2222
// https://tools.ietf.org/html/rfc7230#section-3.3.2
2323
HeaderContentLength = "Content-Length"
2424

25-
// "HeaderContentType" is the mime type of the content part. Defaults to "application/vscode-jsonrpc; charset=utf-8".
25+
// HeaderContentType is the mime type of the content part. Defaults to "application/vscode-jsonrpc; charset=utf-8".
2626
// This entity header is used to indicate the media type of the resource.
2727
//
2828
// RFC 7231, section 3.1.1.5: Content-Type:
@@ -65,13 +65,17 @@ type stream struct {
6565
outMu sync.Mutex
6666
}
6767

68+
// NewStream returns a Stream built on top of an io.Reader and io.Writer
69+
// The messages are sent with HTTP content length and MIME type headers.
70+
// This is the format used by LSP and others.
6871
func NewStream(in io.Reader, out io.Writer) Stream {
6972
return &stream{
7073
in: bufio.NewReader(in),
7174
out: out,
7275
}
7376
}
7477

78+
// Read reads data from stream.
7579
func (s *stream) Read(ctx context.Context) ([]byte, error) {
7680
select {
7781
case <-ctx.Done():
@@ -118,6 +122,7 @@ func (s *stream) Read(ctx context.Context) ([]byte, error) {
118122
return data, nil
119123
}
120124

125+
// Write writes data to stream.
121126
func (s *stream) Write(ctx context.Context, data []byte) error {
122127
select {
123128
case <-ctx.Done():

0 commit comments

Comments
 (0)