Skip to content

Commit d0b41be

Browse files
committed
Fix more golint warnings
1 parent e5be3d2 commit d0b41be

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

carbon/app.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type App struct {
2929
Pickle receiver.Receiver
3030
Grpc receiver.Receiver
3131
Prometheus receiver.Receiver
32-
TelegrafHttpJson receiver.Receiver
32+
TelegrafHTTPJSON receiver.Receiver
3333
Collector *Collector // (!!!) Should be re-created on every change config/modules
3434
writeChan chan *RowBinary.WriteBuffer
3535
exit chan bool
@@ -129,9 +129,9 @@ func (app *App) stopListeners() {
129129
logger.Debug("finished", zap.String("module", "prometheus"))
130130
}
131131

132-
if app.TelegrafHttpJson != nil {
133-
app.TelegrafHttpJson.Stop()
134-
app.TelegrafHttpJson = nil
132+
if app.TelegrafHTTPJSON != nil {
133+
app.TelegrafHTTPJSON.Stop()
134+
app.TelegrafHTTPJSON = nil
135135
logger.Debug("finished", zap.String("module", "telegraf_http_json"))
136136
}
137137
}
@@ -336,7 +336,7 @@ func (app *App) Start() (err error) {
336336
}
337337

338338
if conf.TelegrafHTTPJSON.Enabled {
339-
app.TelegrafHttpJson, err = receiver.New(
339+
app.TelegrafHTTPJSON, err = receiver.New(
340340
"telegraf+http+json://"+conf.TelegrafHTTPJSON.Listen,
341341
app.Config.TagDesc,
342342
receiver.WriteChan(app.writeChan),
@@ -350,7 +350,7 @@ func (app *App) Start() (err error) {
350350
return
351351
}
352352

353-
http.HandleFunc("/debug/receive/telegraf_http_json/dropped/", app.TelegrafHttpJson.DroppedHandler)
353+
http.HandleFunc("/debug/receive/telegraf_http_json/dropped/", app.TelegrafHTTPJSON.DroppedHandler)
354354
}
355355
/* RECEIVER end */
356356

carbon/collector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ func NewCollector(app *App) *Collector {
101101
c.stats = append(c.stats, moduleCallback("prometheus", app.Prometheus))
102102
}
103103

104-
if app.TelegrafHttpJson != nil {
105-
c.stats = append(c.stats, moduleCallback("telegraf_http_json", app.TelegrafHttpJson))
104+
if app.TelegrafHTTPJSON != nil {
105+
c.stats = append(c.stats, moduleCallback("telegraf_http_json", app.TelegrafHTTPJSON))
106106
}
107107

108108
for n, u := range app.Uploaders {

receiver/receiver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func New(dsn string, config tags.TagConfig, opts ...Option) (Receiver, error) {
198198
return nil, err
199199
}
200200

201-
r := &TelegrafHttpJson{
201+
r := &TelegrafHTTPJSON{
202202
Base: NewBase(logger, config),
203203
}
204204
r.applyOptions(opts...)

receiver/telegraf_http_json.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ import (
1717
"go.uber.org/zap"
1818
)
1919

20-
type TelegrafHttpMetric struct {
20+
type TelegrafHTTPMetric struct {
2121
Name string `json:"name"`
2222
Timestamp int64 `json:"timestamp"`
2323
Fields map[string]interface{} `json:"fields"`
2424
Tags map[string]string `json:"tags"`
2525
}
2626

27-
type TelegrafHttpPayload struct {
28-
Metrics []TelegrafHttpMetric `json:"metrics"`
27+
type TelegrafHTTPPayload struct {
28+
Metrics []TelegrafHTTPMetric `json:"metrics"`
2929
}
3030

31-
type TelegrafHttpJson struct {
31+
type TelegrafHTTPJSON struct {
3232
Base
3333
listener *net.TCPListener
3434
}
@@ -73,14 +73,14 @@ func TelegrafEncodeTags(tags map[string]string) string {
7373
return res.String()
7474
}
7575

76-
func (rcv *TelegrafHttpJson) ServeHTTP(w http.ResponseWriter, r *http.Request) {
76+
func (rcv *TelegrafHTTPJSON) ServeHTTP(w http.ResponseWriter, r *http.Request) {
7777
body, err := ioutil.ReadAll(r.Body)
7878
if err != nil {
7979
http.Error(w, err.Error(), http.StatusInternalServerError)
8080
return
8181
}
8282

83-
var data TelegrafHttpPayload
83+
var data TelegrafHTTPPayload
8484
err = json.Unmarshal(body, &data)
8585
if err != nil {
8686
http.Error(w, err.Error(), http.StatusInternalServerError)
@@ -144,19 +144,19 @@ metricsLoop:
144144
}
145145

146146
// Addr returns binded socket address. For bind port 0 in tests
147-
func (rcv *TelegrafHttpJson) Addr() net.Addr {
147+
func (rcv *TelegrafHTTPJSON) Addr() net.Addr {
148148
if rcv.listener == nil {
149149
return nil
150150
}
151151
return rcv.listener.Addr()
152152
}
153153

154-
func (rcv *TelegrafHttpJson) Stat(send func(metric string, value float64)) {
154+
func (rcv *TelegrafHTTPJSON) Stat(send func(metric string, value float64)) {
155155
rcv.SendStat(send, "samplesReceived", "errors", "futureDropped", "pastDropped", "tooLongDropped")
156156
}
157157

158158
// Listen bind port. Receive messages and send to out channel
159-
func (rcv *TelegrafHttpJson) Listen(addr *net.TCPAddr) error {
159+
func (rcv *TelegrafHTTPJSON) Listen(addr *net.TCPAddr) error {
160160
return rcv.StartFunc(func() error {
161161

162162
tcpListener, err := net.ListenTCP("tcp", addr)

0 commit comments

Comments
 (0)