Browse code

client: suppress filters.ToParamWithVersion lint warning

Add annotations to suppress warnings like this one:

> client/container_list.go:38:22: SA1019: filters.ToParamWithVersion is deprecated: Use ToJSON (staticcheck)
> filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters)
> ^

Modify the deprecation notice to specify it is applicable to new code
only.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2019/08/06 08:35:52
Showing 7 changed files
... ...
@@ -57,7 +57,7 @@ func ToJSON(a Args) (string, error) {
57 57
 // then the encoded format will use an older legacy format where the values are a
58 58
 // list of strings, instead of a set.
59 59
 //
60
-// Deprecated: Use ToJSON
60
+// Deprecated: do not use in any new code; use ToJSON instead
61 61
 func ToParamWithVersion(version string, a Args) (string, error) {
62 62
 	if a.Len() == 0 {
63 63
 		return "", nil
... ...
@@ -35,6 +35,7 @@ func (cli *Client) ContainerList(ctx context.Context, options types.ContainerLis
35 35
 	}
36 36
 
37 37
 	if options.Filters.Len() > 0 {
38
+		//lint:ignore SA1019 for old code
38 39
 		filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters)
39 40
 
40 41
 		if err != nil {
... ...
@@ -90,6 +90,7 @@ func buildEventsQueryParams(cliVersion string, options types.EventsOptions) (url
90 90
 	}
91 91
 
92 92
 	if options.Filters.Len() > 0 {
93
+		//lint:ignore SA1019 for old code
93 94
 		filterJSON, err := filters.ToParamWithVersion(cliVersion, options.Filters)
94 95
 		if err != nil {
95 96
 			return nil, err
... ...
@@ -24,6 +24,7 @@ func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions
24 24
 		}
25 25
 	}
26 26
 	if optionFilters.Len() > 0 {
27
+		//lint:ignore SA1019 for old code
27 28
 		filterJSON, err := filters.ToParamWithVersion(cli.version, optionFilters)
28 29
 		if err != nil {
29 30
 			return images, err
... ...
@@ -13,6 +13,7 @@ import (
13 13
 func (cli *Client) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) {
14 14
 	query := url.Values{}
15 15
 	if options.Filters.Len() > 0 {
16
+		//lint:ignore SA1019 for old code
16 17
 		filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters)
17 18
 		if err != nil {
18 19
 			return nil, err
... ...
@@ -15,6 +15,7 @@ func (cli *Client) PluginList(ctx context.Context, filter filters.Args) (types.P
15 15
 	query := url.Values{}
16 16
 
17 17
 	if filter.Len() > 0 {
18
+		//lint:ignore SA1019 for old code
18 19
 		filterJSON, err := filters.ToParamWithVersion(cli.version, filter)
19 20
 		if err != nil {
20 21
 			return plugins, err
... ...
@@ -15,6 +15,7 @@ func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumet
15 15
 	query := url.Values{}
16 16
 
17 17
 	if filter.Len() > 0 {
18
+		//lint:ignore SA1019 for old code
18 19
 		filterJSON, err := filters.ToParamWithVersion(cli.version, filter)
19 20
 		if err != nil {
20 21
 			return volumes, err