Этот коммит содержится в:
Christopher Speller
2018-12-04 12:41:12 -08:00
родитель acdc20d486
Коммит 260b107590
390 изменённых файлов: 36031 добавлений и 16084 удалений

1
vendor/github.com/go-ini/ini/.travis.yml сгенерированный поставляемый
Просмотреть файл

@@ -6,6 +6,7 @@ go:
- 1.8.x
- 1.9.x
- 1.10.x
- 1.11.x
script:
- go get golang.org/x/tools/cmd/cover

2
vendor/github.com/go-ini/ini/README.md сгенерированный поставляемый
Просмотреть файл

@@ -20,6 +20,8 @@ Package ini provides INI file read and write functionality in Go.
## Installation
The minimum requirement of Go is **1.6**.
To use a tagged revision:
```sh

10
vendor/github.com/go-ini/ini/file.go сгенерированный поставляемый
Просмотреть файл

@@ -45,6 +45,9 @@ type File struct {
// newFile initializes File object with given data sources.
func newFile(dataSources []dataSource, opts LoadOptions) *File {
if len(opts.KeyValueDelimiters) == 0 {
opts.KeyValueDelimiters = "=:"
}
return &File{
BlockMode: true,
dataSources: dataSources,
@@ -227,7 +230,8 @@ func (f *File) Append(source interface{}, others ...interface{}) error {
}
func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
equalSign := "="
equalSign := DefaultFormatLeft + "=" + DefaultFormatRight
if PrettyFormat || PrettyEqual {
equalSign = " = "
}
@@ -285,7 +289,7 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
for _, kname := range sec.keyList {
keyLength := len(kname)
// First case will surround key by ` and second by """
if strings.ContainsAny(kname, "\"=:") {
if strings.Contains(kname, "\"") || strings.ContainsAny(kname, f.options.KeyValueDelimiters) {
keyLength += 2
} else if strings.Contains(kname, "`") {
keyLength += 6
@@ -328,7 +332,7 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
switch {
case key.isAutoIncrement:
kname = "-"
case strings.ContainsAny(kname, "\"=:"):
case strings.Contains(kname, "\"") || strings.ContainsAny(kname, f.options.KeyValueDelimiters):
kname = "`" + kname + "`"
case strings.Contains(kname, "`"):
kname = `"""` + kname + `"""`

8
vendor/github.com/go-ini/ini/ini.go сгенерированный поставляемый
Просмотреть файл

@@ -34,7 +34,7 @@ const (
// Maximum allowed depth when recursively substituing variable names.
_DEPTH_VALUES = 99
_VERSION = "1.38.2"
_VERSION = "1.39.1"
)
// Version returns current package version literal.
@@ -48,6 +48,10 @@ var (
// at package init time.
LineBreak = "\n"
// Place custom spaces when PrettyFormat and PrettyEqual are both disabled
DefaultFormatLeft = ""
DefaultFormatRight = ""
// Variable regexp pattern: %(variable)s
varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`)
@@ -164,6 +168,8 @@ type LoadOptions struct {
// UnparseableSections stores a list of blocks that are allowed with raw content which do not otherwise
// conform to key/value pairs. Specify the names of those blocks here.
UnparseableSections []string
// KeyValueDelimiters is the sequence of delimiters that are used to separate key and value. By default, it is "=:".
KeyValueDelimiters string
}
func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) {

20
vendor/github.com/go-ini/ini/parser.go сгенерированный поставляемый
Просмотреть файл

@@ -100,7 +100,7 @@ func cleanComment(in []byte) ([]byte, bool) {
return in[i:], true
}
func readKeyName(in []byte) (string, int, error) {
func readKeyName(delimiters string, in []byte) (string, int, error) {
line := string(in)
// Check if key name surrounded by quotes.
@@ -127,7 +127,7 @@ func readKeyName(in []byte) (string, int, error) {
pos += startIdx
// Find key-value delimiter
i := strings.IndexAny(line[pos+startIdx:], "=:")
i := strings.IndexAny(line[pos+startIdx:], delimiters)
if i < 0 {
return "", -1, ErrDelimiterNotFound{line}
}
@@ -135,7 +135,7 @@ func readKeyName(in []byte) (string, int, error) {
return strings.TrimSpace(line[startIdx:pos]), endIdx + startIdx + 1, nil
}
endIdx = strings.IndexAny(line, "=:")
endIdx = strings.IndexAny(line, delimiters)
if endIdx < 0 {
return "", -1, ErrDelimiterNotFound{line}
}
@@ -273,7 +273,6 @@ func (p *parser) readValue(in []byte,
parserBufferPeekResult, _ := p.buf.Peek(parserBufferSize)
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
identSize := -1
val := line
for {
@@ -290,12 +289,11 @@ func (p *parser) readValue(in []byte,
return val, nil
}
currentIdentSize := len(peekMatches[1])
// NOTE: Return if not a python-ini multi-line value.
if currentIdentSize < 0 {
currentIdentSize := len(peekMatches[1])
if currentIdentSize <= 0 {
return val, nil
}
identSize = currentIdentSize
// NOTE: Just advance the parser reader (buffer) in-sync with the peek buffer.
_, err := p.readUntil('\n')
@@ -305,12 +303,6 @@ func (p *parser) readValue(in []byte,
val += fmt.Sprintf("\n%s", peekMatches[2])
}
// NOTE: If it was a Python multi-line value,
// return the appended value.
if identSize > 0 {
return val, nil
}
}
return line, nil
@@ -428,7 +420,7 @@ func (f *File) parse(reader io.Reader) (err error) {
continue
}
kname, offset, err := readKeyName(line)
kname, offset, err := readKeyName(f.options.KeyValueDelimiters, line)
if err != nil {
// Treat as boolean key when desired, and whole line is key name.
if IsErrDelimiterNotFound(err) {