mirror of https://github.com/sirupsen/logrus.git
Merge pull request #1197 from sirupsen/travis_build
bump go and golangci-lint versions in travis ci
This commit is contained in:
commit
8ae478eb8a
|
@ -4,8 +4,8 @@ git:
|
||||||
depth: 1
|
depth: 1
|
||||||
env:
|
env:
|
||||||
- GO111MODULE=on
|
- GO111MODULE=on
|
||||||
go: [1.13.x, 1.14.x]
|
go: 1.15.x
|
||||||
os: [linux, osx]
|
os: linux
|
||||||
install:
|
install:
|
||||||
- ./travis/install.sh
|
- ./travis/install.sh
|
||||||
script:
|
script:
|
||||||
|
|
6
entry.go
6
entry.go
|
@ -123,11 +123,9 @@ func (entry *Entry) WithFields(fields Fields) *Entry {
|
||||||
for k, v := range fields {
|
for k, v := range fields {
|
||||||
isErrField := false
|
isErrField := false
|
||||||
if t := reflect.TypeOf(v); t != nil {
|
if t := reflect.TypeOf(v); t != nil {
|
||||||
switch t.Kind() {
|
switch {
|
||||||
case reflect.Func:
|
case t.Kind() == reflect.Func, t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Func:
|
||||||
isErrField = true
|
isErrField = true
|
||||||
case reflect.Ptr:
|
|
||||||
isErrField = t.Elem().Kind() == reflect.Func
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if isErrField {
|
if isErrField {
|
||||||
|
|
|
@ -118,7 +118,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
|
||||||
encoder.SetIndent("", " ")
|
encoder.SetIndent("", " ")
|
||||||
}
|
}
|
||||||
if err := encoder.Encode(data); err != nil {
|
if err := encoder.Encode(data); err != nil {
|
||||||
return nil, fmt.Errorf("failed to marshal fields to JSON, %v", err)
|
return nil, fmt.Errorf("failed to marshal fields to JSON, %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return b.Bytes(), nil
|
return b.Bytes(), nil
|
||||||
|
|
|
@ -235,6 +235,8 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
|
||||||
levelColor = yellow
|
levelColor = yellow
|
||||||
case ErrorLevel, FatalLevel, PanicLevel:
|
case ErrorLevel, FatalLevel, PanicLevel:
|
||||||
levelColor = red
|
levelColor = red
|
||||||
|
case InfoLevel:
|
||||||
|
levelColor = blue
|
||||||
default:
|
default:
|
||||||
levelColor = blue
|
levelColor = blue
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Install golanci 1.21.0
|
# Install golanci 1.32.2
|
||||||
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.13\. ]]; then
|
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.15\. ]]; then
|
||||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.21.0
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.32.2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 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.
|
# 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
|
||||||
if [[ "$GO111MODULE" == "on" ]]; then
|
if [[ "$GO111MODULE" == "on" ]]; then
|
||||||
go mod download
|
go mod download
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$GO111MODULE" == "off" ]]; then
|
|
||||||
# Should contain all regular (not indirect) modules from go.mod
|
|
||||||
go get github.com/stretchr/testify golang.org/x/sys/unix golang.org/x/sys/windows
|
|
||||||
fi
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.13\. ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$GO111MODULE" == "on" ]]; then
|
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.15\. ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$GO111MODULE" == "on" ]]; then
|
||||||
$(go env GOPATH)/bin/golangci-lint run ./...
|
$(go env GOPATH)/bin/golangci-lint run ./...
|
||||||
|
else
|
||||||
|
echo "linter has not been run"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue