aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-11-30 15:26:05 +0700
committerShulhan <ms@kilabit.info>2018-11-30 15:26:05 +0700
commit34ae901ff30a32d9aef33bfe25561ff2f685cb0c (patch)
tree3e3c8dd94965b0f26d1fa21eebeeabfa9d0a7fef
parentc61d03ab8d355ac7d14ee86e29599e67fb2c5a66 (diff)
downloadhaminer-34ae901ff30a32d9aef33bfe25561ff2f685cb0c.tar.xz
all: fix warning from linter
-rw-r--r--Makefile2
-rw-r--r--cmd/haminer/main.go2
-rw-r--r--halog.go12
-rw-r--r--influxdb.go2
-rw-r--r--udppacket.go4
5 files changed, 9 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 3dad251..6302c47 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ build:
go build -v ./cmd/haminer
lint:
- -golangci-lint run ./...
+ -golangci-lint run --enable-all ./...
install: build lint
go install -v ./cmd/haminer
diff --git a/cmd/haminer/main.go b/cmd/haminer/main.go
index b457070..578ccd4 100644
--- a/cmd/haminer/main.go
+++ b/cmd/haminer/main.go
@@ -57,7 +57,7 @@ func initConfig() (cfg *haminer.Config) {
cfg.InfluxAPIWrite = flagInfluxAPIWrite
}
- return
+ return cfg
}
func main() {
diff --git a/halog.go b/halog.go
index 8d25fd2..490540d 100644
--- a/halog.go
+++ b/halog.go
@@ -11,16 +11,12 @@ import (
"time"
)
-var (
- timestampLayout = "2/Jan/2006:15:04:05.000"
-)
-
//
// Halog contains the mapping of haproxy HTTP log format to Go struct.
//
// Reference: https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.3
//
-type Halog struct {
+type Halog struct { // nolint: maligned
Timestamp time.Time
ClientIP string
@@ -248,7 +244,7 @@ func (halog *Halog) parseHTTP(in []byte) (ok bool) {
halog.HTTPProto, ok = parseToString(in, '"')
- return
+ return ok
}
//
@@ -283,7 +279,7 @@ func (halog *Halog) Parse(in []byte, reqHeaders []string) (ok bool) {
return
}
- halog.Timestamp, err = time.Parse(timestampLayout, ts)
+ halog.Timestamp, err = time.Parse("2/Jan/2006:15:04:05.000", ts)
if err != nil {
return false
}
@@ -366,7 +362,7 @@ func (halog *Halog) Parse(in []byte, reqHeaders []string) (ok bool) {
in = in[1:]
ok = halog.parseHTTP(in)
- return
+ return ok
}
//
diff --git a/influxdb.go b/influxdb.go
index d266100..badadbe 100644
--- a/influxdb.go
+++ b/influxdb.go
@@ -153,5 +153,5 @@ func (cl *InfluxdbClient) write(halogs []*Halog) (err error) {
}
}
- return
+ return nil
}
diff --git a/udppacket.go b/udppacket.go
index c7b017b..8cecfb0 100644
--- a/udppacket.go
+++ b/udppacket.go
@@ -30,8 +30,8 @@ func NewUDPPacket(size uint32) (p *UDPPacket) {
}
//
-// Reset will set the content of packet data to zero, so it can be used agains
-// on Read().
+// Reset will set the content of packet data to zero, so it can be used
+// against on Read().
//
func (p *UDPPacket) Reset() {
p.Bytes[0] = 0