This commit is contained in:
parent
eb8252f884
commit
c2f6e23306
7
go.mod
7
go.mod
@ -2,10 +2,13 @@ module git.paulbsd.com/paulbsd/weather
|
|||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
||||||
|
gopkg.in/ini.v1 v1.66.6
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20210825203111-a709d8e111b3 // indirect
|
github.com/gopherjs/gopherjs v0.0.0-20210825203111-a709d8e111b3 // indirect
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
|
|
||||||
github.com/smartystreets/assertions v1.2.0 // indirect
|
github.com/smartystreets/assertions v1.2.0 // indirect
|
||||||
github.com/smartystreets/goconvey v1.6.4 // indirect
|
github.com/smartystreets/goconvey v1.6.4 // indirect
|
||||||
gopkg.in/ini.v1 v1.62.0
|
|
||||||
)
|
)
|
||||||
|
4
go.sum
4
go.sum
@ -95,6 +95,8 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J
|
|||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab h1:HqW4xhhynfjrtEiiSGcQUd6vrK23iMam1FO8rI7mwig=
|
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab h1:HqW4xhhynfjrtEiiSGcQUd6vrK23iMam1FO8rI7mwig=
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||||
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c h1:qSHzRbhzK8RdXOsAdfDgO49TtqC1oZ+acxPrkfTxcCs=
|
||||||
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||||
@ -309,6 +311,8 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|||||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
||||||
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.62.0/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/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
2
vendor/github.com/influxdata/influxdb1-client/README.md
generated
vendored
2
vendor/github.com/influxdata/influxdb1-client/README.md
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
# influxdb1-clientv2
|
# influxdb1-clientv2
|
||||||
influxdb1-clientv2 is the current Go client API for InfluxDB 1.x. A Go client for the 2.0 API will be coming soon.
|
influxdb1-clientv2 is the current Go client API for InfluxDB 1.x. For connecting to InfluxDB 2.x see the [influxdb-client-go](https://github.com/influxdata/influxdb-client-go) client library.
|
||||||
|
|
||||||
InfluxDB is an open-source distributed time series database, find more about [InfluxDB](https://www.influxdata.com/time-series-platform/influxdb/) at https://docs.influxdata.com/influxdb/latest
|
InfluxDB is an open-source distributed time series database, find more about [InfluxDB](https://www.influxdata.com/time-series-platform/influxdb/) at https://docs.influxdata.com/influxdb/latest
|
||||||
|
|
||||||
|
5
vendor/github.com/influxdata/influxdb1-client/influxdb.go
generated
vendored
5
vendor/github.com/influxdata/influxdb1-client/influxdb.go
generated
vendored
@ -247,7 +247,10 @@ func (c *Client) QueryContext(ctx context.Context, q Query) (*Response, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() {
|
||||||
|
io.Copy(ioutil.Discard, resp.Body) // https://github.com/influxdata/influxdb1-client/issues/58
|
||||||
|
resp.Body.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
var response Response
|
var response Response
|
||||||
if q.Chunked {
|
if q.Chunked {
|
||||||
|
5
vendor/github.com/influxdata/influxdb1-client/v2/client.go
generated
vendored
5
vendor/github.com/influxdata/influxdb1-client/v2/client.go
generated
vendored
@ -556,7 +556,10 @@ func (c *client) Query(q Query) (*Response, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() {
|
||||||
|
io.Copy(ioutil.Discard, resp.Body) // https://github.com/influxdata/influxdb1-client/issues/58
|
||||||
|
resp.Body.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
if err := checkResponse(resp); err != nil {
|
if err := checkResponse(resp); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
12
vendor/gopkg.in/ini.v1/.editorconfig
generated
vendored
Normal file
12
vendor/gopkg.in/ini.v1/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*_test.go]
|
||||||
|
trim_trailing_whitespace = false
|
1
vendor/gopkg.in/ini.v1/.gitignore
generated
vendored
1
vendor/gopkg.in/ini.v1/.gitignore
generated
vendored
@ -4,3 +4,4 @@ ini.sublime-workspace
|
|||||||
testdata/conf_reflect.ini
|
testdata/conf_reflect.ini
|
||||||
.idea
|
.idea
|
||||||
/.vscode
|
/.vscode
|
||||||
|
.DS_Store
|
||||||
|
27
vendor/gopkg.in/ini.v1/.golangci.yml
generated
vendored
Normal file
27
vendor/gopkg.in/ini.v1/.golangci.yml
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
linters-settings:
|
||||||
|
staticcheck:
|
||||||
|
checks: [
|
||||||
|
"all",
|
||||||
|
"-SA1019" # There are valid use cases of strings.Title
|
||||||
|
]
|
||||||
|
nakedret:
|
||||||
|
max-func-lines: 0 # Disallow any unnamed return statement
|
||||||
|
|
||||||
|
linters:
|
||||||
|
enable:
|
||||||
|
- deadcode
|
||||||
|
- errcheck
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
|
- typecheck
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
- nakedret
|
||||||
|
- gofmt
|
||||||
|
- rowserrcheck
|
||||||
|
- unconvert
|
||||||
|
- 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.6**.
|
The minimum requirement of Go is **1.13**.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ go get gopkg.in/ini.v1
|
$ go get gopkg.in/ini.v1
|
||||||
|
9
vendor/gopkg.in/ini.v1/codecov.yml
generated
vendored
9
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, files'
|
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)
|
||||||
|
}
|
||||||
|
44
vendor/gopkg.in/ini.v1/file.go
generated
vendored
44
vendor/gopkg.in/ini.v1/file.go
generated
vendored
@ -142,6 +142,12 @@ func (f *File) GetSection(name string) (*Section, error) {
|
|||||||
return secs[0], err
|
return secs[0], err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HasSection returns true if the file contains a section with given name.
|
||||||
|
func (f *File) HasSection(name string) bool {
|
||||||
|
section, _ := f.GetSection(name)
|
||||||
|
return section != nil
|
||||||
|
}
|
||||||
|
|
||||||
// SectionsByName returns all sections with given name.
|
// SectionsByName returns all sections with given name.
|
||||||
func (f *File) SectionsByName(name string) ([]*Section, error) {
|
func (f *File) SectionsByName(name string) ([]*Section, error) {
|
||||||
if len(name) == 0 {
|
if len(name) == 0 {
|
||||||
@ -168,8 +174,9 @@ func (f *File) SectionsByName(name string) ([]*Section, error) {
|
|||||||
func (f *File) Section(name string) *Section {
|
func (f *File) Section(name string) *Section {
|
||||||
sec, err := f.GetSection(name)
|
sec, err := f.GetSection(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Note: It's OK here because the only possible error is empty section name,
|
if name == "" {
|
||||||
// but if it's empty, this piece of code won't be executed.
|
name = DefaultSection
|
||||||
|
}
|
||||||
sec, _ = f.NewSection(name)
|
sec, _ = f.NewSection(name)
|
||||||
return sec
|
return sec
|
||||||
}
|
}
|
||||||
@ -335,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 {
|
||||||
@ -364,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
|
||||||
@ -435,16 +444,14 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
|||||||
kname = `"""` + kname + `"""`
|
kname = `"""` + kname + `"""`
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, val := range key.ValueWithShadows() {
|
writeKeyValue := func(val string) (bool, error) {
|
||||||
if _, err := buf.WriteString(kname); err != nil {
|
if _, err := buf.WriteString(kname); err != nil {
|
||||||
return nil, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if key.isBooleanType {
|
if key.isBooleanType {
|
||||||
if kname != sec.keyList[len(sec.keyList)-1] {
|
buf.WriteString(LineBreak)
|
||||||
buf.WriteString(LineBreak)
|
return true, nil
|
||||||
}
|
|
||||||
continue KeyList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out alignment spaces before "=" sign
|
// Write out alignment spaces before "=" sign
|
||||||
@ -461,10 +468,27 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
|||||||
val = `"` + val + `"`
|
val = `"` + val + `"`
|
||||||
}
|
}
|
||||||
if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil {
|
if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
shadows := key.ValueWithShadows()
|
||||||
|
if len(shadows) == 0 {
|
||||||
|
if _, err := writeKeyValue(""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, val := range shadows {
|
||||||
|
exitLoop, err := writeKeyValue(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if exitLoop {
|
||||||
|
continue KeyList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, val := range key.nestedValues {
|
for _, val := range key.nestedValues {
|
||||||
if _, err := buf.WriteString(indent + " " + val + LineBreak); err != nil {
|
if _, err := buf.WriteString(indent + " " + val + LineBreak); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -472,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
|
||||||
|
4
vendor/gopkg.in/ini.v1/ini.go
generated
vendored
4
vendor/gopkg.in/ini.v1/ini.go
generated
vendored
@ -1,5 +1,3 @@
|
|||||||
// +build go1.6
|
|
||||||
|
|
||||||
// Copyright 2014 Unknwon
|
// Copyright 2014 Unknwon
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License"): you may
|
// Licensed under the Apache License, Version 2.0 (the "License"): you may
|
||||||
@ -125,6 +123,8 @@ type LoadOptions struct {
|
|||||||
ReaderBufferSize int
|
ReaderBufferSize int
|
||||||
// AllowNonUniqueSections indicates whether to allow sections with the same name multiple times.
|
// AllowNonUniqueSections indicates whether to allow sections with the same name multiple times.
|
||||||
AllowNonUniqueSections bool
|
AllowNonUniqueSections bool
|
||||||
|
// AllowDuplicateShadowValues indicates whether values for shadowed keys should be deduplicated.
|
||||||
|
AllowDuplicateShadowValues bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugFunc is the type of function called to log parse events.
|
// DebugFunc is the type of function called to log parse events.
|
||||||
|
36
vendor/gopkg.in/ini.v1/key.go
generated
vendored
36
vendor/gopkg.in/ini.v1/key.go
generated
vendored
@ -54,14 +54,16 @@ func (k *Key) addShadow(val string) error {
|
|||||||
return errors.New("cannot add shadow to auto-increment or boolean key")
|
return errors.New("cannot add shadow to auto-increment or boolean key")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deduplicate shadows based on their values.
|
if !k.s.f.options.AllowDuplicateShadowValues {
|
||||||
if k.value == val {
|
// Deduplicate shadows based on their values.
|
||||||
return nil
|
if k.value == val {
|
||||||
}
|
|
||||||
for i := range k.shadows {
|
|
||||||
if k.shadows[i].value == val {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
for i := range k.shadows {
|
||||||
|
if k.shadows[i].value == val {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shadow := newKey(k.s, k.name, val)
|
shadow := newKey(k.s, k.name, val)
|
||||||
@ -108,15 +110,24 @@ func (k *Key) Value() string {
|
|||||||
return k.value
|
return k.value
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValueWithShadows returns raw values of key and its shadows if any.
|
// ValueWithShadows returns raw values of key and its shadows if any. Shadow
|
||||||
|
// keys with empty values are ignored from the returned list.
|
||||||
func (k *Key) ValueWithShadows() []string {
|
func (k *Key) ValueWithShadows() []string {
|
||||||
if len(k.shadows) == 0 {
|
if len(k.shadows) == 0 {
|
||||||
|
if k.value == "" {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
return []string{k.value}
|
return []string{k.value}
|
||||||
}
|
}
|
||||||
vals := make([]string, len(k.shadows)+1)
|
|
||||||
vals[0] = k.value
|
vals := make([]string, 0, len(k.shadows)+1)
|
||||||
for i := range k.shadows {
|
if k.value != "" {
|
||||||
vals[i+1] = k.shadows[i].value
|
vals = append(vals, k.value)
|
||||||
|
}
|
||||||
|
for _, s := range k.shadows {
|
||||||
|
if s.value != "" {
|
||||||
|
vals = append(vals, s.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return vals
|
return vals
|
||||||
}
|
}
|
||||||
@ -781,10 +792,8 @@ func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]u
|
|||||||
return vals, err
|
return vals, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type Parser func(str string) (interface{}, error)
|
type Parser func(str string) (interface{}, error)
|
||||||
|
|
||||||
|
|
||||||
// parseTimesFormat transforms strings to times in given format.
|
// parseTimesFormat transforms strings to times in given format.
|
||||||
func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) {
|
func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) {
|
||||||
vals := make([]time.Time, 0, len(strs))
|
vals := make([]time.Time, 0, len(strs))
|
||||||
@ -801,7 +810,6 @@ func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnO
|
|||||||
return vals, err
|
return vals, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// doParse transforms strings to different types
|
// doParse transforms strings to different types
|
||||||
func (k *Key) doParse(strs []string, addInvalid, returnOnInvalid bool, parser Parser) ([]interface{}, error) {
|
func (k *Key) doParse(strs []string, addInvalid, returnOnInvalid bool, parser Parser) ([]interface{}, error) {
|
||||||
vals := make([]interface{}, 0, len(strs))
|
vals := make([]interface{}, 0, len(strs))
|
||||||
|
47
vendor/gopkg.in/ini.v1/parser.go
generated
vendored
47
vendor/gopkg.in/ini.v1/parser.go
generated
vendored
@ -131,7 +131,7 @@ func readKeyName(delimiters string, in []byte) (string, int, error) {
|
|||||||
// Check if key name surrounded by quotes.
|
// Check if key name surrounded by quotes.
|
||||||
var keyQuote string
|
var keyQuote string
|
||||||
if line[0] == '"' {
|
if line[0] == '"' {
|
||||||
if len(line) > 6 && string(line[0:3]) == `"""` {
|
if len(line) > 6 && line[0:3] == `"""` {
|
||||||
keyQuote = `"""`
|
keyQuote = `"""`
|
||||||
} else {
|
} else {
|
||||||
keyQuote = `"`
|
keyQuote = `"`
|
||||||
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +236,7 @@ func (p *parser) readValue(in []byte, bufferSize int) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var valQuote string
|
var valQuote string
|
||||||
if len(line) > 3 && string(line[0:3]) == `"""` {
|
if len(line) > 3 && line[0:3] == `"""` {
|
||||||
valQuote = `"""`
|
valQuote = `"""`
|
||||||
} else if line[0] == '`' {
|
} else if line[0] == '`' {
|
||||||
valQuote = "`"
|
valQuote = "`"
|
||||||
@ -289,12 +293,8 @@ func (p *parser) readValue(in []byte, bufferSize int) (string, error) {
|
|||||||
hasSurroundedQuote(line, '"')) && !p.options.PreserveSurroundedQuote {
|
hasSurroundedQuote(line, '"')) && !p.options.PreserveSurroundedQuote {
|
||||||
line = line[1 : len(line)-1]
|
line = line[1 : len(line)-1]
|
||||||
} else if len(valQuote) == 0 && p.options.UnescapeValueCommentSymbols {
|
} else if len(valQuote) == 0 && p.options.UnescapeValueCommentSymbols {
|
||||||
if strings.Contains(line, `\;`) {
|
line = strings.ReplaceAll(line, `\;`, ";")
|
||||||
line = strings.Replace(line, `\;`, ";", -1)
|
line = strings.ReplaceAll(line, `\#`, "#")
|
||||||
}
|
|
||||||
if strings.Contains(line, `\#`) {
|
|
||||||
line = strings.Replace(line, `\#`, "#", -1)
|
|
||||||
}
|
|
||||||
} else if p.options.AllowPythonMultilineValues && lastChar == '\n' {
|
} else if p.options.AllowPythonMultilineValues && lastChar == '\n' {
|
||||||
return p.readPythonMultilines(line, bufferSize)
|
return p.readPythonMultilines(line, bufferSize)
|
||||||
}
|
}
|
||||||
@ -306,15 +306,9 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro
|
|||||||
parserBufferPeekResult, _ := p.buf.Peek(bufferSize)
|
parserBufferPeekResult, _ := p.buf.Peek(bufferSize)
|
||||||
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
|
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
|
||||||
|
|
||||||
indentSize := 0
|
|
||||||
for {
|
for {
|
||||||
peekData, peekErr := peekBuffer.ReadBytes('\n')
|
peekData, peekErr := peekBuffer.ReadBytes('\n')
|
||||||
if peekErr != nil {
|
if peekErr != nil && peekErr != io.EOF {
|
||||||
if peekErr == io.EOF {
|
|
||||||
p.debug("readPythonMultilines: io.EOF, peekData: %q, line: %q", string(peekData), line)
|
|
||||||
return line, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
p.debug("readPythonMultilines: failed to peek with error: %v", peekErr)
|
p.debug("readPythonMultilines: failed to peek with error: %v", peekErr)
|
||||||
return "", peekErr
|
return "", peekErr
|
||||||
}
|
}
|
||||||
@ -333,19 +327,6 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro
|
|||||||
return line, nil
|
return line, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine indent size and line prefix.
|
|
||||||
currentIndentSize := len(peekMatches[1])
|
|
||||||
if indentSize < 1 {
|
|
||||||
indentSize = currentIndentSize
|
|
||||||
p.debug("readPythonMultilines: indent size is %d", indentSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure each line is indented at least as far as first line.
|
|
||||||
if currentIndentSize < indentSize {
|
|
||||||
p.debug("readPythonMultilines: end of value, current indent: %d, expected indent: %d, line: %q", currentIndentSize, indentSize, line)
|
|
||||||
return line, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Advance the parser reader (buffer) in-sync with the peek buffer.
|
// Advance the parser reader (buffer) in-sync with the peek buffer.
|
||||||
_, err := p.buf.Discard(len(peekData))
|
_, err := p.buf.Discard(len(peekData))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -353,8 +334,7 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle indented empty line.
|
line += "\n" + peekMatches[0]
|
||||||
line += "\n" + peekMatches[1][indentSize:] + peekMatches[2]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,6 +445,8 @@ func (f *File) parse(reader io.Reader) (err error) {
|
|||||||
// Reset auto-counter and comments
|
// Reset auto-counter and comments
|
||||||
p.comment.Reset()
|
p.comment.Reset()
|
||||||
p.count = 1
|
p.count = 1
|
||||||
|
// Nested values can't span sections
|
||||||
|
isLastValueEmpty = false
|
||||||
|
|
||||||
inUnparseableSection = false
|
inUnparseableSection = false
|
||||||
for i := range f.options.UnparseableSections {
|
for i := range f.options.UnparseableSections {
|
||||||
@ -485,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)
|
||||||
@ -504,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
|
||||||
}
|
}
|
||||||
|
2
vendor/gopkg.in/ini.v1/section.go
generated
vendored
2
vendor/gopkg.in/ini.v1/section.go
generated
vendored
@ -217,7 +217,7 @@ func (s *Section) KeysHash() map[string]string {
|
|||||||
defer s.f.lock.RUnlock()
|
defer s.f.lock.RUnlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
hash := map[string]string{}
|
hash := make(map[string]string, len(s.keysHash))
|
||||||
for key, value := range s.keysHash {
|
for key, value := range s.keysHash {
|
||||||
hash[key] = value
|
hash[key] = value
|
||||||
}
|
}
|
||||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -1,6 +1,6 @@
|
|||||||
# github.com/gopherjs/gopherjs v0.0.0-20210825203111-a709d8e111b3
|
# github.com/gopherjs/gopherjs v0.0.0-20210825203111-a709d8e111b3
|
||||||
## explicit; go 1.16
|
## explicit; go 1.16
|
||||||
# github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
|
# github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
||||||
## explicit
|
## explicit
|
||||||
github.com/influxdata/influxdb1-client
|
github.com/influxdata/influxdb1-client
|
||||||
github.com/influxdata/influxdb1-client/models
|
github.com/influxdata/influxdb1-client/models
|
||||||
@ -10,6 +10,6 @@ github.com/influxdata/influxdb1-client/v2
|
|||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
# github.com/smartystreets/goconvey v1.6.4
|
# github.com/smartystreets/goconvey v1.6.4
|
||||||
## explicit
|
## explicit
|
||||||
# gopkg.in/ini.v1 v1.62.0
|
# gopkg.in/ini.v1 v1.66.6
|
||||||
## explicit
|
## explicit
|
||||||
gopkg.in/ini.v1
|
gopkg.in/ini.v1
|
||||||
|
Loading…
Reference in New Issue
Block a user