Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Commit 7db7436

Browse files
committed
chore(rfc5424): indentation and refinements of parser and builder
Signed-off-by: Leonardo Di Donato <[email protected]>
1 parent d997c3b commit 7db7436

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

rfc5424/builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9380,7 +9380,7 @@ func (sm *SyslogMessage) String() (string, error) {
93809380
if sm.StructuredData != nil {
93819381
// Sort element identifiers
93829382
identifiers := make([]string, 0)
9383-
for k, _ := range *sm.StructuredData {
9383+
for k := range *sm.StructuredData {
93849384
identifiers = append(identifiers, k)
93859385
}
93869386
sort.Strings(identifiers)
@@ -9392,7 +9392,7 @@ func (sm *SyslogMessage) String() (string, error) {
93929392
// Sort parameter names
93939393
params := (*sm.StructuredData)[id]
93949394
names := make([]string, 0)
9395-
for n, _ := range params {
9395+
for n := range params {
93969396
names = append(names, n)
93979397
}
93989398
sort.Strings(names)

rfc5424/machine.go.rl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,37 @@ var ColumnPositionTemplate = " [col %d]"
1313

1414
const (
1515
// ErrPrival represents an error in the priority value (PRIVAL) inside the PRI part of the RFC5424 syslog message.
16-
ErrPrival = "expecting a priority value in the range 1-191 or equal to 0"
16+
ErrPrival = "expecting a priority value in the range 1-191 or equal to 0"
1717
// ErrPri represents an error in the PRI part of the RFC5424 syslog message.
18-
ErrPri = "expecting a priority value within angle brackets"
18+
ErrPri = "expecting a priority value within angle brackets"
1919
// ErrVersion represents an error in the VERSION part of the RFC5424 syslog message.
20-
ErrVersion = "expecting a version value in the range 1-999"
20+
ErrVersion = "expecting a version value in the range 1-999"
2121
// ErrTimestamp represents an error in the TIMESTAMP part of the RFC5424 syslog message.
22-
ErrTimestamp = "expecting a RFC3339MICRO timestamp or a nil value"
22+
ErrTimestamp = "expecting a RFC3339MICRO timestamp or a nil value"
2323
// ErrHostname represents an error in the HOSTNAME part of the RFC5424 syslog message.
24-
ErrHostname = "expecting an hostname (from 1 to max 255 US-ASCII characters) or a nil value"
24+
ErrHostname = "expecting an hostname (from 1 to max 255 US-ASCII characters) or a nil value"
2525
// ErrAppname represents an error in the APP-NAME part of the RFC5424 syslog message.
26-
ErrAppname = "expecting an app-name (from 1 to max 48 US-ASCII characters) or a nil value"
26+
ErrAppname = "expecting an app-name (from 1 to max 48 US-ASCII characters) or a nil value"
2727
// ErrProcID represents an error in the PROCID part of the RFC5424 syslog message.
28-
ErrProcID = "expecting a procid (from 1 to max 128 US-ASCII characters) or a nil value"
28+
ErrProcID = "expecting a procid (from 1 to max 128 US-ASCII characters) or a nil value"
2929
// ErrMsgID represents an error in the MSGID part of the RFC5424 syslog message.
30-
ErrMsgID = "expecting a msgid (from 1 to max 32 US-ASCII characters) or a nil value"
30+
ErrMsgID = "expecting a msgid (from 1 to max 32 US-ASCII characters) or a nil value"
3131
// ErrStructuredData represents an error in the STRUCTURED DATA part of the RFC5424 syslog message.
32-
ErrStructuredData = "expecting a structured data section containing one or more elements (`[id( key=\"value\")*]+`) or a nil value"
32+
ErrStructuredData = "expecting a structured data section containing one or more elements (`[id( key=\"value\")*]+`) or a nil value"
3333
// ErrSdID represents an error regarding the ID of a STRUCTURED DATA element of the RFC5424 syslog message.
34-
ErrSdID = "expecting a structured data element id (from 1 to max 32 US-ASCII characters; except `=`, ` `, `]`, and `\"`"
34+
ErrSdID = "expecting a structured data element id (from 1 to max 32 US-ASCII characters; except `=`, ` `, `]`, and `\"`"
3535
// ErrSdIDDuplicated represents an error occurring when two STRUCTURED DATA elementes have the same ID in a RFC5424 syslog message.
36-
ErrSdIDDuplicated = "duplicate structured data element id"
36+
ErrSdIDDuplicated = "duplicate structured data element id"
3737
// ErrSdParam represents an error regarding a STRUCTURED DATA PARAM of the RFC5424 syslog message.
38-
ErrSdParam = "expecting a structured data parameter (`key=\"value\"`, both part from 1 to max 32 US-ASCII characters; key cannot contain `=`, ` `, `]`, and `\"`, while value cannot contain `]`, backslash, and `\"` unless escaped)"
38+
ErrSdParam = "expecting a structured data parameter (`key=\"value\"`, both part from 1 to max 32 US-ASCII characters; key cannot contain `=`, ` `, `]`, and `\"`, while value cannot contain `]`, backslash, and `\"` unless escaped)"
3939
// ErrMsg represents an error in the MESSAGE part of the RFC5424 syslog message.
40-
ErrMsg = "expecting a free-form optional message in UTF-8 (starting with or without BOM)"
40+
ErrMsg = "expecting a free-form optional message in UTF-8 (starting with or without BOM)"
4141
// ErrMsgNotCompliant represents an error in the MESSAGE part of the RFC5424 syslog message if WithCompliatMsg option is on.
42-
ErrMsgNotCompliant = ErrMsg + " or a free-form optional message in any encoding (starting without BOM)"
42+
ErrMsgNotCompliant = ErrMsg + " or a free-form optional message in any encoding (starting without BOM)"
4343
// ErrEscape represents the error for a RFC5424 syslog message occurring when a STRUCTURED DATA PARAM value contains '"', '\', or ']' not escaped.
44-
ErrEscape = "expecting chars `]`, `\"`, and `\\` to be escaped within param value"
44+
ErrEscape = "expecting chars `]`, `\"`, and `\\` to be escaped within param value"
4545
// ErrParse represents a general parsing error for a RFC5424 syslog message.
46-
ErrParse = "parsing error"
46+
ErrParse = "parsing error"
4747
)
4848

4949
// RFC3339MICRO represents the timestamp format that RFC5424 mandates.

0 commit comments

Comments
 (0)