summaryrefslogtreecommitdiff
path: root/vendor/github.com/nxadm
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/nxadm')
-rw-r--r--vendor/github.com/nxadm/tail/.gitignore3
-rw-r--r--vendor/github.com/nxadm/tail/.travis.yml16
-rw-r--r--vendor/github.com/nxadm/tail/CHANGES.md12
-rw-r--r--vendor/github.com/nxadm/tail/README.md40
-rw-r--r--vendor/github.com/nxadm/tail/appveyor.yml11
-rw-r--r--vendor/github.com/nxadm/tail/go.mod3
-rw-r--r--vendor/github.com/nxadm/tail/go.sum8
-rw-r--r--vendor/github.com/nxadm/tail/tail.go73
-rw-r--r--vendor/github.com/nxadm/tail/tail_posix.go6
-rw-r--r--vendor/github.com/nxadm/tail/tail_windows.go9
-rw-r--r--vendor/github.com/nxadm/tail/util/util.go1
-rw-r--r--vendor/github.com/nxadm/tail/watch/filechanges.go1
-rw-r--r--vendor/github.com/nxadm/tail/watch/inotify.go1
-rw-r--r--vendor/github.com/nxadm/tail/watch/inotify_tracker.go1
-rw-r--r--vendor/github.com/nxadm/tail/watch/polling.go1
-rw-r--r--vendor/github.com/nxadm/tail/watch/watch.go1
-rw-r--r--vendor/github.com/nxadm/tail/winfile/winfile.go1
17 files changed, 107 insertions, 81 deletions
diff --git a/vendor/github.com/nxadm/tail/.gitignore b/vendor/github.com/nxadm/tail/.gitignore
index fa81aa93a..35d9351d3 100644
--- a/vendor/github.com/nxadm/tail/.gitignore
+++ b/vendor/github.com/nxadm/tail/.gitignore
@@ -1,2 +1,3 @@
.idea/
-.test/ \ No newline at end of file
+.test/
+examples/_* \ No newline at end of file
diff --git a/vendor/github.com/nxadm/tail/.travis.yml b/vendor/github.com/nxadm/tail/.travis.yml
deleted file mode 100644
index 95dd3bd78..000000000
--- a/vendor/github.com/nxadm/tail/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-language: go
-
-script:
- - go test -race -v ./...
-
-go:
- - "1.9"
- - "1.10"
- - "1.11"
- - "1.12"
- - "1.13"
- - tip
-
-matrix:
- allow_failures:
- - go: tip
diff --git a/vendor/github.com/nxadm/tail/CHANGES.md b/vendor/github.com/nxadm/tail/CHANGES.md
index ef1b5fbed..224e54b44 100644
--- a/vendor/github.com/nxadm/tail/CHANGES.md
+++ b/vendor/github.com/nxadm/tail/CHANGES.md
@@ -1,4 +1,14 @@
-# Version v1.4.4
+# Version v1.4.7-v1.4.8
+* Documentation updates.
+* Small linter cleanups.
+* Added example in test.
+
+# Version v1.4.6
+
+* Document the usage of Cleanup when re-reading a file (thanks to @lesovsky) for issue #18.
+* Add example directories with example and tests for issues.
+
+# Version v1.4.4-v1.4.5
* Fix of checksum problem because of forced tag. No changes to the code.
diff --git a/vendor/github.com/nxadm/tail/README.md b/vendor/github.com/nxadm/tail/README.md
index dbb6c1727..f47939c74 100644
--- a/vendor/github.com/nxadm/tail/README.md
+++ b/vendor/github.com/nxadm/tail/README.md
@@ -1,36 +1,44 @@
-[![Build Status](https://travis-ci.org/nxadm/tail.svg?branch=master)](https://travis-ci.org/nxadm/tail)
+![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)
-This is repo is forked from the dormant upstream repo at
-[hpcloud](https://github.com/hpcloud/tail). This fork adds support for go
-modules, updates the dependencies, adds features and fixes bugs. Go 1.9 is
-the oldest compiler release supported.
+# tail functionality in Go
-# Go package for tail-ing files
+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
+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
+*BSD, and MS Windows. Go 1.9 is the oldest compiler release supported.
-A Go package striving to emulate the features of the BSD `tail` program.
+A simple example:
```Go
-t, err := tail.TailFile("/var/log/nginx.log", tail.Config{Follow: true})
+// Create a tail
+t, err := tail.TailFile(
+ "/var/log/nginx.log", tail.Config{Follow: true, ReOpen: true})
if err != nil {
panic(err)
}
+// Print the text of each received line
for line := range t.Lines {
fmt.Println(line.Text)
}
```
-See [API documentation](http://godoc.org/github.com/nxadm/tail).
-
-## Log rotation
-
-Tail comes with full support for truncation/move detection as it is
-designed to work with log rotation tools.
+See [API documentation](https://pkg.go.dev/github.com/nxadm/tail).
## Installing
go get github.com/nxadm/tail/...
-## Windows support
+## History
+
+This project is an active, drop-in replacement for the
+[abandoned](https://en.wikipedia.org/wiki/HPE_Helion) Go tail library at
+[hpcloud](https://github.com/hpcloud/tail). Next to
+[addressing open issues/PRs of the original project](https://github.com/nxadm/tail/issues/6),
+nxadm/tail continues the development by keeping up to date with the Go toolchain
+(e.g. go modules) and dependencies, completing the documentation, adding features
+and fixing bugs.
-This package [needs assistance](https://github.com/nxadm/tail/labels/Windows) for full Windows support.
+## Examples
+Examples, e.g. used to debug an issue, are kept in the [examples directory](/examples). \ No newline at end of file
diff --git a/vendor/github.com/nxadm/tail/appveyor.yml b/vendor/github.com/nxadm/tail/appveyor.yml
deleted file mode 100644
index e149bc62d..000000000
--- a/vendor/github.com/nxadm/tail/appveyor.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-version: 0.{build}
-skip_tags: true
-cache: C:\Users\appveyor\AppData\Local\NuGet\Cache
-build_script:
-- SET GOPATH=c:\workspace
-- go test -v -race ./...
-test: off
-clone_folder: c:\workspace\src\github.com\nxadm\tail
-branches:
- only:
- - master
diff --git a/vendor/github.com/nxadm/tail/go.mod b/vendor/github.com/nxadm/tail/go.mod
index fb10d42af..5de9a6061 100644
--- a/vendor/github.com/nxadm/tail/go.mod
+++ b/vendor/github.com/nxadm/tail/go.mod
@@ -3,7 +3,6 @@ module github.com/nxadm/tail
go 1.13
require (
- github.com/fsnotify/fsnotify v1.4.7
- golang.org/x/sys v0.0.0-20190904154756-749cb33beabd // indirect
+ github.com/fsnotify/fsnotify v1.4.9
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
)
diff --git a/vendor/github.com/nxadm/tail/go.sum b/vendor/github.com/nxadm/tail/go.sum
index b391f1904..3485daedb 100644
--- a/vendor/github.com/nxadm/tail/go.sum
+++ b/vendor/github.com/nxadm/tail/go.sum
@@ -1,6 +1,6 @@
-github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
-github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
-golang.org/x/sys v0.0.0-20190904154756-749cb33beabd h1:DBH9mDw0zluJT/R+nGuV3jWFWLFaHyYZWD4tOT+cjn0=
-golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
+github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
+golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9 h1:L2auWcuQIvxz9xSEqzESnV/QN/gNRXNApHi3fYwl2w0=
+golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
diff --git a/vendor/github.com/nxadm/tail/tail.go b/vendor/github.com/nxadm/tail/tail.go
index 58d3c4b95..37ea4411e 100644
--- a/vendor/github.com/nxadm/tail/tail.go
+++ b/vendor/github.com/nxadm/tail/tail.go
@@ -1,6 +1,12 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// Copyright (c) 2015 HPE Software Inc. All rights reserved.
// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
+//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
+//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
+//*BSD, and MS Windows. Go 1.9 is the oldest compiler release supported.
package tail
import (
@@ -22,26 +28,31 @@ import (
)
var (
+ // ErrStop is returned when the tail of a file has been marked to be stopped.
ErrStop = errors.New("tail should now stop")
)
type Line struct {
- Text string
- Num int
- SeekInfo SeekInfo
- Time time.Time
- Err error // Error from tail
+ Text string // The contents of the file
+ Num int // The line number
+ SeekInfo SeekInfo // SeekInfo
+ Time time.Time // Present time
+ Err error // Error from tail
}
-// NewLine returns a Line with present time.
+// Deprecated: this function is no longer used internally and it has little of no
+// use in the API. As such, it will be removed from the API in a future major
+// release.
+//
+// NewLine returns a * pointer to a Line struct.
func NewLine(text string, lineNum int) *Line {
return &Line{text, lineNum, SeekInfo{}, time.Now(), nil}
}
-// SeekInfo represents arguments to `io.Seek`
+// SeekInfo represents arguments to io.Seek. See: https://golang.org/pkg/io/#SectionReader.Seek
type SeekInfo struct {
Offset int64
- Whence int // io.Seek*
+ Whence int
}
type logger interface {
@@ -59,26 +70,28 @@ type logger interface {
// Config is used to specify how a file must be tailed.
type Config struct {
// File-specifc
- Location *SeekInfo // Seek to this location before tailing
- ReOpen bool // Reopen recreated files (tail -F)
- MustExist bool // Fail early if the file does not exist
- Poll bool // Poll for file changes instead of using inotify
- Pipe bool // Is a named pipe (mkfifo)
- RateLimiter *ratelimiter.LeakyBucket
+ Location *SeekInfo // Tail from this location. If nil, start at the beginning of the file
+ ReOpen bool // Reopen recreated files (tail -F)
+ MustExist bool // Fail early if the file does not exist
+ Poll bool // Poll for file changes instead of using the default inotify
+ Pipe bool // The file is a named pipe (mkfifo)
// Generic IO
Follow bool // Continue looking for new lines (tail -f)
MaxLineSize int // If non-zero, split longer lines into multiple lines
- // Logger, when nil, is set to tail.DefaultLogger
- // To disable logging: set field to tail.DiscardingLogger
+ // Optionally, use a ratelimiter (e.g. created by the ratelimiter/NewLeakyBucket function)
+ RateLimiter *ratelimiter.LeakyBucket
+
+ // Optionally use a Logger. When nil, the Logger is set to tail.DefaultLogger.
+ // To disable logging, set it to tail.DiscardingLogger
Logger logger
}
type Tail struct {
- Filename string
- Lines chan *Line
- Config
+ Filename string // The filename
+ Lines chan *Line // A consumable channel of *Line
+ Config // Tail.Configuration
file *os.File
reader *bufio.Reader
@@ -93,16 +106,17 @@ type Tail struct {
}
var (
- // DefaultLogger is used when Config.Logger == nil
+ // DefaultLogger logs to os.Stderr and it is used when Config.Logger == nil
DefaultLogger = log.New(os.Stderr, "", log.LstdFlags)
// DiscardingLogger can be used to disable logging output
DiscardingLogger = log.New(ioutil.Discard, "", 0)
)
-// TailFile begins tailing the file. Output stream is made available
-// via the `Tail.Lines` channel. To handle errors during tailing,
-// invoke the `Wait` or `Err` method after finishing reading from the
-// `Lines` channel.
+// TailFile begins tailing the file. And returns a pointer to a Tail struct
+// and an error. An output stream is made available via the Tail.Lines
+// channel (e.g. to be looped and printed). To handle errors during tailing,
+// after finishing reading from the Lines channel, invoke the `Wait` or `Err`
+// method on the returned *Tail.
func TailFile(filename string, config Config) (*Tail, error) {
if config.ReOpen && !config.Follow {
util.Fatal("cannot set ReOpen without Follow.")
@@ -138,10 +152,9 @@ func TailFile(filename string, config Config) (*Tail, error) {
return t, nil
}
-// Tell returns the file's current position, like stdio's ftell().
-// But this value is not very accurate.
-// One line from the chan(tail.Lines) may have been read,
-// so it may have lost one line.
+// Tell returns the file's current position, like stdio's ftell() and an error.
+// Beware that this value may not be completely accurate because one line from
+// the chan(tail.Lines) may have been read already.
func (tail *Tail) Tell() (offset int64, err error) {
if tail.file == nil {
return
@@ -167,7 +180,8 @@ func (tail *Tail) Stop() error {
return tail.Wait()
}
-// StopAtEOF stops tailing as soon as the end of the file is reached.
+// StopAtEOF stops tailing as soon as the end of the file is reached. The function
+// returns an error,
func (tail *Tail) StopAtEOF() error {
tail.Kill(errStopAtEOF)
return tail.Wait()
@@ -435,6 +449,7 @@ func (tail *Tail) sendLine(line string) bool {
// Cleanup removes inotify watches added by the tail package. This function is
// meant to be invoked from a process's exit handler. Linux kernel may not
// automatically remove inotify watches after the process exits.
+// If you plan to re-read a file, don't call Cleanup in between.
func (tail *Tail) Cleanup() {
watch.Cleanup(tail.Filename)
}
diff --git a/vendor/github.com/nxadm/tail/tail_posix.go b/vendor/github.com/nxadm/tail/tail_posix.go
index 1b94520ec..23e071dea 100644
--- a/vendor/github.com/nxadm/tail/tail_posix.go
+++ b/vendor/github.com/nxadm/tail/tail_posix.go
@@ -1,3 +1,4 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// +build !windows
package tail
@@ -6,6 +7,11 @@ import (
"os"
)
+// Deprecated: this function is only useful internally and, as such,
+// it will be removed from the API in a future major release.
+//
+// OpenFile proxies a os.Open call for a file so it can be correctly tailed
+// on POSIX and non-POSIX OSes like MS Windows.
func OpenFile(name string) (file *os.File, err error) {
return os.Open(name)
}
diff --git a/vendor/github.com/nxadm/tail/tail_windows.go b/vendor/github.com/nxadm/tail/tail_windows.go
index 4aaceea28..da0d2f39c 100644
--- a/vendor/github.com/nxadm/tail/tail_windows.go
+++ b/vendor/github.com/nxadm/tail/tail_windows.go
@@ -1,12 +1,19 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// +build windows
package tail
import (
- "github.com/nxadm/tail/winfile"
"os"
+
+ "github.com/nxadm/tail/winfile"
)
+// Deprecated: this function is only useful internally and, as such,
+// it will be removed from the API in a future major release.
+//
+// OpenFile proxies a os.Open call for a file so it can be correctly tailed
+// on POSIX and non-POSIX OSes like MS Windows.
func OpenFile(name string) (file *os.File, err error) {
return winfile.OpenFile(name, os.O_RDONLY, 0)
}
diff --git a/vendor/github.com/nxadm/tail/util/util.go b/vendor/github.com/nxadm/tail/util/util.go
index 2ba0ed71c..b64caa212 100644
--- a/vendor/github.com/nxadm/tail/util/util.go
+++ b/vendor/github.com/nxadm/tail/util/util.go
@@ -1,3 +1,4 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// Copyright (c) 2015 HPE Software Inc. All rights reserved.
// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
diff --git a/vendor/github.com/nxadm/tail/watch/filechanges.go b/vendor/github.com/nxadm/tail/watch/filechanges.go
index f80aead9a..5b65f42ae 100644
--- a/vendor/github.com/nxadm/tail/watch/filechanges.go
+++ b/vendor/github.com/nxadm/tail/watch/filechanges.go
@@ -1,3 +1,4 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
package watch
type FileChanges struct {
diff --git a/vendor/github.com/nxadm/tail/watch/inotify.go b/vendor/github.com/nxadm/tail/watch/inotify.go
index 439921810..cbd11ad8d 100644
--- a/vendor/github.com/nxadm/tail/watch/inotify.go
+++ b/vendor/github.com/nxadm/tail/watch/inotify.go
@@ -1,3 +1,4 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// Copyright (c) 2015 HPE Software Inc. All rights reserved.
// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
diff --git a/vendor/github.com/nxadm/tail/watch/inotify_tracker.go b/vendor/github.com/nxadm/tail/watch/inotify_tracker.go
index a94bcd4cb..cb9572a03 100644
--- a/vendor/github.com/nxadm/tail/watch/inotify_tracker.go
+++ b/vendor/github.com/nxadm/tail/watch/inotify_tracker.go
@@ -1,3 +1,4 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// Copyright (c) 2015 HPE Software Inc. All rights reserved.
// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
diff --git a/vendor/github.com/nxadm/tail/watch/polling.go b/vendor/github.com/nxadm/tail/watch/polling.go
index fb1706908..74e10aa42 100644
--- a/vendor/github.com/nxadm/tail/watch/polling.go
+++ b/vendor/github.com/nxadm/tail/watch/polling.go
@@ -1,3 +1,4 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// Copyright (c) 2015 HPE Software Inc. All rights reserved.
// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
diff --git a/vendor/github.com/nxadm/tail/watch/watch.go b/vendor/github.com/nxadm/tail/watch/watch.go
index 2e1783ef0..2b5112805 100644
--- a/vendor/github.com/nxadm/tail/watch/watch.go
+++ b/vendor/github.com/nxadm/tail/watch/watch.go
@@ -1,3 +1,4 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// Copyright (c) 2015 HPE Software Inc. All rights reserved.
// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
diff --git a/vendor/github.com/nxadm/tail/winfile/winfile.go b/vendor/github.com/nxadm/tail/winfile/winfile.go
index aa7e7bc5d..4562ac7c2 100644
--- a/vendor/github.com/nxadm/tail/winfile/winfile.go
+++ b/vendor/github.com/nxadm/tail/winfile/winfile.go
@@ -1,3 +1,4 @@
+// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail
// +build windows
package winfile