Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot committed Jun 5, 2018
1 parent f69d8bc commit 9bddebf
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 31 deletions.
2 changes: 1 addition & 1 deletion pkg/skaffold/build/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ func TestLocalRun(t *testing.T) {
out io.Writer
api docker.DockerAPIClient
tagger tag.Tagger
localCluster bool
artifacts []*v1alpha2.Artifact
expected []Build
localCluster bool
shouldErr bool
}{
{
Expand Down
5 changes: 3 additions & 2 deletions pkg/skaffold/build/tag/date_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ type dateTimeTagger struct {
timeFn func() time.Time
}

func NewDateTimeTagger(format, timezone string) (*dateTimeTagger, error) {
// NewDateTimeTagger creates a tagger from a date format and timezone.
func NewDateTimeTagger(format, timezone string) Tagger {
return &dateTimeTagger{
Format: format,
TimeZone: timezone,
timeFn: func() time.Time { return time.Now() },
}, nil
}
}

// GenerateFullyQualifiedImageName tags an image with the supplied image name and the current timestamp
Expand Down
8 changes: 0 additions & 8 deletions pkg/skaffold/build/tag/date_time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ import (
"github.com/GoogleContainerTools/skaffold/testutil"
)

type mockClock struct {
time time.Time
}

func (m mockClock) Now() time.Time {
return m.time
}

func TestDateTime_GenerateFullyQualifiedImageName(t *testing.T) {
aLocalTimeStamp := time.Date(2015, 03, 07, 11, 06, 39, 123456789, time.Local)
localZone, _ := aLocalTimeStamp.Zone()
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/build/tag/env_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type envTemplateTagger struct {
}

// NewEnvTemplateTagger creates a new envTemplateTagger
func NewEnvTemplateTagger(t string) (*envTemplateTagger, error) {
func NewEnvTemplateTagger(t string) (Tagger, error) {
tmpl, err := util.ParseEnvTemplate(t)
if err != nil {
return nil, errors.Wrap(err, "parsing template")
Expand Down
2 changes: 0 additions & 2 deletions pkg/skaffold/docker/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func TestMain(m *testing.M) {
type testImageAPI struct {
description string
imageName string
imageID string
tagToImageID map[string]string
shouldErr bool
expected string
Expand Down Expand Up @@ -96,7 +95,6 @@ func TestRunBuild(t *testing.T) {
{
description: "build",
tagToImageID: map[string]string{},
imageID: "sha256:test",
expected: "test",
},
{
Expand Down
14 changes: 0 additions & 14 deletions pkg/skaffold/kubernetes/wait_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,6 @@ var podBadPhase = &v1.Pod{
},
}

var podDifferentName = &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "pod_different_name",
},
Status: v1.PodStatus{
Conditions: []v1.PodCondition{
{
Type: v1.PodScheduled,
},
},
Phase: "not a real phase",
},
}

func TestWaitForPodReady(t *testing.T) {
var tests = []struct {
description string
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func getTagger(t v1alpha2.TagPolicy, customTag string) (tag.Tagger, error) {
return &tag.GitCommit{}, nil

case t.DateTimeTagger != nil:
return tag.NewDateTimeTagger(t.DateTimeTagger.Format, t.DateTimeTagger.TimeZone)
return tag.NewDateTimeTagger(t.DateTimeTagger.Format, t.DateTimeTagger.TimeZone), nil

default:
return nil, fmt.Errorf("Unknown tagger for strategy %+v", t)
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/util/env_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ func TestEnvTemplate_ExecuteEnvTemplate(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
test_template := template.Must(template.New("").Parse(test.template))
testTemplate := template.Must(template.New("").Parse(test.template))
OSEnviron = func() []string {
return test.env
}

got, err := ExecuteEnvTemplate(test_template, test.customMap)
got, err := ExecuteEnvTemplate(testTemplate, test.customMap)
testutil.CheckErrorAndDeepEqual(t, test.shouldErr, err, test.want, got)
})
}
Expand Down

0 comments on commit 9bddebf

Please sign in to comment.