-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I am not very happy with the formatting gofmt provides, but as there's the cult of gophers who seems to love this tool, it makes sense to try to avoid "why not gofmt!?" discussions and not distract existing go users with differing code style. Next step is obviously to write logstash-forwarder in !Go just to avoid formatting wars, right? ;)
- Loading branch information
1 parent
d2ba889
commit ae65de4
Showing
18 changed files
with
149 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
"encoding/json" | ||
"testing" | ||
) | ||
|
||
type FileConfig struct { | ||
Paths []string "json:paths" | ||
Paths []string "json:paths" | ||
Fields map[string]string "json:fields" | ||
} | ||
|
||
func TestJSONLoading(t *testing.T) { | ||
var f File | ||
err := json.Unmarshal([]byte("{ \"paths\": [ \"/var/log/fail2ban.log\" ], \"fields\": { \"type\": \"fail2ban\" } }"), &f) | ||
|
||
if err != nil { t.Fatalf("json.Unmarshal failed") } | ||
if len(f.Paths) != 1 { t.FailNow() } | ||
if f.Paths[0] != "/var/log/fail2ban.log" { t.FailNow() } | ||
if f.Fields["type"] != "fail2ban" { t.FailNow() } | ||
if err != nil { | ||
t.Fatalf("json.Unmarshal failed") | ||
} | ||
if len(f.Paths) != 1 { | ||
t.FailNow() | ||
} | ||
if f.Paths[0] != "/var/log/fail2ban.log" { | ||
t.FailNow() | ||
} | ||
if f.Fields["type"] != "fail2ban" { | ||
t.FailNow() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
package main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,3 @@ func is_file_renamed(file string, info os.FileInfo, fileinfo map[string]os.FileI | |
} | ||
return false | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.