Skip to content

Commit

Permalink
Merge pull request #1390 from ashmckenzie/ashmckenzie/fix-staticcheck…
Browse files Browse the repository at this point in the history
…-issues
  • Loading branch information
sirupsen committed Jun 3, 2023
2 parents d40e25c + 80d649c commit 104b8b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 8 additions & 3 deletions entry_test.go
Expand Up @@ -10,6 +10,8 @@ import (
"github.com/stretchr/testify/assert"
)

type contextKeyType string

func TestEntryWithError(t *testing.T) {

assert := assert.New(t)
Expand All @@ -36,7 +38,8 @@ func TestEntryWithError(t *testing.T) {

func TestEntryWithContext(t *testing.T) {
assert := assert.New(t)
ctx := context.WithValue(context.Background(), "foo", "bar")
var contextKey contextKeyType = "foo"
ctx := context.WithValue(context.Background(), contextKey, "bar")

assert.Equal(ctx, WithContext(ctx).Context)

Expand All @@ -56,11 +59,13 @@ func TestEntryWithContextCopiesData(t *testing.T) {
parentEntry := NewEntry(logger).WithField("parentKey", "parentValue")

// Create two children Entry objects from the parent in different contexts
ctx1 := context.WithValue(context.Background(), "foo", "bar")
var contextKey1 contextKeyType = "foo"
ctx1 := context.WithValue(context.Background(), contextKey1, "bar")
childEntry1 := parentEntry.WithContext(ctx1)
assert.Equal(ctx1, childEntry1.Context)

ctx2 := context.WithValue(context.Background(), "bar", "baz")
var contextKey2 contextKeyType = "bar"
ctx2 := context.WithValue(context.Background(), contextKey2, "baz")
childEntry2 := parentEntry.WithContext(ctx2)
assert.Equal(ctx2, childEntry2.Context)
assert.NotEqual(ctx1, ctx2)
Expand Down
3 changes: 1 addition & 2 deletions logrus_test.go
Expand Up @@ -544,8 +544,7 @@ func TestParseLevel(t *testing.T) {
}

func TestLevelString(t *testing.T) {
var loggerlevel Level
loggerlevel = 32000
var loggerlevel Level = 32000

_ = loggerlevel.String()
}
Expand Down

0 comments on commit 104b8b0

Please sign in to comment.