From 3df4f86f21fbcae3535e2231828dce16a1940dbb Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 12 Oct 2019 20:58:02 +0200 Subject: [PATCH 1/3] swagger: fix "generated code" comment not in correct format As described in https://golang.org/s/generatedcode, Go has a formalized format that should be used to indicate that a file is generated. Matching that format helps linters to skip generated files; From https://golang.org/s/generatedcode (https://github.com/golang/go/issues/13560#issuecomment-288457920); > Generated files are marked by a line of text that matches the regular expression, in Go syntax: > > ^// Code generated .* DO NOT EDIT\.$ > > The `.*` means the tool can put whatever folderol it wants in there, but the comment > must be a single line and must start with `Code generated` and end with `DO NOT EDIT.`, > with a period. > > The text may appear anywhere in the file. This patch updates the template used for our generated types to match that format. Signed-off-by: Sebastiaan van Stijn --- api/templates/server/operation.gotmpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/templates/server/operation.gotmpl b/api/templates/server/operation.gotmpl index dbcecafb58..828deb4735 100644 --- a/api/templates/server/operation.gotmpl +++ b/api/templates/server/operation.gotmpl @@ -1,8 +1,7 @@ package {{ .Package }} // import "github.com/docker/docker/api/types/{{ .Package }}" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- From c511db70ed39f344f41ea8773cc9264a1eeddfda Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 12 Oct 2019 21:01:20 +0200 Subject: [PATCH 2/3] api/types: re-generate with new template Signed-off-by: Sebastiaan van Stijn --- api/types/container/container_changes.go | 3 +-- api/types/container/container_create.go | 3 +-- api/types/container/container_top.go | 3 +-- api/types/container/container_update.go | 3 +-- api/types/container/container_wait.go | 3 +-- api/types/image/image_history.go | 3 +-- api/types/volume/volume_create.go | 3 +-- api/types/volume/volume_list.go | 3 +-- 8 files changed, 8 insertions(+), 16 deletions(-) diff --git a/api/types/container/container_changes.go b/api/types/container/container_changes.go index 222d141007..16dd5019ee 100644 --- a/api/types/container/container_changes.go +++ b/api/types/container/container_changes.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/api/types/container/container_create.go b/api/types/container/container_create.go index 1ec9c3728b..d0c852f84d 100644 --- a/api/types/container/container_create.go +++ b/api/types/container/container_create.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/api/types/container/container_top.go b/api/types/container/container_top.go index f8a606687c..f0ee9dde70 100644 --- a/api/types/container/container_top.go +++ b/api/types/container/container_top.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/api/types/container/container_update.go b/api/types/container/container_update.go index 33addedf77..c10f175ea8 100644 --- a/api/types/container/container_update.go +++ b/api/types/container/container_update.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/api/types/container/container_wait.go b/api/types/container/container_wait.go index 94b6a20e15..49e05ae669 100644 --- a/api/types/container/container_wait.go +++ b/api/types/container/container_wait.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/api/types/image/image_history.go b/api/types/image/image_history.go index b5a7a0c490..e302bb0aeb 100644 --- a/api/types/image/image_history.go +++ b/api/types/image/image_history.go @@ -1,8 +1,7 @@ package image // import "github.com/docker/docker/api/types/image" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/api/types/volume/volume_create.go b/api/types/volume/volume_create.go index 0c3772d3ad..0d4f46a846 100644 --- a/api/types/volume/volume_create.go +++ b/api/types/volume/volume_create.go @@ -1,8 +1,7 @@ package volume // import "github.com/docker/docker/api/types/volume" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/api/types/volume/volume_list.go b/api/types/volume/volume_list.go index 45c3c1c9ae..8e685d51c9 100644 --- a/api/types/volume/volume_list.go +++ b/api/types/volume/volume_list.go @@ -1,8 +1,7 @@ package volume // import "github.com/docker/docker/api/types/volume" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- From 6186e9fe8794660d669f19a2e2ba7127321b817f Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 12 Oct 2019 21:20:29 +0200 Subject: [PATCH 3/3] hack/make/.go-autogen: fix "generated code" comment not in correct format As described in https://golang.org/s/generatedcode, Go has a formalized format that should be used to indicate that a file is generated. Matching that format helps linters to skip generated files; From https://golang.org/s/generatedcode (https://github.com/golang/go/issues/13560#issuecomment-288457920); > Generated files are marked by a line of text that matches the regular expression, in Go syntax: > > ^// Code generated .* DO NOT EDIT\.$ > > The `.*` means the tool can put whatever folderol it wants in there, but the comment > must be a single line and must start with `Code generated` and end with `DO NOT EDIT.`, > with a period. > > The text may appear anywhere in the file. This patch updates the autogenerated code to match that format. Signed-off-by: Sebastiaan van Stijn --- hack/make/.go-autogen | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/make/.go-autogen b/hack/make/.go-autogen index 2df015b14f..e6a47d4169 100644 --- a/hack/make/.go-autogen +++ b/hack/make/.go-autogen @@ -24,7 +24,7 @@ const ( DefaultProductLicense string = "${DEFAULT_PRODUCT_LICENSE}" ) -// AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen +// Code generated by hack/make/.go-autogen. DO NOT EDIT. DVEOF cat > dockerversion/version_autogen_unix.go <