Skip to content

Commit 8ae478e

Browse files
authored
Merge pull request #1197 from sirupsen/travis_build
bump go and golangci-lint versions in travis ci
2 parents 6121f5c + 89b92b9 commit 8ae478e

File tree

6 files changed

+13
-16
lines changed

6 files changed

+13
-16
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ git:
44
depth: 1
55
env:
66
- GO111MODULE=on
7-
go: [1.13.x, 1.14.x]
8-
os: [linux, osx]
7+
go: 1.15.x
8+
os: linux
99
install:
1010
- ./travis/install.sh
1111
script:

entry.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,9 @@ func (entry *Entry) WithFields(fields Fields) *Entry {
123123
for k, v := range fields {
124124
isErrField := false
125125
if t := reflect.TypeOf(v); t != nil {
126-
switch t.Kind() {
127-
case reflect.Func:
126+
switch {
127+
case t.Kind() == reflect.Func, t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Func:
128128
isErrField = true
129-
case reflect.Ptr:
130-
isErrField = t.Elem().Kind() == reflect.Func
131129
}
132130
}
133131
if isErrField {

json_formatter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
118118
encoder.SetIndent("", " ")
119119
}
120120
if err := encoder.Encode(data); err != nil {
121-
return nil, fmt.Errorf("failed to marshal fields to JSON, %v", err)
121+
return nil, fmt.Errorf("failed to marshal fields to JSON, %w", err)
122122
}
123123

124124
return b.Bytes(), nil

text_formatter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
235235
levelColor = yellow
236236
case ErrorLevel, FatalLevel, PanicLevel:
237237
levelColor = red
238+
case InfoLevel:
239+
levelColor = blue
238240
default:
239241
levelColor = blue
240242
}

travis/install.sh

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
set -e
44

5-
# Install golanci 1.21.0
6-
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.13\. ]]; then
7-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.21.0
5+
# Install golanci 1.32.2
6+
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.15\. ]]; then
7+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.32.2
88
fi
99

1010
# Only do this for go1.12 when modules are on so that it doesn't need to be done when modules are off as well.
@@ -15,8 +15,3 @@ fi
1515
if [[ "$GO111MODULE" == "on" ]]; then
1616
go mod download
1717
fi
18-
19-
if [[ "$GO111MODULE" == "off" ]]; then
20-
# Should contain all regular (not indirect) modules from go.mod
21-
go get github.com/stretchr/testify golang.org/x/sys/unix golang.org/x/sys/windows
22-
fi

travis/lint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3-
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.13\. ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$GO111MODULE" == "on" ]]; then
3+
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.15\. ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$GO111MODULE" == "on" ]]; then
44
$(go env GOPATH)/bin/golangci-lint run ./...
5+
else
6+
echo "linter has not been run"
57
fi

0 commit comments

Comments
 (0)