cli/command: fix deprecation comments for Stream types

These were deprecated in 6c400a9c2009bba9376ad61ab59c04c1ad675871 (docker 19.03),
but the "Deprecated:" comments were missing a newline before them.

While most IDEs will detect such comments as "deprecated", pkg.go.dev and linters
will ignore them, which may result in users not being aware of them being deprecated.

This patch;

- Fixes the "Deprecated:" comments.
- Changes the var aliases to functions, which is slightly more boilerplating,
  but makes sure the functions are documented as "function", instead of shown
  in the "variables" section on pkg.go.dev.
- Adds some punctuation and adds "doc links", which allows readers to navigate
  to related content on pkg.go.dev.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-04-01 18:16:52 +02:00
parent a0756c3c2c
commit 817897f891
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 19 additions and 10 deletions

View File

@ -1,23 +1,32 @@
package command package command
import ( import (
"io"
"github.com/docker/cli/cli/streams" "github.com/docker/cli/cli/streams"
) )
// InStream is an input stream used by the DockerCli to read user input // InStream is an input stream used by the DockerCli to read user input
// Deprecated: Use github.com/docker/cli/cli/streams.In instead //
// Deprecated: Use [streams.In] instead.
type InStream = streams.In type InStream = streams.In
// OutStream is an output stream used by the DockerCli to write normal program // OutStream is an output stream used by the DockerCli to write normal program
// output. // output.
// Deprecated: Use github.com/docker/cli/cli/streams.Out instead //
// Deprecated: Use [streams.Out] instead.
type OutStream = streams.Out type OutStream = streams.Out
var ( // NewInStream returns a new [streams.In] from an [io.ReadCloser].
// NewInStream returns a new InStream object from a ReadCloser //
// Deprecated: Use github.com/docker/cli/cli/streams.NewIn instead // Deprecated: Use [streams.NewIn] instead.
NewInStream = streams.NewIn func NewInStream(in io.ReadCloser) *streams.In {
// NewOutStream returns a new OutStream object from a Writer return streams.NewIn(in)
// Deprecated: Use github.com/docker/cli/cli/streams.NewOut instead }
NewOutStream = streams.NewOut
) // NewOutStream returns a new [streams.Out] from an [io.Writer].
//
// Deprecated: Use [streams.NewOut] instead.
func NewOutStream(out io.Writer) *streams.Out {
return streams.NewOut(out)
}