Use gofmt from Go 1.11 (#5259)
This commit is contained in:
parent
0f75f3b304
commit
84139cf890
|
@ -36,30 +36,30 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: '/go/src'
|
at: '/go/src'
|
||||||
- run: 'make check'
|
# disabled due to gofmt differences (1.10 vs 1.11).
|
||||||
|
#- run: 'make check'
|
||||||
- run: 'make test'
|
- run: 'make test'
|
||||||
test-go-1.10:
|
test-go-1.10:
|
||||||
<<: [ *defaults, *go-1_10 ]
|
<<: [ *defaults, *go-1_10 ]
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: '/go/src'
|
at: '/go/src'
|
||||||
- run: 'make check'
|
# disabled due to gofmt differences (1.10 vs 1.11).
|
||||||
|
#- run: 'make check'
|
||||||
- run: 'make test'
|
- run: 'make test'
|
||||||
test-go-1.11:
|
test-go-1.11:
|
||||||
<<: [ *defaults, *go-1_11 ]
|
<<: [ *defaults, *go-1_11 ]
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: '/go/src'
|
at: '/go/src'
|
||||||
# disabled due to gofmt differences (1.10 vs 1.11).
|
- run: 'make check'
|
||||||
# - run: 'make check'
|
|
||||||
- run: 'make test'
|
- run: 'make test'
|
||||||
test-go-1.11-386:
|
test-go-1.11-386:
|
||||||
<<: [ *defaults, *go-1_11 ]
|
<<: [ *defaults, *go-1_11 ]
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: '/go/src'
|
at: '/go/src'
|
||||||
# disabled due to gofmt differences (1.10 vs 1.11).
|
- run: 'GOARCH=386 make check'
|
||||||
# - run: 'GOARCH=386 make check'
|
|
||||||
- run: 'GOARCH=386 make test'
|
- run: 'GOARCH=386 make test'
|
||||||
|
|
||||||
package:
|
package:
|
||||||
|
|
|
@ -38,7 +38,7 @@ Ansible role: https://github.com/rossmcdonald/telegraf
|
||||||
|
|
||||||
Telegraf requires golang version 1.9 or newer, the Makefile requires GNU make.
|
Telegraf requires golang version 1.9 or newer, the Makefile requires GNU make.
|
||||||
|
|
||||||
1. [Install Go](https://golang.org/doc/install) >=1.9 (1.10 recommended)
|
1. [Install Go](https://golang.org/doc/install) >=1.9 (1.11 recommended)
|
||||||
2. [Install dep](https://golang.github.io/dep/docs/installation.html) ==v0.5.0
|
2. [Install dep](https://golang.github.io/dep/docs/installation.html) ==v0.5.0
|
||||||
3. Download Telegraf source:
|
3. Download Telegraf source:
|
||||||
```
|
```
|
||||||
|
|
|
@ -12,11 +12,11 @@ platform: x64
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- IF NOT EXIST "C:\Cache" mkdir C:\Cache
|
- IF NOT EXIST "C:\Cache" mkdir C:\Cache
|
||||||
- IF NOT EXIST "C:\Cache\go1.10.4.msi" curl -o "C:\Cache\go1.10.4.msi" https://storage.googleapis.com/golang/go1.10.4.windows-amd64.msi
|
- IF NOT EXIST "C:\Cache\go1.11.4.msi" curl -o "C:\Cache\go1.11.4.msi" https://storage.googleapis.com/golang/go1.11.4.windows-amd64.msi
|
||||||
- IF NOT EXIST "C:\Cache\gnuwin32-bin.zip" curl -o "C:\Cache\gnuwin32-bin.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-bin.zip
|
- IF NOT EXIST "C:\Cache\gnuwin32-bin.zip" curl -o "C:\Cache\gnuwin32-bin.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-bin.zip
|
||||||
- IF NOT EXIST "C:\Cache\gnuwin32-dep.zip" curl -o "C:\Cache\gnuwin32-dep.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-dep.zip
|
- IF NOT EXIST "C:\Cache\gnuwin32-dep.zip" curl -o "C:\Cache\gnuwin32-dep.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-dep.zip
|
||||||
- IF EXIST "C:\Go" rmdir /S /Q C:\Go
|
- IF EXIST "C:\Go" rmdir /S /Q C:\Go
|
||||||
- msiexec.exe /i "C:\Cache\go1.10.4.msi" /quiet
|
- msiexec.exe /i "C:\Cache\go1.11.4.msi" /quiet
|
||||||
- 7z x "C:\Cache\gnuwin32-bin.zip" -oC:\GnuWin32 -y
|
- 7z x "C:\Cache\gnuwin32-bin.zip" -oC:\GnuWin32 -y
|
||||||
- 7z x "C:\Cache\gnuwin32-dep.zip" -oC:\GnuWin32 -y
|
- 7z x "C:\Cache\gnuwin32-dep.zip" -oC:\GnuWin32 -y
|
||||||
- go get -d github.com/golang/dep
|
- go get -d github.com/golang/dep
|
||||||
|
|
|
@ -248,30 +248,30 @@ func HaproxyGetFieldValues() map[string]interface{} {
|
||||||
"http_response.4xx": uint64(140),
|
"http_response.4xx": uint64(140),
|
||||||
"http_response.5xx": uint64(0),
|
"http_response.5xx": uint64(0),
|
||||||
"http_response.other": uint64(0),
|
"http_response.other": uint64(0),
|
||||||
"iid": uint64(4),
|
"iid": uint64(4),
|
||||||
"last_chk": "OK",
|
"last_chk": "OK",
|
||||||
"lastchg": uint64(1036557),
|
"lastchg": uint64(1036557),
|
||||||
"lastsess": int64(1342),
|
"lastsess": int64(1342),
|
||||||
"lbtot": uint64(9481),
|
"lbtot": uint64(9481),
|
||||||
"mode": "http",
|
"mode": "http",
|
||||||
"pid": uint64(1),
|
"pid": uint64(1),
|
||||||
"qcur": uint64(0),
|
"qcur": uint64(0),
|
||||||
"qmax": uint64(0),
|
"qmax": uint64(0),
|
||||||
"qtime": uint64(1268),
|
"qtime": uint64(1268),
|
||||||
"rate": uint64(0),
|
"rate": uint64(0),
|
||||||
"rate_max": uint64(2),
|
"rate_max": uint64(2),
|
||||||
"rtime": uint64(2908),
|
"rtime": uint64(2908),
|
||||||
"sid": uint64(1),
|
"sid": uint64(1),
|
||||||
"scur": uint64(0),
|
"scur": uint64(0),
|
||||||
"slim": uint64(2),
|
"slim": uint64(2),
|
||||||
"smax": uint64(2),
|
"smax": uint64(2),
|
||||||
"srv_abort": uint64(0),
|
"srv_abort": uint64(0),
|
||||||
"status": "UP",
|
"status": "UP",
|
||||||
"stot": uint64(14539),
|
"stot": uint64(14539),
|
||||||
"ttime": uint64(4500),
|
"ttime": uint64(4500),
|
||||||
"weight": uint64(1),
|
"weight": uint64(1),
|
||||||
"wredis": uint64(0),
|
"wredis": uint64(0),
|
||||||
"wretr": uint64(0),
|
"wretr": uint64(0),
|
||||||
}
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,7 +321,7 @@ func init() {
|
||||||
return &MQTTConsumer{
|
return &MQTTConsumer{
|
||||||
ConnectionTimeout: defaultConnectionTimeout,
|
ConnectionTimeout: defaultConnectionTimeout,
|
||||||
MaxUndeliveredMessages: defaultMaxUndeliveredMessages,
|
MaxUndeliveredMessages: defaultMaxUndeliveredMessages,
|
||||||
state: Disconnected,
|
state: Disconnected,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,10 +202,10 @@ var (
|
||||||
"deleting": uint32(0),
|
"deleting": uint32(0),
|
||||||
"executing": uint32(0),
|
"executing": uint32(0),
|
||||||
"execution of init_command": uint32(0),
|
"execution of init_command": uint32(0),
|
||||||
"end": uint32(0),
|
"end": uint32(0),
|
||||||
"freeing items": uint32(0),
|
"freeing items": uint32(0),
|
||||||
"flushing tables": uint32(0),
|
"flushing tables": uint32(0),
|
||||||
"fulltext initialization": uint32(0),
|
"fulltext initialization": uint32(0),
|
||||||
"idle": uint32(0),
|
"idle": uint32(0),
|
||||||
"init": uint32(0),
|
"init": uint32(0),
|
||||||
"killed": uint32(0),
|
"killed": uint32(0),
|
||||||
|
@ -241,8 +241,8 @@ var (
|
||||||
}
|
}
|
||||||
// plaintext statuses
|
// plaintext statuses
|
||||||
stateStatusMappings = map[string]string{
|
stateStatusMappings = map[string]string{
|
||||||
"user sleep": "idle",
|
"user sleep": "idle",
|
||||||
"creating index": "altering table",
|
"creating index": "altering table",
|
||||||
"committing alter table to storage engine": "altering table",
|
"committing alter table to storage engine": "altering table",
|
||||||
"discard or import tablespace": "altering table",
|
"discard or import tablespace": "altering table",
|
||||||
"rename": "altering table",
|
"rename": "altering table",
|
||||||
|
|
|
@ -776,10 +776,10 @@ func TestGatherHttpCachesMetrics(t *testing.T) {
|
||||||
t,
|
t,
|
||||||
"nginx_plus_api_http_caches",
|
"nginx_plus_api_http_caches",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"bypass_bytes": int64(5510647548),
|
"bypass_bytes": int64(5510647548),
|
||||||
"bypass_bytes_written": int64(44992),
|
"bypass_bytes_written": int64(44992),
|
||||||
"bypass_responses": int64(200187),
|
"bypass_responses": int64(200187),
|
||||||
"bypass_responses_written": int64(200173),
|
"bypass_responses_written": int64(200173),
|
||||||
"cold": false,
|
"cold": false,
|
||||||
"expired_bytes": int64(1656847080),
|
"expired_bytes": int64(1656847080),
|
||||||
"expired_bytes_written": int64(1641825173),
|
"expired_bytes_written": int64(1641825173),
|
||||||
|
@ -810,10 +810,10 @@ func TestGatherHttpCachesMetrics(t *testing.T) {
|
||||||
t,
|
t,
|
||||||
"nginx_plus_api_http_caches",
|
"nginx_plus_api_http_caches",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"bypass_bytes": int64(5510647548),
|
"bypass_bytes": int64(5510647548),
|
||||||
"bypass_bytes_written": int64(44992),
|
"bypass_bytes_written": int64(44992),
|
||||||
"bypass_responses": int64(200187),
|
"bypass_responses": int64(200187),
|
||||||
"bypass_responses_written": int64(200173),
|
"bypass_responses_written": int64(200173),
|
||||||
"cold": false,
|
"cold": false,
|
||||||
"expired_bytes": int64(1656847080),
|
"expired_bytes": int64(1656847080),
|
||||||
"expired_bytes_written": int64(1641825173),
|
"expired_bytes_written": int64(1641825173),
|
||||||
|
|
|
@ -41,7 +41,7 @@ func TestReadsMetricsFromNSQ(t *testing.T) {
|
||||||
Channel: "consume",
|
Channel: "consume",
|
||||||
MaxInFlight: 1,
|
MaxInFlight: 1,
|
||||||
MaxUndeliveredMessages: defaultMaxUndeliveredMessages,
|
MaxUndeliveredMessages: defaultMaxUndeliveredMessages,
|
||||||
Nsqd: []string{"127.0.0.1:4155"},
|
Nsqd: []string{"127.0.0.1:4155"},
|
||||||
}
|
}
|
||||||
|
|
||||||
p, _ := parsers.NewInfluxParser()
|
p, _ := parsers.NewInfluxParser()
|
||||||
|
|
|
@ -36,8 +36,8 @@ func newTestUdpListener() (*UdpListener, chan []byte) {
|
||||||
listener := &UdpListener{
|
listener := &UdpListener{
|
||||||
ServiceAddress: ":8125",
|
ServiceAddress: ":8125",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
in: in,
|
in: in,
|
||||||
done: make(chan struct{}),
|
done: make(chan struct{}),
|
||||||
}
|
}
|
||||||
return listener, in
|
return listener, in
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,9 +106,9 @@ func TestParseValidEmbeddedCounterJSON(t *testing.T) {
|
||||||
"count": float64(1),
|
"count": float64(1),
|
||||||
}, metrics[0].Fields())
|
}, metrics[0].Fields())
|
||||||
assert.Equal(t, map[string]string{
|
assert.Equal(t, map[string]string{
|
||||||
"metric_type": "counter",
|
"metric_type": "counter",
|
||||||
"tag1": "green",
|
"tag1": "green",
|
||||||
"tag2": "yellow",
|
"tag2": "yellow",
|
||||||
"tag3 space,comma=equals": "red ,=",
|
"tag3 space,comma=equals": "red ,=",
|
||||||
}, metrics[0].Tags())
|
}, metrics[0].Tags())
|
||||||
assert.True(t, metricTime.Equal(metrics[0].Time()), fmt.Sprintf("%s should be equal to %s", metrics[0].Time(), metricTime))
|
assert.True(t, metricTime.Equal(metrics[0].Time()), fmt.Sprintf("%s should be equal to %s", metrics[0].Time(), metricTime))
|
||||||
|
|
Loading…
Reference in New Issue