From 3e82f4e9f97215fe7970eee41e530319e7b37c79 Mon Sep 17 00:00:00 2001 From: Karl Isenberg Date: Tue, 18 Aug 2020 12:04:30 -0700 Subject: [PATCH] Add lint test and make it pass. --- .github/workflows/e2e-test.yaml | 7 +++++++ pkg/tombstone/tombstone.go | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index 94166dd..0bf870d 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -7,6 +7,13 @@ on: - master jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Lint Go Code + run: make lint e2e-test: runs-on: ubuntu-latest steps: diff --git a/pkg/tombstone/tombstone.go b/pkg/tombstone/tombstone.go index 68acf65..fd011b6 100644 --- a/pkg/tombstone/tombstone.go +++ b/pkg/tombstone/tombstone.go @@ -23,7 +23,7 @@ type Tombstone struct { Graveyard string `json:"-"` Name string `json:"-"` - fileLock sync.Mutex `json:"-"` + fileLock sync.Mutex } func (t *Tombstone) Path() string { @@ -64,7 +64,7 @@ func (t *Tombstone) RecordBirth() error { log.Printf("Creating tombstone: %s\n", t.Path()) err := t.Write() if err != nil { - return fmt.Errorf("failed to create tombstone: ", err) + return fmt.Errorf("failed to create tombstone: %v", err) } return nil } @@ -78,7 +78,7 @@ func (t *Tombstone) RecordDeath(exitCode int) error { log.Printf("Updating tombstone: %s\n", t.Path()) err := t.Write() if err != nil { - return fmt.Errorf("failed to update tombstone: ", err) + return fmt.Errorf("failed to update tombstone: %v", err) } return nil } @@ -86,7 +86,8 @@ func (t *Tombstone) RecordDeath(exitCode int) error { func (t *Tombstone) String() string { inline, err := json.Marshal(t) if err != nil { - return fmt.Sprintf("%+v", t) + log.Printf("Error: failed to marshal tombstone as json: %v\n", err) + return "{}" } return string(inline) }