summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2020-12-08 14:32:29 +0000
committerPaul Buetow <pbuetow@mimecast.com>2020-12-08 14:32:29 +0000
commit602fb36da6c734a2d64bf4be13719c7349d5fe73 (patch)
tree71dd7f67e9fc1ae3b5a55433425120b57a53e73c
parentc74bfb883c35b15883e4cb1356e8a52282b96971 (diff)
make lint and vet happy
-rw-r--r--Makefile4
-rw-r--r--go.mod2
-rw-r--r--go.sum14
-rw-r--r--internal/clients/handlers/healthhandler.go2
-rw-r--r--internal/config/server.go1
-rw-r--r--internal/io/signal/signal.go2
-rw-r--r--internal/mapr/server/aggregate.go1
-rw-r--r--internal/regex/flag.go2
-rw-r--r--internal/regex/regex.go7
-rw-r--r--internal/server/continuous.go2
-rw-r--r--internal/server/handlers/controlhandler.go2
-rw-r--r--internal/server/handlers/serverhandler.go2
-rw-r--r--internal/server/scheduler.go2
13 files changed, 37 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 8e3d608..6552f0c 100644
--- a/Makefile
+++ b/Makefile
@@ -24,8 +24,8 @@ vet:
lint:
${GO} get golang.org/x/lint/golint
find . -type d | while read dir; do \
- echo ${GOPATH}/bin/golint $$dir; \
- ${GOPATH}/bin/golint $$dir; \
+ echo golint $$dir; \
+ golint $$dir; \
done
test:
${GO} test ./... -v
diff --git a/go.mod b/go.mod
index e95da7d..863e417 100644
--- a/go.mod
+++ b/go.mod
@@ -6,5 +6,5 @@ require (
github.com/DataDog/zstd v1.4.5
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
- golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d // indirect
+ golang.org/x/tools v0.0.0-20201208062317-e652b2f42cc7 // indirect
)
diff --git a/go.sum b/go.sum
index 00c6f54..2487cf1 100644
--- a/go.sum
+++ b/go.sum
@@ -2,10 +2,12 @@ github.com/DataDog/zstd v1.4.4 h1:+IawcoXhCBylN7ccwdwf8LOH2jKq7NavGpEPanrlTzE=
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876 h1:sKJQZMuxjOAR/Uo2LBfU90onWEf1dF4C+0hPJCc9Mpc=
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de h1:ikNHVSjEfnvz6sxdSPCaPt572qowuyMDMJLLm3Db3ig=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367 h1:0IiAsCRByjO2QjX7ZPkw5oU9x+n1YqRL802rjC0c3Aw=
@@ -13,15 +15,27 @@ golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPI
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d h1:QQrM/CCYEzTs91GZylDCQjGHudbPTxF/1fvXdVh5lMo=
golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7 h1:EBZoQjiKKPaLbPrbpssUfuHtwM6KV/vb4U85g/cigFY=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20201208062317-e652b2f42cc7 h1:2OSu5vYyX4LVqZAtqZXnFEcN26SDKIJYlEVIRl1tj8U=
+golang.org/x/tools v0.0.0-20201208062317-e652b2f42cc7/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/internal/clients/handlers/healthhandler.go b/internal/clients/handlers/healthhandler.go
index 95693ab..08ed137 100644
--- a/internal/clients/handlers/healthhandler.go
+++ b/internal/clients/handlers/healthhandler.go
@@ -45,10 +45,12 @@ func (h *HealthHandler) Status() int {
return h.status
}
+// Done returns done channel of the handler.
func (h *HealthHandler) Done() <-chan struct{} {
return h.done.Done()
}
+// Shutdown the handler.
func (h *HealthHandler) Shutdown() {
h.done.Shutdown()
}
diff --git a/internal/config/server.go b/internal/config/server.go
index db12cec..dc0d587 100644
--- a/internal/config/server.go
+++ b/internal/config/server.go
@@ -61,6 +61,7 @@ type ServerConfig struct {
Continuous []Continuous `json:",omitempty"`
}
+// ServerRelaxedAuthEnable should be used for development and testing purposes only.
var ServerRelaxedAuthEnable bool
// Create a new default server configuration.
diff --git a/internal/io/signal/signal.go b/internal/io/signal/signal.go
index 27c7852..500c530 100644
--- a/internal/io/signal/signal.go
+++ b/internal/io/signal/signal.go
@@ -10,7 +10,7 @@ import (
"github.com/mimecast/dtail/internal/config"
)
-// StatsCh returns a channel for "please print stats" signalling.
+// InterruptCh returns a channel for "please print stats" signalling.
func InterruptCh(ctx context.Context) <-chan string {
sigIntCh := make(chan os.Signal)
gosignal.Notify(sigIntCh, os.Interrupt)
diff --git a/internal/mapr/server/aggregate.go b/internal/mapr/server/aggregate.go
index cd59b63..28bb074 100644
--- a/internal/mapr/server/aggregate.go
+++ b/internal/mapr/server/aggregate.go
@@ -80,6 +80,7 @@ func NewAggregate(queryStr string) (*Aggregate, error) {
return &a, nil
}
+// Shutdown the aggregation engine.
func (a *Aggregate) Shutdown() {
a.Flush()
a.done.Shutdown()
diff --git a/internal/regex/flag.go b/internal/regex/flag.go
index d3ff712..396bda0 100644
--- a/internal/regex/flag.go
+++ b/internal/regex/flag.go
@@ -2,6 +2,7 @@ package regex
import "fmt"
+// Flag for regex.
type Flag int
const (
@@ -15,6 +16,7 @@ const (
Noop Flag = iota
)
+// NewFlag returns a new regex flag.
func NewFlag(str string) (Flag, error) {
switch str {
case "default":
diff --git a/internal/regex/regex.go b/internal/regex/regex.go
index f668c38..2561659 100644
--- a/internal/regex/regex.go
+++ b/internal/regex/regex.go
@@ -8,6 +8,7 @@ import (
"github.com/mimecast/dtail/internal/io/logger"
)
+// Regex for filtering lines.
type Regex struct {
// The original regex string
regexStr string
@@ -24,6 +25,7 @@ func (r Regex) String() string {
r.regexStr, r.flags, r.initialized, r.re == nil)
}
+// NewNoop is a noop regex (doing nothing).
func NewNoop() Regex {
return Regex{
flags: []Flag{Noop},
@@ -31,6 +33,7 @@ func NewNoop() Regex {
}
}
+// New returns a new regex object.
func New(regexStr string, flag Flag) (Regex, error) {
if regexStr == "" || regexStr == "." || regexStr == ".*" {
return NewNoop(), nil
@@ -59,6 +62,7 @@ func new(regexStr string, flags []Flag) (Regex, error) {
return r, nil
}
+// Match a byte string.
func (r Regex) Match(bytes []byte) bool {
switch r.flags[0] {
case Default:
@@ -72,6 +76,7 @@ func (r Regex) Match(bytes []byte) bool {
}
}
+// MatchString matches a string.
func (r Regex) MatchString(str string) bool {
switch r.flags[0] {
case Default:
@@ -85,6 +90,7 @@ func (r Regex) MatchString(str string) bool {
}
}
+// Serialize the regex.
func (r Regex) Serialize() string {
var flags []string
for _, flag := range r.flags {
@@ -98,6 +104,7 @@ func (r Regex) Serialize() string {
return fmt.Sprintf("regex:%s %s", strings.Join(flags, ","), r.regexStr)
}
+// Deserialize the regex.
func Deserialize(str string) (Regex, error) {
// Get regex string
s := strings.SplitN(str, " ", 2)
diff --git a/internal/server/continuous.go b/internal/server/continuous.go
index 583d136..f75c732 100644
--- a/internal/server/continuous.go
+++ b/internal/server/continuous.go
@@ -92,7 +92,7 @@ func (c *continuous) runJob(ctx context.Context, job config.Continuous) {
}
logger.Info(fmt.Sprintf("Starting job %s", job.Name))
- status := client.Start(jobCtx, make(chan struct{}))
+ status := client.Start(jobCtx, make(chan string))
logMessage := fmt.Sprintf("Job exited with status %d", status)
if status != 0 {
diff --git a/internal/server/handlers/controlhandler.go b/internal/server/handlers/controlhandler.go
index 9a8eb75..8cc5a40 100644
--- a/internal/server/handlers/controlhandler.go
+++ b/internal/server/handlers/controlhandler.go
@@ -41,10 +41,12 @@ func NewControlHandler(user *user.User) *ControlHandler {
return &h
}
+// Shutdown the handler.
func (h *ControlHandler) Shutdown() {
h.done.Shutdown()
}
+// Done channel of the handler.
func (h *ControlHandler) Done() <-chan struct{} {
return h.done.Done()
}
diff --git a/internal/server/handlers/serverhandler.go b/internal/server/handlers/serverhandler.go
index 843eabc..5cf8041 100644
--- a/internal/server/handlers/serverhandler.go
+++ b/internal/server/handlers/serverhandler.go
@@ -72,10 +72,12 @@ func NewServerHandler(user *user.User, catLimiter, tailLimiter, globalServerWait
return &h
}
+// Shutdown the handler.
func (h *ServerHandler) Shutdown() {
h.done.Shutdown()
}
+// Done channel of the handler.
func (h *ServerHandler) Done() <-chan struct{} {
return h.done.Done()
}
diff --git a/internal/server/scheduler.go b/internal/server/scheduler.go
index 9d76a3b..a1e9e36 100644
--- a/internal/server/scheduler.go
+++ b/internal/server/scheduler.go
@@ -93,7 +93,7 @@ func (s *scheduler) runJobs(ctx context.Context) {
defer cancel()
logger.Info(fmt.Sprintf("Starting job %s", job.Name))
- status := client.Start(jobCtx, make(chan struct{}))
+ status := client.Start(jobCtx, make(chan string))
logMessage := fmt.Sprintf("Job exited with status %d", status)
if status != 0 {