This commit is contained in:
parent
8b3e22ba50
commit
b8befed108
8
go.mod
8
go.mod
@ -3,12 +3,12 @@ module git.paulbsd.com/paulbsd/fuelprices
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/antchfx/xmlquery v1.3.10
|
github.com/antchfx/xmlquery v1.3.11
|
||||||
github.com/antchfx/xpath v1.2.0 // indirect
|
github.com/antchfx/xpath v1.2.1 // indirect
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
||||||
golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect
|
golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/text v0.3.7 // indirect
|
||||||
gopkg.in/ini.v1 v1.66.4
|
gopkg.in/ini.v1 v1.66.6
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
8
go.sum
8
go.sum
@ -2,8 +2,12 @@ github.com/antchfx/xmlquery v1.3.8 h1:dRnBQM3Vk5BVJFvFwsHOLAox+mEiNw5ZusaUNCrEdo
|
|||||||
github.com/antchfx/xmlquery v1.3.8/go.mod h1:wojC/BxjEkjJt6dPiAqUzoXO5nIMWtxHS8PD8TmN4ks=
|
github.com/antchfx/xmlquery v1.3.8/go.mod h1:wojC/BxjEkjJt6dPiAqUzoXO5nIMWtxHS8PD8TmN4ks=
|
||||||
github.com/antchfx/xmlquery v1.3.10 h1:U2yMwr8U0KmGM2iDG2Ky/3LfxNsiK4uw1bSBkeMO9+g=
|
github.com/antchfx/xmlquery v1.3.10 h1:U2yMwr8U0KmGM2iDG2Ky/3LfxNsiK4uw1bSBkeMO9+g=
|
||||||
github.com/antchfx/xmlquery v1.3.10/go.mod h1:wojC/BxjEkjJt6dPiAqUzoXO5nIMWtxHS8PD8TmN4ks=
|
github.com/antchfx/xmlquery v1.3.10/go.mod h1:wojC/BxjEkjJt6dPiAqUzoXO5nIMWtxHS8PD8TmN4ks=
|
||||||
|
github.com/antchfx/xmlquery v1.3.11 h1:8aRK7l3+dJjL8ZmwgVzG5AXysrP7Mss2424tfntKWKY=
|
||||||
|
github.com/antchfx/xmlquery v1.3.11/go.mod h1:ywPcYkN0GvURUxXpUujaMVvuLSOYQBzoSfHKfAYezCE=
|
||||||
github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8=
|
github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8=
|
||||||
github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
||||||
|
github.com/antchfx/xpath v1.2.1 h1:qhp4EW6aCOVr5XIkT+l6LJ9ck/JsUH/yyauNgTQkBF8=
|
||||||
|
github.com/antchfx/xpath v1.2.1/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -27,6 +31,8 @@ golang.org/x/net v0.0.0-20211203184738-4852103109b8 h1:PFkPt/jI9Del3hmFplBtRp8tD
|
|||||||
golang.org/x/net v0.0.0-20211203184738-4852103109b8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211203184738-4852103109b8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc=
|
golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc=
|
||||||
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
|
golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6flUMtzCwzlvkxEQtHHB0=
|
||||||
|
golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@ -43,6 +49,8 @@ gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
|
|||||||
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
|
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
|
||||||
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
|
gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI=
|
||||||
|
gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
13
vendor/github.com/antchfx/xpath/README.md
generated
vendored
13
vendor/github.com/antchfx/xpath/README.md
generated
vendored
@ -57,6 +57,7 @@ Supported Features
|
|||||||
|
|
||||||
- `(a, b, c)` : Evaluates each of its operands and concatenates the resulting sequences, in order, into a single result sequence
|
- `(a, b, c)` : Evaluates each of its operands and concatenates the resulting sequences, in order, into a single result sequence
|
||||||
|
|
||||||
|
- `(a/b)` : Selects all matches nodes as grouping set.
|
||||||
|
|
||||||
#### Node Axes
|
#### Node Axes
|
||||||
|
|
||||||
@ -159,15 +160,3 @@ Supported Features
|
|||||||
`translate()`| ✓ |
|
`translate()`| ✓ |
|
||||||
`true()`| ✓ |
|
`true()`| ✓ |
|
||||||
`unparsed-entity-url()` | ✗ |
|
`unparsed-entity-url()` | ✗ |
|
||||||
|
|
||||||
Changelogs
|
|
||||||
===
|
|
||||||
|
|
||||||
2019-03-19
|
|
||||||
- optimize XPath `|` operation performance. [#33](https://github.com/antchfx/xpath/issues/33). Tips: suggest split into multiple subquery if you have a lot of `|` operations.
|
|
||||||
|
|
||||||
2019-01-29
|
|
||||||
- improvement `normalize-space` function. [#32](https://github.com/antchfx/xpath/issues/32)
|
|
||||||
|
|
||||||
2018-12-07
|
|
||||||
- supports XPath 2.0 Sequence expressions. [#30](https://github.com/antchfx/xpath/pull/30) by [@minherz](https://github.com/minherz).
|
|
2
vendor/github.com/antchfx/xpath/build.go
generated
vendored
2
vendor/github.com/antchfx/xpath/build.go
generated
vendored
@ -42,7 +42,7 @@ func axisPredicate(root *axisNode) func(NodeNavigator) bool {
|
|||||||
}
|
}
|
||||||
nametest := root.LocalName != "" || root.Prefix != ""
|
nametest := root.LocalName != "" || root.Prefix != ""
|
||||||
predicate := func(n NodeNavigator) bool {
|
predicate := func(n NodeNavigator) bool {
|
||||||
if typ == n.NodeType() || typ == allNode || typ == TextNode {
|
if typ == n.NodeType() || typ == allNode {
|
||||||
if nametest {
|
if nametest {
|
||||||
if root.LocalName == n.LocalName() && root.Prefix == n.Prefix() {
|
if root.LocalName == n.LocalName() && root.Prefix == n.Prefix() {
|
||||||
return true
|
return true
|
||||||
|
10
vendor/github.com/antchfx/xpath/func.go
generated
vendored
10
vendor/github.com/antchfx/xpath/func.go
generated
vendored
@ -122,17 +122,19 @@ func asNumber(t iterator, o interface{}) float64 {
|
|||||||
return typ
|
return typ
|
||||||
case string:
|
case string:
|
||||||
v, err := strconv.ParseFloat(typ, 64)
|
v, err := strconv.ParseFloat(typ, 64)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
panic(errors.New("ceiling() function argument type must be a node-set or number"))
|
return v
|
||||||
}
|
}
|
||||||
return v
|
|
||||||
}
|
}
|
||||||
return 0
|
return math.NaN()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ceilingFunc is a XPath Node Set functions ceiling(node-set).
|
// ceilingFunc is a XPath Node Set functions ceiling(node-set).
|
||||||
func ceilingFunc(q query, t iterator) interface{} {
|
func ceilingFunc(q query, t iterator) interface{} {
|
||||||
val := asNumber(t, functionArgs(q).Evaluate(t))
|
val := asNumber(t, functionArgs(q).Evaluate(t))
|
||||||
|
// if math.IsNaN(val) {
|
||||||
|
// panic(errors.New("ceiling() function argument type must be a valid number"))
|
||||||
|
// }
|
||||||
return math.Ceil(val)
|
return math.Ceil(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
vendor/github.com/antchfx/xpath/func_go110.go
generated
vendored
2
vendor/github.com/antchfx/xpath/func_go110.go
generated
vendored
@ -11,6 +11,6 @@ func round(f float64) int {
|
|||||||
return int(math.Round(f))
|
return int(math.Round(f))
|
||||||
}
|
}
|
||||||
|
|
||||||
func newStringBuilder() stringBuilder{
|
func newStringBuilder() stringBuilder {
|
||||||
return &strings.Builder{}
|
return &strings.Builder{}
|
||||||
}
|
}
|
||||||
|
29
vendor/github.com/antchfx/xpath/operator.go
generated
vendored
29
vendor/github.com/antchfx/xpath/operator.go
generated
vendored
@ -165,15 +165,28 @@ func cmpNodeSetString(t iterator, op string, m, n interface{}) bool {
|
|||||||
func cmpNodeSetNodeSet(t iterator, op string, m, n interface{}) bool {
|
func cmpNodeSetNodeSet(t iterator, op string, m, n interface{}) bool {
|
||||||
a := m.(query)
|
a := m.(query)
|
||||||
b := n.(query)
|
b := n.(query)
|
||||||
x := a.Select(t)
|
for {
|
||||||
if x == nil {
|
x := a.Select(t)
|
||||||
return false
|
if x == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
y := b.Select(t)
|
||||||
|
if y == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
if cmpStringStringF(op, x.Value(), y.Value()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if y = b.Select(t); y == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// reset
|
||||||
|
b.Evaluate(t)
|
||||||
}
|
}
|
||||||
y := b.Select(t)
|
|
||||||
if y == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return cmpStringStringF(op, x.Value(), y.Value())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmpStringNumeric(t iterator, op string, m, n interface{}) bool {
|
func cmpStringNumeric(t iterator, op string, m, n interface{}) bool {
|
||||||
|
4
vendor/github.com/antchfx/xpath/query.go
generated
vendored
4
vendor/github.com/antchfx/xpath/query.go
generated
vendored
@ -820,6 +820,8 @@ func (b *booleanQuery) Select(t iterator) NodeNavigator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *booleanQuery) Evaluate(t iterator) interface{} {
|
func (b *booleanQuery) Evaluate(t iterator) interface{} {
|
||||||
|
n := t.Current().Copy()
|
||||||
|
|
||||||
m := b.Left.Evaluate(t)
|
m := b.Left.Evaluate(t)
|
||||||
left := asBool(t, m)
|
left := asBool(t, m)
|
||||||
if b.IsOr && left {
|
if b.IsOr && left {
|
||||||
@ -827,6 +829,8 @@ func (b *booleanQuery) Evaluate(t iterator) interface{} {
|
|||||||
} else if !b.IsOr && !left {
|
} else if !b.IsOr && !left {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Current().MoveTo(n)
|
||||||
m = b.Right.Evaluate(t)
|
m = b.Right.Evaluate(t)
|
||||||
return asBool(t, m)
|
return asBool(t, m)
|
||||||
}
|
}
|
||||||
|
6
vendor/gopkg.in/ini.v1/.golangci.yml
generated
vendored
6
vendor/gopkg.in/ini.v1/.golangci.yml
generated
vendored
@ -1,4 +1,9 @@
|
|||||||
linters-settings:
|
linters-settings:
|
||||||
|
staticcheck:
|
||||||
|
checks: [
|
||||||
|
"all",
|
||||||
|
"-SA1019" # There are valid use cases of strings.Title
|
||||||
|
]
|
||||||
nakedret:
|
nakedret:
|
||||||
max-func-lines: 0 # Disallow any unnamed return statement
|
max-func-lines: 0 # Disallow any unnamed return statement
|
||||||
|
|
||||||
@ -19,3 +24,4 @@ linters:
|
|||||||
- rowserrcheck
|
- rowserrcheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- goimports
|
- goimports
|
||||||
|
- unparam
|
||||||
|
4
vendor/gopkg.in/ini.v1/README.md
generated
vendored
4
vendor/gopkg.in/ini.v1/README.md
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
# INI
|
# INI
|
||||||
|
|
||||||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/go-ini/ini/Go?logo=github&style=for-the-badge)](https://github.com/go-ini/ini/actions?query=workflow%3AGo)
|
[![GitHub Workflow Status](https://img.shields.io/github/checks-status/go-ini/ini/main?logo=github&style=for-the-badge)](https://github.com/go-ini/ini/actions?query=branch%3Amain)
|
||||||
[![codecov](https://img.shields.io/codecov/c/github/go-ini/ini/master?logo=codecov&style=for-the-badge)](https://codecov.io/gh/go-ini/ini)
|
[![codecov](https://img.shields.io/codecov/c/github/go-ini/ini/master?logo=codecov&style=for-the-badge)](https://codecov.io/gh/go-ini/ini)
|
||||||
[![GoDoc](https://img.shields.io/badge/GoDoc-Reference-blue?style=for-the-badge&logo=go)](https://pkg.go.dev/github.com/go-ini/ini?tab=doc)
|
[![GoDoc](https://img.shields.io/badge/GoDoc-Reference-blue?style=for-the-badge&logo=go)](https://pkg.go.dev/github.com/go-ini/ini?tab=doc)
|
||||||
[![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?style=for-the-badge&logo=sourcegraph)](https://sourcegraph.com/github.com/go-ini/ini)
|
[![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?style=for-the-badge&logo=sourcegraph)](https://sourcegraph.com/github.com/go-ini/ini)
|
||||||
@ -24,7 +24,7 @@ Package ini provides INI file read and write functionality in Go.
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
The minimum requirement of Go is **1.12**.
|
The minimum requirement of Go is **1.13**.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ go get gopkg.in/ini.v1
|
$ go get gopkg.in/ini.v1
|
||||||
|
7
vendor/gopkg.in/ini.v1/codecov.yml
generated
vendored
7
vendor/gopkg.in/ini.v1/codecov.yml
generated
vendored
@ -4,6 +4,13 @@ coverage:
|
|||||||
project:
|
project:
|
||||||
default:
|
default:
|
||||||
threshold: 1%
|
threshold: 1%
|
||||||
|
informational: true
|
||||||
|
patch:
|
||||||
|
defualt:
|
||||||
|
only_pulls: true
|
||||||
|
informational: true
|
||||||
|
|
||||||
comment:
|
comment:
|
||||||
layout: 'diff'
|
layout: 'diff'
|
||||||
|
|
||||||
|
github_checks: false
|
||||||
|
15
vendor/gopkg.in/ini.v1/error.go
generated
vendored
15
vendor/gopkg.in/ini.v1/error.go
generated
vendored
@ -32,3 +32,18 @@ func IsErrDelimiterNotFound(err error) bool {
|
|||||||
func (err ErrDelimiterNotFound) Error() string {
|
func (err ErrDelimiterNotFound) Error() string {
|
||||||
return fmt.Sprintf("key-value delimiter not found: %s", err.Line)
|
return fmt.Sprintf("key-value delimiter not found: %s", err.Line)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ErrEmptyKeyName indicates the error type of no key name is found which there should be one.
|
||||||
|
type ErrEmptyKeyName struct {
|
||||||
|
Line string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsErrEmptyKeyName returns true if the given error is an instance of ErrEmptyKeyName.
|
||||||
|
func IsErrEmptyKeyName(err error) bool {
|
||||||
|
_, ok := err.(ErrEmptyKeyName)
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
func (err ErrEmptyKeyName) Error() string {
|
||||||
|
return fmt.Sprintf("empty key name: %s", err.Line)
|
||||||
|
}
|
||||||
|
10
vendor/gopkg.in/ini.v1/file.go
generated
vendored
10
vendor/gopkg.in/ini.v1/file.go
generated
vendored
@ -342,6 +342,7 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
|||||||
|
|
||||||
// Use buffer to make sure target is safe until finish encoding.
|
// Use buffer to make sure target is safe until finish encoding.
|
||||||
buf := bytes.NewBuffer(nil)
|
buf := bytes.NewBuffer(nil)
|
||||||
|
lastSectionIdx := len(f.sectionList) - 1
|
||||||
for i, sname := range f.sectionList {
|
for i, sname := range f.sectionList {
|
||||||
sec := f.SectionWithIndex(sname, f.sectionIndexes[i])
|
sec := f.SectionWithIndex(sname, f.sectionIndexes[i])
|
||||||
if len(sec.Comment) > 0 {
|
if len(sec.Comment) > 0 {
|
||||||
@ -371,12 +372,13 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isLastSection := i == lastSectionIdx
|
||||||
if sec.isRawSection {
|
if sec.isRawSection {
|
||||||
if _, err := buf.WriteString(sec.rawBody); err != nil {
|
if _, err := buf.WriteString(sec.rawBody); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if PrettySection {
|
if PrettySection && !isLastSection {
|
||||||
// Put a line between sections
|
// Put a line between sections
|
||||||
if _, err := buf.WriteString(LineBreak); err != nil {
|
if _, err := buf.WriteString(LineBreak); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -448,9 +450,7 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if key.isBooleanType {
|
if key.isBooleanType {
|
||||||
if kname != sec.keyList[len(sec.keyList)-1] {
|
buf.WriteString(LineBreak)
|
||||||
buf.WriteString(LineBreak)
|
|
||||||
}
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if PrettySection {
|
if PrettySection && !isLastSection {
|
||||||
// Put a line between sections
|
// Put a line between sections
|
||||||
if _, err := buf.WriteString(LineBreak); err != nil {
|
if _, err := buf.WriteString(LineBreak); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
9
vendor/gopkg.in/ini.v1/parser.go
generated
vendored
9
vendor/gopkg.in/ini.v1/parser.go
generated
vendored
@ -164,6 +164,10 @@ func readKeyName(delimiters string, in []byte) (string, int, error) {
|
|||||||
if endIdx < 0 {
|
if endIdx < 0 {
|
||||||
return "", -1, ErrDelimiterNotFound{line}
|
return "", -1, ErrDelimiterNotFound{line}
|
||||||
}
|
}
|
||||||
|
if endIdx == 0 {
|
||||||
|
return "", -1, ErrEmptyKeyName{line}
|
||||||
|
}
|
||||||
|
|
||||||
return strings.TrimSpace(line[0:endIdx]), endIdx + 1, nil
|
return strings.TrimSpace(line[0:endIdx]), endIdx + 1, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,8 +467,9 @@ func (f *File) parse(reader io.Reader) (err error) {
|
|||||||
|
|
||||||
kname, offset, err := readKeyName(f.options.KeyValueDelimiters, line)
|
kname, offset, err := readKeyName(f.options.KeyValueDelimiters, line)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
switch {
|
||||||
// Treat as boolean key when desired, and whole line is key name.
|
// Treat as boolean key when desired, and whole line is key name.
|
||||||
if IsErrDelimiterNotFound(err) {
|
case IsErrDelimiterNotFound(err):
|
||||||
switch {
|
switch {
|
||||||
case f.options.AllowBooleanKeys:
|
case f.options.AllowBooleanKeys:
|
||||||
kname, err := p.readValue(line, parserBufferSize)
|
kname, err := p.readValue(line, parserBufferSize)
|
||||||
@ -482,6 +487,8 @@ func (f *File) parse(reader io.Reader) (err error) {
|
|||||||
case f.options.SkipUnrecognizableLines:
|
case f.options.SkipUnrecognizableLines:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
case IsErrEmptyKeyName(err) && f.options.SkipUnrecognizableLines:
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
8
vendor/modules.txt
vendored
8
vendor/modules.txt
vendored
@ -1,7 +1,7 @@
|
|||||||
# github.com/antchfx/xmlquery v1.3.10
|
# github.com/antchfx/xmlquery v1.3.11
|
||||||
## explicit; go 1.14
|
## explicit; go 1.14
|
||||||
github.com/antchfx/xmlquery
|
github.com/antchfx/xmlquery
|
||||||
# github.com/antchfx/xpath v1.2.0
|
# github.com/antchfx/xpath v1.2.1
|
||||||
## explicit; go 1.14
|
## explicit; go 1.14
|
||||||
github.com/antchfx/xpath
|
github.com/antchfx/xpath
|
||||||
# github.com/davecgh/go-spew v1.1.1
|
# github.com/davecgh/go-spew v1.1.1
|
||||||
@ -16,7 +16,7 @@ github.com/influxdata/influxdb1-client/pkg/escape
|
|||||||
github.com/influxdata/influxdb1-client/v2
|
github.com/influxdata/influxdb1-client/v2
|
||||||
# github.com/stretchr/testify v1.7.0
|
# github.com/stretchr/testify v1.7.0
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
# golang.org/x/net v0.0.0-20220325170049-de3da57026de
|
# golang.org/x/net v0.0.0-20220708220712-1185a9018129
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
golang.org/x/net/html
|
golang.org/x/net/html
|
||||||
golang.org/x/net/html/atom
|
golang.org/x/net/html/atom
|
||||||
@ -40,7 +40,7 @@ golang.org/x/text/internal/utf8internal
|
|||||||
golang.org/x/text/language
|
golang.org/x/text/language
|
||||||
golang.org/x/text/runes
|
golang.org/x/text/runes
|
||||||
golang.org/x/text/transform
|
golang.org/x/text/transform
|
||||||
# gopkg.in/ini.v1 v1.66.4
|
# gopkg.in/ini.v1 v1.66.6
|
||||||
## explicit
|
## explicit
|
||||||
gopkg.in/ini.v1
|
gopkg.in/ini.v1
|
||||||
# gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
# gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||||
|
Loading…
Reference in New Issue
Block a user