Enable gofmt code simplification (#4887)

This commit is contained in:
Trevor Pounds
2018-10-19 16:32:54 -04:00
committed by Daniel Nelson
parent 4a311830c6
commit ee056278f5
59 changed files with 599 additions and 599 deletions

View File

@@ -53,7 +53,7 @@ func TestFieldConversions(t *testing.T) {
name: "Should change existing field to lowercase",
plugin: &Strings{
Lowercase: []converter{
converter{
{
Field: "request",
},
},
@@ -68,7 +68,7 @@ func TestFieldConversions(t *testing.T) {
name: "Should change existing field to uppercase",
plugin: &Strings{
Uppercase: []converter{
converter{
{
Field: "request",
},
},
@@ -83,7 +83,7 @@ func TestFieldConversions(t *testing.T) {
name: "Should add new lowercase field",
plugin: &Strings{
Lowercase: []converter{
converter{
{
Field: "request",
Dest: "lowercase_request",
},
@@ -103,7 +103,7 @@ func TestFieldConversions(t *testing.T) {
name: "Should trim from both sides",
plugin: &Strings{
Trim: []converter{
converter{
{
Field: "request",
Cutset: "/w",
},
@@ -119,13 +119,13 @@ func TestFieldConversions(t *testing.T) {
name: "Should trim from both sides and make lowercase",
plugin: &Strings{
Trim: []converter{
converter{
{
Field: "request",
Cutset: "/w",
},
},
Lowercase: []converter{
converter{
{
Field: "request",
},
},
@@ -140,7 +140,7 @@ func TestFieldConversions(t *testing.T) {
name: "Should trim from left side",
plugin: &Strings{
TrimLeft: []converter{
converter{
{
Field: "request",
Cutset: "/w",
},
@@ -156,7 +156,7 @@ func TestFieldConversions(t *testing.T) {
name: "Should trim from right side",
plugin: &Strings{
TrimRight: []converter{
converter{
{
Field: "request",
Cutset: "/w",
},
@@ -172,7 +172,7 @@ func TestFieldConversions(t *testing.T) {
name: "Should trim prefix '/mixed'",
plugin: &Strings{
TrimPrefix: []converter{
converter{
{
Field: "request",
Prefix: "/mixed",
},
@@ -188,7 +188,7 @@ func TestFieldConversions(t *testing.T) {
name: "Should trim suffix '-1D&to=now'",
plugin: &Strings{
TrimSuffix: []converter{
converter{
{
Field: "request",
Suffix: "-1D&to=now",
},
@@ -204,7 +204,7 @@ func TestFieldConversions(t *testing.T) {
name: "Trim without cutset removes whitespace",
plugin: &Strings{
Trim: []converter{
converter{
{
Field: "whitespace",
},
},
@@ -219,7 +219,7 @@ func TestFieldConversions(t *testing.T) {
name: "Trim left without cutset removes whitespace",
plugin: &Strings{
TrimLeft: []converter{
converter{
{
Field: "whitespace",
},
},
@@ -234,7 +234,7 @@ func TestFieldConversions(t *testing.T) {
name: "Trim right without cutset removes whitespace",
plugin: &Strings{
TrimRight: []converter{
converter{
{
Field: "whitespace",
},
},
@@ -249,7 +249,7 @@ func TestFieldConversions(t *testing.T) {
name: "No change if field missing",
plugin: &Strings{
Lowercase: []converter{
converter{
{
Field: "xyzzy",
Suffix: "-1D&to=now",
},
@@ -281,7 +281,7 @@ func TestTagConversions(t *testing.T) {
name: "Should change existing tag to lowercase",
plugin: &Strings{
Lowercase: []converter{
converter{
{
Tag: "s-computername",
},
},
@@ -300,7 +300,7 @@ func TestTagConversions(t *testing.T) {
name: "Should add new lowercase tag",
plugin: &Strings{
Lowercase: []converter{
converter{
{
Tag: "s-computername",
Dest: "s-computername_lowercase",
},
@@ -324,7 +324,7 @@ func TestTagConversions(t *testing.T) {
name: "Should add new uppercase tag",
plugin: &Strings{
Uppercase: []converter{
converter{
{
Tag: "s-computername",
Dest: "s-computername_uppercase",
},
@@ -365,7 +365,7 @@ func TestMeasurementConversions(t *testing.T) {
name: "lowercase measurement",
plugin: &Strings{
Lowercase: []converter{
converter{
{
Measurement: "IIS_log",
},
},
@@ -388,19 +388,19 @@ func TestMeasurementConversions(t *testing.T) {
func TestMultipleConversions(t *testing.T) {
plugin := &Strings{
Lowercase: []converter{
converter{
{
Tag: "s-computername",
},
converter{
{
Field: "request",
},
converter{
{
Field: "cs-host",
Dest: "cs-host_lowercase",
},
},
Uppercase: []converter{
converter{
{
Tag: "verb",
},
},
@@ -428,18 +428,18 @@ func TestMultipleConversions(t *testing.T) {
func TestReadmeExample(t *testing.T) {
plugin := &Strings{
Lowercase: []converter{
converter{
{
Tag: "uri_stem",
},
},
TrimPrefix: []converter{
converter{
{
Tag: "uri_stem",
Prefix: "/api/",
},
},
Uppercase: []converter{
converter{
{
Field: "cs-host",
Dest: "cs-host_normalised",
},
@@ -492,7 +492,7 @@ func newMetric(name string) telegraf.Metric {
func TestMeasurementReplace(t *testing.T) {
plugin := &Strings{
Replace: []converter{
converter{
{
Old: "_",
New: "-",
Measurement: "*",
@@ -513,7 +513,7 @@ func TestMeasurementReplace(t *testing.T) {
func TestMeasurementCharDeletion(t *testing.T) {
plugin := &Strings{
Replace: []converter{
converter{
{
Old: "foo",
New: "",
Measurement: "*",