Skip to content

Commit 3e82f4e

Browse files
committed
Add lint test and make it pass.
1 parent 4e1c0c9 commit 3e82f4e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/e2e-test.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ on:
77
- master
88

99
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Lint Go Code
16+
run: make lint
1017
e2e-test:
1118
runs-on: ubuntu-latest
1219
steps:

pkg/tombstone/tombstone.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Tombstone struct {
2323
Graveyard string `json:"-"`
2424
Name string `json:"-"`
2525

26-
fileLock sync.Mutex `json:"-"`
26+
fileLock sync.Mutex
2727
}
2828

2929
func (t *Tombstone) Path() string {
@@ -64,7 +64,7 @@ func (t *Tombstone) RecordBirth() error {
6464
log.Printf("Creating tombstone: %s\n", t.Path())
6565
err := t.Write()
6666
if err != nil {
67-
return fmt.Errorf("failed to create tombstone: ", err)
67+
return fmt.Errorf("failed to create tombstone: %v", err)
6868
}
6969
return nil
7070
}
@@ -78,15 +78,16 @@ func (t *Tombstone) RecordDeath(exitCode int) error {
7878
log.Printf("Updating tombstone: %s\n", t.Path())
7979
err := t.Write()
8080
if err != nil {
81-
return fmt.Errorf("failed to update tombstone: ", err)
81+
return fmt.Errorf("failed to update tombstone: %v", err)
8282
}
8383
return nil
8484
}
8585

8686
func (t *Tombstone) String() string {
8787
inline, err := json.Marshal(t)
8888
if err != nil {
89-
return fmt.Sprintf("%+v", t)
89+
log.Printf("Error: failed to marshal tombstone as json: %v\n", err)
90+
return "{}"
9091
}
9192
return string(inline)
9293
}

0 commit comments

Comments
 (0)