vendor: github.com/pelletier/go-toml v1.9.1
Remove the replace rule, and use the version as specified by (indirect) dependencies: full diff: https://github.com/pelletier/go-toml/compare/v1.8.1...v1.9.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
8f6d58915d
commit
40bf5d414e
16 changed files with 505 additions and 191 deletions
|
@ -170,7 +170,6 @@ replace (
|
|||
github.com/matttproud/golang_protobuf_extensions => github.com/matttproud/golang_protobuf_extensions v1.0.1
|
||||
github.com/onsi/ginkgo => github.com/onsi/ginkgo v1.8.0
|
||||
github.com/onsi/gomega => github.com/onsi/gomega v1.5.0
|
||||
github.com/pelletier/go-toml => github.com/pelletier/go-toml v1.8.1
|
||||
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.6.0
|
||||
github.com/prometheus/common => github.com/prometheus/common v0.9.1
|
||||
github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.11
|
||||
|
|
|
@ -440,8 +440,10 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt
|
|||
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
|
||||
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
||||
github.com/pelletier/go-toml v1.9.1 h1:a6qW1EVNZWH9WGI6CsYdD8WAylkoXBS5yv0XHlh17Tc=
|
||||
github.com/pelletier/go-toml v1.9.1/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||
github.com/phayes/permbits v0.0.0-20190612203442-39d7c581d2ee h1:P6U24L02WMfj9ymZTxl7CxS73JC99x3ukk+DBkgQGQs=
|
||||
github.com/phayes/permbits v0.0.0-20190612203442-39d7c581d2ee/go.mod h1:3uODdxMgOaPYeWU7RzZLxVtJHZ/x1f/iHkBZuKJDzuY=
|
||||
|
|
4
vendor/github.com/pelletier/go-toml/CONTRIBUTING.md
generated
vendored
4
vendor/github.com/pelletier/go-toml/CONTRIBUTING.md
generated
vendored
|
@ -28,7 +28,7 @@ improve the documentation. Fix a typo, clarify an interface, add an
|
|||
example, anything goes!
|
||||
|
||||
The documentation is present in the [README][readme] and thorough the
|
||||
source code. On release, it gets updated on [GoDoc][godoc]. To make a
|
||||
source code. On release, it gets updated on [pkg.go.dev][pkg.go.dev]. To make a
|
||||
change to the documentation, create a pull request with your proposed
|
||||
changes. For simple changes like that, the easiest way to go is probably
|
||||
the "Fork this project and edit the file" button on Github, displayed at
|
||||
|
@ -123,7 +123,7 @@ Checklist:
|
|||
|
||||
[issues-tracker]: https://github.com/pelletier/go-toml/issues
|
||||
[bug-report]: https://github.com/pelletier/go-toml/issues/new?template=bug_report.md
|
||||
[godoc]: https://godoc.org/github.com/pelletier/go-toml
|
||||
[pkg.go.dev]: https://pkg.go.dev/github.com/pelletier/go-toml
|
||||
[readme]: ./README.md
|
||||
[fork]: https://help.github.com/articles/fork-a-repo
|
||||
[pull-request]: https://help.github.com/en/articles/creating-a-pull-request
|
||||
|
|
2
vendor/github.com/pelletier/go-toml/LICENSE
generated
vendored
2
vendor/github.com/pelletier/go-toml/LICENSE
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 - 2017 Thomas Pelletier, Eric Anderton
|
||||
Copyright (c) 2013 - 2021 Thomas Pelletier, Eric Anderton
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
12
vendor/github.com/pelletier/go-toml/README.md
generated
vendored
12
vendor/github.com/pelletier/go-toml/README.md
generated
vendored
|
@ -1,11 +1,11 @@
|
|||
# go-toml
|
||||
|
||||
Go library for the [TOML](https://github.com/mojombo/toml) format.
|
||||
Go library for the [TOML](https://toml.io/) format.
|
||||
|
||||
This library supports TOML version
|
||||
[v1.0.0-rc.1](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v1.0.0-rc.1.md)
|
||||
[v1.0.0-rc.3](https://toml.io/en/v1.0.0-rc.3)
|
||||
|
||||
[![GoDoc](https://godoc.org/github.com/pelletier/go-toml?status.svg)](http://godoc.org/github.com/pelletier/go-toml)
|
||||
[![Go Reference](https://pkg.go.dev/badge/github.com/pelletier/go-toml.svg)](https://pkg.go.dev/github.com/pelletier/go-toml)
|
||||
[![license](https://img.shields.io/github/license/pelletier/go-toml.svg)](https://github.com/pelletier/go-toml/blob/master/LICENSE)
|
||||
[![Build Status](https://dev.azure.com/pelletierthomas/go-toml-ci/_apis/build/status/pelletier.go-toml?branchName=master)](https://dev.azure.com/pelletierthomas/go-toml-ci/_build/latest?definitionId=1&branchName=master)
|
||||
[![codecov](https://codecov.io/gh/pelletier/go-toml/branch/master/graph/badge.svg)](https://codecov.io/gh/pelletier/go-toml)
|
||||
|
@ -81,11 +81,11 @@ for ii, item := range results.Values() {
|
|||
## Documentation
|
||||
|
||||
The documentation and additional examples are available at
|
||||
[godoc.org](http://godoc.org/github.com/pelletier/go-toml).
|
||||
[pkg.go.dev](https://pkg.go.dev/github.com/pelletier/go-toml).
|
||||
|
||||
## Tools
|
||||
|
||||
Go-toml provides two handy command line tools:
|
||||
Go-toml provides three handy command line tools:
|
||||
|
||||
* `tomll`: Reads TOML files and lints them.
|
||||
|
||||
|
@ -109,7 +109,7 @@ Go-toml provides two handy command line tools:
|
|||
|
||||
### Docker image
|
||||
|
||||
Those tools are also availble as a Docker image from
|
||||
Those tools are also available as a Docker image from
|
||||
[dockerhub](https://hub.docker.com/r/pelletier/go-toml). For example, to
|
||||
use `tomljson`:
|
||||
|
||||
|
|
74
vendor/github.com/pelletier/go-toml/azure-pipelines.yml
generated
vendored
74
vendor/github.com/pelletier/go-toml/azure-pipelines.yml
generated
vendored
|
@ -2,30 +2,6 @@ trigger:
|
|||
- master
|
||||
|
||||
stages:
|
||||
- stage: fuzzit
|
||||
displayName: "Run Fuzzit"
|
||||
dependsOn: []
|
||||
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
|
||||
jobs:
|
||||
- job: submit
|
||||
displayName: "Submit"
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- task: GoTool@0
|
||||
displayName: "Install Go 1.15"
|
||||
inputs:
|
||||
version: "1.15"
|
||||
- script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
|
||||
- script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml
|
||||
- script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml
|
||||
- task: Bash@3
|
||||
inputs:
|
||||
filePath: './fuzzit.sh'
|
||||
env:
|
||||
TYPE: fuzzing
|
||||
FUZZIT_API_KEY: $(FUZZIT_API_KEY)
|
||||
|
||||
- stage: run_checks
|
||||
displayName: "Check"
|
||||
dependsOn: []
|
||||
|
@ -36,9 +12,9 @@ stages:
|
|||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- task: GoTool@0
|
||||
displayName: "Install Go 1.15"
|
||||
displayName: "Install Go 1.16"
|
||||
inputs:
|
||||
version: "1.15"
|
||||
version: "1.16"
|
||||
- task: Go@0
|
||||
displayName: "go fmt ./..."
|
||||
inputs:
|
||||
|
@ -51,9 +27,9 @@ stages:
|
|||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- task: GoTool@0
|
||||
displayName: "Install Go 1.15"
|
||||
displayName: "Install Go 1.16"
|
||||
inputs:
|
||||
version: "1.15"
|
||||
version: "1.16"
|
||||
- task: Go@0
|
||||
displayName: "Generate coverage"
|
||||
inputs:
|
||||
|
@ -71,37 +47,28 @@ stages:
|
|||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- task: GoTool@0
|
||||
displayName: "Install Go 1.15"
|
||||
displayName: "Install Go 1.16"
|
||||
inputs:
|
||||
version: "1.15"
|
||||
version: "1.16"
|
||||
- script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
|
||||
- task: Bash@3
|
||||
inputs:
|
||||
filePath: './benchmark.sh'
|
||||
arguments: "master $(Build.Repository.Uri)"
|
||||
|
||||
- job: fuzzing
|
||||
displayName: "fuzzing"
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- task: GoTool@0
|
||||
displayName: "Install Go 1.15"
|
||||
inputs:
|
||||
version: "1.15"
|
||||
- script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
|
||||
- script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml
|
||||
- script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml
|
||||
- task: Bash@3
|
||||
inputs:
|
||||
filePath: './fuzzit.sh'
|
||||
env:
|
||||
TYPE: local-regression
|
||||
|
||||
- job: go_unit_tests
|
||||
displayName: "unit tests"
|
||||
strategy:
|
||||
matrix:
|
||||
linux 1.16:
|
||||
goVersion: '1.16'
|
||||
imageName: 'ubuntu-latest'
|
||||
mac 1.16:
|
||||
goVersion: '1.16'
|
||||
imageName: 'macOS-latest'
|
||||
windows 1.16:
|
||||
goVersion: '1.16'
|
||||
imageName: 'windows-latest'
|
||||
linux 1.15:
|
||||
goVersion: '1.15'
|
||||
imageName: 'ubuntu-latest'
|
||||
|
@ -111,15 +78,6 @@ stages:
|
|||
windows 1.15:
|
||||
goVersion: '1.15'
|
||||
imageName: 'windows-latest'
|
||||
linux 1.14:
|
||||
goVersion: '1.14'
|
||||
imageName: 'ubuntu-latest'
|
||||
mac 1.14:
|
||||
goVersion: '1.14'
|
||||
imageName: 'macOS-latest'
|
||||
windows 1.14:
|
||||
goVersion: '1.14'
|
||||
imageName: 'windows-latest'
|
||||
pool:
|
||||
vmImage: $(imageName)
|
||||
steps:
|
||||
|
@ -155,7 +113,7 @@ stages:
|
|||
- task: GoTool@0
|
||||
displayName: "Install Go"
|
||||
inputs:
|
||||
version: 1.15
|
||||
version: 1.16
|
||||
- task: Bash@3
|
||||
inputs:
|
||||
targetType: inline
|
||||
|
|
26
vendor/github.com/pelletier/go-toml/fuzzit.sh
generated
vendored
26
vendor/github.com/pelletier/go-toml/fuzzit.sh
generated
vendored
|
@ -1,26 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -xe
|
||||
|
||||
# go-fuzz doesn't support modules yet, so ensure we do everything
|
||||
# in the old style GOPATH way
|
||||
export GO111MODULE="off"
|
||||
|
||||
# install go-fuzz
|
||||
go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
|
||||
|
||||
# target name can only contain lower-case letters (a-z), digits (0-9) and a dash (-)
|
||||
# to add another target, make sure to create it with `fuzzit create target`
|
||||
# before using `fuzzit create job`
|
||||
TARGET=toml-fuzzer
|
||||
|
||||
go-fuzz-build -libfuzzer -o ${TARGET}.a github.com/pelletier/go-toml
|
||||
clang -fsanitize=fuzzer ${TARGET}.a -o ${TARGET}
|
||||
|
||||
# install fuzzit for talking to fuzzit.dev service
|
||||
# or latest version:
|
||||
# https://github.com/fuzzitdev/fuzzit/releases/latest/download/fuzzit_Linux_x86_64
|
||||
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.52/fuzzit_Linux_x86_64
|
||||
chmod a+x fuzzit
|
||||
|
||||
# TODO: change kkowalczyk to go-toml and create toml-fuzzer target there
|
||||
./fuzzit create job --type $TYPE go-toml/${TARGET} ${TARGET}
|
306
vendor/github.com/pelletier/go-toml/lexer.go
generated
vendored
306
vendor/github.com/pelletier/go-toml/lexer.go
generated
vendored
|
@ -9,13 +9,10 @@ import (
|
|||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var dateRegexp *regexp.Regexp
|
||||
|
||||
// Define state functions
|
||||
type tomlLexStateFn func() tomlLexStateFn
|
||||
|
||||
|
@ -216,18 +213,12 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
|
|||
break
|
||||
}
|
||||
|
||||
possibleDate := l.peekString(35)
|
||||
dateSubmatches := dateRegexp.FindStringSubmatch(possibleDate)
|
||||
if dateSubmatches != nil && dateSubmatches[0] != "" {
|
||||
l.fastForward(len(dateSubmatches[0]))
|
||||
if dateSubmatches[2] == "" { // no timezone information => local date
|
||||
return l.lexLocalDate
|
||||
}
|
||||
return l.lexDate
|
||||
if next == '+' || next == '-' {
|
||||
return l.lexNumber
|
||||
}
|
||||
|
||||
if next == '+' || next == '-' || isDigit(next) {
|
||||
return l.lexNumber
|
||||
if isDigit(next) {
|
||||
return l.lexDateTimeOrNumber
|
||||
}
|
||||
|
||||
return l.errorf("no value can start with %c", next)
|
||||
|
@ -237,6 +228,32 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (l *tomlLexer) lexDateTimeOrNumber() tomlLexStateFn {
|
||||
// Could be either a date/time, or a digit.
|
||||
// The options for date/times are:
|
||||
// YYYY-... => date or date-time
|
||||
// HH:... => time
|
||||
// Anything else should be a number.
|
||||
|
||||
lookAhead := l.peekString(5)
|
||||
if len(lookAhead) < 3 {
|
||||
return l.lexNumber()
|
||||
}
|
||||
|
||||
for idx, r := range lookAhead {
|
||||
if !isDigit(r) {
|
||||
if idx == 2 && r == ':' {
|
||||
return l.lexDateTimeOrTime()
|
||||
}
|
||||
if idx == 4 && r == '-' {
|
||||
return l.lexDateTimeOrTime()
|
||||
}
|
||||
return l.lexNumber()
|
||||
}
|
||||
}
|
||||
return l.lexNumber()
|
||||
}
|
||||
|
||||
func (l *tomlLexer) lexLeftCurlyBrace() tomlLexStateFn {
|
||||
l.next()
|
||||
l.emit(tokenLeftCurlyBrace)
|
||||
|
@ -254,14 +271,245 @@ func (l *tomlLexer) lexRightCurlyBrace() tomlLexStateFn {
|
|||
return l.lexRvalue
|
||||
}
|
||||
|
||||
func (l *tomlLexer) lexDate() tomlLexStateFn {
|
||||
l.emit(tokenDate)
|
||||
func (l *tomlLexer) lexDateTimeOrTime() tomlLexStateFn {
|
||||
// Example matches:
|
||||
// 1979-05-27T07:32:00Z
|
||||
// 1979-05-27T00:32:00-07:00
|
||||
// 1979-05-27T00:32:00.999999-07:00
|
||||
// 1979-05-27 07:32:00Z
|
||||
// 1979-05-27 00:32:00-07:00
|
||||
// 1979-05-27 00:32:00.999999-07:00
|
||||
// 1979-05-27T07:32:00
|
||||
// 1979-05-27T00:32:00.999999
|
||||
// 1979-05-27 07:32:00
|
||||
// 1979-05-27 00:32:00.999999
|
||||
// 1979-05-27
|
||||
// 07:32:00
|
||||
// 00:32:00.999999
|
||||
|
||||
// we already know those two are digits
|
||||
l.next()
|
||||
l.next()
|
||||
|
||||
// Got 2 digits. At that point it could be either a time or a date(-time).
|
||||
|
||||
r := l.next()
|
||||
if r == ':' {
|
||||
return l.lexTime()
|
||||
}
|
||||
|
||||
return l.lexDateTime()
|
||||
}
|
||||
|
||||
func (l *tomlLexer) lexDateTime() tomlLexStateFn {
|
||||
// This state accepts an offset date-time, a local date-time, or a local date.
|
||||
//
|
||||
// v--- cursor
|
||||
// 1979-05-27T07:32:00Z
|
||||
// 1979-05-27T00:32:00-07:00
|
||||
// 1979-05-27T00:32:00.999999-07:00
|
||||
// 1979-05-27 07:32:00Z
|
||||
// 1979-05-27 00:32:00-07:00
|
||||
// 1979-05-27 00:32:00.999999-07:00
|
||||
// 1979-05-27T07:32:00
|
||||
// 1979-05-27T00:32:00.999999
|
||||
// 1979-05-27 07:32:00
|
||||
// 1979-05-27 00:32:00.999999
|
||||
// 1979-05-27
|
||||
|
||||
// date
|
||||
|
||||
// already checked by lexRvalue
|
||||
l.next() // digit
|
||||
l.next() // -
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid month digit in date: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
r := l.next()
|
||||
if r != '-' {
|
||||
return l.errorf("expected - to separate month of a date, not %c", r)
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid day digit in date: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
l.emit(tokenLocalDate)
|
||||
|
||||
r = l.peek()
|
||||
|
||||
if r == eof {
|
||||
|
||||
return l.lexRvalue
|
||||
}
|
||||
|
||||
if r != ' ' && r != 'T' {
|
||||
return l.errorf("incorrect date/time separation character: %c", r)
|
||||
}
|
||||
|
||||
if r == ' ' {
|
||||
lookAhead := l.peekString(3)[1:]
|
||||
if len(lookAhead) < 2 {
|
||||
return l.lexRvalue
|
||||
}
|
||||
for _, r := range lookAhead {
|
||||
if !isDigit(r) {
|
||||
return l.lexRvalue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
l.skip() // skip the T or ' '
|
||||
|
||||
// time
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid hour digit in time: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
r = l.next()
|
||||
if r != ':' {
|
||||
return l.errorf("time hour/minute separator should be :, not %c", r)
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid minute digit in time: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
r = l.next()
|
||||
if r != ':' {
|
||||
return l.errorf("time minute/second separator should be :, not %c", r)
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid second digit in time: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
r = l.peek()
|
||||
if r == '.' {
|
||||
l.next()
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("expected at least one digit in time's fraction, not %c", r)
|
||||
}
|
||||
|
||||
for {
|
||||
r := l.peek()
|
||||
if !isDigit(r) {
|
||||
break
|
||||
}
|
||||
l.next()
|
||||
}
|
||||
}
|
||||
|
||||
l.emit(tokenLocalTime)
|
||||
|
||||
return l.lexTimeOffset
|
||||
|
||||
}
|
||||
|
||||
func (l *tomlLexer) lexTimeOffset() tomlLexStateFn {
|
||||
// potential offset
|
||||
|
||||
// Z
|
||||
// -07:00
|
||||
// +07:00
|
||||
// nothing
|
||||
|
||||
r := l.peek()
|
||||
|
||||
if r == 'Z' {
|
||||
l.next()
|
||||
l.emit(tokenTimeOffset)
|
||||
} else if r == '+' || r == '-' {
|
||||
l.next()
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid hour digit in time offset: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
r = l.next()
|
||||
if r != ':' {
|
||||
return l.errorf("time offset hour/minute separator should be :, not %c", r)
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid minute digit in time offset: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
l.emit(tokenTimeOffset)
|
||||
}
|
||||
|
||||
return l.lexRvalue
|
||||
}
|
||||
|
||||
func (l *tomlLexer) lexLocalDate() tomlLexStateFn {
|
||||
l.emit(tokenLocalDate)
|
||||
func (l *tomlLexer) lexTime() tomlLexStateFn {
|
||||
// v--- cursor
|
||||
// 07:32:00
|
||||
// 00:32:00.999999
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid minute digit in time: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
r := l.next()
|
||||
if r != ':' {
|
||||
return l.errorf("time minute/second separator should be :, not %c", r)
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("invalid second digit in time: %c", r)
|
||||
}
|
||||
}
|
||||
|
||||
r = l.peek()
|
||||
if r == '.' {
|
||||
l.next()
|
||||
r := l.next()
|
||||
if !isDigit(r) {
|
||||
return l.errorf("expected at least one digit in time's fraction, not %c", r)
|
||||
}
|
||||
|
||||
for {
|
||||
r := l.peek()
|
||||
if !isDigit(r) {
|
||||
break
|
||||
}
|
||||
l.next()
|
||||
}
|
||||
}
|
||||
|
||||
l.emit(tokenLocalTime)
|
||||
return l.lexRvalue
|
||||
|
||||
}
|
||||
|
||||
func (l *tomlLexer) lexTrue() tomlLexStateFn {
|
||||
|
@ -767,30 +1015,6 @@ func (l *tomlLexer) run() {
|
|||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Regexp for all date/time formats supported by TOML.
|
||||
// Group 1: nano precision
|
||||
// Group 2: timezone
|
||||
//
|
||||
// /!\ also matches the empty string
|
||||
//
|
||||
// Example matches:
|
||||
// 1979-05-27T07:32:00Z
|
||||
// 1979-05-27T00:32:00-07:00
|
||||
// 1979-05-27T00:32:00.999999-07:00
|
||||
// 1979-05-27 07:32:00Z
|
||||
// 1979-05-27 00:32:00-07:00
|
||||
// 1979-05-27 00:32:00.999999-07:00
|
||||
// 1979-05-27T07:32:00
|
||||
// 1979-05-27T00:32:00.999999
|
||||
// 1979-05-27 07:32:00
|
||||
// 1979-05-27 00:32:00.999999
|
||||
// 1979-05-27
|
||||
// 07:32:00
|
||||
// 00:32:00.999999
|
||||
dateRegexp = regexp.MustCompile(`^(?:\d{1,4}-\d{2}-\d{2})?(?:[T ]?\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})?)?`)
|
||||
}
|
||||
|
||||
// Entry point
|
||||
func lexToml(inputBytes []byte) []token {
|
||||
runes := bytes.Runes(inputBytes)
|
||||
|
|
44
vendor/github.com/pelletier/go-toml/marshal.go
generated
vendored
44
vendor/github.com/pelletier/go-toml/marshal.go
generated
vendored
|
@ -18,6 +18,7 @@ const (
|
|||
tagFieldComment = "comment"
|
||||
tagCommented = "commented"
|
||||
tagMultiline = "multiline"
|
||||
tagLiteral = "literal"
|
||||
tagDefault = "default"
|
||||
)
|
||||
|
||||
|
@ -27,6 +28,7 @@ type tomlOpts struct {
|
|||
comment string
|
||||
commented bool
|
||||
multiline bool
|
||||
literal bool
|
||||
include bool
|
||||
omitempty bool
|
||||
defaultValue string
|
||||
|
@ -46,6 +48,7 @@ type annotation struct {
|
|||
comment string
|
||||
commented string
|
||||
multiline string
|
||||
literal string
|
||||
defaultValue string
|
||||
}
|
||||
|
||||
|
@ -54,15 +57,16 @@ var annotationDefault = annotation{
|
|||
comment: tagFieldComment,
|
||||
commented: tagCommented,
|
||||
multiline: tagMultiline,
|
||||
literal: tagLiteral,
|
||||
defaultValue: tagDefault,
|
||||
}
|
||||
|
||||
type marshalOrder int
|
||||
type MarshalOrder int
|
||||
|
||||
// Orders the Encoder can write the fields to the output stream.
|
||||
const (
|
||||
// Sort fields alphabetically.
|
||||
OrderAlphabetical marshalOrder = iota + 1
|
||||
OrderAlphabetical MarshalOrder = iota + 1
|
||||
// Preserve the order the fields are encountered. For example, the order of fields in
|
||||
// a struct.
|
||||
OrderPreserve
|
||||
|
@ -256,7 +260,7 @@ type Encoder struct {
|
|||
annotation
|
||||
line int
|
||||
col int
|
||||
order marshalOrder
|
||||
order MarshalOrder
|
||||
promoteAnon bool
|
||||
indentation string
|
||||
}
|
||||
|
@ -317,7 +321,7 @@ func (e *Encoder) ArraysWithOneElementPerLine(v bool) *Encoder {
|
|||
}
|
||||
|
||||
// Order allows to change in which order fields will be written to the output stream.
|
||||
func (e *Encoder) Order(ord marshalOrder) *Encoder {
|
||||
func (e *Encoder) Order(ord MarshalOrder) *Encoder {
|
||||
e.order = ord
|
||||
return e
|
||||
}
|
||||
|
@ -442,6 +446,7 @@ func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, er
|
|||
Comment: opts.comment,
|
||||
Commented: opts.commented,
|
||||
Multiline: opts.multiline,
|
||||
Literal: opts.literal,
|
||||
}, val)
|
||||
}
|
||||
}
|
||||
|
@ -586,6 +591,7 @@ func (e *Encoder) wrapTomlValue(val interface{}, parent *Tree) interface{} {
|
|||
_, isTree := val.(*Tree)
|
||||
_, isTreeS := val.([]*Tree)
|
||||
if isTree || isTreeS {
|
||||
e.line++
|
||||
return val
|
||||
}
|
||||
|
||||
|
@ -830,7 +836,21 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
|
|||
case reflect.Int32:
|
||||
val, err = strconv.ParseInt(opts.defaultValue, 10, 32)
|
||||
case reflect.Int64:
|
||||
val, err = strconv.ParseInt(opts.defaultValue, 10, 64)
|
||||
// Check if the provided number has a non-numeric extension.
|
||||
var hasExtension bool
|
||||
if len(opts.defaultValue) > 0 {
|
||||
lastChar := opts.defaultValue[len(opts.defaultValue)-1]
|
||||
if lastChar < '0' || lastChar > '9' {
|
||||
hasExtension = true
|
||||
}
|
||||
}
|
||||
// If the value is a time.Duration with extension, parse as duration.
|
||||
// If the value is an int64 or a time.Duration without extension, parse as number.
|
||||
if hasExtension && mvalf.Type().String() == "time.Duration" {
|
||||
val, err = time.ParseDuration(opts.defaultValue)
|
||||
} else {
|
||||
val, err = strconv.ParseInt(opts.defaultValue, 10, 64)
|
||||
}
|
||||
case reflect.Float32:
|
||||
val, err = strconv.ParseFloat(opts.defaultValue, 32)
|
||||
case reflect.Float64:
|
||||
|
@ -1004,8 +1024,18 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}, mval1 *ref
|
|||
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to a slice", tval, tval)
|
||||
default:
|
||||
d.visitor.visit()
|
||||
mvalPtr := reflect.New(mtype)
|
||||
|
||||
// Check if pointer to value implements the Unmarshaler interface.
|
||||
if isCustomUnmarshaler(mvalPtr.Type()) {
|
||||
if err := callCustomUnmarshaler(mvalPtr, tval); err != nil {
|
||||
return reflect.ValueOf(nil), fmt.Errorf("unmarshal toml: %v", err)
|
||||
}
|
||||
return mvalPtr.Elem(), nil
|
||||
}
|
||||
|
||||
// Check if pointer to value implements the encoding.TextUnmarshaler.
|
||||
if mvalPtr := reflect.New(mtype); isTextUnmarshaler(mvalPtr.Type()) && !isTimeType(mtype) {
|
||||
if isTextUnmarshaler(mvalPtr.Type()) && !isTimeType(mtype) {
|
||||
if err := d.unmarshalText(tval, mvalPtr); err != nil {
|
||||
return reflect.ValueOf(nil), fmt.Errorf("unmarshal text: %v", err)
|
||||
}
|
||||
|
@ -1144,6 +1174,7 @@ func tomlOptions(vf reflect.StructField, an annotation) tomlOpts {
|
|||
}
|
||||
commented, _ := strconv.ParseBool(vf.Tag.Get(an.commented))
|
||||
multiline, _ := strconv.ParseBool(vf.Tag.Get(an.multiline))
|
||||
literal, _ := strconv.ParseBool(vf.Tag.Get(an.literal))
|
||||
defaultValue := vf.Tag.Get(tagDefault)
|
||||
result := tomlOpts{
|
||||
name: vf.Name,
|
||||
|
@ -1151,6 +1182,7 @@ func tomlOptions(vf reflect.StructField, an annotation) tomlOpts {
|
|||
comment: comment,
|
||||
commented: commented,
|
||||
multiline: multiline,
|
||||
literal: literal,
|
||||
include: true,
|
||||
omitempty: false,
|
||||
defaultValue: defaultValue,
|
||||
|
|
93
vendor/github.com/pelletier/go-toml/parser.go
generated
vendored
93
vendor/github.com/pelletier/go-toml/parser.go
generated
vendored
|
@ -7,7 +7,6 @@ import (
|
|||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -231,19 +230,38 @@ func (p *tomlParser) parseAssign() tomlParserStateFn {
|
|||
return p.parseStart
|
||||
}
|
||||
|
||||
var numberUnderscoreInvalidRegexp *regexp.Regexp
|
||||
var hexNumberUnderscoreInvalidRegexp *regexp.Regexp
|
||||
var errInvalidUnderscore = errors.New("invalid use of _ in number")
|
||||
|
||||
func numberContainsInvalidUnderscore(value string) error {
|
||||
if numberUnderscoreInvalidRegexp.MatchString(value) {
|
||||
return errors.New("invalid use of _ in number")
|
||||
// For large numbers, you may use underscores between digits to enhance
|
||||
// readability. Each underscore must be surrounded by at least one digit on
|
||||
// each side.
|
||||
|
||||
hasBefore := false
|
||||
for idx, r := range value {
|
||||
if r == '_' {
|
||||
if !hasBefore || idx+1 >= len(value) {
|
||||
// can't end with an underscore
|
||||
return errInvalidUnderscore
|
||||
}
|
||||
}
|
||||
hasBefore = isDigit(r)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var errInvalidUnderscoreHex = errors.New("invalid use of _ in hex number")
|
||||
|
||||
func hexNumberContainsInvalidUnderscore(value string) error {
|
||||
if hexNumberUnderscoreInvalidRegexp.MatchString(value) {
|
||||
return errors.New("invalid use of _ in hex number")
|
||||
hasBefore := false
|
||||
for idx, r := range value {
|
||||
if r == '_' {
|
||||
if !hasBefore || idx+1 >= len(value) {
|
||||
// can't end with an underscore
|
||||
return errInvalidUnderscoreHex
|
||||
}
|
||||
}
|
||||
hasBefore = isHexDigit(r)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -322,42 +340,44 @@ func (p *tomlParser) parseRvalue() interface{} {
|
|||
p.raiseError(tok, "%s", err)
|
||||
}
|
||||
return val
|
||||
case tokenDate:
|
||||
layout := time.RFC3339Nano
|
||||
if !strings.Contains(tok.val, "T") {
|
||||
layout = strings.Replace(layout, "T", " ", 1)
|
||||
}
|
||||
val, err := time.ParseInLocation(layout, tok.val, time.UTC)
|
||||
case tokenLocalTime:
|
||||
val, err := ParseLocalTime(tok.val)
|
||||
if err != nil {
|
||||
p.raiseError(tok, "%s", err)
|
||||
}
|
||||
return val
|
||||
case tokenLocalDate:
|
||||
v := strings.Replace(tok.val, " ", "T", -1)
|
||||
isDateTime := false
|
||||
isTime := false
|
||||
for _, c := range v {
|
||||
if c == 'T' || c == 't' {
|
||||
isDateTime = true
|
||||
break
|
||||
}
|
||||
if c == ':' {
|
||||
isTime = true
|
||||
break
|
||||
// a local date may be followed by:
|
||||
// * nothing: this is a local date
|
||||
// * a local time: this is a local date-time
|
||||
|
||||
next := p.peek()
|
||||
if next == nil || next.typ != tokenLocalTime {
|
||||
val, err := ParseLocalDate(tok.val)
|
||||
if err != nil {
|
||||
p.raiseError(tok, "%s", err)
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
var val interface{}
|
||||
var err error
|
||||
localDate := tok
|
||||
localTime := p.getToken()
|
||||
|
||||
if isDateTime {
|
||||
val, err = ParseLocalDateTime(v)
|
||||
} else if isTime {
|
||||
val, err = ParseLocalTime(v)
|
||||
} else {
|
||||
val, err = ParseLocalDate(v)
|
||||
next = p.peek()
|
||||
if next == nil || next.typ != tokenTimeOffset {
|
||||
v := localDate.val + "T" + localTime.val
|
||||
val, err := ParseLocalDateTime(v)
|
||||
if err != nil {
|
||||
p.raiseError(tok, "%s", err)
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
offset := p.getToken()
|
||||
|
||||
layout := time.RFC3339Nano
|
||||
v := localDate.val + "T" + localTime.val + offset.val
|
||||
val, err := time.ParseInLocation(layout, v, time.UTC)
|
||||
if err != nil {
|
||||
p.raiseError(tok, "%s", err)
|
||||
}
|
||||
|
@ -370,10 +390,10 @@ func (p *tomlParser) parseRvalue() interface{} {
|
|||
p.raiseError(tok, "cannot have multiple equals for the same key")
|
||||
case tokenError:
|
||||
p.raiseError(tok, "%s", tok)
|
||||
default:
|
||||
panic(fmt.Errorf("unhandled token: %v", tok))
|
||||
}
|
||||
|
||||
p.raiseError(tok, "never reached")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -486,8 +506,3 @@ func parseToml(flow []token) *Tree {
|
|||
parser.run()
|
||||
return result
|
||||
}
|
||||
|
||||
func init() {
|
||||
numberUnderscoreInvalidRegexp = regexp.MustCompile(`([^\d]_|_[^\d])|_$|^_`)
|
||||
hexNumberUnderscoreInvalidRegexp = regexp.MustCompile(`(^0x_)|([^\da-f]_|_[^\da-f])|_$|^_`)
|
||||
}
|
||||
|
|
6
vendor/github.com/pelletier/go-toml/token.go
generated
vendored
6
vendor/github.com/pelletier/go-toml/token.go
generated
vendored
|
@ -30,8 +30,9 @@ const (
|
|||
tokenRightParen
|
||||
tokenDoubleLeftBracket
|
||||
tokenDoubleRightBracket
|
||||
tokenDate
|
||||
tokenLocalDate
|
||||
tokenLocalTime
|
||||
tokenTimeOffset
|
||||
tokenKeyGroup
|
||||
tokenKeyGroupArray
|
||||
tokenComma
|
||||
|
@ -66,7 +67,8 @@ var tokenTypeNames = []string{
|
|||
"]]",
|
||||
"[[",
|
||||
"LocalDate",
|
||||
"LocalDate",
|
||||
"LocalTime",
|
||||
"TimeOffset",
|
||||
"KeyGroup",
|
||||
"KeyGroupArray",
|
||||
",",
|
||||
|
|
4
vendor/github.com/pelletier/go-toml/toml.go
generated
vendored
4
vendor/github.com/pelletier/go-toml/toml.go
generated
vendored
|
@ -15,6 +15,7 @@ type tomlValue struct {
|
|||
comment string
|
||||
commented bool
|
||||
multiline bool
|
||||
literal bool
|
||||
position Position
|
||||
}
|
||||
|
||||
|
@ -314,6 +315,7 @@ type SetOptions struct {
|
|||
Comment string
|
||||
Commented bool
|
||||
Multiline bool
|
||||
Literal bool
|
||||
}
|
||||
|
||||
// SetWithOptions is the same as Set, but allows you to provide formatting
|
||||
|
@ -362,12 +364,14 @@ func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interfac
|
|||
v.comment = opts.Comment
|
||||
v.commented = opts.Commented
|
||||
v.multiline = opts.Multiline
|
||||
v.literal = opts.Literal
|
||||
toInsert = v
|
||||
default:
|
||||
toInsert = &tomlValue{value: value,
|
||||
comment: opts.Comment,
|
||||
commented: opts.Commented,
|
||||
multiline: opts.Multiline,
|
||||
literal: opts.Literal,
|
||||
position: Position{Line: subtree.position.Line + len(subtree.values) + 1, Col: subtree.position.Col}}
|
||||
}
|
||||
|
||||
|
|
71
vendor/github.com/pelletier/go-toml/tomlpub.go
generated
vendored
Normal file
71
vendor/github.com/pelletier/go-toml/tomlpub.go
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
package toml
|
||||
|
||||
// PubTOMLValue wrapping tomlValue in order to access all properties from outside.
|
||||
type PubTOMLValue = tomlValue
|
||||
|
||||
func (ptv *PubTOMLValue) Value() interface{} {
|
||||
return ptv.value
|
||||
}
|
||||
func (ptv *PubTOMLValue) Comment() string {
|
||||
return ptv.comment
|
||||
}
|
||||
func (ptv *PubTOMLValue) Commented() bool {
|
||||
return ptv.commented
|
||||
}
|
||||
func (ptv *PubTOMLValue) Multiline() bool {
|
||||
return ptv.multiline
|
||||
}
|
||||
func (ptv *PubTOMLValue) Position() Position {
|
||||
return ptv.position
|
||||
}
|
||||
|
||||
func (ptv *PubTOMLValue) SetValue(v interface{}) {
|
||||
ptv.value = v
|
||||
}
|
||||
func (ptv *PubTOMLValue) SetComment(s string) {
|
||||
ptv.comment = s
|
||||
}
|
||||
func (ptv *PubTOMLValue) SetCommented(c bool) {
|
||||
ptv.commented = c
|
||||
}
|
||||
func (ptv *PubTOMLValue) SetMultiline(m bool) {
|
||||
ptv.multiline = m
|
||||
}
|
||||
func (ptv *PubTOMLValue) SetPosition(p Position) {
|
||||
ptv.position = p
|
||||
}
|
||||
|
||||
// PubTree wrapping Tree in order to access all properties from outside.
|
||||
type PubTree = Tree
|
||||
|
||||
func (pt *PubTree) Values() map[string]interface{} {
|
||||
return pt.values
|
||||
}
|
||||
|
||||
func (pt *PubTree) Comment() string {
|
||||
return pt.comment
|
||||
}
|
||||
|
||||
func (pt *PubTree) Commented() bool {
|
||||
return pt.commented
|
||||
}
|
||||
|
||||
func (pt *PubTree) Inline() bool {
|
||||
return pt.inline
|
||||
}
|
||||
|
||||
func (pt *PubTree) SetValues(v map[string]interface{}) {
|
||||
pt.values = v
|
||||
}
|
||||
|
||||
func (pt *PubTree) SetComment(c string) {
|
||||
pt.comment = c
|
||||
}
|
||||
|
||||
func (pt *PubTree) SetCommented(c bool) {
|
||||
pt.commented = c
|
||||
}
|
||||
|
||||
func (pt *PubTree) SetInline(i bool) {
|
||||
pt.inline = i
|
||||
}
|
40
vendor/github.com/pelletier/go-toml/tomltree_write.go
generated
vendored
40
vendor/github.com/pelletier/go-toml/tomltree_write.go
generated
vendored
|
@ -103,7 +103,7 @@ func encodeTomlString(value string) string {
|
|||
return b.String()
|
||||
}
|
||||
|
||||
func tomlTreeStringRepresentation(t *Tree, ord marshalOrder) (string, error) {
|
||||
func tomlTreeStringRepresentation(t *Tree, ord MarshalOrder) (string, error) {
|
||||
var orderedVals []sortNode
|
||||
switch ord {
|
||||
case OrderPreserve:
|
||||
|
@ -126,7 +126,7 @@ func tomlTreeStringRepresentation(t *Tree, ord marshalOrder) (string, error) {
|
|||
return "{ " + strings.Join(values, ", ") + " }", nil
|
||||
}
|
||||
|
||||
func tomlValueStringRepresentation(v interface{}, commented string, indent string, ord marshalOrder, arraysOneElementPerLine bool) (string, error) {
|
||||
func tomlValueStringRepresentation(v interface{}, commented string, indent string, ord MarshalOrder, arraysOneElementPerLine bool) (string, error) {
|
||||
// this interface check is added to dereference the change made in the writeTo function.
|
||||
// That change was made to allow this function to see formatting options.
|
||||
tv, ok := v.(*tomlValue)
|
||||
|
@ -158,7 +158,15 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
|
|||
return strings.ToLower(strconv.FormatFloat(value, 'f', -1, bits)), nil
|
||||
case string:
|
||||
if tv.multiline {
|
||||
return "\"\"\"\n" + encodeMultilineTomlString(value, commented) + "\"\"\"", nil
|
||||
if tv.literal {
|
||||
b := strings.Builder{}
|
||||
b.WriteString("'''\n")
|
||||
b.Write([]byte(value))
|
||||
b.WriteString("\n'''")
|
||||
return b.String(), nil
|
||||
} else {
|
||||
return "\"\"\"\n" + encodeMultilineTomlString(value, commented) + "\"\"\"", nil
|
||||
}
|
||||
}
|
||||
return "\"" + encodeTomlString(value) + "\"", nil
|
||||
case []byte:
|
||||
|
@ -218,7 +226,9 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
|
|||
}
|
||||
|
||||
func getTreeArrayLine(trees []*Tree) (line int) {
|
||||
// get lowest line number that is not 0
|
||||
// Prevent returning 0 for empty trees
|
||||
line = int(^uint(0) >> 1)
|
||||
// get lowest line number >= 0
|
||||
for _, tv := range trees {
|
||||
if tv.position.Line < line || line == 0 {
|
||||
line = tv.position.Line
|
||||
|
@ -310,7 +320,7 @@ func (t *Tree) writeTo(w io.Writer, indent, keyspace string, bytesCount int64, a
|
|||
return t.writeToOrdered(w, indent, keyspace, bytesCount, arraysOneElementPerLine, OrderAlphabetical, " ", false)
|
||||
}
|
||||
|
||||
func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool, ord marshalOrder, indentString string, parentCommented bool) (int64, error) {
|
||||
func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool, ord MarshalOrder, indentString string, parentCommented bool) (int64, error) {
|
||||
var orderedVals []sortNode
|
||||
|
||||
switch ord {
|
||||
|
@ -510,8 +520,26 @@ func (t *Tree) ToMap() map[string]interface{} {
|
|||
case *Tree:
|
||||
result[k] = node.ToMap()
|
||||
case *tomlValue:
|
||||
result[k] = node.value
|
||||
result[k] = tomlValueToGo(node.value)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func tomlValueToGo(v interface{}) interface{} {
|
||||
if tree, ok := v.(*Tree); ok {
|
||||
return tree.ToMap()
|
||||
}
|
||||
|
||||
rv := reflect.ValueOf(v)
|
||||
|
||||
if rv.Kind() != reflect.Slice {
|
||||
return v
|
||||
}
|
||||
values := make([]interface{}, rv.Len())
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
item := rv.Index(i).Interface()
|
||||
values[i] = tomlValueToGo(item)
|
||||
}
|
||||
return values
|
||||
}
|
||||
|
|
6
vendor/github.com/pelletier/go-toml/tomltree_writepub.go
generated
vendored
Normal file
6
vendor/github.com/pelletier/go-toml/tomltree_writepub.go
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
package toml
|
||||
|
||||
// ValueStringRepresentation transforms an interface{} value into its toml string representation.
|
||||
func ValueStringRepresentation(v interface{}, commented string, indent string, ord MarshalOrder, arraysOneElementPerLine bool) (string, error) {
|
||||
return tomlValueStringRepresentation(v, commented, indent, ord, arraysOneElementPerLine)
|
||||
}
|
3
vendor/modules.txt
vendored
3
vendor/modules.txt
vendored
|
@ -690,7 +690,7 @@ github.com/opentracing-contrib/go-stdlib/nethttp
|
|||
github.com/opentracing/opentracing-go
|
||||
github.com/opentracing/opentracing-go/ext
|
||||
github.com/opentracing/opentracing-go/log
|
||||
# github.com/pelletier/go-toml v1.9.1 => github.com/pelletier/go-toml v1.8.1
|
||||
# github.com/pelletier/go-toml v1.9.1
|
||||
## explicit; go 1.12
|
||||
github.com/pelletier/go-toml
|
||||
# github.com/phayes/permbits v0.0.0-20190612203442-39d7c581d2ee
|
||||
|
@ -1006,7 +1006,6 @@ gotest.tools/v3/skip
|
|||
# github.com/matttproud/golang_protobuf_extensions => github.com/matttproud/golang_protobuf_extensions v1.0.1
|
||||
# github.com/onsi/ginkgo => github.com/onsi/ginkgo v1.8.0
|
||||
# github.com/onsi/gomega => github.com/onsi/gomega v1.5.0
|
||||
# github.com/pelletier/go-toml => github.com/pelletier/go-toml v1.8.1
|
||||
# github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.6.0
|
||||
# github.com/prometheus/common => github.com/prometheus/common v0.9.1
|
||||
# github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.11
|
||||
|
|
Loading…
Reference in a new issue