Merge pull request from containers/renovate/github.com-nxadm-tail-1.x

fix(deps): update module github.com/nxadm/tail to v1.4.11
This commit is contained in:
openshift-ci[bot]
2023-10-10 19:10:25 +00:00
committed by GitHub
9 changed files with 65 additions and 17 deletions

2
go.mod

@ -43,7 +43,7 @@ require (
github.com/mattn/go-shellwords v1.0.12 github.com/mattn/go-shellwords v1.0.12
github.com/mattn/go-sqlite3 v1.14.17 github.com/mattn/go-sqlite3 v1.14.17
github.com/moby/term v0.5.0 github.com/moby/term v0.5.0
github.com/nxadm/tail v1.4.8 github.com/nxadm/tail v1.4.11
github.com/onsi/ginkgo/v2 v2.13.0 github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.28.0 github.com/onsi/gomega v1.28.0
github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/go-digest v1.0.0

3
go.sum

@ -784,8 +784,9 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc=
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=

8
vendor/github.com/nxadm/tail/.cirrus.yml generated vendored Normal file

@ -0,0 +1,8 @@
task:
name: FreeBSD
freebsd_instance:
image_family: freebsd-12-2
install_script: pkg install -y go
script: |
go build
go test -v -race -timeout 2m ./...

@ -1,3 +1,2 @@
.idea/ .idea/
.test/
examples/_* examples/_*

@ -1,3 +1,11 @@
# Version v1.4.11
* Bump fsnotify to v1.6.0. Should fix some issues.
# Version v1.4.9
* Bump fsnotify to v1.5.1 fixes issue #28, hpcloud/tail#90.
* PR #27: "Add timeout to tests"by @kokes++. Also timeout on FreeBSD.
* PR #29: "Use temp directory for tests, instead of relative" by @ches++.
# Version v1.4.7-v1.4.8 # Version v1.4.7-v1.4.8
* Documentation updates. * Documentation updates.
* Small linter cleanups. * Small linter cleanups.

5
vendor/github.com/nxadm/tail/CONTRIBUTING.md generated vendored Normal file

@ -0,0 +1,5 @@
# Contributing
Comments (at Discussions), Issues and PRs are always welcome. In the case of issues,
code examples make it easier to reproduce the problem. In the case of PRs add tests
if applicable so we make sure nothing breaks for people using the library on different
OSes.

@ -1,12 +1,13 @@
![ci](https://github.com/nxadm/tail/workflows/ci/badge.svg)[![Go Reference](https://pkg.go.dev/badge/github.com/nxadm/tail.svg)](https://pkg.go.dev/github.com/nxadm/tail) [![Go Reference](https://pkg.go.dev/badge/github.com/nxadm/tail.svg)](https://pkg.go.dev/github.com/nxadm/tail#section-documentation)
![ci](https://github.com/nxadm/tail/workflows/ci/badge.svg)
[![FreeBSD](https://api.cirrus-ci.com/github/nxadm/tail.svg)](https://cirrus-ci.com/github/nxadm/tail)
# tail functionality in Go # tail functionality in Go
nxadm/tail provides a Go library that emulates the features of the BSD `tail` nxadm/tail provides a Go library that emulates the features of the BSD `tail`
program. The library comes with full support for truncation/move detection as program. The library comes with full support for truncation/move detection as
it is designed to work with log rotation tools. The library works on all it is designed to work with log rotation tools. The library works on all
operating systems supported by Go, including POSIX systems like Linux and operating systems supported by Go, including POSIX systems like Linux, *BSD,
*BSD, and MS Windows. Go 1.9 is the oldest compiler release supported. MacOS, and MS Windows. Go 1.12 is the oldest compiler release supported.
A simple example: A simple example:
@ -24,7 +25,7 @@ for line := range t.Lines {
} }
``` ```
See [API documentation](https://pkg.go.dev/github.com/nxadm/tail). See [API documentation](https://pkg.go.dev/github.com/nxadm/tail#section-documentation).
## Installing ## Installing

32
vendor/github.com/nxadm/tail/tail.go generated vendored

@ -79,6 +79,7 @@ type Config struct {
// Generic IO // Generic IO
Follow bool // Continue looking for new lines (tail -f) Follow bool // Continue looking for new lines (tail -f)
MaxLineSize int // If non-zero, split longer lines into multiple lines MaxLineSize int // If non-zero, split longer lines into multiple lines
CompleteLines bool // Only return complete lines (that end with "\n" or EOF when Follow is false)
// Optionally, use a ratelimiter (e.g. created by the ratelimiter/NewLeakyBucket function) // Optionally, use a ratelimiter (e.g. created by the ratelimiter/NewLeakyBucket function)
RateLimiter *ratelimiter.LeakyBucket RateLimiter *ratelimiter.LeakyBucket
@ -97,6 +98,8 @@ type Tail struct {
reader *bufio.Reader reader *bufio.Reader
lineNum int lineNum int
lineBuf *strings.Builder
watcher watch.FileWatcher watcher watch.FileWatcher
changes *watch.FileChanges changes *watch.FileChanges
@ -128,6 +131,10 @@ func TailFile(filename string, config Config) (*Tail, error) {
Config: config, Config: config,
} }
if config.CompleteLines {
t.lineBuf = new(strings.Builder)
}
// when Logger was not specified in config, use default logger // when Logger was not specified in config, use default logger
if t.Logger == nil { if t.Logger == nil {
t.Logger = DefaultLogger t.Logger = DefaultLogger
@ -202,6 +209,9 @@ func (tail *Tail) closeFile() {
} }
func (tail *Tail) reopen() error { func (tail *Tail) reopen() error {
if tail.lineBuf != nil {
tail.lineBuf.Reset()
}
tail.closeFile() tail.closeFile()
tail.lineNum = 0 tail.lineNum = 0
for { for {
@ -229,16 +239,32 @@ func (tail *Tail) readLine() (string, error) {
tail.lk.Lock() tail.lk.Lock()
line, err := tail.reader.ReadString('\n') line, err := tail.reader.ReadString('\n')
tail.lk.Unlock() tail.lk.Unlock()
if err != nil {
newlineEnding := strings.HasSuffix(line, "\n")
line = strings.TrimRight(line, "\n")
// if we don't have to handle incomplete lines, we can return the line as-is
if !tail.Config.CompleteLines {
// Note ReadString "returns the data read before the error" in // Note ReadString "returns the data read before the error" in
// case of an error, including EOF, so we return it as is. The // case of an error, including EOF, so we return it as is. The
// caller is expected to process it if err is EOF. // caller is expected to process it if err is EOF.
return line, err return line, err
} }
line = strings.TrimRight(line, "\n") if _, err := tail.lineBuf.WriteString(line); err != nil {
return line, err return line, err
}
if newlineEnding {
line = tail.lineBuf.String()
tail.lineBuf.Reset()
return line, nil
} else {
if tail.Config.Follow {
line = ""
}
return line, io.EOF
}
} }
func (tail *Tail) tailFileSync() { func (tail *Tail) tailFileSync() {

2
vendor/modules.txt vendored

@ -770,7 +770,7 @@ github.com/modern-go/reflect2
# github.com/morikuni/aec v1.0.0 # github.com/morikuni/aec v1.0.0
## explicit ## explicit
github.com/morikuni/aec github.com/morikuni/aec
# github.com/nxadm/tail v1.4.8 # github.com/nxadm/tail v1.4.11
## explicit; go 1.13 ## explicit; go 1.13
github.com/nxadm/tail github.com/nxadm/tail
github.com/nxadm/tail/ratelimiter github.com/nxadm/tail/ratelimiter