Skip to content

Commit 0bbd5aa

Browse files
committed
Fix lint issues
Lint fixes in preparation of pulumi/ci-mgmt#2024.
1 parent 491f7de commit 0bbd5aa

File tree

7 files changed

+37
-31
lines changed

7 files changed

+37
-31
lines changed

provider/cmd/pulumi-resource-docker-build/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
package main
1717

1818
import (
19-
"github.com/pulumi/pulumi-docker-build/provider"
2019
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil"
20+
21+
"github.com/pulumi/pulumi-docker-build/provider"
2122
)
2223

2324
func main() {

provider/internal/cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ func (c CacheFrom) String() string {
448448
return join(c.Local, c.Registry, c.GHA, c.AZBlob, c.S3, c.Raw)
449449
}
450450

451-
func (c CacheFrom) validate(preview bool) (*controllerapi.CacheOptionsEntry, error) {
451+
func (c CacheFrom) validate(_ bool) (*controllerapi.CacheOptionsEntry, error) {
452452
if strings.Count(c.String(), "type=") > 1 {
453453
return nil, errors.New("cacheFrom should only specify one cache type")
454454
}
@@ -672,7 +672,7 @@ func (c CacheTo) String() string {
672672
return join(c.Inline, c.Local, c.Registry, c.GHA, c.AZBlob, c.S3, c.Raw)
673673
}
674674

675-
func (c CacheTo) validate(preview bool) (*controllerapi.CacheOptionsEntry, error) {
675+
func (c CacheTo) validate(_ bool) (*controllerapi.CacheOptionsEntry, error) {
676676
if strings.Count(c.String(), "type=") > 1 {
677677
return nil, errors.New("cacheTo should only specify one cache type")
678678
}

provider/internal/export.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import (
2828
"github.com/pulumi/pulumi-go-provider/infer"
2929
)
3030

31+
const (
32+
trueLiteral = "true"
33+
)
34+
3135
var (
3236
_ fmt.Stringer = (*Export)(nil)
3337
_ fmt.Stringer = (*ExportDocker)(nil)
@@ -114,7 +118,7 @@ func (e Export) pushed() bool {
114118
if err != nil {
115119
return false
116120
}
117-
return exp[0].Attrs["push"] == "true"
121+
return exp[0].Attrs["push"] == trueLiteral
118122
}
119123
if e.Registry != nil {
120124
return e.Registry.Push == nil || *e.Registry.Push
@@ -182,7 +186,7 @@ func parseExports(inp []string) ([]*controllerapi.ExportEntry, error) {
182186
if out.Type == "registry" {
183187
out.Type = client.ExporterImage
184188
if _, ok := out.Attrs["push"]; !ok {
185-
out.Attrs["push"] = "true"
189+
out.Attrs["push"] = trueLiteral
186190
}
187191
}
188192

provider/internal/host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type host struct {
4343
supportsMultipleExports bool
4444
}
4545

46-
func newHost(ctx context.Context, config *Config) (*host, error) {
46+
func newHost(_ context.Context, config *Config) (*host, error) {
4747
docker, err := newDockerCLI(config)
4848
if err != nil {
4949
return nil, err

provider/internal/image_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func TestImageLifecycle(t *testing.T) {
8484
Return(nil)
8585
return c
8686
},
87-
op: func(t *testing.T) integration.Operation {
87+
op: func(_ *testing.T) integration.Operation {
8888
return integration.Operation{
8989
Inputs: property.NewMap(map[string]property.Value{
9090
"push": property.New(false),
@@ -130,7 +130,7 @@ func TestImageLifecycle(t *testing.T) {
130130
{
131131
name: "tags are required when pushing",
132132
client: noClient,
133-
op: func(t *testing.T) integration.Operation {
133+
op: func(_ *testing.T) integration.Operation {
134134
return integration.Operation{
135135
Inputs: property.NewMap(map[string]property.Value{
136136
"push": property.New(false),
@@ -159,7 +159,7 @@ func TestImageLifecycle(t *testing.T) {
159159
{
160160
name: "invalid exports",
161161
client: noClient,
162-
op: func(t *testing.T) integration.Operation {
162+
op: func(_ *testing.T) integration.Operation {
163163
return integration.Operation{
164164
Inputs: property.NewMap(map[string]property.Value{
165165
"push": property.New(false),
@@ -192,7 +192,7 @@ func TestImageLifecycle(t *testing.T) {
192192
)
193193
return c
194194
},
195-
op: func(t *testing.T) integration.Operation {
195+
op: func(_ *testing.T) integration.Operation {
196196
return integration.Operation{
197197
Inputs: property.NewMap(map[string]property.Value{
198198
"push": property.New(false),
@@ -219,7 +219,7 @@ func TestImageLifecycle(t *testing.T) {
219219
)
220220
return c
221221
},
222-
op: func(t *testing.T) integration.Operation {
222+
op: func(_ *testing.T) integration.Operation {
223223
return integration.Operation{
224224
Inputs: property.NewMap(map[string]property.Value{
225225
"push": property.New(false),
@@ -252,7 +252,7 @@ func TestImageLifecycle(t *testing.T) {
252252
c.EXPECT().Delete(gomock.Any(), "default-dockerfile").Return(nil)
253253
return c
254254
},
255-
op: func(t *testing.T) integration.Operation {
255+
op: func(_ *testing.T) integration.Operation {
256256
return integration.Operation{
257257
Inputs: property.NewMap(map[string]property.Value{
258258
"push": property.New(false),
@@ -294,7 +294,7 @@ func TestImageLifecycle(t *testing.T) {
294294
c.EXPECT().Delete(gomock.Any(), "inline-dockerfile").Return(nil)
295295
return c
296296
},
297-
op: func(t *testing.T) integration.Operation {
297+
op: func(_ *testing.T) integration.Operation {
298298
return integration.Operation{
299299
Inputs: property.NewMap(map[string]property.Value{
300300
"push": property.New(false),
@@ -459,7 +459,7 @@ func TestImageDiff(t *testing.T) {
459459
is.Pull = true
460460
return is
461461
},
462-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
462+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
463463
ia.Pull = true
464464
return ia
465465
},
@@ -472,7 +472,7 @@ func TestImageDiff(t *testing.T) {
472472
is.Load = true
473473
return is
474474
},
475-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
475+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
476476
ia.Pull = true
477477
ia.Load = true
478478
return ia
@@ -534,7 +534,7 @@ func TestImageDiff(t *testing.T) {
534534
{
535535
name: "diff if pull changes",
536536
state: func(*testing.T, ImageState) ImageState { return baseState },
537-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
537+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
538538
ia.Pull = true
539539
return ia
540540
},
@@ -543,7 +543,7 @@ func TestImageDiff(t *testing.T) {
543543
{
544544
name: "diff if load changes",
545545
state: func(*testing.T, ImageState) ImageState { return baseState },
546-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
546+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
547547
ia.Load = true
548548
return ia
549549
},
@@ -552,7 +552,7 @@ func TestImageDiff(t *testing.T) {
552552
{
553553
name: "diff if push changes",
554554
state: func(*testing.T, ImageState) ImageState { return baseState },
555-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
555+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
556556
ia.Push = true
557557
return ia
558558
},
@@ -561,7 +561,7 @@ func TestImageDiff(t *testing.T) {
561561
{
562562
name: "diff if buildOnPreview doesn't change",
563563
state: func(*testing.T, ImageState) ImageState { return baseState },
564-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
564+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
565565
val := true
566566
ia.BuildOnPreview = &val
567567
return ia
@@ -571,7 +571,7 @@ func TestImageDiff(t *testing.T) {
571571
{
572572
name: "diff if buildOnPreview changes",
573573
state: func(*testing.T, ImageState) ImageState { return baseState },
574-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
574+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
575575
val := false
576576
ia.BuildOnPreview = &val
577577
return ia
@@ -581,7 +581,7 @@ func TestImageDiff(t *testing.T) {
581581
{
582582
name: "diff if ssh changes",
583583
state: func(*testing.T, ImageState) ImageState { return baseState },
584-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
584+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
585585
ia.SSH = []SSH{{ID: "default"}}
586586
return ia
587587
},
@@ -590,7 +590,7 @@ func TestImageDiff(t *testing.T) {
590590
{
591591
name: "diff if hosts change",
592592
state: func(*testing.T, ImageState) ImageState { return baseState },
593-
inputs: func(t *testing.T, ia ImageArgs) ImageArgs {
593+
inputs: func(_ *testing.T, ia ImageArgs) ImageArgs {
594594
ia.AddHosts = []string{"localhost"}
595595
return ia
596596
},
@@ -751,7 +751,7 @@ func TestImageDiff(t *testing.T) {
751751
},
752752
{
753753
name: "diff if local export doesn't exist",
754-
state: func(t *testing.T, state ImageState) ImageState {
754+
state: func(_ *testing.T, state ImageState) ImageState {
755755
state.Exports = []Export{
756756
{Local: &ExportLocal{Dest: "not-real"}},
757757
}
@@ -767,7 +767,7 @@ func TestImageDiff(t *testing.T) {
767767
},
768768
{
769769
name: "diff if tar export doesn't exist",
770-
state: func(t *testing.T, state ImageState) ImageState {
770+
state: func(_ *testing.T, state ImageState) ImageState {
771771
state.Exports = []Export{
772772
{Tar: &ExportTar{ExportLocal: ExportLocal{Dest: "not-real"}}},
773773
}

provider/internal/index_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232

3333
func TestIndexLifecycle(t *testing.T) {
3434
t.Parallel()
35-
realClient := func(t *testing.T) clientF { return RealClientF }
35+
realClient := func(_ *testing.T) clientF { return RealClientF }
3636

3737
tests := []struct {
3838
name string
@@ -44,7 +44,7 @@ func TestIndexLifecycle(t *testing.T) {
4444
{
4545
name: "not pushed",
4646
client: realClient,
47-
op: func(t *testing.T) integration.Operation {
47+
op: func(_ *testing.T) integration.Operation {
4848
return integration.Operation{
4949
Inputs: property.NewMap(map[string]property.Value{
5050
"tag": property.New(
@@ -63,7 +63,7 @@ func TestIndexLifecycle(t *testing.T) {
6363
name: "pushed",
6464
skip: os.Getenv("DOCKER_HUB_PASSWORD") == "",
6565
client: realClient,
66-
op: func(t *testing.T) integration.Operation {
66+
op: func(_ *testing.T) integration.Operation {
6767
return integration.Operation{
6868
Inputs: property.NewMap(map[string]property.Value{
6969
"tag": property.New(
@@ -85,15 +85,15 @@ func TestIndexLifecycle(t *testing.T) {
8585
},
8686
{
8787
name: "expired credentials",
88-
client: func(t *testing.T) clientF {
88+
client: func(_ *testing.T) clientF {
8989
ctrl := gomock.NewController(t)
9090
c := NewMockClient(ctrl)
9191
c.EXPECT().ManifestCreate(gomock.Any(), true, gomock.Any(), gomock.Any())
9292
c.EXPECT().ManifestInspect(gomock.Any(), gomock.Any()).Return("", errs.ErrHTTPUnauthorized)
9393
c.EXPECT().ManifestDelete(gomock.Any(), gomock.Any()).Return(nil)
9494
return mockClientF(c)
9595
},
96-
op: func(t *testing.T) integration.Operation {
96+
op: func(_ *testing.T) integration.Operation {
9797
return integration.Operation{
9898
Inputs: property.NewMap(map[string]property.Value{
9999
"tag": property.New(
@@ -157,7 +157,7 @@ func TestIndexDiff(t *testing.T) {
157157
{
158158
name: "diff if tag changes",
159159
state: func(*testing.T, IndexState) IndexState { return baseState },
160-
inputs: func(t *testing.T, a IndexArgs) IndexArgs {
160+
inputs: func(_ *testing.T, a IndexArgs) IndexArgs {
161161
a.Tag = "new-tag"
162162
return a
163163
},

provider/provider.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
package provider
1616

1717
import (
18-
"github.com/pulumi/pulumi-docker-build/provider/internal"
1918
gp "github.com/pulumi/pulumi-go-provider"
2019
"github.com/pulumi/pulumi/pkg/v3/resource/provider"
2120
rpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
21+
22+
"github.com/pulumi/pulumi-docker-build/provider/internal"
2223
)
2324

2425
// Version is initialized by the Go linker to contain the semver of this build.

0 commit comments

Comments
 (0)