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

Commit

Permalink
Upgrade major version to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored and leodido committed Nov 27, 2019
1 parent 8318965 commit 1193720
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For example:
## Installation

```
go get github.com/influxdata/go-syslog
go get github.com/influxdata/go-syslog/v2
```

## Docs
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/influxdata/go-syslog
module github.com/influxdata/go-syslog/v2

require (
github.com/davecgh/go-spew v1.1.1
Expand Down
2 changes: 1 addition & 1 deletion nontransparent/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"math/rand"
"strings"

"github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/v2"
"time"
)

Expand Down
4 changes: 2 additions & 2 deletions nontransparent/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package nontransparent
import (
"io"

syslog "github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/rfc5424"
syslog "github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/rfc5424"
parser "github.com/leodido/ragel-machinery/parser"
)

Expand Down
10 changes: 5 additions & 5 deletions nontransparent/parser.go.rl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package nontransparent

import (
"io"

parser "github.com/leodido/ragel-machinery/parser"
syslog "github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/rfc5424"
syslog "github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/rfc5424"
)

%%{
Expand All @@ -22,13 +22,13 @@ action on_init {
if len(m.candidate) > 0 {
m.process()
}
m.candidate = make([]byte, 0)
m.candidate = make([]byte, 0)
}

t = 10 when { m.trailertyp == LF } |
00 when { m.trailertyp == NUL };

main :=
main :=
start: (
'<' >on_init (any)* -> trailer
),
Expand Down
4 changes: 2 additions & 2 deletions nontransparent/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strings"
"testing"

"github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/rfc5424"
"github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/rfc5424"
"github.com/leodido/ragel-machinery"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion octetcounting/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/davecgh/go-spew/spew"
syslog "github.com/influxdata/go-syslog"
syslog "github.com/influxdata/go-syslog/v2"
)

func output(out interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions octetcounting/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"io"

syslog "github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/rfc5424"
syslog "github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/rfc5424"
)

// parser is capable to parse the input stream containing syslog messages with octetcounting framing.
Expand Down
6 changes: 3 additions & 3 deletions octetcounting/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"strings"
"testing"

"github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/rfc5424"
syslogtesting "github.com/influxdata/go-syslog/testing"
"github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/rfc5424"
syslogtesting "github.com/influxdata/go-syslog/v2/testing"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion rfc5424/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sort"
"time"

"github.com/influxdata/go-syslog/common"
"github.com/influxdata/go-syslog/v2/common"
)

const builder_start int = 59
Expand Down
8 changes: 4 additions & 4 deletions rfc5424/builder.go.rl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sort"
"fmt"

"github.com/influxdata/go-syslog/common"
"github.com/influxdata/go-syslog/v2/common"
)

%%{
Expand Down Expand Up @@ -51,7 +51,7 @@ action set_sdid {
if sm.structuredData == nil {
sm.structuredData = &(map[string]map[string]string{})
}

id := string(data[pb:p])
elements := *sm.structuredData
if _, ok := elements[id]; !ok {
Expand Down Expand Up @@ -226,7 +226,7 @@ func (sm *SyslogMessage) SetElementID(value string) *SyslogMessage {
func (sm *SyslogMessage) SetParameter(id string, name string, value string) *SyslogMessage {
// Create an element with the given id (or re-use the existing one)
sm.set(sdid, id)

// We can create parameter iff the given element id exists
if sm.structuredData != nil {
elements := *sm.structuredData
Expand All @@ -240,7 +240,7 @@ func (sm *SyslogMessage) SetParameter(id string, name string, value string) *Sys
}
}
}

return sm
}

Expand Down
2 changes: 1 addition & 1 deletion rfc5424/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions rfc5424/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"time"

"github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/common"
"github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/common"
)

// ColumnPositionTemplate is the template used to communicate the column where errors occur.
Expand Down
24 changes: 12 additions & 12 deletions rfc5424/machine.go.rl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package rfc5424
import (
"time"
"fmt"
"github.com/influxdata/go-syslog"
"github.com/influxdata/go-syslog/common"

"github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/common"
)

// ColumnPositionTemplate is the template used to communicate the column where errors occur.
Expand All @@ -24,23 +24,23 @@ const (
ErrHostname = "expecting an hostname (from 1 to max 255 US-ASCII characters) or a nil value"
// ErrAppname represents an error in the APP-NAME part of the RFC5424 syslog message.
ErrAppname = "expecting an app-name (from 1 to max 48 US-ASCII characters) or a nil value"
// ErrProcID represents an error in the PROCID part of the RFC5424 syslog message.
// ErrProcID represents an error in the PROCID part of the RFC5424 syslog message.
ErrProcID = "expecting a procid (from 1 to max 128 US-ASCII characters) or a nil value"
// ErrMsgID represents an error in the MSGID part of the RFC5424 syslog message.
// ErrMsgID represents an error in the MSGID part of the RFC5424 syslog message.
ErrMsgID = "expecting a msgid (from 1 to max 32 US-ASCII characters) or a nil value"
// ErrStructuredData represents an error in the STRUCTURED DATA part of the RFC5424 syslog message.
// ErrStructuredData represents an error in the STRUCTURED DATA part of the RFC5424 syslog message.
ErrStructuredData = "expecting a structured data section containing one or more elements (`[id( key=\"value\")*]+`) or a nil value"
// ErrSdID represents an error regarding the ID of a STRUCTURED DATA element of the RFC5424 syslog message.
// ErrSdID represents an error regarding the ID of a STRUCTURED DATA element of the RFC5424 syslog message.
ErrSdID = "expecting a structured data element id (from 1 to max 32 US-ASCII characters; except `=`, ` `, `]`, and `\"`"
// ErrSdIDDuplicated represents an error occurring when two STRUCTURED DATA elementes have the same ID in a RFC5424 syslog message.
// ErrSdIDDuplicated represents an error occurring when two STRUCTURED DATA elementes have the same ID in a RFC5424 syslog message.
ErrSdIDDuplicated = "duplicate structured data element id"
// ErrSdParam represents an error regarding a STRUCTURED DATA PARAM of the RFC5424 syslog message.
// ErrSdParam represents an error regarding a STRUCTURED DATA PARAM of the RFC5424 syslog message.
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)"
// ErrMsg represents an error in the MESSAGE part of the RFC5424 syslog message.
// ErrMsg represents an error in the MESSAGE part of the RFC5424 syslog message.
ErrMsg = "expecting a free-form optional message in UTF-8 (starting with or without BOM)"
// ErrEscape represents the error for a RFC5424 syslog message occurring when a STRUCTURED DATA PARAM value contains '"', '\', or ']' not escaped.
ErrEscape = "expecting chars `]`, `\"`, and `\\` to be escaped within param value"
// ErrParse represents a general parsing error for a RFC5424 syslog message.
// ErrParse represents a general parsing error for a RFC5424 syslog message.
ErrParse = "parsing error"
)

Expand Down Expand Up @@ -135,7 +135,7 @@ action set_paramvalue {

// Store text
text := m.text()

// Strip backslashes only when there are ...
if len(m.backslashat) > 0 {
text = common.RemoveBytes(text, m.backslashat, m.pb)
Expand Down
4 changes: 2 additions & 2 deletions rfc5424/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"math/rand"
"testing"

"github.com/influxdata/go-syslog"
syslogtesting "github.com/influxdata/go-syslog/testing"
"github.com/influxdata/go-syslog/v2"
syslogtesting "github.com/influxdata/go-syslog/v2/testing"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion rfc5424/options.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package rfc5424

import (
syslog "github.com/influxdata/go-syslog"
syslog "github.com/influxdata/go-syslog/v2"
)

// WithBestEffort enables the best effort mode.
Expand Down
2 changes: 1 addition & 1 deletion rfc5424/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package rfc5424
import (
"sync"

syslog "github.com/influxdata/go-syslog"
syslog "github.com/influxdata/go-syslog/v2"
)

// parser represent a RFC5424 parser with mutex capabilities.
Expand Down
4 changes: 2 additions & 2 deletions rfc5424/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package rfc5424
import (
"testing"

"github.com/influxdata/go-syslog"
syslogtesting "github.com/influxdata/go-syslog/testing"
"github.com/influxdata/go-syslog/v2"
syslogtesting "github.com/influxdata/go-syslog/v2/testing"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions rfc5424/performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package rfc5424
import (
"testing"

"github.com/influxdata/go-syslog"
syslogtesting "github.com/influxdata/go-syslog/testing"
"github.com/influxdata/go-syslog/v2"
syslogtesting "github.com/influxdata/go-syslog/v2/testing"
)

// This is here to avoid compiler optimizations that
Expand Down

0 comments on commit 1193720

Please sign in to comment.