Merge pull request #5905 from thaJeztah/update_toml
go.mod: github.com/pelletier/go-toml v1.9.3
This commit is contained in:
commit
81317350c4
2
go.mod
2
go.mod
@ -46,7 +46,7 @@ require (
|
|||||||
github.com/opencontainers/runc v1.0.1
|
github.com/opencontainers/runc v1.0.1
|
||||||
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
|
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
|
||||||
github.com/opencontainers/selinux v1.8.2
|
github.com/opencontainers/selinux v1.8.2
|
||||||
github.com/pelletier/go-toml v1.8.1
|
github.com/pelletier/go-toml v1.9.3
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/prometheus/client_golang v1.11.0
|
github.com/prometheus/client_golang v1.11.0
|
||||||
github.com/satori/go.uuid v1.2.0 // indirect
|
github.com/satori/go.uuid v1.2.0 // indirect
|
||||||
|
4
go.sum
4
go.sum
@ -440,8 +440,8 @@ github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xA
|
|||||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM=
|
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
|
||||||
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
@ -411,8 +411,8 @@ github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xA
|
|||||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM=
|
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
|
||||||
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
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!
|
example, anything goes!
|
||||||
|
|
||||||
The documentation is present in the [README][readme] and thorough the
|
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
|
change to the documentation, create a pull request with your proposed
|
||||||
changes. For simple changes like that, the easiest way to go is probably
|
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
|
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
|
[issues-tracker]: https://github.com/pelletier/go-toml/issues
|
||||||
[bug-report]: https://github.com/pelletier/go-toml/issues/new?template=bug_report.md
|
[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
|
[readme]: ./README.md
|
||||||
[fork]: https://help.github.com/articles/fork-a-repo
|
[fork]: https://help.github.com/articles/fork-a-repo
|
||||||
[pull-request]: https://help.github.com/en/articles/creating-a-pull-request
|
[pull-request]: https://help.github.com/en/articles/creating-a-pull-request
|
||||||
|
228
vendor/github.com/pelletier/go-toml/LICENSE
generated
vendored
228
vendor/github.com/pelletier/go-toml/LICENSE
generated
vendored
@ -1,6 +1,16 @@
|
|||||||
|
The bulk of github.com/pelletier/go-toml is distributed under the MIT license
|
||||||
|
(see below), with the exception of localtime.go and localtime.test.go.
|
||||||
|
Those two files have been copied over from Google's civil library at revision
|
||||||
|
ed46f5086358513cf8c25f8e3f022cb838a49d66, and are distributed under the Apache
|
||||||
|
2.0 license (see below).
|
||||||
|
|
||||||
|
|
||||||
|
github.com/pelletier/go-toml:
|
||||||
|
|
||||||
|
|
||||||
The MIT License (MIT)
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -19,3 +29,219 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
localtime.go, localtime_test.go:
|
||||||
|
|
||||||
|
Originals:
|
||||||
|
https://raw.githubusercontent.com/googleapis/google-cloud-go/ed46f5086358513cf8c25f8e3f022cb838a49d66/civil/civil.go
|
||||||
|
https://raw.githubusercontent.com/googleapis/google-cloud-go/ed46f5086358513cf8c25f8e3f022cb838a49d66/civil/civil_test.go
|
||||||
|
Changes:
|
||||||
|
* Renamed files from civil* to localtime*.
|
||||||
|
* Package changed from civil to toml.
|
||||||
|
* 'Local' prefix added to all structs.
|
||||||
|
License:
|
||||||
|
https://raw.githubusercontent.com/googleapis/google-cloud-go/ed46f5086358513cf8c25f8e3f022cb838a49d66/LICENSE
|
||||||
|
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
39
vendor/github.com/pelletier/go-toml/README.md
generated
vendored
39
vendor/github.com/pelletier/go-toml/README.md
generated
vendored
@ -1,17 +1,42 @@
|
|||||||
# go-toml
|
# 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
|
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)
|
||||||
|
|
||||||
[](http://godoc.org/github.com/pelletier/go-toml)
|
[](https://pkg.go.dev/github.com/pelletier/go-toml)
|
||||||
[](https://github.com/pelletier/go-toml/blob/master/LICENSE)
|
[](https://github.com/pelletier/go-toml/blob/master/LICENSE)
|
||||||
[](https://dev.azure.com/pelletierthomas/go-toml-ci/_build/latest?definitionId=1&branchName=master)
|
[](https://dev.azure.com/pelletierthomas/go-toml-ci/_build/latest?definitionId=1&branchName=master)
|
||||||
[](https://codecov.io/gh/pelletier/go-toml)
|
[](https://codecov.io/gh/pelletier/go-toml)
|
||||||
[](https://goreportcard.com/report/github.com/pelletier/go-toml)
|
[](https://goreportcard.com/report/github.com/pelletier/go-toml)
|
||||||
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fpelletier%2Fgo-toml?ref=badge_shield)
|
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fpelletier%2Fgo-toml?ref=badge_shield)
|
||||||
|
|
||||||
|
|
||||||
|
## Development status
|
||||||
|
|
||||||
|
**ℹ️ Consider go-toml v2!**
|
||||||
|
|
||||||
|
The next version of go-toml is in [active development][v2-dev], and
|
||||||
|
[nearing completion][v2-map].
|
||||||
|
|
||||||
|
Though technically in beta, v2 is already more tested, [fixes bugs][v1-bugs],
|
||||||
|
and [much faster][v2-bench]. If you only need reading and writing TOML documents
|
||||||
|
(majority of cases), those features are implemented and the API unlikely to
|
||||||
|
change.
|
||||||
|
|
||||||
|
The remaining features (Document structure editing and tooling) will be added
|
||||||
|
shortly. While pull-requests are welcome on v1, no active development is
|
||||||
|
expected on it. When v2.0.0 is released, v1 will be deprecated.
|
||||||
|
|
||||||
|
👉 [go-toml v2][v2]
|
||||||
|
|
||||||
|
[v2]: https://github.com/pelletier/go-toml/tree/v2
|
||||||
|
[v2-map]: https://github.com/pelletier/go-toml/discussions/506
|
||||||
|
[v2-dev]: https://github.com/pelletier/go-toml/tree/v2
|
||||||
|
[v1-bugs]: https://github.com/pelletier/go-toml/issues?q=is%3Aissue+is%3Aopen+label%3Av2-fixed
|
||||||
|
[v2-bench]: https://github.com/pelletier/go-toml/tree/v2#benchmarks
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
Go-toml provides the following features for using data parsed from TOML documents:
|
Go-toml provides the following features for using data parsed from TOML documents:
|
||||||
@ -81,11 +106,11 @@ for ii, item := range results.Values() {
|
|||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
The documentation and additional examples are available at
|
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
|
## Tools
|
||||||
|
|
||||||
Go-toml provides two handy command line tools:
|
Go-toml provides three handy command line tools:
|
||||||
|
|
||||||
* `tomll`: Reads TOML files and lints them.
|
* `tomll`: Reads TOML files and lints them.
|
||||||
|
|
||||||
@ -109,7 +134,7 @@ Go-toml provides two handy command line tools:
|
|||||||
|
|
||||||
### Docker image
|
### 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
|
[dockerhub](https://hub.docker.com/r/pelletier/go-toml). For example, to
|
||||||
use `tomljson`:
|
use `tomljson`:
|
||||||
|
|
||||||
@ -148,4 +173,4 @@ this document. The last two major versions of Go are supported
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
The MIT License (MIT). Read [LICENSE](LICENSE).
|
The MIT License (MIT) + Apache 2.0. Read [LICENSE](LICENSE).
|
||||||
|
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
|
- master
|
||||||
|
|
||||||
stages:
|
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
|
- stage: run_checks
|
||||||
displayName: "Check"
|
displayName: "Check"
|
||||||
dependsOn: []
|
dependsOn: []
|
||||||
@ -36,9 +12,9 @@ stages:
|
|||||||
vmImage: ubuntu-latest
|
vmImage: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- task: GoTool@0
|
- task: GoTool@0
|
||||||
displayName: "Install Go 1.15"
|
displayName: "Install Go 1.16"
|
||||||
inputs:
|
inputs:
|
||||||
version: "1.15"
|
version: "1.16"
|
||||||
- task: Go@0
|
- task: Go@0
|
||||||
displayName: "go fmt ./..."
|
displayName: "go fmt ./..."
|
||||||
inputs:
|
inputs:
|
||||||
@ -51,9 +27,9 @@ stages:
|
|||||||
vmImage: ubuntu-latest
|
vmImage: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- task: GoTool@0
|
- task: GoTool@0
|
||||||
displayName: "Install Go 1.15"
|
displayName: "Install Go 1.16"
|
||||||
inputs:
|
inputs:
|
||||||
version: "1.15"
|
version: "1.16"
|
||||||
- task: Go@0
|
- task: Go@0
|
||||||
displayName: "Generate coverage"
|
displayName: "Generate coverage"
|
||||||
inputs:
|
inputs:
|
||||||
@ -71,37 +47,28 @@ stages:
|
|||||||
vmImage: ubuntu-latest
|
vmImage: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- task: GoTool@0
|
- task: GoTool@0
|
||||||
displayName: "Install Go 1.15"
|
displayName: "Install Go 1.16"
|
||||||
inputs:
|
inputs:
|
||||||
version: "1.15"
|
version: "1.16"
|
||||||
- script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
|
- script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
|
||||||
- task: Bash@3
|
- task: Bash@3
|
||||||
inputs:
|
inputs:
|
||||||
filePath: './benchmark.sh'
|
filePath: './benchmark.sh'
|
||||||
arguments: "master $(Build.Repository.Uri)"
|
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
|
- job: go_unit_tests
|
||||||
displayName: "unit tests"
|
displayName: "unit tests"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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:
|
linux 1.15:
|
||||||
goVersion: '1.15'
|
goVersion: '1.15'
|
||||||
imageName: 'ubuntu-latest'
|
imageName: 'ubuntu-latest'
|
||||||
@ -111,15 +78,6 @@ stages:
|
|||||||
windows 1.15:
|
windows 1.15:
|
||||||
goVersion: '1.15'
|
goVersion: '1.15'
|
||||||
imageName: 'windows-latest'
|
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:
|
pool:
|
||||||
vmImage: $(imageName)
|
vmImage: $(imageName)
|
||||||
steps:
|
steps:
|
||||||
@ -155,7 +113,7 @@ stages:
|
|||||||
- task: GoTool@0
|
- task: GoTool@0
|
||||||
displayName: "Install Go"
|
displayName: "Install Go"
|
||||||
inputs:
|
inputs:
|
||||||
version: 1.15
|
version: 1.16
|
||||||
- task: Bash@3
|
- task: Bash@3
|
||||||
inputs:
|
inputs:
|
||||||
targetType: inline
|
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}
|
|
2
vendor/github.com/pelletier/go-toml/go.mod
generated
vendored
2
vendor/github.com/pelletier/go-toml/go.mod
generated
vendored
@ -1,5 +1,3 @@
|
|||||||
module github.com/pelletier/go-toml
|
module github.com/pelletier/go-toml
|
||||||
|
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require github.com/davecgh/go-spew v1.1.1
|
|
||||||
|
19
vendor/github.com/pelletier/go-toml/go.sum
generated
vendored
19
vendor/github.com/pelletier/go-toml/go.sum
generated
vendored
@ -1,19 +0,0 @@
|
|||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
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=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c=
|
|
||||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
|
|
||||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
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"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var dateRegexp *regexp.Regexp
|
|
||||||
|
|
||||||
// Define state functions
|
// Define state functions
|
||||||
type tomlLexStateFn func() tomlLexStateFn
|
type tomlLexStateFn func() tomlLexStateFn
|
||||||
|
|
||||||
@ -216,18 +213,12 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
possibleDate := l.peekString(35)
|
if next == '+' || next == '-' {
|
||||||
dateSubmatches := dateRegexp.FindStringSubmatch(possibleDate)
|
return l.lexNumber
|
||||||
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 == '-' || isDigit(next) {
|
if isDigit(next) {
|
||||||
return l.lexNumber
|
return l.lexDateTimeOrNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
return l.errorf("no value can start with %c", next)
|
return l.errorf("no value can start with %c", next)
|
||||||
@ -237,6 +228,32 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
|
|||||||
return nil
|
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 {
|
func (l *tomlLexer) lexLeftCurlyBrace() tomlLexStateFn {
|
||||||
l.next()
|
l.next()
|
||||||
l.emit(tokenLeftCurlyBrace)
|
l.emit(tokenLeftCurlyBrace)
|
||||||
@ -254,14 +271,245 @@ func (l *tomlLexer) lexRightCurlyBrace() tomlLexStateFn {
|
|||||||
return l.lexRvalue
|
return l.lexRvalue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *tomlLexer) lexDate() tomlLexStateFn {
|
func (l *tomlLexer) lexDateTimeOrTime() tomlLexStateFn {
|
||||||
l.emit(tokenDate)
|
// 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
|
return l.lexRvalue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *tomlLexer) lexLocalDate() tomlLexStateFn {
|
func (l *tomlLexer) lexTime() tomlLexStateFn {
|
||||||
l.emit(tokenLocalDate)
|
// 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
|
return l.lexRvalue
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *tomlLexer) lexTrue() tomlLexStateFn {
|
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
|
// Entry point
|
||||||
func lexToml(inputBytes []byte) []token {
|
func lexToml(inputBytes []byte) []token {
|
||||||
runes := bytes.Runes(inputBytes)
|
runes := bytes.Runes(inputBytes)
|
||||||
|
10
vendor/github.com/pelletier/go-toml/localtime.go
generated
vendored
10
vendor/github.com/pelletier/go-toml/localtime.go
generated
vendored
@ -1,6 +1,12 @@
|
|||||||
// Implementation of TOML's local date/time.
|
// Implementation of TOML's local date/time.
|
||||||
// Copied over from https://github.com/googleapis/google-cloud-go/blob/master/civil/civil.go
|
//
|
||||||
// to avoid pulling all the Google dependencies.
|
// Copied over from Google's civil to avoid pulling all the Google dependencies.
|
||||||
|
// Originals:
|
||||||
|
// https://raw.githubusercontent.com/googleapis/google-cloud-go/ed46f5086358513cf8c25f8e3f022cb838a49d66/civil/civil.go
|
||||||
|
// Changes:
|
||||||
|
// * Renamed files from civil* to localtime*.
|
||||||
|
// * Package changed from civil to toml.
|
||||||
|
// * 'Local' prefix added to all structs.
|
||||||
//
|
//
|
||||||
// Copyright 2016 Google LLC
|
// Copyright 2016 Google LLC
|
||||||
//
|
//
|
||||||
|
51
vendor/github.com/pelletier/go-toml/marshal.go
generated
vendored
51
vendor/github.com/pelletier/go-toml/marshal.go
generated
vendored
@ -18,6 +18,7 @@ const (
|
|||||||
tagFieldComment = "comment"
|
tagFieldComment = "comment"
|
||||||
tagCommented = "commented"
|
tagCommented = "commented"
|
||||||
tagMultiline = "multiline"
|
tagMultiline = "multiline"
|
||||||
|
tagLiteral = "literal"
|
||||||
tagDefault = "default"
|
tagDefault = "default"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ type tomlOpts struct {
|
|||||||
comment string
|
comment string
|
||||||
commented bool
|
commented bool
|
||||||
multiline bool
|
multiline bool
|
||||||
|
literal bool
|
||||||
include bool
|
include bool
|
||||||
omitempty bool
|
omitempty bool
|
||||||
defaultValue string
|
defaultValue string
|
||||||
@ -46,6 +48,7 @@ type annotation struct {
|
|||||||
comment string
|
comment string
|
||||||
commented string
|
commented string
|
||||||
multiline string
|
multiline string
|
||||||
|
literal string
|
||||||
defaultValue string
|
defaultValue string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,15 +57,16 @@ var annotationDefault = annotation{
|
|||||||
comment: tagFieldComment,
|
comment: tagFieldComment,
|
||||||
commented: tagCommented,
|
commented: tagCommented,
|
||||||
multiline: tagMultiline,
|
multiline: tagMultiline,
|
||||||
|
literal: tagLiteral,
|
||||||
defaultValue: tagDefault,
|
defaultValue: tagDefault,
|
||||||
}
|
}
|
||||||
|
|
||||||
type marshalOrder int
|
type MarshalOrder int
|
||||||
|
|
||||||
// Orders the Encoder can write the fields to the output stream.
|
// Orders the Encoder can write the fields to the output stream.
|
||||||
const (
|
const (
|
||||||
// Sort fields alphabetically.
|
// 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
|
// Preserve the order the fields are encountered. For example, the order of fields in
|
||||||
// a struct.
|
// a struct.
|
||||||
OrderPreserve
|
OrderPreserve
|
||||||
@ -256,8 +260,9 @@ type Encoder struct {
|
|||||||
annotation
|
annotation
|
||||||
line int
|
line int
|
||||||
col int
|
col int
|
||||||
order marshalOrder
|
order MarshalOrder
|
||||||
promoteAnon bool
|
promoteAnon bool
|
||||||
|
compactComments bool
|
||||||
indentation string
|
indentation string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +322,7 @@ func (e *Encoder) ArraysWithOneElementPerLine(v bool) *Encoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Order allows to change in which order fields will be written to the output stream.
|
// 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
|
e.order = ord
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
@ -365,6 +370,12 @@ func (e *Encoder) PromoteAnonymous(promote bool) *Encoder {
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CompactComments removes the new line before each comment in the tree.
|
||||||
|
func (e *Encoder) CompactComments(cc bool) *Encoder {
|
||||||
|
e.compactComments = cc
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
func (e *Encoder) marshal(v interface{}) ([]byte, error) {
|
func (e *Encoder) marshal(v interface{}) ([]byte, error) {
|
||||||
// Check if indentation is valid
|
// Check if indentation is valid
|
||||||
for _, char := range e.indentation {
|
for _, char := range e.indentation {
|
||||||
@ -404,7 +415,7 @@ func (e *Encoder) marshal(v interface{}) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
_, err = t.writeToOrdered(&buf, "", "", 0, e.arraysOneElementPerLine, e.order, e.indentation, false)
|
_, err = t.writeToOrdered(&buf, "", "", 0, e.arraysOneElementPerLine, e.order, e.indentation, e.compactComments, false)
|
||||||
|
|
||||||
return buf.Bytes(), err
|
return buf.Bytes(), err
|
||||||
}
|
}
|
||||||
@ -442,6 +453,7 @@ func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, er
|
|||||||
Comment: opts.comment,
|
Comment: opts.comment,
|
||||||
Commented: opts.commented,
|
Commented: opts.commented,
|
||||||
Multiline: opts.multiline,
|
Multiline: opts.multiline,
|
||||||
|
Literal: opts.literal,
|
||||||
}, val)
|
}, val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -586,6 +598,7 @@ func (e *Encoder) wrapTomlValue(val interface{}, parent *Tree) interface{} {
|
|||||||
_, isTree := val.(*Tree)
|
_, isTree := val.(*Tree)
|
||||||
_, isTreeS := val.([]*Tree)
|
_, isTreeS := val.([]*Tree)
|
||||||
if isTree || isTreeS {
|
if isTree || isTreeS {
|
||||||
|
e.line++
|
||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,7 +843,21 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
|
|||||||
case reflect.Int32:
|
case reflect.Int32:
|
||||||
val, err = strconv.ParseInt(opts.defaultValue, 10, 32)
|
val, err = strconv.ParseInt(opts.defaultValue, 10, 32)
|
||||||
case reflect.Int64:
|
case reflect.Int64:
|
||||||
|
// 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)
|
val, err = strconv.ParseInt(opts.defaultValue, 10, 64)
|
||||||
|
}
|
||||||
case reflect.Float32:
|
case reflect.Float32:
|
||||||
val, err = strconv.ParseFloat(opts.defaultValue, 32)
|
val, err = strconv.ParseFloat(opts.defaultValue, 32)
|
||||||
case reflect.Float64:
|
case reflect.Float64:
|
||||||
@ -1004,8 +1031,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)
|
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to a slice", tval, tval)
|
||||||
default:
|
default:
|
||||||
d.visitor.visit()
|
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.
|
// 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 {
|
if err := d.unmarshalText(tval, mvalPtr); err != nil {
|
||||||
return reflect.ValueOf(nil), fmt.Errorf("unmarshal text: %v", err)
|
return reflect.ValueOf(nil), fmt.Errorf("unmarshal text: %v", err)
|
||||||
}
|
}
|
||||||
@ -1144,6 +1181,7 @@ func tomlOptions(vf reflect.StructField, an annotation) tomlOpts {
|
|||||||
}
|
}
|
||||||
commented, _ := strconv.ParseBool(vf.Tag.Get(an.commented))
|
commented, _ := strconv.ParseBool(vf.Tag.Get(an.commented))
|
||||||
multiline, _ := strconv.ParseBool(vf.Tag.Get(an.multiline))
|
multiline, _ := strconv.ParseBool(vf.Tag.Get(an.multiline))
|
||||||
|
literal, _ := strconv.ParseBool(vf.Tag.Get(an.literal))
|
||||||
defaultValue := vf.Tag.Get(tagDefault)
|
defaultValue := vf.Tag.Get(tagDefault)
|
||||||
result := tomlOpts{
|
result := tomlOpts{
|
||||||
name: vf.Name,
|
name: vf.Name,
|
||||||
@ -1151,6 +1189,7 @@ func tomlOptions(vf reflect.StructField, an annotation) tomlOpts {
|
|||||||
comment: comment,
|
comment: comment,
|
||||||
commented: commented,
|
commented: commented,
|
||||||
multiline: multiline,
|
multiline: multiline,
|
||||||
|
literal: literal,
|
||||||
include: true,
|
include: true,
|
||||||
omitempty: false,
|
omitempty: false,
|
||||||
defaultValue: defaultValue,
|
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"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -231,19 +230,38 @@ func (p *tomlParser) parseAssign() tomlParserStateFn {
|
|||||||
return p.parseStart
|
return p.parseStart
|
||||||
}
|
}
|
||||||
|
|
||||||
var numberUnderscoreInvalidRegexp *regexp.Regexp
|
var errInvalidUnderscore = errors.New("invalid use of _ in number")
|
||||||
var hexNumberUnderscoreInvalidRegexp *regexp.Regexp
|
|
||||||
|
|
||||||
func numberContainsInvalidUnderscore(value string) error {
|
func numberContainsInvalidUnderscore(value string) error {
|
||||||
if numberUnderscoreInvalidRegexp.MatchString(value) {
|
// For large numbers, you may use underscores between digits to enhance
|
||||||
return errors.New("invalid use of _ in number")
|
// 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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errInvalidUnderscoreHex = errors.New("invalid use of _ in hex number")
|
||||||
|
|
||||||
func hexNumberContainsInvalidUnderscore(value string) error {
|
func hexNumberContainsInvalidUnderscore(value string) error {
|
||||||
if hexNumberUnderscoreInvalidRegexp.MatchString(value) {
|
hasBefore := false
|
||||||
return errors.New("invalid use of _ in hex number")
|
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
|
return nil
|
||||||
}
|
}
|
||||||
@ -322,42 +340,44 @@ func (p *tomlParser) parseRvalue() interface{} {
|
|||||||
p.raiseError(tok, "%s", err)
|
p.raiseError(tok, "%s", err)
|
||||||
}
|
}
|
||||||
return val
|
return val
|
||||||
case tokenDate:
|
case tokenLocalTime:
|
||||||
layout := time.RFC3339Nano
|
val, err := ParseLocalTime(tok.val)
|
||||||
if !strings.Contains(tok.val, "T") {
|
|
||||||
layout = strings.Replace(layout, "T", " ", 1)
|
|
||||||
}
|
|
||||||
val, err := time.ParseInLocation(layout, tok.val, time.UTC)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.raiseError(tok, "%s", err)
|
p.raiseError(tok, "%s", err)
|
||||||
}
|
}
|
||||||
return val
|
return val
|
||||||
case tokenLocalDate:
|
case tokenLocalDate:
|
||||||
v := strings.Replace(tok.val, " ", "T", -1)
|
// a local date may be followed by:
|
||||||
isDateTime := false
|
// * nothing: this is a local date
|
||||||
isTime := false
|
// * a local time: this is a local date-time
|
||||||
for _, c := range v {
|
|
||||||
if c == 'T' || c == 't' {
|
next := p.peek()
|
||||||
isDateTime = true
|
if next == nil || next.typ != tokenLocalTime {
|
||||||
break
|
val, err := ParseLocalDate(tok.val)
|
||||||
}
|
if err != nil {
|
||||||
if c == ':' {
|
p.raiseError(tok, "%s", err)
|
||||||
isTime = true
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
var val interface{}
|
localDate := tok
|
||||||
var err error
|
localTime := p.getToken()
|
||||||
|
|
||||||
if isDateTime {
|
next = p.peek()
|
||||||
val, err = ParseLocalDateTime(v)
|
if next == nil || next.typ != tokenTimeOffset {
|
||||||
} else if isTime {
|
v := localDate.val + "T" + localTime.val
|
||||||
val, err = ParseLocalTime(v)
|
val, err := ParseLocalDateTime(v)
|
||||||
} else {
|
if err != nil {
|
||||||
val, err = ParseLocalDate(v)
|
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 {
|
if err != nil {
|
||||||
p.raiseError(tok, "%s", err)
|
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")
|
p.raiseError(tok, "cannot have multiple equals for the same key")
|
||||||
case tokenError:
|
case tokenError:
|
||||||
p.raiseError(tok, "%s", tok)
|
p.raiseError(tok, "%s", tok)
|
||||||
|
default:
|
||||||
|
panic(fmt.Errorf("unhandled token: %v", tok))
|
||||||
}
|
}
|
||||||
|
|
||||||
p.raiseError(tok, "never reached")
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,8 +506,3 @@ func parseToml(flow []token) *Tree {
|
|||||||
parser.run()
|
parser.run()
|
||||||
return result
|
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
|
tokenRightParen
|
||||||
tokenDoubleLeftBracket
|
tokenDoubleLeftBracket
|
||||||
tokenDoubleRightBracket
|
tokenDoubleRightBracket
|
||||||
tokenDate
|
|
||||||
tokenLocalDate
|
tokenLocalDate
|
||||||
|
tokenLocalTime
|
||||||
|
tokenTimeOffset
|
||||||
tokenKeyGroup
|
tokenKeyGroup
|
||||||
tokenKeyGroupArray
|
tokenKeyGroupArray
|
||||||
tokenComma
|
tokenComma
|
||||||
@ -66,7 +67,8 @@ var tokenTypeNames = []string{
|
|||||||
"]]",
|
"]]",
|
||||||
"[[",
|
"[[",
|
||||||
"LocalDate",
|
"LocalDate",
|
||||||
"LocalDate",
|
"LocalTime",
|
||||||
|
"TimeOffset",
|
||||||
"KeyGroup",
|
"KeyGroup",
|
||||||
"KeyGroupArray",
|
"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
|
comment string
|
||||||
commented bool
|
commented bool
|
||||||
multiline bool
|
multiline bool
|
||||||
|
literal bool
|
||||||
position Position
|
position Position
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,6 +315,7 @@ type SetOptions struct {
|
|||||||
Comment string
|
Comment string
|
||||||
Commented bool
|
Commented bool
|
||||||
Multiline bool
|
Multiline bool
|
||||||
|
Literal bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetWithOptions is the same as Set, but allows you to provide formatting
|
// 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.comment = opts.Comment
|
||||||
v.commented = opts.Commented
|
v.commented = opts.Commented
|
||||||
v.multiline = opts.Multiline
|
v.multiline = opts.Multiline
|
||||||
|
v.literal = opts.Literal
|
||||||
toInsert = v
|
toInsert = v
|
||||||
default:
|
default:
|
||||||
toInsert = &tomlValue{value: value,
|
toInsert = &tomlValue{value: value,
|
||||||
comment: opts.Comment,
|
comment: opts.Comment,
|
||||||
commented: opts.Commented,
|
commented: opts.Commented,
|
||||||
multiline: opts.Multiline,
|
multiline: opts.Multiline,
|
||||||
|
literal: opts.Literal,
|
||||||
position: Position{Line: subtree.position.Line + len(subtree.values) + 1, Col: subtree.position.Col}}
|
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
|
||||||
|
}
|
53
vendor/github.com/pelletier/go-toml/tomltree_write.go
generated
vendored
53
vendor/github.com/pelletier/go-toml/tomltree_write.go
generated
vendored
@ -103,7 +103,7 @@ func encodeTomlString(value string) string {
|
|||||||
return b.String()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func tomlTreeStringRepresentation(t *Tree, ord marshalOrder) (string, error) {
|
func tomlTreeStringRepresentation(t *Tree, ord MarshalOrder) (string, error) {
|
||||||
var orderedVals []sortNode
|
var orderedVals []sortNode
|
||||||
switch ord {
|
switch ord {
|
||||||
case OrderPreserve:
|
case OrderPreserve:
|
||||||
@ -126,7 +126,7 @@ func tomlTreeStringRepresentation(t *Tree, ord marshalOrder) (string, error) {
|
|||||||
return "{ " + strings.Join(values, ", ") + " }", nil
|
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.
|
// 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.
|
// That change was made to allow this function to see formatting options.
|
||||||
tv, ok := v.(*tomlValue)
|
tv, ok := v.(*tomlValue)
|
||||||
@ -158,8 +158,16 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
|
|||||||
return strings.ToLower(strconv.FormatFloat(value, 'f', -1, bits)), nil
|
return strings.ToLower(strconv.FormatFloat(value, 'f', -1, bits)), nil
|
||||||
case string:
|
case string:
|
||||||
if tv.multiline {
|
if tv.multiline {
|
||||||
|
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 "\"\"\"\n" + encodeMultilineTomlString(value, commented) + "\"\"\"", nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return "\"" + encodeTomlString(value) + "\"", nil
|
return "\"" + encodeTomlString(value) + "\"", nil
|
||||||
case []byte:
|
case []byte:
|
||||||
b, _ := v.([]byte)
|
b, _ := v.([]byte)
|
||||||
@ -218,7 +226,9 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getTreeArrayLine(trees []*Tree) (line int) {
|
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 {
|
for _, tv := range trees {
|
||||||
if tv.position.Line < line || line == 0 {
|
if tv.position.Line < line || line == 0 {
|
||||||
line = tv.position.Line
|
line = tv.position.Line
|
||||||
@ -307,10 +317,10 @@ func sortAlphabetical(t *Tree) (vals []sortNode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tree) writeTo(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool) (int64, error) {
|
func (t *Tree) writeTo(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool) (int64, error) {
|
||||||
return t.writeToOrdered(w, indent, keyspace, bytesCount, arraysOneElementPerLine, OrderAlphabetical, " ", false)
|
return t.writeToOrdered(w, indent, keyspace, bytesCount, arraysOneElementPerLine, OrderAlphabetical, " ", false, 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, compactComments, parentCommented bool) (int64, error) {
|
||||||
var orderedVals []sortNode
|
var orderedVals []sortNode
|
||||||
|
|
||||||
switch ord {
|
switch ord {
|
||||||
@ -360,7 +370,7 @@ func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount i
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return bytesCount, err
|
return bytesCount, err
|
||||||
}
|
}
|
||||||
bytesCount, err = node.writeToOrdered(w, indent+indentString, combinedKey, bytesCount, arraysOneElementPerLine, ord, indentString, parentCommented || t.commented || tv.commented)
|
bytesCount, err = node.writeToOrdered(w, indent+indentString, combinedKey, bytesCount, arraysOneElementPerLine, ord, indentString, compactComments, parentCommented || t.commented || tv.commented)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return bytesCount, err
|
return bytesCount, err
|
||||||
}
|
}
|
||||||
@ -376,7 +386,7 @@ func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount i
|
|||||||
return bytesCount, err
|
return bytesCount, err
|
||||||
}
|
}
|
||||||
|
|
||||||
bytesCount, err = subTree.writeToOrdered(w, indent+indentString, combinedKey, bytesCount, arraysOneElementPerLine, ord, indentString, parentCommented || t.commented || subTree.commented)
|
bytesCount, err = subTree.writeToOrdered(w, indent+indentString, combinedKey, bytesCount, arraysOneElementPerLine, ord, indentString, compactComments, parentCommented || t.commented || subTree.commented)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return bytesCount, err
|
return bytesCount, err
|
||||||
}
|
}
|
||||||
@ -404,7 +414,14 @@ func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount i
|
|||||||
if strings.HasPrefix(comment, "#") {
|
if strings.HasPrefix(comment, "#") {
|
||||||
start = ""
|
start = ""
|
||||||
}
|
}
|
||||||
writtenBytesCountComment, errc := writeStrings(w, "\n", indent, start, comment, "\n")
|
if !compactComments {
|
||||||
|
writtenBytesCountComment, errc := writeStrings(w, "\n")
|
||||||
|
bytesCount += int64(writtenBytesCountComment)
|
||||||
|
if errc != nil {
|
||||||
|
return bytesCount, errc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writtenBytesCountComment, errc := writeStrings(w, indent, start, comment, "\n")
|
||||||
bytesCount += int64(writtenBytesCountComment)
|
bytesCount += int64(writtenBytesCountComment)
|
||||||
if errc != nil {
|
if errc != nil {
|
||||||
return bytesCount, errc
|
return bytesCount, errc
|
||||||
@ -510,8 +527,26 @@ func (t *Tree) ToMap() map[string]interface{} {
|
|||||||
case *Tree:
|
case *Tree:
|
||||||
result[k] = node.ToMap()
|
result[k] = node.ToMap()
|
||||||
case *tomlValue:
|
case *tomlValue:
|
||||||
result[k] = node.value
|
result[k] = tomlValueToGo(node.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
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)
|
||||||
|
}
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -318,7 +318,7 @@ github.com/opencontainers/runtime-spec/specs-go
|
|||||||
github.com/opencontainers/selinux/go-selinux
|
github.com/opencontainers/selinux/go-selinux
|
||||||
github.com/opencontainers/selinux/go-selinux/label
|
github.com/opencontainers/selinux/go-selinux/label
|
||||||
github.com/opencontainers/selinux/pkg/pwalk
|
github.com/opencontainers/selinux/pkg/pwalk
|
||||||
# github.com/pelletier/go-toml v1.8.1
|
# github.com/pelletier/go-toml v1.9.3
|
||||||
## explicit
|
## explicit
|
||||||
github.com/pelletier/go-toml
|
github.com/pelletier/go-toml
|
||||||
# github.com/pkg/errors v0.9.1
|
# github.com/pkg/errors v0.9.1
|
||||||
|
Loading…
Reference in New Issue
Block a user