New Upstream Release - golang-github-go-logfmt-logfmt

Ready changes

Summary

Merged new upstream version: 0.6.0 (was: 0.5.1).

Resulting package

Built on 2023-03-14T17:23 (took 2m3s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases golang-github-go-logfmt-logfmt-dev

Lintian Result

Diff

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..3ed1c0b
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,43 @@
+on:
+  push:
+  pull_request:
+  schedule:
+    - cron: "0 0 1,11,21 * *"
+name: "Build and Test"
+jobs:
+  test:
+    strategy:
+      fail-fast: false
+      matrix:
+        go-version:
+          - 1.16.x
+          - 1.17.x
+          - 1.18.x
+          - 1.19.x
+        os: [ubuntu-latest, macos-latest, windows-latest]
+    runs-on: ${{ matrix.os }}
+    steps:
+      - name: Install Go
+        uses: actions/setup-go@v3
+        with:
+          go-version: ${{ matrix.go-version }}
+      - name: Checkout code
+        uses: actions/checkout@v3
+      - name: Test
+        run: go test ./...
+      - name: Test coverage
+        run: go test -coverprofile="cover.out" ./... # quotes needed for powershell
+      - name: Send coverage
+        uses: shogo82148/actions-goveralls@v1
+        with:
+          path-to-profile: cover.out
+          flag-name: go${{ matrix.go-version }}-${{ matrix.os }}
+          parallel: true
+  # notifies that all test jobs are finished.
+  finish:
+    needs: test
+    runs-on: ubuntu-latest
+    steps:
+      - uses: shogo82148/actions-goveralls@v1
+        with:
+          parallel-finished: true
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 5139309..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: go
-sudo: false
-go:
-  - "1.7.x"
-  - "1.8.x"
-  - "1.9.x"
-  - "1.10.x"
-  - "1.11.x"
-  - "1.12.x"
-  - "1.13.x"
-  - "tip"
-
-before_install:
-  - go get github.com/mattn/goveralls
-  - go get golang.org/x/tools/cmd/cover
-
-script:
-  - goveralls -service=travis-ci
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a9a27b..8f349c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,48 +1,82 @@
 # Changelog
+
 All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [0.6.0] - 2023-01-30
+
+[0.6.0]: https://github.com/go-logfmt/logfmt/compare/v0.5.1...v0.6.0
+
+### Added
+
+- NewDecoderSize by [@alexanderjophus]
+
+## [0.5.1] - 2021-08-18
+
+[0.5.1]: https://github.com/go-logfmt/logfmt/compare/v0.5.0...v0.5.1
+
+### Changed
+
+- Update the `go.mod` file for Go 1.17 as described in the [Go 1.17 release
+  notes](https://golang.org/doc/go1.17#go-command)
+
 ## [0.5.0] - 2020-01-03
 
+[0.5.0]: https://github.com/go-logfmt/logfmt/compare/v0.4.0...v0.5.0
+
 ### Changed
+
 - Remove the dependency on github.com/kr/logfmt by [@ChrisHines]
 - Move fuzz code to github.com/go-logfmt/fuzzlogfmt by [@ChrisHines]
 
 ## [0.4.0] - 2018-11-21
 
+[0.4.0]: https://github.com/go-logfmt/logfmt/compare/v0.3.0...v0.4.0
+
 ### Added
+
 - Go module support by [@ChrisHines]
 - CHANGELOG by [@ChrisHines]
 
 ### Changed
+
 - Drop invalid runes from keys instead of returning ErrInvalidKey by [@ChrisHines]
 - On panic while printing, attempt to print panic value by [@bboreham]
 
 ## [0.3.0] - 2016-11-15
+
+[0.3.0]: https://github.com/go-logfmt/logfmt/compare/v0.2.0...v0.3.0
+
 ### Added
+
 - Pool buffers for quoted strings and byte slices by [@nussjustin]
+
 ### Fixed
+
 - Fuzz fix, quote invalid UTF-8 values by [@judwhite]
 
 ## [0.2.0] - 2016-05-08
+
+[0.2.0]: https://github.com/go-logfmt/logfmt/compare/v0.1.0...v0.2.0
+
 ### Added
+
 - Encoder.EncodeKeyvals by [@ChrisHines]
 
 ## [0.1.0] - 2016-03-28
+
+[0.1.0]: https://github.com/go-logfmt/logfmt/commits/v0.1.0
+
 ### Added
+
 - Encoder by [@ChrisHines]
 - Decoder by [@ChrisHines]
 - MarshalKeyvals by [@ChrisHines]
 
-[0.5.0]: https://github.com/go-logfmt/logfmt/compare/v0.4.0...v0.5.0
-[0.4.0]: https://github.com/go-logfmt/logfmt/compare/v0.3.0...v0.4.0
-[0.3.0]: https://github.com/go-logfmt/logfmt/compare/v0.2.0...v0.3.0
-[0.2.0]: https://github.com/go-logfmt/logfmt/compare/v0.1.0...v0.2.0
-[0.1.0]: https://github.com/go-logfmt/logfmt/commits/v0.1.0
-
 [@ChrisHines]: https://github.com/ChrisHines
 [@bboreham]: https://github.com/bboreham
 [@judwhite]: https://github.com/judwhite
 [@nussjustin]: https://github.com/nussjustin
+[@alexanderjophus]: https://github.com/alexanderjophus
diff --git a/README.md b/README.md
index 3a8f10b..71c5794 100644
--- a/README.md
+++ b/README.md
@@ -1,33 +1,41 @@
-[![GoDoc](https://godoc.org/github.com/go-logfmt/logfmt?status.svg)](https://godoc.org/github.com/go-logfmt/logfmt)
-[![Go Report Card](https://goreportcard.com/badge/go-logfmt/logfmt)](https://goreportcard.com/report/go-logfmt/logfmt)
-[![TravisCI](https://travis-ci.org/go-logfmt/logfmt.svg?branch=master)](https://travis-ci.org/go-logfmt/logfmt)
-[![Coverage Status](https://coveralls.io/repos/github/go-logfmt/logfmt/badge.svg?branch=master)](https://coveralls.io/github/go-logfmt/logfmt?branch=master)
-
-# logfmt
-
-Package logfmt implements utilities to marshal and unmarshal data in the [logfmt
-format](https://brandur.org/logfmt). It provides an API similar to
-[encoding/json](http://golang.org/pkg/encoding/json/) and
-[encoding/xml](http://golang.org/pkg/encoding/xml/).
-
-The logfmt format was first documented by Brandur Leach in [this
-article](https://brandur.org/logfmt). The format has not been formally
-standardized. The most authoritative public specification to date has been the
-documentation of a Go Language [package](http://godoc.org/github.com/kr/logfmt)
-written by Blake Mizerany and Keith Rarick.
-
-## Goals
-
-This project attempts to conform as closely as possible to the prior art, while
-also removing ambiguity where necessary to provide well behaved encoder and
-decoder implementations.
-
-## Non-goals
-
-This project does not attempt to formally standardize the logfmt format. In the
-event that logfmt is standardized this project would take conforming to the
-standard as a goal.
-
-## Versioning
-
-Package logfmt publishes releases via [semver](http://semver.org/) compatible Git tags prefixed with a single 'v'.
+# logfmt
+
+[![Go Reference](https://pkg.go.dev/badge/github.com/go-logfmt/logfmt.svg)](https://pkg.go.dev/github.com/go-logfmt/logfmt)
+[![Go Report Card](https://goreportcard.com/badge/go-logfmt/logfmt)](https://goreportcard.com/report/go-logfmt/logfmt)
+[![Github Actions](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml/badge.svg)](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml)
+[![Coverage Status](https://coveralls.io/repos/github/go-logfmt/logfmt/badge.svg?branch=master)](https://coveralls.io/github/go-logfmt/logfmt?branch=main)
+
+Package logfmt implements utilities to marshal and unmarshal data in the [logfmt
+format][fmt]. It provides an API similar to [encoding/json][json] and
+[encoding/xml][xml].
+
+[fmt]: https://brandur.org/logfmt
+[json]: https://pkg.go.dev/encoding/json
+[xml]: https://pkg.go.dev/encoding/xml
+
+The logfmt format was first documented by Brandur Leach in [this
+article][origin]. The format has not been formally standardized. The most
+authoritative public specification to date has been the documentation of a Go
+Language [package][parser] written by Blake Mizerany and Keith Rarick.
+
+[origin]: https://brandur.org/logfmt
+[parser]: https://pkg.go.dev/github.com/kr/logfmt
+
+## Goals
+
+This project attempts to conform as closely as possible to the prior art, while
+also removing ambiguity where necessary to provide well behaved encoder and
+decoder implementations.
+
+## Non-goals
+
+This project does not attempt to formally standardize the logfmt format. In the
+event that logfmt is standardized this project would take conforming to the
+standard as a goal.
+
+## Versioning
+
+This project publishes releases according to the Go language guidelines for
+[developing and publishing modules][pub].
+
+[pub]: https://go.dev/doc/modules/developing
diff --git a/debian/changelog b/debian/changelog
index cd97c06..cf57248 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+golang-github-go-logfmt-logfmt (0.6.0-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Tue, 14 Mar 2023 17:21:43 -0000
+
 golang-github-go-logfmt-logfmt (0.5.0-2) unstable; urgency=medium
 
   * Team upload.
diff --git a/decode.go b/decode.go
index 2013708..a1c22dc 100644
--- a/decode.go
+++ b/decode.go
@@ -29,6 +29,23 @@ func NewDecoder(r io.Reader) *Decoder {
 	return dec
 }
 
+// NewDecoderSize returns a new decoder that reads from r.
+//
+// The decoder introduces its own buffering and may read data from r beyond
+// the logfmt records requested.
+// The size argument specifies the size of the initial buffer that the
+// Decoder will use to read records from r.
+// If a log line is longer than the size argument, the Decoder will return
+// a bufio.ErrTooLong error.
+func NewDecoderSize(r io.Reader, size int) *Decoder {
+	scanner := bufio.NewScanner(r)
+	scanner.Buffer(make([]byte, 0, size), size)
+	dec := &Decoder{
+		s: scanner,
+	}
+	return dec
+}
+
 // ScanRecord advances the Decoder to the next record, which can then be
 // parsed with the ScanKeyval method. It returns false when decoding stops,
 // either by reaching the end of the input or an error. After ScanRecord
diff --git a/decode_test.go b/decode_test.go
index 363152d..9d85ec4 100644
--- a/decode_test.go
+++ b/decode_test.go
@@ -1,6 +1,7 @@
 package logfmt
 
 import (
+	"bufio"
 	"bytes"
 	"fmt"
 	"reflect"
@@ -17,21 +18,56 @@ func (s kv) String() string {
 }
 
 func TestDecoder_scan(t *testing.T) {
+	defaultDecoder := func(s string) *Decoder { return NewDecoder(strings.NewReader(s)) }
 	tests := []struct {
 		data string
+		dec  func(string) *Decoder
 		want [][]kv
 	}{
-		{"", nil},
-		{"\n\n", [][]kv{nil, nil}},
-		{`x= `, [][]kv{{{[]byte("x"), nil}}}},
-		{`y=`, [][]kv{{{[]byte("y"), nil}}}},
-		{`y`, [][]kv{{{[]byte("y"), nil}}}},
-		{`y=f`, [][]kv{{{[]byte("y"), []byte("f")}}}},
-		{"y=\"\\tf\"", [][]kv{{{[]byte("y"), []byte("\tf")}}}},
-		{"a=1\n", [][]kv{{{[]byte("a"), []byte("1")}}}},
-		{
-			`a=1 b="bar" ƒ=2h3s r="esc\t" d x=sf   `,
-			[][]kv{{
+		{
+			data: "",
+			dec:  defaultDecoder,
+			want: nil,
+		},
+		{
+			data: "\n\n",
+			dec:  defaultDecoder,
+			want: [][]kv{nil, nil},
+		},
+		{
+			data: `x= `,
+			dec:  defaultDecoder,
+			want: [][]kv{{{[]byte("x"), nil}}},
+		},
+		{
+			data: `y=`,
+			dec:  defaultDecoder,
+			want: [][]kv{{{[]byte("y"), nil}}},
+		},
+		{
+			data: `y`,
+			dec:  defaultDecoder,
+			want: [][]kv{{{[]byte("y"), nil}}},
+		},
+		{
+			data: `y=f`,
+			dec:  defaultDecoder,
+			want: [][]kv{{{[]byte("y"), []byte("f")}}},
+		},
+		{
+			data: "y=\"\\tf\"",
+			dec:  defaultDecoder,
+			want: [][]kv{{{[]byte("y"), []byte("\tf")}}},
+		},
+		{
+			data: "a=1\n",
+			dec:  defaultDecoder,
+			want: [][]kv{{{[]byte("a"), []byte("1")}}},
+		},
+		{
+			data: `a=1 b="bar" ƒ=2h3s r="esc\t" d x=sf   `,
+			dec:  defaultDecoder,
+			want: [][]kv{{
 				{[]byte("a"), []byte("1")},
 				{[]byte("b"), []byte("bar")},
 				{[]byte("ƒ"), []byte("2h3s")},
@@ -41,46 +77,62 @@ func TestDecoder_scan(t *testing.T) {
 			}},
 		},
 		{
-			"y=f\ny=g",
-			[][]kv{
+			data: "y=f\ny=g",
+			dec:  defaultDecoder,
+			want: [][]kv{
 				{{[]byte("y"), []byte("f")}},
 				{{[]byte("y"), []byte("g")}},
 			},
 		},
 		{
-			"y=f  \n\x1e y=g",
-			[][]kv{
+			data: "y=f  \n\x1e y=g",
+			dec:  defaultDecoder,
+			want: [][]kv{
 				{{[]byte("y"), []byte("f")}},
 				{{[]byte("y"), []byte("g")}},
 			},
 		},
 		{
-			"y= d y=g",
-			[][]kv{{
+			data: "y= d y=g",
+			dec:  defaultDecoder,
+			want: [][]kv{{
 				{[]byte("y"), nil},
 				{[]byte("d"), nil},
 				{[]byte("y"), []byte("g")},
 			}},
 		},
 		{
-			"y=\"f\"\ny=g",
-			[][]kv{
+			data: "y=\"f\"\ny=g",
+			dec:  defaultDecoder,
+			want: [][]kv{
 				{{[]byte("y"), []byte("f")}},
 				{{[]byte("y"), []byte("g")}},
 			},
 		},
 		{
-			"y=\"f\\n\"y=g",
-			[][]kv{{
+			data: "y=\"f\\n\"y=g",
+			dec:  defaultDecoder,
+			want: [][]kv{{
 				{[]byte("y"), []byte("f\n")},
 				{[]byte("y"), []byte("g")},
 			}},
 		},
+		{
+			data: strings.Repeat(`y=f `, 5),
+			dec:  func(s string) *Decoder { return NewDecoderSize(strings.NewReader(s), 21) },
+			want: [][]kv{{
+				{[]byte("y"), []byte("f")},
+				{[]byte("y"), []byte("f")},
+				{[]byte("y"), []byte("f")},
+				{[]byte("y"), []byte("f")},
+				{[]byte("y"), []byte("f")},
+			}},
+		},
 	}
 
 	for _, test := range tests {
 		var got [][]kv
-		dec := NewDecoder(strings.NewReader(test.data))
+		dec := test.dec(test.data)
 
 		for dec.ScanRecord() {
 			var kvs []kv
@@ -103,28 +155,94 @@ func TestDecoder_scan(t *testing.T) {
 }
 
 func TestDecoder_errors(t *testing.T) {
+	defaultDecoder := func(s string) *Decoder { return NewDecoder(strings.NewReader(s)) }
 	tests := []struct {
 		data string
+		dec  func(string) *Decoder
 		want error
 	}{
-		{"a=1\n=bar", &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 1}},
-		{"a=1\n\"k\"=bar", &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 1}},
-		{"a=1\nk\"ey=bar", &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 2}},
-		{"a=1\nk=b\"ar", &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 4}},
-		{"a=1\nk=b =ar", &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 5}},
-		{"a==", &SyntaxError{Msg: "unexpected '='", Line: 1, Pos: 3}},
-		{"a=1\nk=b=ar", &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 4}},
-		{"a=\"1", &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 5}},
-		{"a=\"1\\", &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 6}},
-		{"a=\"\\t1", &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 7}},
-		{"a=\"\\u1\"", &SyntaxError{Msg: "invalid quoted value", Line: 1, Pos: 8}},
-		{"a\ufffd=bar", &SyntaxError{Msg: "invalid key", Line: 1, Pos: 5}},
-		{"\x80=bar", &SyntaxError{Msg: "invalid key", Line: 1, Pos: 2}},
-		{"\x80", &SyntaxError{Msg: "invalid key", Line: 1, Pos: 2}},
+		{
+			data: "a=1\n=bar",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 1},
+		},
+		{
+			data: "a=1\n\"k\"=bar",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 1},
+		},
+		{
+			data: "a=1\nk\"ey=bar",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 2},
+		},
+		{
+			data: "a=1\nk=b\"ar",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unexpected '\"'", Line: 2, Pos: 4},
+		},
+		{
+			data: "a=1\nk=b =ar",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 5},
+		},
+		{
+			data: "a==",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unexpected '='", Line: 1, Pos: 3},
+		},
+		{
+			data: "a=1\nk=b=ar",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unexpected '='", Line: 2, Pos: 4},
+		},
+		{
+			data: "a=\"1",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 5},
+		},
+		{
+			data: "a=\"1\\",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 6},
+		},
+		{
+			data: "a=\"\\t1",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "unterminated quoted value", Line: 1, Pos: 7},
+		},
+		{
+			data: "a=\"\\u1\"",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "invalid quoted value", Line: 1, Pos: 8},
+		},
+		{
+			data: "a\ufffd=bar",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "invalid key", Line: 1, Pos: 5},
+		},
+		{
+			data: "\x80=bar",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "invalid key", Line: 1, Pos: 2},
+		},
+		{
+			data: "\x80",
+			dec:  defaultDecoder,
+			want: &SyntaxError{Msg: "invalid key", Line: 1, Pos: 2},
+		},
+		{
+			data: "a=1\nb=2",
+			dec: func(s string) *Decoder {
+				dec := NewDecoderSize(strings.NewReader(s), 1)
+				return dec
+			},
+			want: bufio.ErrTooLong,
+		},
 	}
 
 	for _, test := range tests {
-		dec := NewDecoder(strings.NewReader(test.data))
+		dec := test.dec(test.data)
 
 		for dec.ScanRecord() {
 			for dec.ScanKeyval() {
diff --git a/go.mod b/go.mod
index df71929..c6fe10b 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,3 @@
 module github.com/go-logfmt/logfmt
 
-go 1.13
+go 1.17

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details