Skip to content

Commit 82427d1

Browse files
committed
format (GoDoc) comments with Go 1.19 to prepare for go updates
Older versions of Go do not format these comments, so we can already reformat them ahead of time to prevent gofmt linting failing once we update to Go 1.19 or up. Result of: gofmt -s -w $(find . -type f -name '*.go' | grep -v "/vendor/") With some manual adjusting. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 3564b7d commit 82427d1

40 files changed

Lines changed: 136 additions & 103 deletions

File tree

cli-plugins/manager/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Plugin struct {
3434
// returned with no error. An error is only returned due to a
3535
// non-recoverable error.
3636
//
37-
// nolint: gocyclo
37+
//nolint:gocyclo
3838
func newPlugin(c Candidate, rootcmd *cobra.Command) (Plugin, error) {
3939
path := c.Path()
4040
if path == "" {

cli/command/container/cp.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,12 @@ func copyToContainer(ctx context.Context, dockerCli command.Cli, copyConfig cpCo
368368
// in a valid LOCALPATH, like `file:name.txt`. We can resolve this ambiguity by
369369
// requiring a LOCALPATH with a `:` to be made explicit with a relative or
370370
// absolute path:
371-
// `/path/to/file:name.txt` or `./file:name.txt`
371+
//
372+
// `/path/to/file:name.txt` or `./file:name.txt`
372373
//
373374
// This is apparently how `scp` handles this as well:
374-
// http://www.cyberciti.biz/faq/rsync-scp-file-name-with-colon-punctuation-in-it/
375+
//
376+
// http://www.cyberciti.biz/faq/rsync-scp-file-name-with-colon-punctuation-in-it/
375377
//
376378
// We can't simply check for a filepath separator because container names may
377379
// have a separator, e.g., "host0/cname1" if container is in a Docker cluster,

cli/command/container/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func newCIDFile(path string) (*cidFile, error) {
198198
return &cidFile{path: path, file: f}, nil
199199
}
200200

201-
// nolint: gocyclo
201+
//nolint:gocyclo
202202
func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig *containerConfig, opts *createOptions) (*container.CreateResponse, error) {
203203
config := containerConfig.Config
204204
hostConfig := containerConfig.HostConfig

cli/command/container/opts.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ type containerConfig struct {
311311
// parse parses the args for the specified command and generates a Config,
312312
// a HostConfig and returns them with the specified command.
313313
// If the specified args are not valid, it will return an error.
314-
// nolint: gocyclo
314+
//
315+
//nolint:gocyclo
315316
func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*containerConfig, error) {
316317
var (
317318
attachStdin = copts.attach.Get("stdin")
@@ -965,7 +966,8 @@ func parseWindowsDevice(device string) (container.DeviceMapping, error) {
965966

966967
// validateDeviceCgroupRule validates a device cgroup rule string format
967968
// It will make sure 'val' is in the form:
968-
// 'type major:minor mode'
969+
//
970+
// 'type major:minor mode'
969971
func validateDeviceCgroupRule(val string) (string, error) {
970972
if deviceCgroupRuleRegexp.MatchString(val) {
971973
return val, nil
@@ -1009,7 +1011,9 @@ func validateDevice(val string, serverOS string) (string, error) {
10091011
// validateLinuxPath is the implementation of validateDevice knowing that the
10101012
// target server operating system is a Linux daemon.
10111013
// It will make sure 'val' is in the form:
1012-
// [host-dir:]container-path[:mode]
1014+
//
1015+
// [host-dir:]container-path[:mode]
1016+
//
10131017
// It also validates the device mode.
10141018
func validateLinuxPath(val string, validator func(string) bool) (string, error) {
10151019
var containerPath string

cli/command/container/opts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func TestParseRunWithInvalidArgs(t *testing.T) {
182182
}
183183
}
184184

185-
// nolint: gocyclo
185+
//nolint:gocyclo
186186
func TestParseWithVolumes(t *testing.T) {
187187

188188
// A single volume

cli/command/container/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func runRun(dockerCli command.Cli, flags *pflag.FlagSet, ropts *runOptions, copt
118118
return runContainer(dockerCli, ropts, copts, containerConfig)
119119
}
120120

121-
// nolint: gocyclo
121+
//nolint:gocyclo
122122
func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptions, containerConfig *containerConfig) error {
123123
config := containerConfig.Config
124124
stdout, stderr := dockerCli.Out(), dockerCli.Err()

cli/command/container/start.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ func NewStartCommand(dockerCli command.Cli) *cobra.Command {
6767
}
6868

6969
// RunStart executes a `start` command
70-
// nolint: gocyclo
70+
//
71+
//nolint:gocyclo
7172
func RunStart(dockerCli command.Cli, opts *StartOptions) error {
7273
ctx, cancelFun := context.WithCancel(context.Background())
7374
defer cancelFun()

cli/command/container/stats.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ func NewStatsCommand(dockerCli command.Cli) *cobra.Command {
5656

5757
// runStats displays a live stream of resource usage statistics for one or more containers.
5858
// This shows real-time information on CPU usage, memory usage, and network I/O.
59-
// nolint: gocyclo
59+
//
60+
//nolint:gocyclo
6061
func runStats(dockerCli command.Cli, opts *statsOptions) error {
6162
showAll := len(opts.containers) == 0
6263
closeChan := make(chan error)

cli/command/formatter/container_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ type ports struct {
436436
expected string
437437
}
438438

439-
// nolint: lll
439+
//nolint:lll
440440
func TestDisplayablePorts(t *testing.T) {
441441
cases := []ports{
442442
{

cli/command/formatter/reflect_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func (d *dummy) Func1() string {
1212
return "Func1"
1313
}
1414

15-
func (d *dummy) func2() string { // nolint: unused
15+
func (d *dummy) func2() string { //nolint:unused
1616
return "func2(should not be marshalled)"
1717
}
1818

0 commit comments

Comments
 (0)