Skip to content

Commit 0618d83

Browse files
committed
fix linting/formatting errors
1 parent 88abec7 commit 0618d83

7 files changed

Lines changed: 15 additions & 20 deletions

File tree

‎.github/workflows/main.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: CLI release
2+
name: Testing and publishing
33

44
on:
55
pull_request: {}

‎cli/cmd/logs.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func processLogs(eventsChan chan string, done chan struct{}, output string) {
4343
case events.Status:
4444
fmt.Println(event.Message)
4545
case events.Error:
46-
fmt.Println("Error occured ", event.Message)
46+
fmt.Println("Error occurred ", event.Message)
4747
done <- struct{}{}
4848
case events.Result:
4949
data, err := base64.StdEncoding.DecodeString(event.Message)

‎cli/cmd/run.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ func run(
5252
}
5353

5454
handleLogs(readCloser, output)
55-
fmt.Printf("Result successfuly written to %s\n", output)
55+
fmt.Printf("Result successfully written to %s\n", output)
5656

5757
err = k8s.DeleteJob(jobName)
58+
if err != nil {
59+
return err
60+
}
5861

5962
return nil
6063
}

‎dumper/exec.go‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"os/exec"
66

7-
"github.com/dodopizza/kubectl-shovel/events"
7+
"github.com/pkg/errors"
88
)
99

1010
func runCommand(executable string, args ...string) error {
@@ -13,18 +13,12 @@ func runCommand(executable string, args ...string) error {
1313
args...,
1414
)
1515

16-
var Stdout bytes.Buffer
17-
cmd.Stdout = &Stdout
16+
var stdout bytes.Buffer
17+
cmd.Stdout = &stdout
1818

1919
err := cmd.Run()
20-
21-
events.NewEvent(
22-
events.Status,
23-
Stdout.String(),
24-
)
25-
2620
if err != nil {
27-
return err
21+
return errors.Wrap(err, stdout.String())
2822
}
2923

3024
return nil

‎dumper/launch.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func launch(containerID, tool string) error {
2727
tool,
2828
),
2929
)
30+
3031
var output string
3132
switch tool {
3233
case dotnetGCDumpBinary:

‎events/events.go‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ const (
2121
)
2222

2323
// NewEvent is used to publish new event
24-
func NewEvent(eventType EventType, message string) error {
25-
data, err := json.Marshal(Event{
24+
func NewEvent(eventType EventType, message string) {
25+
data, _ := json.Marshal(Event{
2626
Type: eventType,
2727
Message: message,
2828
})
29-
if err != nil {
30-
return err
31-
}
32-
fmt.Println(string(data))
3329

34-
return nil
30+
fmt.Println(string(data))
3531
}
3632

3733
// GetEvent is used to read published event

‎go.mod‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.15
44

55
require (
66
github.com/googleapis/gnostic v0.5.1 // indirect
7+
github.com/pkg/errors v0.9.1
78
github.com/spf13/cobra v1.0.0
89
github.com/spf13/pflag v1.0.5
910
github.com/stretchr/testify v1.6.1 // indirect

0 commit comments

Comments
 (0)