Build Error: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
rohitjoshi opened this issue · comments
I am getting below error
make
go build -o bin/tidis-server cmd/server/*
# github.com/yongman/go/log
../../go/src/github.com/yongman/go/log/log.go:36:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:39:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:42:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:45:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:48:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
../../go/src/github.com/yongman/go/log/log.go:51:4: l.SetLevel undefined (type *logrus.Logger has no field or method SetLevel)
make: *** [build] Error 2
I replaced l.SetLevel
with logrus.SetLevel
which works fine.
Can you provide more information about the env:
- which
golang
version you using? logurs
already exists in yourGOPATH
?
I think the problem is l
is an alias for logurs.Logger
which doesn't have SetLevel
method
echo $GOROOT
/usr/local/opt/go/libexec
echo $GOPATH
/Users/xxx/projects/go
go version
go version go1.10.3 darwin/amd64
l
is the instance of logger
, and the *logger
have SetLevel
method.
You can check out https://github.com/sirupsen/logrus/blob/master/logger.go#L315
It seems like a version/dependency issue. It has checked out older version which did not have https://github.com/sirupsen/logrus/blob/master/logger.go#L311 and later