Skip to content

Commit

Permalink
chore(linter): Make the mandatory linters happy
Browse files Browse the repository at this point in the history
There are some new linting rules in the updated go-dev from upstream
deis/docker-go-dev.
  • Loading branch information
Kingdon Barrett committed Jan 7, 2020
1 parent 58149c6 commit 77a6c09
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/gitreceive/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func prettyPrintJSON(data interface{}) (string, error) {
if err := json.Indent(formatted, output.Bytes(), "", " "); err != nil {
return "", err
}
return string(formatted.Bytes()), nil
return formatted.String(), nil
}

func getProcFile(getter storage.ObjectGetter, dirName, procfileKey string, bType buildType) (deisAPI.ProcessType, error) {
Expand Down
11 changes: 7 additions & 4 deletions pkg/gitreceive/k8s_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,13 @@ func createAppEnvConfigSecret(secretsClient client.SecretsInterface, secretName
}
if _, err := secretsClient.Create(newSecret); err != nil {
if apierrors.IsAlreadyExists(err) {
if _, err = secretsClient.Update(newSecret); err != nil {
return err
}
return nil
_, err = secretsClient.Update(newSecret)
// I simplified according to linter, err is either "err" or nil
// So no need for an if-statement here, as before with the redundant if
// statement, it was either returning err or nil just the same...
return err
// KPB: I actually don't agree with this simplification, but I don't know
// how to make the linter ignore it yet...
}
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/sshd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestGitPktLine(t *testing.T) {
err := gitPktLine(b, str)
assert.NoErr(t, err)

outStr := string(b.Bytes())
outStr := b.String()
assert.True(t, len(outStr) > 4, "output string <= 4 chars")
assert.Equal(t, outStr[:4], fmt.Sprintf("%04x", len(str)+4), "hex prefix")
assert.Equal(t, outStr[4:], str, "remainder of string")
Expand Down Expand Up @@ -279,7 +279,7 @@ func gitPktLineStr(str string) (string, error) {
if err := gitPktLine(&buf, str); err != nil {
return "", err
}
return string(buf.Bytes()), nil
return buf.String(), nil
}

// connMetadata mocks ssh.ConnMetadata for authentication.
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
)

func TestObjectExistsSuccess(t *testing.T) {
objInfo := storagedriver.FileInfoInternal{storagedriver.FileInfoFields{Path: objPath, Size: 1234}}
objInfo := storagedriver.FileInfoInternal{FileInfoFields: storagedriver.FileInfoFields{Path: objPath, Size: 1234}}
statter := &FakeObjectStatter{
Fn: func(context.Context, string) (storagedriver.FileInfo, error) {
return objInfo, nil
Expand Down

0 comments on commit 77a6c09

Please sign in to comment.