You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/02/19 03:42:27 UTC
[18/20] incubator-mynewt-newt git commit: Remove Godeps;
user can acquire deps via "go get".
Remove Godeps; user can acquire deps via "go get".
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/c08cb449
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/c08cb449
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/c08cb449
Branch: refs/heads/master
Commit: c08cb449d319d35d8452fa0aecde7c3fdc11e14a
Parents: 030e1cf
Author: Christopher Collins <cc...@gmail.com>
Authored: Thu Feb 18 18:01:02 2016 -0800
Committer: Christopher Collins <cc...@gmail.com>
Committed: Thu Feb 18 18:01:02 2016 -0800
----------------------------------------------------------------------
newt/Godeps/Godeps.json | 65 -
newt/Godeps/Readme | 5 -
newt/Godeps/_workspace/.gitignore | 2 -
.../src/github.com/BurntSushi/toml/.gitignore | 5 -
.../src/github.com/BurntSushi/toml/.travis.yml | 12 -
.../src/github.com/BurntSushi/toml/COMPATIBLE | 3 -
.../src/github.com/BurntSushi/toml/COPYING | 14 -
.../src/github.com/BurntSushi/toml/Makefile | 19 -
.../src/github.com/BurntSushi/toml/README.md | 220 -
.../toml/cmd/toml-test-decoder/COPYING | 14 -
.../toml/cmd/toml-test-decoder/README.md | 14 -
.../toml/cmd/toml-test-decoder/main.go | 90 -
.../toml/cmd/toml-test-encoder/COPYING | 14 -
.../toml/cmd/toml-test-encoder/README.md | 14 -
.../toml/cmd/toml-test-encoder/main.go | 131 -
.../BurntSushi/toml/cmd/tomlv/COPYING | 14 -
.../BurntSushi/toml/cmd/tomlv/README.md | 22 -
.../BurntSushi/toml/cmd/tomlv/main.go | 61 -
.../src/github.com/BurntSushi/toml/decode.go | 492 -
.../github.com/BurntSushi/toml/decode_meta.go | 122 -
.../github.com/BurntSushi/toml/decode_test.go | 950 -
.../src/github.com/BurntSushi/toml/doc.go | 27 -
.../src/github.com/BurntSushi/toml/encode.go | 551 -
.../github.com/BurntSushi/toml/encode_test.go | 542 -
.../BurntSushi/toml/encoding_types.go | 19 -
.../BurntSushi/toml/encoding_types_1.1.go | 18 -
.../src/github.com/BurntSushi/toml/lex.go | 874 -
.../src/github.com/BurntSushi/toml/parse.go | 498 -
.../src/github.com/BurntSushi/toml/session.vim | 1 -
.../github.com/BurntSushi/toml/type_check.go | 91 -
.../github.com/BurntSushi/toml/type_fields.go | 241 -
.../github.com/hashicorp/logutils/.gitignore | 22 -
.../src/github.com/hashicorp/logutils/LICENSE | 354 -
.../src/github.com/hashicorp/logutils/README.md | 36 -
.../src/github.com/hashicorp/logutils/level.go | 81 -
.../hashicorp/logutils/level_benchmark_test.go | 37 -
.../github.com/hashicorp/logutils/level_test.go | 94 -
.../inconshreveable/mousetrap/LICENSE | 13 -
.../inconshreveable/mousetrap/README.md | 23 -
.../inconshreveable/mousetrap/trap_others.go | 15 -
.../inconshreveable/mousetrap/trap_windows.go | 98 -
.../mousetrap/trap_windows_1.4.go | 46 -
.../src/github.com/kr/pretty/.gitignore | 4 -
.../_workspace/src/github.com/kr/pretty/License | 21 -
.../_workspace/src/github.com/kr/pretty/Readme | 9 -
.../_workspace/src/github.com/kr/pretty/diff.go | 158 -
.../src/github.com/kr/pretty/diff_test.go | 74 -
.../src/github.com/kr/pretty/example_test.go | 20 -
.../src/github.com/kr/pretty/formatter.go | 337 -
.../src/github.com/kr/pretty/formatter_test.go | 261 -
.../src/github.com/kr/pretty/pretty.go | 98 -
.../_workspace/src/github.com/kr/pretty/zero.go | 41 -
.../_workspace/src/github.com/kr/text/License | 19 -
.../_workspace/src/github.com/kr/text/Readme | 3 -
.../src/github.com/kr/text/colwriter/Readme | 5 -
.../src/github.com/kr/text/colwriter/column.go | 147 -
.../github.com/kr/text/colwriter/column_test.go | 90 -
.../_workspace/src/github.com/kr/text/doc.go | 3 -
.../_workspace/src/github.com/kr/text/indent.go | 74 -
.../src/github.com/kr/text/indent_test.go | 119 -
.../_workspace/src/github.com/kr/text/mc/Readme | 9 -
.../_workspace/src/github.com/kr/text/mc/mc.go | 62 -
.../_workspace/src/github.com/kr/text/wrap.go | 86 -
.../src/github.com/kr/text/wrap_test.go | 44 -
.../github.com/magiconair/properties/.gitignore | 2 -
.../magiconair/properties/.travis.yml | 5 -
.../github.com/magiconair/properties/LICENSE | 25 -
.../github.com/magiconair/properties/README.md | 121 -
.../magiconair/properties/benchmark_test.go | 22 -
.../src/github.com/magiconair/properties/doc.go | 135 -
.../magiconair/properties/example_test.go | 93 -
.../src/github.com/magiconair/properties/lex.go | 409 -
.../github.com/magiconair/properties/load.go | 124 -
.../magiconair/properties/load_test.go | 137 -
.../github.com/magiconair/properties/parser.go | 95 -
.../magiconair/properties/properties.go | 698 -
.../magiconair/properties/properties_test.go | 846 -
.../magiconair/properties/rangecheck.go | 31 -
.../src/github.com/mattn/go-sqlite3/.gitignore | 3 -
.../src/github.com/mattn/go-sqlite3/.travis.yml | 9 -
.../src/github.com/mattn/go-sqlite3/LICENSE | 21 -
.../src/github.com/mattn/go-sqlite3/README.md | 62 -
.../src/github.com/mattn/go-sqlite3/backup.go | 70 -
.../src/github.com/mattn/go-sqlite3/doc.go | 95 -
.../src/github.com/mattn/go-sqlite3/error.go | 128 -
.../github.com/mattn/go-sqlite3/error_test.go | 242 -
.../mattn/go-sqlite3/sqlite3-binding.c | 147782 ----------------
.../mattn/go-sqlite3/sqlite3-binding.h | 7478 -
.../src/github.com/mattn/go-sqlite3/sqlite3.go | 675 -
.../mattn/go-sqlite3/sqlite3_fts3_test.go | 83 -
.../mattn/go-sqlite3/sqlite3_other.go | 13 -
.../github.com/mattn/go-sqlite3/sqlite3_test.go | 1058 -
.../mattn/go-sqlite3/sqlite3_test/sqltest.go | 412 -
.../mattn/go-sqlite3/sqlite3_windows.go | 14 -
.../github.com/mattn/go-sqlite3/sqlite3ext.h | 487 -
.../mitchellh/mapstructure/.travis.yml | 7 -
.../github.com/mitchellh/mapstructure/LICENSE | 21 -
.../github.com/mitchellh/mapstructure/README.md | 46 -
.../mitchellh/mapstructure/decode_hooks.go | 151 -
.../mitchellh/mapstructure/decode_hooks_test.go | 229 -
.../github.com/mitchellh/mapstructure/error.go | 50 -
.../mitchellh/mapstructure/mapstructure.go | 745 -
.../mapstructure/mapstructure_benchmark_test.go | 243 -
.../mapstructure/mapstructure_bugs_test.go | 47 -
.../mapstructure/mapstructure_examples_test.go | 203 -
.../mitchellh/mapstructure/mapstructure_test.go | 999 -
.../src/github.com/spf13/cast/.gitignore | 23 -
.../src/github.com/spf13/cast/LICENSE | 21 -
.../src/github.com/spf13/cast/README.md | 72 -
.../src/github.com/spf13/cast/cast.go | 68 -
.../src/github.com/spf13/cast/cast_test.go | 117 -
.../src/github.com/spf13/cast/caste.go | 378 -
.../src/github.com/spf13/cobra/.gitignore | 24 -
.../src/github.com/spf13/cobra/.travis.yml | 8 -
.../src/github.com/spf13/cobra/LICENSE.txt | 174 -
.../src/github.com/spf13/cobra/README.md | 485 -
.../github.com/spf13/cobra/bash_completions.go | 370 -
.../github.com/spf13/cobra/bash_completions.md | 149 -
.../spf13/cobra/bash_completions_test.go | 80 -
.../src/github.com/spf13/cobra/cobra.go | 112 -
.../src/github.com/spf13/cobra/cobra_test.go | 965 -
.../src/github.com/spf13/cobra/command.go | 1032 -
.../src/github.com/spf13/cobra/command_test.go | 90 -
.../src/github.com/spf13/cobra/md_docs.go | 138 -
.../src/github.com/spf13/cobra/md_docs.md | 81 -
.../src/github.com/spf13/cobra/md_docs_test.go | 67 -
.../spf13/jwalterweatherman/.gitignore | 22 -
.../github.com/spf13/jwalterweatherman/LICENSE | 21 -
.../spf13/jwalterweatherman/README.md | 158 -
.../spf13/jwalterweatherman/jww_test.go | 56 -
.../thatswhyyoualwaysleaveanote.go | 183 -
.../src/github.com/spf13/pflag/.travis.yml | 8 -
.../src/github.com/spf13/pflag/LICENSE | 28 -
.../src/github.com/spf13/pflag/README.md | 228 -
.../src/github.com/spf13/pflag/bool.go | 97 -
.../src/github.com/spf13/pflag/bool_test.go | 180 -
.../src/github.com/spf13/pflag/duration.go | 86 -
.../src/github.com/spf13/pflag/example_test.go | 77 -
.../src/github.com/spf13/pflag/export_test.go | 29 -
.../src/github.com/spf13/pflag/flag.go | 749 -
.../src/github.com/spf13/pflag/flag_test.go | 755 -
.../src/github.com/spf13/pflag/float32.go | 91 -
.../src/github.com/spf13/pflag/float64.go | 87 -
.../src/github.com/spf13/pflag/int.go | 87 -
.../src/github.com/spf13/pflag/int32.go | 91 -
.../src/github.com/spf13/pflag/int64.go | 87 -
.../src/github.com/spf13/pflag/int8.go | 91 -
.../src/github.com/spf13/pflag/int_slice.go | 113 -
.../github.com/spf13/pflag/int_slice_test.go | 49 -
.../_workspace/src/github.com/spf13/pflag/ip.go | 93 -
.../src/github.com/spf13/pflag/ipmask.go | 122 -
.../src/github.com/spf13/pflag/string.go | 82 -
.../src/github.com/spf13/pflag/string_slice.go | 86 -
.../github.com/spf13/pflag/string_slice_test.go | 44 -
.../src/github.com/spf13/pflag/uint.go | 91 -
.../src/github.com/spf13/pflag/uint16.go | 89 -
.../src/github.com/spf13/pflag/uint32.go | 89 -
.../src/github.com/spf13/pflag/uint64.go | 91 -
.../src/github.com/spf13/pflag/uint8.go | 91 -
.../src/github.com/spf13/viper/.gitignore | 23 -
.../src/github.com/spf13/viper/.travis.yml | 8 -
.../src/github.com/spf13/viper/LICENSE | 21 -
.../src/github.com/spf13/viper/README.md | 445 -
.../src/github.com/spf13/viper/remote/remote.go | 77 -
.../src/github.com/spf13/viper/util.go | 198 -
.../src/github.com/spf13/viper/viper.go | 982 -
.../src/github.com/spf13/viper/viper_test.go | 559 -
.../_workspace/src/gopkg.in/yaml.v2/LICENSE | 188 -
.../src/gopkg.in/yaml.v2/LICENSE.libyaml | 31 -
.../_workspace/src/gopkg.in/yaml.v2/README.md | 128 -
.../_workspace/src/gopkg.in/yaml.v2/apic.go | 742 -
.../_workspace/src/gopkg.in/yaml.v2/decode.go | 683 -
.../src/gopkg.in/yaml.v2/decode_test.go | 966 -
.../_workspace/src/gopkg.in/yaml.v2/emitterc.go | 1685 -
.../_workspace/src/gopkg.in/yaml.v2/encode.go | 306 -
.../src/gopkg.in/yaml.v2/encode_test.go | 495 -
.../_workspace/src/gopkg.in/yaml.v2/parserc.go | 1096 -
.../_workspace/src/gopkg.in/yaml.v2/readerc.go | 391 -
.../_workspace/src/gopkg.in/yaml.v2/resolve.go | 203 -
.../_workspace/src/gopkg.in/yaml.v2/scannerc.go | 2710 -
.../_workspace/src/gopkg.in/yaml.v2/sorter.go | 104 -
.../src/gopkg.in/yaml.v2/suite_test.go | 12 -
.../_workspace/src/gopkg.in/yaml.v2/writerc.go | 89 -
.../_workspace/src/gopkg.in/yaml.v2/yaml.go | 344 -
.../_workspace/src/gopkg.in/yaml.v2/yamlh.go | 716 -
.../src/gopkg.in/yaml.v2/yamlprivateh.go | 173 -
186 files changed, 193844 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/Godeps.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/Godeps.json b/newt/Godeps/Godeps.json
deleted file mode 100644
index ad69a1e..0000000
--- a/newt/Godeps/Godeps.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "ImportPath": "git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/newt",
- "GoVersion": "go1.5.1",
- "Deps": [
- {
- "ImportPath": "github.com/BurntSushi/toml",
- "Comment": "v0.1.0-21-g056c9bc",
- "Rev": "056c9bc7be7190eaa7715723883caffa5f8fa3e4"
- },
- {
- "ImportPath": "github.com/hashicorp/logutils",
- "Rev": "0dc08b1671f34c4250ce212759ebd880f743d883"
- },
- {
- "ImportPath": "github.com/inconshreveable/mousetrap",
- "Rev": "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
- },
- {
- "ImportPath": "github.com/kr/pretty",
- "Comment": "go.weekly.2011-12-22-27-ge6ac2fc",
- "Rev": "e6ac2fc51e89a3249e82157fa0bb7a18ef9dd5bb"
- },
- {
- "ImportPath": "github.com/kr/text",
- "Rev": "e373e137fafd8abd480af49182dea0513914adb4"
- },
- {
- "ImportPath": "github.com/magiconair/properties",
- "Comment": "v1.5.3",
- "Rev": "624009598839a9432bd97bb75552389422357723"
- },
- {
- "ImportPath": "github.com/mattn/go-sqlite3",
- "Rev": "542ae647f8601bafd96233961b150cae198e0295"
- },
- {
- "ImportPath": "github.com/mitchellh/mapstructure",
- "Rev": "2caf8efc93669b6c43e0441cdc6aed17546c96f3"
- },
- {
- "ImportPath": "github.com/spf13/cast",
- "Rev": "4d07383ffe94b5e5a6fa3af9211374a4507a0184"
- },
- {
- "ImportPath": "github.com/spf13/cobra",
- "Rev": "66816bcd0378e248c613e3c443c020f544c28804"
- },
- {
- "ImportPath": "github.com/spf13/jwalterweatherman",
- "Rev": "3d60171a64319ef63c78bd45bd60e6eab1e75f8b"
- },
- {
- "ImportPath": "github.com/spf13/pflag",
- "Rev": "67cbc198fd11dab704b214c1e629a97af392c085"
- },
- {
- "ImportPath": "github.com/spf13/viper",
- "Rev": "db7ff930a189b98d602179d9001d33345f42b8c7"
- },
- {
- "ImportPath": "gopkg.in/yaml.v2",
- "Rev": "c1cd2254a6dd314c9d73c338c12688c9325d85c6"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/Readme
----------------------------------------------------------------------
diff --git a/newt/Godeps/Readme b/newt/Godeps/Readme
deleted file mode 100644
index 4cdaa53..0000000
--- a/newt/Godeps/Readme
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory tree is generated automatically by godep.
-
-Please do not edit.
-
-See https://github.com/tools/godep for more information.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/.gitignore
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/.gitignore b/newt/Godeps/_workspace/.gitignore
deleted file mode 100644
index f037d68..0000000
--- a/newt/Godeps/_workspace/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/pkg
-/bin
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/.gitignore
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/.gitignore b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/.gitignore
deleted file mode 100644
index 0cd3800..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-TAGS
-tags
-.*.swp
-tomlcheck/tomlcheck
-toml.test
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/.travis.yml
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/.travis.yml b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/.travis.yml
deleted file mode 100644
index 43caf6d..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/.travis.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-language: go
-go:
- - 1.1
- - 1.2
- - tip
-install:
- - go install ./...
- - go get github.com/BurntSushi/toml-test
-script:
- - export PATH="$PATH:$HOME/gopath/bin"
- - make test
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/COMPATIBLE
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/COMPATIBLE b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/COMPATIBLE
deleted file mode 100644
index 21e0938..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/COMPATIBLE
+++ /dev/null
@@ -1,3 +0,0 @@
-Compatible with TOML version
-[v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md)
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/COPYING
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/COPYING b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sa...@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/Makefile
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/Makefile b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/Makefile
deleted file mode 100644
index 3600848..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-install:
- go install ./...
-
-test: install
- go test -v
- toml-test toml-test-decoder
- toml-test -encoder toml-test-encoder
-
-fmt:
- gofmt -w *.go */*.go
- colcheck *.go */*.go
-
-tags:
- find ./ -name '*.go' -print0 | xargs -0 gotags > TAGS
-
-push:
- git push origin master
- git push github master
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/README.md
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/README.md b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/README.md
deleted file mode 100644
index 5a5df63..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/README.md
+++ /dev/null
@@ -1,220 +0,0 @@
-## TOML parser and encoder for Go with reflection
-
-TOML stands for Tom's Obvious, Minimal Language. This Go package provides a
-reflection interface similar to Go's standard library `json` and `xml`
-packages. This package also supports the `encoding.TextUnmarshaler` and
-`encoding.TextMarshaler` interfaces so that you can define custom data
-representations. (There is an example of this below.)
-
-Spec: https://github.com/mojombo/toml
-
-Compatible with TOML version
-[v0.2.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.2.0.md)
-
-Documentation: http://godoc.org/github.com/BurntSushi/toml
-
-Installation:
-
-```bash
-go get github.com/BurntSushi/toml
-```
-
-Try the toml validator:
-
-```bash
-go get github.com/BurntSushi/toml/cmd/tomlv
-tomlv some-toml-file.toml
-```
-
-[](https://travis-ci.org/BurntSushi/toml)
-
-
-### Testing
-
-This package passes all tests in
-[toml-test](https://github.com/BurntSushi/toml-test) for both the decoder
-and the encoder.
-
-### Examples
-
-This package works similarly to how the Go standard library handles `XML`
-and `JSON`. Namely, data is loaded into Go values via reflection.
-
-For the simplest example, consider some TOML file as just a list of keys
-and values:
-
-```toml
-Age = 25
-Cats = [ "Cauchy", "Plato" ]
-Pi = 3.14
-Perfection = [ 6, 28, 496, 8128 ]
-DOB = 1987-07-05T05:45:00Z
-```
-
-Which could be defined in Go as:
-
-```go
-type Config struct {
- Age int
- Cats []string
- Pi float64
- Perfection []int
- DOB time.Time // requires `import time`
-}
-```
-
-And then decoded with:
-
-```go
-var conf Config
-if _, err := toml.Decode(tomlData, &conf); err != nil {
- // handle error
-}
-```
-
-You can also use struct tags if your struct field name doesn't map to a TOML
-key value directly:
-
-```toml
-some_key_NAME = "wat"
-```
-
-```go
-type TOML struct {
- ObscureKey string `toml:"some_key_NAME"`
-}
-```
-
-### Using the `encoding.TextUnmarshaler` interface
-
-Here's an example that automatically parses duration strings into
-`time.Duration` values:
-
-```toml
-[[song]]
-name = "Thunder Road"
-duration = "4m49s"
-
-[[song]]
-name = "Stairway to Heaven"
-duration = "8m03s"
-```
-
-Which can be decoded with:
-
-```go
-type song struct {
- Name string
- Duration duration
-}
-type songs struct {
- Song []song
-}
-var favorites songs
-if _, err := toml.Decode(blob, &favorites); err != nil {
- log.Fatal(err)
-}
-
-for _, s := range favorites.Song {
- fmt.Printf("%s (%s)\n", s.Name, s.Duration)
-}
-```
-
-And you'll also need a `duration` type that satisfies the
-`encoding.TextUnmarshaler` interface:
-
-```go
-type duration struct {
- time.Duration
-}
-
-func (d *duration) UnmarshalText(text []byte) error {
- var err error
- d.Duration, err = time.ParseDuration(string(text))
- return err
-}
-```
-
-### More complex usage
-
-Here's an example of how to load the example from the official spec page:
-
-```toml
-# This is a TOML document. Boom.
-
-title = "TOML Example"
-
-[owner]
-name = "Tom Preston-Werner"
-organization = "GitHub"
-bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
-dob = 1979-05-27T07:32:00Z # First class dates? Why not?
-
-[database]
-server = "192.168.1.1"
-ports = [ 8001, 8001, 8002 ]
-connection_max = 5000
-enabled = true
-
-[servers]
-
- # You can indent as you please. Tabs or spaces. TOML don't care.
- [servers.alpha]
- ip = "10.0.0.1"
- dc = "eqdc10"
-
- [servers.beta]
- ip = "10.0.0.2"
- dc = "eqdc10"
-
-[clients]
-data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
-
-# Line breaks are OK when inside arrays
-hosts = [
- "alpha",
- "omega"
-]
-```
-
-And the corresponding Go types are:
-
-```go
-type tomlConfig struct {
- Title string
- Owner ownerInfo
- DB database `toml:"database"`
- Servers map[string]server
- Clients clients
-}
-
-type ownerInfo struct {
- Name string
- Org string `toml:"organization"`
- Bio string
- DOB time.Time
-}
-
-type database struct {
- Server string
- Ports []int
- ConnMax int `toml:"connection_max"`
- Enabled bool
-}
-
-type server struct {
- IP string
- DC string
-}
-
-type clients struct {
- Data [][]interface{}
- Hosts []string
-}
-```
-
-Note that a case insensitive match will be tried if an exact match can't be
-found.
-
-A working example of the above can be found in `_examples/example.{go,toml}`.
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sa...@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md
deleted file mode 100644
index 24421eb..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Implements the TOML test suite interface
-
-This is an implementation of the interface expected by
-[toml-test](https://github.com/BurntSushi/toml-test) for my
-[toml parser written in Go](https://github.com/BurntSushi/toml).
-In particular, it maps TOML data on `stdin` to a JSON format on `stdout`.
-
-
-Compatible with TOML version
-[v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md)
-
-Compatible with `toml-test` version
-[v0.2.0](https://github.com/BurntSushi/toml-test/tree/v0.2.0)
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go
deleted file mode 100644
index 14e7557..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Command toml-test-decoder satisfies the toml-test interface for testing
-// TOML decoders. Namely, it accepts TOML on stdin and outputs JSON on stdout.
-package main
-
-import (
- "encoding/json"
- "flag"
- "fmt"
- "log"
- "os"
- "path"
- "time"
-
- "github.com/BurntSushi/toml"
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s < toml-file\n", path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() != 0 {
- flag.Usage()
- }
-
- var tmp interface{}
- if _, err := toml.DecodeReader(os.Stdin, &tmp); err != nil {
- log.Fatalf("Error decoding TOML: %s", err)
- }
-
- typedTmp := translate(tmp)
- if err := json.NewEncoder(os.Stdout).Encode(typedTmp); err != nil {
- log.Fatalf("Error encoding JSON: %s", err)
- }
-}
-
-func translate(tomlData interface{}) interface{} {
- switch orig := tomlData.(type) {
- case map[string]interface{}:
- typed := make(map[string]interface{}, len(orig))
- for k, v := range orig {
- typed[k] = translate(v)
- }
- return typed
- case []map[string]interface{}:
- typed := make([]map[string]interface{}, len(orig))
- for i, v := range orig {
- typed[i] = translate(v).(map[string]interface{})
- }
- return typed
- case []interface{}:
- typed := make([]interface{}, len(orig))
- for i, v := range orig {
- typed[i] = translate(v)
- }
-
- // We don't really need to tag arrays, but let's be future proof.
- // (If TOML ever supports tuples, we'll need this.)
- return tag("array", typed)
- case time.Time:
- return tag("datetime", orig.Format("2006-01-02T15:04:05Z"))
- case bool:
- return tag("bool", fmt.Sprintf("%v", orig))
- case int64:
- return tag("integer", fmt.Sprintf("%d", orig))
- case float64:
- return tag("float", fmt.Sprintf("%v", orig))
- case string:
- return tag("string", orig)
- }
-
- panic(fmt.Sprintf("Unknown type: %T", tomlData))
-}
-
-func tag(typeName string, data interface{}) map[string]interface{} {
- return map[string]interface{}{
- "type": typeName,
- "value": data,
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sa...@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md
deleted file mode 100644
index 45a603f..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Implements the TOML test suite interface for TOML encoders
-
-This is an implementation of the interface expected by
-[toml-test](https://github.com/BurntSushi/toml-test) for the
-[TOML encoder](https://github.com/BurntSushi/toml).
-In particular, it maps JSON data on `stdin` to a TOML format on `stdout`.
-
-
-Compatible with TOML version
-[v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md)
-
-Compatible with `toml-test` version
-[v0.2.0](https://github.com/BurntSushi/toml-test/tree/v0.2.0)
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go
deleted file mode 100644
index 092cc68..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Command toml-test-encoder satisfies the toml-test interface for testing
-// TOML encoders. Namely, it accepts JSON on stdin and outputs TOML on stdout.
-package main
-
-import (
- "encoding/json"
- "flag"
- "log"
- "os"
- "path"
- "strconv"
- "time"
-
- "github.com/BurntSushi/toml"
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s < json-file\n", path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() != 0 {
- flag.Usage()
- }
-
- var tmp interface{}
- if err := json.NewDecoder(os.Stdin).Decode(&tmp); err != nil {
- log.Fatalf("Error decoding JSON: %s", err)
- }
-
- tomlData := translate(tmp)
- if err := toml.NewEncoder(os.Stdout).Encode(tomlData); err != nil {
- log.Fatalf("Error encoding TOML: %s", err)
- }
-}
-
-func translate(typedJson interface{}) interface{} {
- switch v := typedJson.(type) {
- case map[string]interface{}:
- if len(v) == 2 && in("type", v) && in("value", v) {
- return untag(v)
- }
- m := make(map[string]interface{}, len(v))
- for k, v2 := range v {
- m[k] = translate(v2)
- }
- return m
- case []interface{}:
- tabArray := make([]map[string]interface{}, len(v))
- for i := range v {
- if m, ok := translate(v[i]).(map[string]interface{}); ok {
- tabArray[i] = m
- } else {
- log.Fatalf("JSON arrays may only contain objects. This " +
- "corresponds to only tables being allowed in " +
- "TOML table arrays.")
- }
- }
- return tabArray
- }
- log.Fatalf("Unrecognized JSON format '%T'.", typedJson)
- panic("unreachable")
-}
-
-func untag(typed map[string]interface{}) interface{} {
- t := typed["type"].(string)
- v := typed["value"]
- switch t {
- case "string":
- return v.(string)
- case "integer":
- v := v.(string)
- n, err := strconv.Atoi(v)
- if err != nil {
- log.Fatalf("Could not parse '%s' as integer: %s", v, err)
- }
- return n
- case "float":
- v := v.(string)
- f, err := strconv.ParseFloat(v, 64)
- if err != nil {
- log.Fatalf("Could not parse '%s' as float64: %s", v, err)
- }
- return f
- case "datetime":
- v := v.(string)
- t, err := time.Parse("2006-01-02T15:04:05Z", v)
- if err != nil {
- log.Fatalf("Could not parse '%s' as a datetime: %s", v, err)
- }
- return t
- case "bool":
- v := v.(string)
- switch v {
- case "true":
- return true
- case "false":
- return false
- }
- log.Fatalf("Could not parse '%s' as a boolean.", v)
- case "array":
- v := v.([]interface{})
- array := make([]interface{}, len(v))
- for i := range v {
- if m, ok := v[i].(map[string]interface{}); ok {
- array[i] = untag(m)
- } else {
- log.Fatalf("Arrays may only contain other arrays or "+
- "primitive values, but found a '%T'.", m)
- }
- }
- return array
- }
- log.Fatalf("Unrecognized tag type '%s'.", t)
- panic("unreachable")
-}
-
-func in(key string, m map[string]interface{}) bool {
- _, ok := m[key]
- return ok
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/COPYING
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/COPYING b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sa...@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/README.md
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/README.md b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/README.md
deleted file mode 100644
index 5df0dc3..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# TOML Validator
-
-If Go is installed, it's simple to try it out:
-
-```bash
-go get github.com/BurntSushi/toml/cmd/tomlv
-tomlv some-toml-file.toml
-```
-
-You can see the types of every key in a TOML file with:
-
-```bash
-tomlv -types some-toml-file.toml
-```
-
-At the moment, only one error message is reported at a time. Error messages
-include line numbers. No output means that the files given are valid TOML, or
-there is a bug in `tomlv`.
-
-Compatible with TOML version
-[v0.1.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.1.0.md)
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/main.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/main.go b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/main.go
deleted file mode 100644
index c7d689a..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/cmd/tomlv/main.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Command tomlv validates TOML documents and prints each key's type.
-package main
-
-import (
- "flag"
- "fmt"
- "log"
- "os"
- "path"
- "strings"
- "text/tabwriter"
-
- "github.com/BurntSushi/toml"
-)
-
-var (
- flagTypes = false
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.BoolVar(&flagTypes, "types", flagTypes,
- "When set, the types of every defined key will be shown.")
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s toml-file [ toml-file ... ]\n",
- path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() < 1 {
- flag.Usage()
- }
- for _, f := range flag.Args() {
- var tmp interface{}
- md, err := toml.DecodeFile(f, &tmp)
- if err != nil {
- log.Fatalf("Error in '%s': %s", f, err)
- }
- if flagTypes {
- printTypes(md)
- }
- }
-}
-
-func printTypes(md toml.MetaData) {
- tabw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- for _, key := range md.Keys() {
- fmt.Fprintf(tabw, "%s%s\t%s\n",
- strings.Repeat(" ", len(key)-1), key, md.Type(key...))
- }
- tabw.Flush()
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode.go b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode.go
deleted file mode 100644
index 6c7d398..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode.go
+++ /dev/null
@@ -1,492 +0,0 @@
-package toml
-
-import (
- "fmt"
- "io"
- "io/ioutil"
- "math"
- "reflect"
- "strings"
- "time"
-)
-
-var e = fmt.Errorf
-
-// Unmarshaler is the interface implemented by objects that can unmarshal a
-// TOML description of themselves.
-type Unmarshaler interface {
- UnmarshalTOML(interface{}) error
-}
-
-// Unmarshal decodes the contents of `p` in TOML format into a pointer `v`.
-func Unmarshal(p []byte, v interface{}) error {
- _, err := Decode(string(p), v)
- return err
-}
-
-// Primitive is a TOML value that hasn't been decoded into a Go value.
-// When using the various `Decode*` functions, the type `Primitive` may
-// be given to any value, and its decoding will be delayed.
-//
-// A `Primitive` value can be decoded using the `PrimitiveDecode` function.
-//
-// The underlying representation of a `Primitive` value is subject to change.
-// Do not rely on it.
-//
-// N.B. Primitive values are still parsed, so using them will only avoid
-// the overhead of reflection. They can be useful when you don't know the
-// exact type of TOML data until run time.
-type Primitive struct {
- undecoded interface{}
- context Key
-}
-
-// DEPRECATED!
-//
-// Use MetaData.PrimitiveDecode instead.
-func PrimitiveDecode(primValue Primitive, v interface{}) error {
- md := MetaData{decoded: make(map[string]bool)}
- return md.unify(primValue.undecoded, rvalue(v))
-}
-
-// PrimitiveDecode is just like the other `Decode*` functions, except it
-// decodes a TOML value that has already been parsed. Valid primitive values
-// can *only* be obtained from values filled by the decoder functions,
-// including this method. (i.e., `v` may contain more `Primitive`
-// values.)
-//
-// Meta data for primitive values is included in the meta data returned by
-// the `Decode*` functions with one exception: keys returned by the Undecoded
-// method will only reflect keys that were decoded. Namely, any keys hidden
-// behind a Primitive will be considered undecoded. Executing this method will
-// update the undecoded keys in the meta data. (See the example.)
-func (md *MetaData) PrimitiveDecode(primValue Primitive, v interface{}) error {
- md.context = primValue.context
- defer func() { md.context = nil }()
- return md.unify(primValue.undecoded, rvalue(v))
-}
-
-// Decode will decode the contents of `data` in TOML format into a pointer
-// `v`.
-//
-// TOML hashes correspond to Go structs or maps. (Dealer's choice. They can be
-// used interchangeably.)
-//
-// TOML arrays of tables correspond to either a slice of structs or a slice
-// of maps.
-//
-// TOML datetimes correspond to Go `time.Time` values.
-//
-// All other TOML types (float, string, int, bool and array) correspond
-// to the obvious Go types.
-//
-// An exception to the above rules is if a type implements the
-// encoding.TextUnmarshaler interface. In this case, any primitive TOML value
-// (floats, strings, integers, booleans and datetimes) will be converted to
-// a byte string and given to the value's UnmarshalText method. See the
-// Unmarshaler example for a demonstration with time duration strings.
-//
-// Key mapping
-//
-// TOML keys can map to either keys in a Go map or field names in a Go
-// struct. The special `toml` struct tag may be used to map TOML keys to
-// struct fields that don't match the key name exactly. (See the example.)
-// A case insensitive match to struct names will be tried if an exact match
-// can't be found.
-//
-// The mapping between TOML values and Go values is loose. That is, there
-// may exist TOML values that cannot be placed into your representation, and
-// there may be parts of your representation that do not correspond to
-// TOML values. This loose mapping can be made stricter by using the IsDefined
-// and/or Undecoded methods on the MetaData returned.
-//
-// This decoder will not handle cyclic types. If a cyclic type is passed,
-// `Decode` will not terminate.
-func Decode(data string, v interface{}) (MetaData, error) {
- p, err := parse(data)
- if err != nil {
- return MetaData{}, err
- }
- md := MetaData{
- p.mapping, p.types, p.ordered,
- make(map[string]bool, len(p.ordered)), nil,
- }
- return md, md.unify(p.mapping, rvalue(v))
-}
-
-// DecodeFile is just like Decode, except it will automatically read the
-// contents of the file at `fpath` and decode it for you.
-func DecodeFile(fpath string, v interface{}) (MetaData, error) {
- bs, err := ioutil.ReadFile(fpath)
- if err != nil {
- return MetaData{}, err
- }
- return Decode(string(bs), v)
-}
-
-// DecodeReader is just like Decode, except it will consume all bytes
-// from the reader and decode it for you.
-func DecodeReader(r io.Reader, v interface{}) (MetaData, error) {
- bs, err := ioutil.ReadAll(r)
- if err != nil {
- return MetaData{}, err
- }
- return Decode(string(bs), v)
-}
-
-// unify performs a sort of type unification based on the structure of `rv`,
-// which is the client representation.
-//
-// Any type mismatch produces an error. Finding a type that we don't know
-// how to handle produces an unsupported type error.
-func (md *MetaData) unify(data interface{}, rv reflect.Value) error {
-
- // Special case. Look for a `Primitive` value.
- if rv.Type() == reflect.TypeOf((*Primitive)(nil)).Elem() {
- // Save the undecoded data and the key context into the primitive
- // value.
- context := make(Key, len(md.context))
- copy(context, md.context)
- rv.Set(reflect.ValueOf(Primitive{
- undecoded: data,
- context: context,
- }))
- return nil
- }
-
- // Special case. Unmarshaler Interface support.
- if rv.CanAddr() {
- if v, ok := rv.Addr().Interface().(Unmarshaler); ok {
- return v.UnmarshalTOML(data)
- }
- }
-
- // Special case. Handle time.Time values specifically.
- // TODO: Remove this code when we decide to drop support for Go 1.1.
- // This isn't necessary in Go 1.2 because time.Time satisfies the encoding
- // interfaces.
- if rv.Type().AssignableTo(rvalue(time.Time{}).Type()) {
- return md.unifyDatetime(data, rv)
- }
-
- // Special case. Look for a value satisfying the TextUnmarshaler interface.
- if v, ok := rv.Interface().(TextUnmarshaler); ok {
- return md.unifyText(data, v)
- }
- // BUG(burntsushi)
- // The behavior here is incorrect whenever a Go type satisfies the
- // encoding.TextUnmarshaler interface but also corresponds to a TOML
- // hash or array. In particular, the unmarshaler should only be applied
- // to primitive TOML values. But at this point, it will be applied to
- // all kinds of values and produce an incorrect error whenever those values
- // are hashes or arrays (including arrays of tables).
-
- k := rv.Kind()
-
- // laziness
- if k >= reflect.Int && k <= reflect.Uint64 {
- return md.unifyInt(data, rv)
- }
- switch k {
- case reflect.Ptr:
- elem := reflect.New(rv.Type().Elem())
- err := md.unify(data, reflect.Indirect(elem))
- if err != nil {
- return err
- }
- rv.Set(elem)
- return nil
- case reflect.Struct:
- return md.unifyStruct(data, rv)
- case reflect.Map:
- return md.unifyMap(data, rv)
- case reflect.Array:
- return md.unifyArray(data, rv)
- case reflect.Slice:
- return md.unifySlice(data, rv)
- case reflect.String:
- return md.unifyString(data, rv)
- case reflect.Bool:
- return md.unifyBool(data, rv)
- case reflect.Interface:
- // we only support empty interfaces.
- if rv.NumMethod() > 0 {
- return e("Unsupported type '%s'.", rv.Kind())
- }
- return md.unifyAnything(data, rv)
- case reflect.Float32:
- fallthrough
- case reflect.Float64:
- return md.unifyFloat64(data, rv)
- }
- return e("Unsupported type '%s'.", rv.Kind())
-}
-
-func (md *MetaData) unifyStruct(mapping interface{}, rv reflect.Value) error {
- tmap, ok := mapping.(map[string]interface{})
- if !ok {
- return mismatch(rv, "map", mapping)
- }
-
- for key, datum := range tmap {
- var f *field
- fields := cachedTypeFields(rv.Type())
- for i := range fields {
- ff := &fields[i]
- if ff.name == key {
- f = ff
- break
- }
- if f == nil && strings.EqualFold(ff.name, key) {
- f = ff
- }
- }
- if f != nil {
- subv := rv
- for _, i := range f.index {
- subv = indirect(subv.Field(i))
- }
- if isUnifiable(subv) {
- md.decoded[md.context.add(key).String()] = true
- md.context = append(md.context, key)
- if err := md.unify(datum, subv); err != nil {
- return e("Type mismatch for '%s.%s': %s",
- rv.Type().String(), f.name, err)
- }
- md.context = md.context[0 : len(md.context)-1]
- } else if f.name != "" {
- // Bad user! No soup for you!
- return e("Field '%s.%s' is unexported, and therefore cannot "+
- "be loaded with reflection.", rv.Type().String(), f.name)
- }
- }
- }
- return nil
-}
-
-func (md *MetaData) unifyMap(mapping interface{}, rv reflect.Value) error {
- tmap, ok := mapping.(map[string]interface{})
- if !ok {
- return badtype("map", mapping)
- }
- if rv.IsNil() {
- rv.Set(reflect.MakeMap(rv.Type()))
- }
- for k, v := range tmap {
- md.decoded[md.context.add(k).String()] = true
- md.context = append(md.context, k)
-
- rvkey := indirect(reflect.New(rv.Type().Key()))
- rvval := reflect.Indirect(reflect.New(rv.Type().Elem()))
- if err := md.unify(v, rvval); err != nil {
- return err
- }
- md.context = md.context[0 : len(md.context)-1]
-
- rvkey.SetString(k)
- rv.SetMapIndex(rvkey, rvval)
- }
- return nil
-}
-
-func (md *MetaData) unifyArray(data interface{}, rv reflect.Value) error {
- datav := reflect.ValueOf(data)
- if datav.Kind() != reflect.Slice {
- return badtype("slice", data)
- }
- sliceLen := datav.Len()
- if sliceLen != rv.Len() {
- return e("expected array length %d; got TOML array of length %d",
- rv.Len(), sliceLen)
- }
- return md.unifySliceArray(datav, rv)
-}
-
-func (md *MetaData) unifySlice(data interface{}, rv reflect.Value) error {
- datav := reflect.ValueOf(data)
- if datav.Kind() != reflect.Slice {
- return badtype("slice", data)
- }
- sliceLen := datav.Len()
- if rv.IsNil() {
- rv.Set(reflect.MakeSlice(rv.Type(), sliceLen, sliceLen))
- }
- return md.unifySliceArray(datav, rv)
-}
-
-func (md *MetaData) unifySliceArray(data, rv reflect.Value) error {
- sliceLen := data.Len()
- for i := 0; i < sliceLen; i++ {
- v := data.Index(i).Interface()
- sliceval := indirect(rv.Index(i))
- if err := md.unify(v, sliceval); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (md *MetaData) unifyDatetime(data interface{}, rv reflect.Value) error {
- if _, ok := data.(time.Time); ok {
- rv.Set(reflect.ValueOf(data))
- return nil
- }
- return badtype("time.Time", data)
-}
-
-func (md *MetaData) unifyString(data interface{}, rv reflect.Value) error {
- if s, ok := data.(string); ok {
- rv.SetString(s)
- return nil
- }
- return badtype("string", data)
-}
-
-func (md *MetaData) unifyFloat64(data interface{}, rv reflect.Value) error {
- if num, ok := data.(float64); ok {
- switch rv.Kind() {
- case reflect.Float32:
- fallthrough
- case reflect.Float64:
- rv.SetFloat(num)
- default:
- panic("bug")
- }
- return nil
- }
- return badtype("float", data)
-}
-
-func (md *MetaData) unifyInt(data interface{}, rv reflect.Value) error {
- if num, ok := data.(int64); ok {
- if rv.Kind() >= reflect.Int && rv.Kind() <= reflect.Int64 {
- switch rv.Kind() {
- case reflect.Int, reflect.Int64:
- // No bounds checking necessary.
- case reflect.Int8:
- if num < math.MinInt8 || num > math.MaxInt8 {
- return e("Value '%d' is out of range for int8.", num)
- }
- case reflect.Int16:
- if num < math.MinInt16 || num > math.MaxInt16 {
- return e("Value '%d' is out of range for int16.", num)
- }
- case reflect.Int32:
- if num < math.MinInt32 || num > math.MaxInt32 {
- return e("Value '%d' is out of range for int32.", num)
- }
- }
- rv.SetInt(num)
- } else if rv.Kind() >= reflect.Uint && rv.Kind() <= reflect.Uint64 {
- unum := uint64(num)
- switch rv.Kind() {
- case reflect.Uint, reflect.Uint64:
- // No bounds checking necessary.
- case reflect.Uint8:
- if num < 0 || unum > math.MaxUint8 {
- return e("Value '%d' is out of range for uint8.", num)
- }
- case reflect.Uint16:
- if num < 0 || unum > math.MaxUint16 {
- return e("Value '%d' is out of range for uint16.", num)
- }
- case reflect.Uint32:
- if num < 0 || unum > math.MaxUint32 {
- return e("Value '%d' is out of range for uint32.", num)
- }
- }
- rv.SetUint(unum)
- } else {
- panic("unreachable")
- }
- return nil
- }
- return badtype("integer", data)
-}
-
-func (md *MetaData) unifyBool(data interface{}, rv reflect.Value) error {
- if b, ok := data.(bool); ok {
- rv.SetBool(b)
- return nil
- }
- return badtype("boolean", data)
-}
-
-func (md *MetaData) unifyAnything(data interface{}, rv reflect.Value) error {
- rv.Set(reflect.ValueOf(data))
- return nil
-}
-
-func (md *MetaData) unifyText(data interface{}, v TextUnmarshaler) error {
- var s string
- switch sdata := data.(type) {
- case TextMarshaler:
- text, err := sdata.MarshalText()
- if err != nil {
- return err
- }
- s = string(text)
- case fmt.Stringer:
- s = sdata.String()
- case string:
- s = sdata
- case bool:
- s = fmt.Sprintf("%v", sdata)
- case int64:
- s = fmt.Sprintf("%d", sdata)
- case float64:
- s = fmt.Sprintf("%f", sdata)
- default:
- return badtype("primitive (string-like)", data)
- }
- if err := v.UnmarshalText([]byte(s)); err != nil {
- return err
- }
- return nil
-}
-
-// rvalue returns a reflect.Value of `v`. All pointers are resolved.
-func rvalue(v interface{}) reflect.Value {
- return indirect(reflect.ValueOf(v))
-}
-
-// indirect returns the value pointed to by a pointer.
-// Pointers are followed until the value is not a pointer.
-// New values are allocated for each nil pointer.
-//
-// An exception to this rule is if the value satisfies an interface of
-// interest to us (like encoding.TextUnmarshaler).
-func indirect(v reflect.Value) reflect.Value {
- if v.Kind() != reflect.Ptr {
- if v.CanAddr() {
- pv := v.Addr()
- if _, ok := pv.Interface().(TextUnmarshaler); ok {
- return pv
- }
- }
- return v
- }
- if v.IsNil() {
- v.Set(reflect.New(v.Type().Elem()))
- }
- return indirect(reflect.Indirect(v))
-}
-
-func isUnifiable(rv reflect.Value) bool {
- if rv.CanSet() {
- return true
- }
- if _, ok := rv.Interface().(TextUnmarshaler); ok {
- return true
- }
- return false
-}
-
-func badtype(expected string, data interface{}) error {
- return e("Expected %s but found '%T'.", expected, data)
-}
-
-func mismatch(user reflect.Value, expected string, data interface{}) error {
- return e("Type mismatch for %s. Expected %s but found '%T'.",
- user.Type().String(), expected, data)
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode_meta.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode_meta.go b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode_meta.go
deleted file mode 100644
index ef6f545..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode_meta.go
+++ /dev/null
@@ -1,122 +0,0 @@
-package toml
-
-import "strings"
-
-// MetaData allows access to meta information about TOML data that may not
-// be inferrable via reflection. In particular, whether a key has been defined
-// and the TOML type of a key.
-type MetaData struct {
- mapping map[string]interface{}
- types map[string]tomlType
- keys []Key
- decoded map[string]bool
- context Key // Used only during decoding.
-}
-
-// IsDefined returns true if the key given exists in the TOML data. The key
-// should be specified hierarchially. e.g.,
-//
-// // access the TOML key 'a.b.c'
-// IsDefined("a", "b", "c")
-//
-// IsDefined will return false if an empty key given. Keys are case sensitive.
-func (md *MetaData) IsDefined(key ...string) bool {
- if len(key) == 0 {
- return false
- }
-
- var hash map[string]interface{}
- var ok bool
- var hashOrVal interface{} = md.mapping
- for _, k := range key {
- if hash, ok = hashOrVal.(map[string]interface{}); !ok {
- return false
- }
- if hashOrVal, ok = hash[k]; !ok {
- return false
- }
- }
- return true
-}
-
-// Type returns a string representation of the type of the key specified.
-//
-// Type will return the empty string if given an empty key or a key that
-// does not exist. Keys are case sensitive.
-func (md *MetaData) Type(key ...string) string {
- fullkey := strings.Join(key, ".")
- if typ, ok := md.types[fullkey]; ok {
- return typ.typeString()
- }
- return ""
-}
-
-// Key is the type of any TOML key, including key groups. Use (MetaData).Keys
-// to get values of this type.
-type Key []string
-
-func (k Key) String() string {
- return strings.Join(k, ".")
-}
-
-func (k Key) maybeQuotedAll() string {
- var ss []string
- for i := range k {
- ss = append(ss, k.maybeQuoted(i))
- }
- return strings.Join(ss, ".")
-}
-
-func (k Key) maybeQuoted(i int) string {
- quote := false
- for _, c := range k[i] {
- if !isBareKeyChar(c) {
- quote = true
- break
- }
- }
- if quote {
- return "\"" + strings.Replace(k[i], "\"", "\\\"", -1) + "\""
- } else {
- return k[i]
- }
-}
-
-func (k Key) add(piece string) Key {
- newKey := make(Key, len(k)+1)
- copy(newKey, k)
- newKey[len(k)] = piece
- return newKey
-}
-
-// Keys returns a slice of every key in the TOML data, including key groups.
-// Each key is itself a slice, where the first element is the top of the
-// hierarchy and the last is the most specific.
-//
-// The list will have the same order as the keys appeared in the TOML data.
-//
-// All keys returned are non-empty.
-func (md *MetaData) Keys() []Key {
- return md.keys
-}
-
-// Undecoded returns all keys that have not been decoded in the order in which
-// they appear in the original TOML document.
-//
-// This includes keys that haven't been decoded because of a Primitive value.
-// Once the Primitive value is decoded, the keys will be considered decoded.
-//
-// Also note that decoding into an empty interface will result in no decoding,
-// and so no keys will be considered decoded.
-//
-// In this sense, the Undecoded keys correspond to keys in the TOML document
-// that do not have a concrete type in your representation.
-func (md *MetaData) Undecoded() []Key {
- undecoded := make([]Key, 0, len(md.keys))
- for _, key := range md.keys {
- if !md.decoded[key.String()] {
- undecoded = append(undecoded, key)
- }
- }
- return undecoded
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode_test.go b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode_test.go
deleted file mode 100644
index 3805931..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/decode_test.go
+++ /dev/null
@@ -1,950 +0,0 @@
-package toml
-
-import (
- "fmt"
- "log"
- "reflect"
- "testing"
- "time"
-)
-
-func init() {
- log.SetFlags(0)
-}
-
-func TestDecodeSimple(t *testing.T) {
- var testSimple = `
-age = 250
-andrew = "gallant"
-kait = "brady"
-now = 1987-07-05T05:45:00Z
-yesOrNo = true
-pi = 3.14
-colors = [
- ["red", "green", "blue"],
- ["cyan", "magenta", "yellow", "black"],
-]
-
-[My.Cats]
-plato = "cat 1"
-cauchy = "cat 2"
-`
-
- type cats struct {
- Plato string
- Cauchy string
- }
- type simple struct {
- Age int
- Colors [][]string
- Pi float64
- YesOrNo bool
- Now time.Time
- Andrew string
- Kait string
- My map[string]cats
- }
-
- var val simple
- _, err := Decode(testSimple, &val)
- if err != nil {
- t.Fatal(err)
- }
-
- now, err := time.Parse("2006-01-02T15:04:05", "1987-07-05T05:45:00")
- if err != nil {
- panic(err)
- }
- var answer = simple{
- Age: 250,
- Andrew: "gallant",
- Kait: "brady",
- Now: now,
- YesOrNo: true,
- Pi: 3.14,
- Colors: [][]string{
- {"red", "green", "blue"},
- {"cyan", "magenta", "yellow", "black"},
- },
- My: map[string]cats{
- "Cats": cats{Plato: "cat 1", Cauchy: "cat 2"},
- },
- }
- if !reflect.DeepEqual(val, answer) {
- t.Fatalf("Expected\n-----\n%#v\n-----\nbut got\n-----\n%#v\n",
- answer, val)
- }
-}
-
-func TestDecodeEmbedded(t *testing.T) {
- type Dog struct{ Name string }
- type Age int
-
- tests := map[string]struct {
- input string
- decodeInto interface{}
- wantDecoded interface{}
- }{
- "embedded struct": {
- input: `Name = "milton"`,
- decodeInto: &struct{ Dog }{},
- wantDecoded: &struct{ Dog }{Dog{"milton"}},
- },
- "embedded non-nil pointer to struct": {
- input: `Name = "milton"`,
- decodeInto: &struct{ *Dog }{},
- wantDecoded: &struct{ *Dog }{&Dog{"milton"}},
- },
- "embedded nil pointer to struct": {
- input: ``,
- decodeInto: &struct{ *Dog }{},
- wantDecoded: &struct{ *Dog }{nil},
- },
- "embedded int": {
- input: `Age = -5`,
- decodeInto: &struct{ Age }{},
- wantDecoded: &struct{ Age }{-5},
- },
- }
-
- for label, test := range tests {
- _, err := Decode(test.input, test.decodeInto)
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(test.wantDecoded, test.decodeInto) {
- t.Errorf("%s: want decoded == %+v, got %+v",
- label, test.wantDecoded, test.decodeInto)
- }
- }
-}
-
-func TestTableArrays(t *testing.T) {
- var tomlTableArrays = `
-[[albums]]
-name = "Born to Run"
-
- [[albums.songs]]
- name = "Jungleland"
-
- [[albums.songs]]
- name = "Meeting Across the River"
-
-[[albums]]
-name = "Born in the USA"
-
- [[albums.songs]]
- name = "Glory Days"
-
- [[albums.songs]]
- name = "Dancing in the Dark"
-`
-
- type Song struct {
- Name string
- }
-
- type Album struct {
- Name string
- Songs []Song
- }
-
- type Music struct {
- Albums []Album
- }
-
- expected := Music{[]Album{
- {"Born to Run", []Song{{"Jungleland"}, {"Meeting Across the River"}}},
- {"Born in the USA", []Song{{"Glory Days"}, {"Dancing in the Dark"}}},
- }}
- var got Music
- if _, err := Decode(tomlTableArrays, &got); err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(expected, got) {
- t.Fatalf("\n%#v\n!=\n%#v\n", expected, got)
- }
-}
-
-// Case insensitive matching tests.
-// A bit more comprehensive than needed given the current implementation,
-// but implementations change.
-// Probably still missing demonstrations of some ugly corner cases regarding
-// case insensitive matching and multiple fields.
-func TestCase(t *testing.T) {
- var caseToml = `
-tOpString = "string"
-tOpInt = 1
-tOpFloat = 1.1
-tOpBool = true
-tOpdate = 2006-01-02T15:04:05Z
-tOparray = [ "array" ]
-Match = "i should be in Match only"
-MatcH = "i should be in MatcH only"
-once = "just once"
-[nEst.eD]
-nEstedString = "another string"
-`
-
- type InsensitiveEd struct {
- NestedString string
- }
-
- type InsensitiveNest struct {
- Ed InsensitiveEd
- }
-
- type Insensitive struct {
- TopString string
- TopInt int
- TopFloat float64
- TopBool bool
- TopDate time.Time
- TopArray []string
- Match string
- MatcH string
- Once string
- OncE string
- Nest InsensitiveNest
- }
-
- tme, err := time.Parse(time.RFC3339, time.RFC3339[:len(time.RFC3339)-5])
- if err != nil {
- panic(err)
- }
- expected := Insensitive{
- TopString: "string",
- TopInt: 1,
- TopFloat: 1.1,
- TopBool: true,
- TopDate: tme,
- TopArray: []string{"array"},
- MatcH: "i should be in MatcH only",
- Match: "i should be in Match only",
- Once: "just once",
- OncE: "",
- Nest: InsensitiveNest{
- Ed: InsensitiveEd{NestedString: "another string"},
- },
- }
- var got Insensitive
- if _, err := Decode(caseToml, &got); err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(expected, got) {
- t.Fatalf("\n%#v\n!=\n%#v\n", expected, got)
- }
-}
-
-func TestPointers(t *testing.T) {
- type Object struct {
- Type string
- Description string
- }
-
- type Dict struct {
- NamedObject map[string]*Object
- BaseObject *Object
- Strptr *string
- Strptrs []*string
- }
- s1, s2, s3 := "blah", "abc", "def"
- expected := &Dict{
- Strptr: &s1,
- Strptrs: []*string{&s2, &s3},
- NamedObject: map[string]*Object{
- "foo": {"FOO", "fooooo!!!"},
- "bar": {"BAR", "ba-ba-ba-ba-barrrr!!!"},
- },
- BaseObject: &Object{"BASE", "da base"},
- }
-
- ex1 := `
-Strptr = "blah"
-Strptrs = ["abc", "def"]
-
-[NamedObject.foo]
-Type = "FOO"
-Description = "fooooo!!!"
-
-[NamedObject.bar]
-Type = "BAR"
-Description = "ba-ba-ba-ba-barrrr!!!"
-
-[BaseObject]
-Type = "BASE"
-Description = "da base"
-`
- dict := new(Dict)
- _, err := Decode(ex1, dict)
- if err != nil {
- t.Errorf("Decode error: %v", err)
- }
- if !reflect.DeepEqual(expected, dict) {
- t.Fatalf("\n%#v\n!=\n%#v\n", expected, dict)
- }
-}
-
-type sphere struct {
- Center [3]float64
- Radius float64
-}
-
-func TestDecodeSimpleArray(t *testing.T) {
- var s1 sphere
- if _, err := Decode(`center = [0.0, 1.5, 0.0]`, &s1); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestDecodeArrayWrongSize(t *testing.T) {
- var s1 sphere
- if _, err := Decode(`center = [0.1, 2.3]`, &s1); err == nil {
- t.Fatal("Expected array type mismatch error")
- }
-}
-
-func TestDecodeLargeIntoSmallInt(t *testing.T) {
- type table struct {
- Value int8
- }
- var tab table
- if _, err := Decode(`value = 500`, &tab); err == nil {
- t.Fatal("Expected integer out-of-bounds error.")
- }
-}
-
-func TestDecodeSizedInts(t *testing.T) {
- type table struct {
- U8 uint8
- U16 uint16
- U32 uint32
- U64 uint64
- U uint
- I8 int8
- I16 int16
- I32 int32
- I64 int64
- I int
- }
- answer := table{1, 1, 1, 1, 1, -1, -1, -1, -1, -1}
- toml := `
- u8 = 1
- u16 = 1
- u32 = 1
- u64 = 1
- u = 1
- i8 = -1
- i16 = -1
- i32 = -1
- i64 = -1
- i = -1
- `
- var tab table
- if _, err := Decode(toml, &tab); err != nil {
- t.Fatal(err.Error())
- }
- if answer != tab {
- t.Fatalf("Expected %#v but got %#v", answer, tab)
- }
-}
-
-func TestUnmarshaler(t *testing.T) {
-
- var tomlBlob = `
-[dishes.hamboogie]
-name = "Hamboogie with fries"
-price = 10.99
-
-[[dishes.hamboogie.ingredients]]
-name = "Bread Bun"
-
-[[dishes.hamboogie.ingredients]]
-name = "Lettuce"
-
-[[dishes.hamboogie.ingredients]]
-name = "Real Beef Patty"
-
-[[dishes.hamboogie.ingredients]]
-name = "Tomato"
-
-[dishes.eggsalad]
-name = "Egg Salad with rice"
-price = 3.99
-
-[[dishes.eggsalad.ingredients]]
-name = "Egg"
-
-[[dishes.eggsalad.ingredients]]
-name = "Mayo"
-
-[[dishes.eggsalad.ingredients]]
-name = "Rice"
-`
- m := &menu{}
- if _, err := Decode(tomlBlob, m); err != nil {
- log.Fatal(err)
- }
-
- if len(m.Dishes) != 2 {
- t.Log("two dishes should be loaded with UnmarshalTOML()")
- t.Errorf("expected %d but got %d", 2, len(m.Dishes))
- }
-
- eggSalad := m.Dishes["eggsalad"]
- if _, ok := interface{}(eggSalad).(dish); !ok {
- t.Errorf("expected a dish")
- }
-
- if eggSalad.Name != "Egg Salad with rice" {
- t.Errorf("expected the dish to be named 'Egg Salad with rice'")
- }
-
- if len(eggSalad.Ingredients) != 3 {
- t.Log("dish should be loaded with UnmarshalTOML()")
- t.Errorf("expected %d but got %d", 3, len(eggSalad.Ingredients))
- }
-
- found := false
- for _, i := range eggSalad.Ingredients {
- if i.Name == "Rice" {
- found = true
- break
- }
- }
- if !found {
- t.Error("Rice was not loaded in UnmarshalTOML()")
- }
-
- // test on a value - must be passed as *
- o := menu{}
- if _, err := Decode(tomlBlob, &o); err != nil {
- log.Fatal(err)
- }
-
-}
-
-type menu struct {
- Dishes map[string]dish
-}
-
-func (m *menu) UnmarshalTOML(p interface{}) error {
- m.Dishes = make(map[string]dish)
- data, _ := p.(map[string]interface{})
- dishes := data["dishes"].(map[string]interface{})
- for n, v := range dishes {
- if d, ok := v.(map[string]interface{}); ok {
- nd := dish{}
- nd.UnmarshalTOML(d)
- m.Dishes[n] = nd
- } else {
- return fmt.Errorf("not a dish")
- }
- }
- return nil
-}
-
-type dish struct {
- Name string
- Price float32
- Ingredients []ingredient
-}
-
-func (d *dish) UnmarshalTOML(p interface{}) error {
- data, _ := p.(map[string]interface{})
- d.Name, _ = data["name"].(string)
- d.Price, _ = data["price"].(float32)
- ingredients, _ := data["ingredients"].([]map[string]interface{})
- for _, e := range ingredients {
- n, _ := interface{}(e).(map[string]interface{})
- name, _ := n["name"].(string)
- i := ingredient{name}
- d.Ingredients = append(d.Ingredients, i)
- }
- return nil
-}
-
-type ingredient struct {
- Name string
-}
-
-func ExampleMetaData_PrimitiveDecode() {
- var md MetaData
- var err error
-
- var tomlBlob = `
-ranking = ["Springsteen", "J Geils"]
-
-[bands.Springsteen]
-started = 1973
-albums = ["Greetings", "WIESS", "Born to Run", "Darkness"]
-
-[bands."J Geils"]
-started = 1970
-albums = ["The J. Geils Band", "Full House", "Blow Your Face Out"]
-`
-
- type band struct {
- Started int
- Albums []string
- }
- type classics struct {
- Ranking []string
- Bands map[string]Primitive
- }
-
- // Do the initial decode. Reflection is delayed on Primitive values.
- var music classics
- if md, err = Decode(tomlBlob, &music); err != nil {
- log.Fatal(err)
- }
-
- // MetaData still includes information on Primitive values.
- fmt.Printf("Is `bands.Springsteen` defined? %v\n",
- md.IsDefined("bands", "Springsteen"))
-
- // Decode primitive data into Go values.
- for _, artist := range music.Ranking {
- // A band is a primitive value, so we need to decode it to get a
- // real `band` value.
- primValue := music.Bands[artist]
-
- var aBand band
- if err = md.PrimitiveDecode(primValue, &aBand); err != nil {
- log.Fatal(err)
- }
- fmt.Printf("%s started in %d.\n", artist, aBand.Started)
- }
- // Check to see if there were any fields left undecoded.
- // Note that this won't be empty before decoding the Primitive value!
- fmt.Printf("Undecoded: %q\n", md.Undecoded())
-
- // Output:
- // Is `bands.Springsteen` defined? true
- // Springsteen started in 1973.
- // J Geils started in 1970.
- // Undecoded: []
-}
-
-func ExampleDecode() {
- var tomlBlob = `
-# Some comments.
-[alpha]
-ip = "10.0.0.1"
-
- [alpha.config]
- Ports = [ 8001, 8002 ]
- Location = "Toronto"
- Created = 1987-07-05T05:45:00Z
-
-[beta]
-ip = "10.0.0.2"
-
- [beta.config]
- Ports = [ 9001, 9002 ]
- Location = "New Jersey"
- Created = 1887-01-05T05:55:00Z
-`
-
- type serverConfig struct {
- Ports []int
- Location string
- Created time.Time
- }
-
- type server struct {
- IP string `toml:"ip"`
- Config serverConfig `toml:"config"`
- }
-
- type servers map[string]server
-
- var config servers
- if _, err := Decode(tomlBlob, &config); err != nil {
- log.Fatal(err)
- }
-
- for _, name := range []string{"alpha", "beta"} {
- s := config[name]
- fmt.Printf("Server: %s (ip: %s) in %s created on %s\n",
- name, s.IP, s.Config.Location,
- s.Config.Created.Format("2006-01-02"))
- fmt.Printf("Ports: %v\n", s.Config.Ports)
- }
-
- // Output:
- // Server: alpha (ip: 10.0.0.1) in Toronto created on 1987-07-05
- // Ports: [8001 8002]
- // Server: beta (ip: 10.0.0.2) in New Jersey created on 1887-01-05
- // Ports: [9001 9002]
-}
-
-type duration struct {
- time.Duration
-}
-
-func (d *duration) UnmarshalText(text []byte) error {
- var err error
- d.Duration, err = time.ParseDuration(string(text))
- return err
-}
-
-// Example Unmarshaler shows how to decode TOML strings into your own
-// custom data type.
-func Example_unmarshaler() {
- blob := `
-[[song]]
-name = "Thunder Road"
-duration = "4m49s"
-
-[[song]]
-name = "Stairway to Heaven"
-duration = "8m03s"
-`
- type song struct {
- Name string
- Duration duration
- }
- type songs struct {
- Song []song
- }
- var favorites songs
- if _, err := Decode(blob, &favorites); err != nil {
- log.Fatal(err)
- }
-
- // Code to implement the TextUnmarshaler interface for `duration`:
- //
- // type duration struct {
- // time.Duration
- // }
- //
- // func (d *duration) UnmarshalText(text []byte) error {
- // var err error
- // d.Duration, err = time.ParseDuration(string(text))
- // return err
- // }
-
- for _, s := range favorites.Song {
- fmt.Printf("%s (%s)\n", s.Name, s.Duration)
- }
- // Output:
- // Thunder Road (4m49s)
- // Stairway to Heaven (8m3s)
-}
-
-// Example StrictDecoding shows how to detect whether there are keys in the
-// TOML document that weren't decoded into the value given. This is useful
-// for returning an error to the user if they've included extraneous fields
-// in their configuration.
-func Example_strictDecoding() {
- var blob = `
-key1 = "value1"
-key2 = "value2"
-key3 = "value3"
-`
- type config struct {
- Key1 string
- Key3 string
- }
-
- var conf config
- md, err := Decode(blob, &conf)
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("Undecoded keys: %q\n", md.Undecoded())
- // Output:
- // Undecoded keys: ["key2"]
-}
-
-// Example UnmarshalTOML shows how to implement a struct type that knows how to
-// unmarshal itself. The struct must take full responsibility for mapping the
-// values passed into the struct. The method may be used with interfaces in a
-// struct in cases where the actual type is not known until the data is
-// examined.
-func Example_unmarshalTOML() {
-
- var blob = `
-[[parts]]
-type = "valve"
-id = "valve-1"
-size = 1.2
-rating = 4
-
-[[parts]]
-type = "valve"
-id = "valve-2"
-size = 2.1
-rating = 5
-
-[[parts]]
-type = "pipe"
-id = "pipe-1"
-length = 2.1
-diameter = 12
-
-[[parts]]
-type = "cable"
-id = "cable-1"
-length = 12
-rating = 3.1
-`
- o := &order{}
- err := Unmarshal([]byte(blob), o)
- if err != nil {
- log.Fatal(err)
- }
-
- fmt.Println(len(o.parts))
-
- for _, part := range o.parts {
- fmt.Println(part.Name())
- }
-
- // Code to implement UmarshalJSON.
-
- // type order struct {
- // // NOTE `order.parts` is a private slice of type `part` which is an
- // // interface and may only be loaded from toml using the
- // // UnmarshalTOML() method of the Umarshaler interface.
- // parts parts
- // }
-
- // func (o *order) UnmarshalTOML(data interface{}) error {
-
- // // NOTE the example below contains detailed type casting to show how
- // // the 'data' is retrieved. In operational use, a type cast wrapper
- // // may be prefered e.g.
- // //
- // // func AsMap(v interface{}) (map[string]interface{}, error) {
- // // return v.(map[string]interface{})
- // // }
- // //
- // // resulting in:
- // // d, _ := AsMap(data)
- // //
-
- // d, _ := data.(map[string]interface{})
- // parts, _ := d["parts"].([]map[string]interface{})
-
- // for _, p := range parts {
-
- // typ, _ := p["type"].(string)
- // id, _ := p["id"].(string)
-
- // // detect the type of part and handle each case
- // switch p["type"] {
- // case "valve":
-
- // size := float32(p["size"].(float64))
- // rating := int(p["rating"].(int64))
-
- // valve := &valve{
- // Type: typ,
- // ID: id,
- // Size: size,
- // Rating: rating,
- // }
-
- // o.parts = append(o.parts, valve)
-
- // case "pipe":
-
- // length := float32(p["length"].(float64))
- // diameter := int(p["diameter"].(int64))
-
- // pipe := &pipe{
- // Type: typ,
- // ID: id,
- // Length: length,
- // Diameter: diameter,
- // }
-
- // o.parts = append(o.parts, pipe)
-
- // case "cable":
-
- // length := int(p["length"].(int64))
- // rating := float32(p["rating"].(float64))
-
- // cable := &cable{
- // Type: typ,
- // ID: id,
- // Length: length,
- // Rating: rating,
- // }
-
- // o.parts = append(o.parts, cable)
-
- // }
- // }
-
- // return nil
- // }
-
- // type parts []part
-
- // type part interface {
- // Name() string
- // }
-
- // type valve struct {
- // Type string
- // ID string
- // Size float32
- // Rating int
- // }
-
- // func (v *valve) Name() string {
- // return fmt.Sprintf("VALVE: %s", v.ID)
- // }
-
- // type pipe struct {
- // Type string
- // ID string
- // Length float32
- // Diameter int
- // }
-
- // func (p *pipe) Name() string {
- // return fmt.Sprintf("PIPE: %s", p.ID)
- // }
-
- // type cable struct {
- // Type string
- // ID string
- // Length int
- // Rating float32
- // }
-
- // func (c *cable) Name() string {
- // return fmt.Sprintf("CABLE: %s", c.ID)
- // }
-
- // Output:
- // 4
- // VALVE: valve-1
- // VALVE: valve-2
- // PIPE: pipe-1
- // CABLE: cable-1
-
-}
-
-type order struct {
- // NOTE `order.parts` is a private slice of type `part` which is an
- // interface and may only be loaded from toml using the UnmarshalTOML()
- // method of the Umarshaler interface.
- parts parts
-}
-
-func (o *order) UnmarshalTOML(data interface{}) error {
-
- // NOTE the example below contains detailed type casting to show how
- // the 'data' is retrieved. In operational use, a type cast wrapper
- // may be prefered e.g.
- //
- // func AsMap(v interface{}) (map[string]interface{}, error) {
- // return v.(map[string]interface{})
- // }
- //
- // resulting in:
- // d, _ := AsMap(data)
- //
-
- d, _ := data.(map[string]interface{})
- parts, _ := d["parts"].([]map[string]interface{})
-
- for _, p := range parts {
-
- typ, _ := p["type"].(string)
- id, _ := p["id"].(string)
-
- // detect the type of part and handle each case
- switch p["type"] {
- case "valve":
-
- size := float32(p["size"].(float64))
- rating := int(p["rating"].(int64))
-
- valve := &valve{
- Type: typ,
- ID: id,
- Size: size,
- Rating: rating,
- }
-
- o.parts = append(o.parts, valve)
-
- case "pipe":
-
- length := float32(p["length"].(float64))
- diameter := int(p["diameter"].(int64))
-
- pipe := &pipe{
- Type: typ,
- ID: id,
- Length: length,
- Diameter: diameter,
- }
-
- o.parts = append(o.parts, pipe)
-
- case "cable":
-
- length := int(p["length"].(int64))
- rating := float32(p["rating"].(float64))
-
- cable := &cable{
- Type: typ,
- ID: id,
- Length: length,
- Rating: rating,
- }
-
- o.parts = append(o.parts, cable)
-
- }
- }
-
- return nil
-}
-
-type parts []part
-
-type part interface {
- Name() string
-}
-
-type valve struct {
- Type string
- ID string
- Size float32
- Rating int
-}
-
-func (v *valve) Name() string {
- return fmt.Sprintf("VALVE: %s", v.ID)
-}
-
-type pipe struct {
- Type string
- ID string
- Length float32
- Diameter int
-}
-
-func (p *pipe) Name() string {
- return fmt.Sprintf("PIPE: %s", p.ID)
-}
-
-type cable struct {
- Type string
- ID string
- Length int
- Rating float32
-}
-
-func (c *cable) Name() string {
- return fmt.Sprintf("CABLE: %s", c.ID)
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/c08cb449/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/doc.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/doc.go b/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/doc.go
deleted file mode 100644
index fe26800..0000000
--- a/newt/Godeps/_workspace/src/github.com/BurntSushi/toml/doc.go
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Package toml provides facilities for decoding and encoding TOML configuration
-files via reflection. There is also support for delaying decoding with
-the Primitive type, and querying the set of keys in a TOML document with the
-MetaData type.
-
-The specification implemented: https://github.com/mojombo/toml
-
-The sub-command github.com/BurntSushi/toml/cmd/tomlv can be used to verify
-whether a file is a valid TOML document. It can also be used to print the
-type of each key in a TOML document.
-
-Testing
-
-There are two important types of tests used for this package. The first is
-contained inside '*_test.go' files and uses the standard Go unit testing
-framework. These tests are primarily devoted to holistically testing the
-decoder and encoder.
-
-The second type of testing is used to verify the implementation's adherence
-to the TOML specification. These tests have been factored into their own
-project: https://github.com/BurntSushi/toml-test
-
-The reason the tests are in a separate project is so that they can be used by
-any implementation of TOML. Namely, it is language agnostic.
-*/
-package toml