From d26b52b5bfd39537a9af6bf0e775f4cfd06bdce7 Mon Sep 17 00:00:00 2001
From: jasmingacic
Date: Tue, 15 Oct 2019 13:22:17 +0200
Subject: [PATCH 1/4] fixed output of go install -ldflags "-X
main.Version=0.0.3 -X main.Build=`git rev-parse HEAD`" mv
/Volumes/Data/go/bin/packet-cli /Volumes/Data/go/bin/packet
---
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index a8273079..318f3df2 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,8 @@ clean-docs:
rm -rf docs/
install:
- go install ${LDFLAGS}
+ go install ${LDFLAGS}
+ mv ${GOPATH}/bin/packet-cli ${GOPATH}/bin/packet
generate-docs: clean-docs
mkdir -p docs
From 94b7cf843a1dc3075f014856be8555e684b1adce Mon Sep 17 00:00:00 2001
From: jasmingacic
Date: Mon, 25 Nov 2019 10:59:58 +0100
Subject: [PATCH 2/4] Added go modules support Various fixes
---
go.mod | 35 +++++++++++++++++++++++++++++++
go.sum | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+)
create mode 100644 go.mod
create mode 100644 go.sum
diff --git a/go.mod b/go.mod
new file mode 100644
index 00000000..0d620414
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,35 @@
+module github.com/packethost/packet-cli
+
+go 1.13
+
+require (
+ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
+ github.com/cpuguy83/go-md2man v1.0.10 // indirect
+ github.com/fsnotify/fsnotify v1.4.7
+ github.com/ghodss/yaml v1.0.0
+ github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
+ github.com/inconshreveable/mousetrap v1.0.0
+ github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a
+ github.com/lunixbochs/vtclean v0.0.0-20170504063817-d14193dfc626
+ github.com/magiconair/properties v1.8.0
+ github.com/manifoldco/promptui v0.3.0
+ github.com/mattn/go-colorable v0.0.9
+ github.com/mattn/go-isatty v0.0.3
+ github.com/mattn/go-runewidth v0.0.2
+ github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675
+ github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84
+ github.com/packethost/packngo v0.2.0
+ // github.com/packethost/packngo v0.1.1-0.20180815124420-3e366203a129
+ github.com/pelletier/go-toml v1.2.0
+ github.com/russross/blackfriday v1.5.2
+ github.com/spf13/afero v1.1.1
+ github.com/spf13/cast v1.2.0
+ github.com/spf13/cobra v0.0.3
+ github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec
+ github.com/spf13/pflag v1.0.1
+ github.com/spf13/viper v1.0.2
+ golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67
+ golang.org/x/sys v0.0.0-20190209173611-3b5209105503
+ golang.org/x/text v0.3.0
+ gopkg.in/yaml.v2 v2.2.1
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 00000000..6b09c50f
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,65 @@
+github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
+github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
+github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
+github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce h1:xdsDDbiBDQTKASoGEZ+pEmF1OnWuu8AQ9I8iNbHNeno=
+github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=
+github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU=
+github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU=
+github.com/lunixbochs/vtclean v0.0.0-20170504063817-d14193dfc626 h1:33Ys8SnkRfz5ojdG853pyT/2Iqbk95PVm+QrC5XvI70=
+github.com/lunixbochs/vtclean v0.0.0-20170504063817-d14193dfc626/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
+github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
+github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
+github.com/manifoldco/promptui v0.3.0 h1:vJiVJREqDfn9ZhqTG1Dz5zP9RPWlAzWQkwRYLGyUHx4=
+github.com/manifoldco/promptui v0.3.0/go.mod h1:zoCNXiJnyM03LlBgTsWv8mq28s7aTC71UgKasqRJHww=
+github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
+github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=
+github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
+github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675 h1:/rdJjIiKG5rRdwG5yxHmSE/7ZREjpyC0kL7GxGT/qJw=
+github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84 h1:fiKJgB4JDUd43CApkmCeTSQlWjtTtABrU2qsgbuP0BI=
+github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
+github.com/packethost/packngo v0.1.1-0.20180815124420-3e366203a129 h1:lDfDk9Dhr7aIoHUg2oUDQZDH9CEOFoKsusDxgaI2Z9M=
+github.com/packethost/packngo v0.1.1-0.20180815124420-3e366203a129/go.mod h1:otzZQXgoO96RTzDB/Hycg0qZcXZsWJGJRSXbmEIJ+4M=
+github.com/packethost/packngo v0.2.0 h1:mSlzOof8PsOWCy78sBMt/PwMJTEjjQ/rRvMixu4Nm6c=
+github.com/packethost/packngo v0.2.0/go.mod h1:RQHg5xR1F614BwJyepfMqrKN+32IH0i7yX+ey43rEeQ=
+github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
+github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/russross/blackfriday v1.5.1/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
+github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
+github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
+github.com/spf13/afero v1.1.1 h1:Lt3ihYMlE+lreX1GS4Qw4ZsNpYQLxIXKBTEOXm3nt6I=
+github.com/spf13/afero v1.1.1/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
+github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg=
+github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
+github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
+github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
+github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec h1:2ZXvIUGghLpdTVHR1UfvfrzoVlZaE/yOWC5LueIHZig=
+github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
+github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
+github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/viper v1.0.2 h1:Ncr3ZIuJn322w2k1qmzXDnkLAdQMlJqBa9kfAH+irso=
+github.com/spf13/viper v1.0.2/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE=
+golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/sys v0.0.0-20180613171135-56ede360ec1c h1:MXZD94RFXTTtcEuUwFza91dzAvAqaXCZZxTpMnV4biY=
+golang.org/x/sys v0.0.0-20180613171135-56ede360ec1c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190209173611-3b5209105503 h1:5SvYFrOM3W8Mexn9/oA44Ji7vhXAZQ9hiP+1Q/DMrWg=
+golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
From 4c354bb3d192970133dfafe7627cae6214819e9f Mon Sep 17 00:00:00 2001
From: jasmingacic
Date: Mon, 25 Nov 2019 11:01:45 +0100
Subject: [PATCH 3/4] various fixes
---
cmd/create_device.go | 4 +-
cmd/create_virtual_network.go | 13 +-
cmd/request_ip.go | 5 +-
cmd/retrieve_device.go | 2 +-
cmd/retrieve_event.go | 5 +-
cmd/retrieve_facilities.go | 2 +-
cmd/retrieve_hardware_reservations.go | 5 +-
cmd/retrieve_ip.go | 4 +-
cmd/retrieve_organization.go | 4 +-
cmd/retrieve_plans.go | 3 +-
cmd/retrieve_project.go | 4 +-
cmd/retrieve_ssh_key.go | 2 +-
cmd/retrieve_user.go | 2 +-
cmd/retrieve_virtual_network.go | 2 +-
cmd/retrieve_volume.go | 2 +-
cmd/retrieve_vpn.go | 2 +-
docs/packet.md | 6 +-
docs/packet_2fa.md | 4 +-
docs/packet_2fa_disable.md | 4 +-
docs/packet_2fa_enable.md | 4 +-
docs/packet_2fa_receive.md | 4 +-
docs/packet_device.md | 4 +-
docs/packet_device_create.md | 4 +-
docs/packet_device_delete.md | 4 +-
docs/packet_device_get.md | 4 +-
docs/packet_device_reboot.md | 4 +-
docs/packet_device_start.md | 4 +-
docs/packet_device_stop.md | 4 +-
docs/packet_device_update.md | 4 +-
docs/packet_event.md | 4 +-
docs/packet_event_get.md | 4 +-
docs/packet_facilities.md | 4 +-
docs/packet_facilities_get.md | 4 +-
docs/packet_hardware-reservation.md | 4 +-
docs/packet_hardware-reservation_get.md | 4 +-
docs/packet_hardware-reservation_move.md | 4 +-
docs/packet_ip.md | 4 +-
docs/packet_ip_assign.md | 4 +-
docs/packet_ip_available.md | 4 +-
docs/packet_ip_get.md | 4 +-
docs/packet_ip_remove.md | 4 +-
docs/packet_ip_request.md | 4 +-
docs/packet_ip_unassign.md | 4 +-
docs/packet_operating-systems.md | 4 +-
docs/packet_operating-systems_get.md | 4 +-
docs/packet_organization.md | 4 +-
docs/packet_organization_create.md | 4 +-
docs/packet_organization_delete.md | 4 +-
docs/packet_organization_get.md | 4 +-
...packet_organization_get_payment-methods.md | 4 +-
docs/packet_organization_update.md | 4 +-
docs/packet_plan.md | 4 +-
docs/packet_plan_get.md | 4 +-
docs/packet_project.md | 4 +-
docs/packet_project_create.md | 4 +-
docs/packet_project_delete.md | 4 +-
docs/packet_project_get.md | 4 +-
docs/packet_project_update.md | 4 +-
docs/packet_ssh-key.md | 4 +-
docs/packet_ssh-key_create.md | 4 +-
docs/packet_ssh-key_delete.md | 4 +-
docs/packet_ssh-key_get.md | 4 +-
docs/packet_ssh-key_update.md | 4 +-
docs/packet_user.md | 4 +-
docs/packet_user_get.md | 4 +-
docs/packet_virtual-network.md | 4 +-
docs/packet_virtual-network_create.md | 6 +-
docs/packet_virtual-network_delete.md | 4 +-
docs/packet_virtual-network_get.md | 4 +-
docs/packet_volume.md | 4 +-
docs/packet_volume_attach.md | 4 +-
docs/packet_volume_create.md | 4 +-
docs/packet_volume_delete.md | 4 +-
docs/packet_volume_detach.md | 4 +-
docs/packet_volume_get.md | 4 +-
docs/packet_vpn.md | 4 +-
docs/packet_vpn_disable.md | 4 +-
docs/packet_vpn_enable.md | 4 +-
docs/packet_vpn_get.md | 4 +-
tests/facilities_test.go | 2 +-
tests/main_test.go | 4 +-
tests/organization_test.go | 6 +-
tests/plan_test.go | 2 +-
tests/project_test.go | 6 +-
tests/ssh_key_test.go | 57 +-
tests/virtual_network_test.go | 6 +-
tests/volumes_test.go | 12 +-
vendor/github.com/chzyer/readline/.gitignore | 1 -
vendor/github.com/chzyer/readline/.travis.yml | 8 -
.../github.com/chzyer/readline/CHANGELOG.md | 58 -
vendor/github.com/chzyer/readline/LICENSE | 22 -
vendor/github.com/chzyer/readline/README.md | 114 -
.../chzyer/readline/ansi_windows.go | 249 -
vendor/github.com/chzyer/readline/complete.go | 285 -
.../chzyer/readline/complete_helper.go | 165 -
.../chzyer/readline/complete_segment.go | 82 -
.../chzyer/readline/complete_segment_test.go | 167 -
.../chzyer/readline/doc/shortcut.md | 62 -
.../example/readline-demo/readline-demo.go | 167 -
.../readline/example/readline-im/README.md | 3 -
.../example/readline-im/readline-im.go | 60 -
.../readline-multiline/readline-multiline.go | 41 -
.../readline-pass-strength.go | 102 -
.../readline-remote-client/client.go | 9 -
.../readline-remote-server/server.go | 26 -
vendor/github.com/chzyer/readline/history.go | 330 -
.../github.com/chzyer/readline/operation.go | 531 -
vendor/github.com/chzyer/readline/password.go | 33 -
.../chzyer/readline/rawreader_windows.go | 125 -
vendor/github.com/chzyer/readline/readline.go | 326 -
.../chzyer/readline/readline_test.go | 27 -
vendor/github.com/chzyer/readline/remote.go | 475 -
vendor/github.com/chzyer/readline/runebuf.go | 629 -
vendor/github.com/chzyer/readline/runes.go | 223 -
.../github.com/chzyer/readline/runes/runes.go | 155 -
.../chzyer/readline/runes/runes_test.go | 68 -
.../github.com/chzyer/readline/runes_test.go | 68 -
vendor/github.com/chzyer/readline/search.go | 164 -
vendor/github.com/chzyer/readline/std.go | 197 -
.../github.com/chzyer/readline/std_windows.go | 9 -
vendor/github.com/chzyer/readline/term.go | 123 -
vendor/github.com/chzyer/readline/term_bsd.go | 29 -
.../github.com/chzyer/readline/term_linux.go | 33 -
.../chzyer/readline/term_solaris.go | 32 -
.../github.com/chzyer/readline/term_unix.go | 24 -
.../chzyer/readline/term_windows.go | 171 -
vendor/github.com/chzyer/readline/terminal.go | 238 -
vendor/github.com/chzyer/readline/utils.go | 277 -
.../github.com/chzyer/readline/utils_test.go | 1 -
.../github.com/chzyer/readline/utils_unix.go | 83 -
.../chzyer/readline/utils_windows.go | 41 -
vendor/github.com/chzyer/readline/vim.go | 176 -
.../github.com/chzyer/readline/windows_api.go | 152 -
.../github.com/cpuguy83/go-md2man/.gitignore | 1 -
.../cpuguy83/go-md2man/.gometalinter.json | 20 -
.../github.com/cpuguy83/go-md2man/.travis.yml | 13 -
.../github.com/cpuguy83/go-md2man/Dockerfile | 8 -
.../github.com/cpuguy83/go-md2man/Gopkg.lock | 15 -
.../github.com/cpuguy83/go-md2man/Gopkg.toml | 26 -
.../github.com/cpuguy83/go-md2man/LICENSE.md | 21 -
vendor/github.com/cpuguy83/go-md2man/Makefile | 2 -
.../github.com/cpuguy83/go-md2man/README.md | 21 -
.../cpuguy83/go-md2man/go-md2man.1.md | 23 -
.../github.com/cpuguy83/go-md2man/md2man.go | 51 -
.../cpuguy83/go-md2man/md2man/md2man.go | 20 -
.../cpuguy83/go-md2man/md2man/roff.go | 285 -
.../cpuguy83/go-md2man/md2man/roff_test.go | 97 -
.../cpuguy83/go-md2man/script/setup/dev-tools | 7 -
.../cpuguy83/go-md2man/script/validate/vendor | 18 -
.../fsnotify/fsnotify/.editorconfig | 5 -
.../fsnotify/.github/ISSUE_TEMPLATE.md | 11 -
.../fsnotify/.github/PULL_REQUEST_TEMPLATE.md | 8 -
.../github.com/fsnotify/fsnotify/.gitignore | 6 -
.../github.com/fsnotify/fsnotify/.travis.yml | 30 -
vendor/github.com/fsnotify/fsnotify/AUTHORS | 52 -
.../github.com/fsnotify/fsnotify/CHANGELOG.md | 317 -
.../fsnotify/fsnotify/CONTRIBUTING.md | 77 -
vendor/github.com/fsnotify/fsnotify/LICENSE | 28 -
vendor/github.com/fsnotify/fsnotify/README.md | 79 -
.../fsnotify/fsnotify/example_test.go | 42 -
vendor/github.com/fsnotify/fsnotify/fen.go | 37 -
.../github.com/fsnotify/fsnotify/fsnotify.go | 66 -
.../fsnotify/fsnotify/fsnotify_test.go | 70 -
.../github.com/fsnotify/fsnotify/inotify.go | 337 -
.../fsnotify/fsnotify/inotify_poller.go | 187 -
.../fsnotify/fsnotify/inotify_poller_test.go | 229 -
.../fsnotify/fsnotify/inotify_test.go | 449 -
.../fsnotify/integration_darwin_test.go | 147 -
.../fsnotify/fsnotify/integration_test.go | 1237 -
vendor/github.com/fsnotify/fsnotify/kqueue.go | 521 -
.../fsnotify/fsnotify/open_mode_bsd.go | 11 -
.../fsnotify/fsnotify/open_mode_darwin.go | 12 -
.../github.com/fsnotify/fsnotify/windows.go | 561 -
vendor/github.com/ghodss/yaml/.gitignore | 20 -
vendor/github.com/ghodss/yaml/.travis.yml | 7 -
vendor/github.com/ghodss/yaml/LICENSE | 50 -
vendor/github.com/ghodss/yaml/README.md | 121 -
vendor/github.com/ghodss/yaml/fields.go | 501 -
vendor/github.com/ghodss/yaml/yaml.go | 277 -
vendor/github.com/ghodss/yaml/yaml_test.go | 287 -
.../hashicorp/hcl/.github/ISSUE_TEMPLATE.md | 21 -
vendor/github.com/hashicorp/hcl/.gitignore | 9 -
vendor/github.com/hashicorp/hcl/.travis.yml | 13 -
vendor/github.com/hashicorp/hcl/LICENSE | 354 -
vendor/github.com/hashicorp/hcl/Makefile | 18 -
vendor/github.com/hashicorp/hcl/README.md | 125 -
vendor/github.com/hashicorp/hcl/appveyor.yml | 19 -
vendor/github.com/hashicorp/hcl/decoder.go | 729 -
.../github.com/hashicorp/hcl/decoder_test.go | 1203 -
vendor/github.com/hashicorp/hcl/hcl.go | 11 -
.../github.com/hashicorp/hcl/hcl/ast/ast.go | 219 -
.../hashicorp/hcl/hcl/ast/ast_test.go | 200 -
.../github.com/hashicorp/hcl/hcl/ast/walk.go | 52 -
.../hashicorp/hcl/hcl/fmtcmd/fmtcmd.go | 162 -
.../hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go | 440 -
.../hcl/fmtcmd/test-fixtures/.hidden.ignore | 1 -
.../hcl/hcl/fmtcmd/test-fixtures/dir.ignore | 0
.../hcl/hcl/fmtcmd/test-fixtures/file.ignore | 1 -
.../hcl/hcl/fmtcmd/test-fixtures/good.hcl | 0
.../hashicorp/hcl/hcl/parser/error.go | 17 -
.../hashicorp/hcl/hcl/parser/error_test.go | 9 -
.../hashicorp/hcl/hcl/parser/parser.go | 532 -
.../hashicorp/hcl/hcl/parser/parser_test.go | 575 -
.../parser/test-fixtures/array_comment.hcl | 4 -
.../parser/test-fixtures/array_comment_2.hcl | 6 -
.../hcl/parser/test-fixtures/assign_colon.hcl | 6 -
.../hcl/parser/test-fixtures/assign_deep.hcl | 5 -
.../hcl/hcl/parser/test-fixtures/comment.hcl | 15 -
.../hcl/parser/test-fixtures/comment_crlf.hcl | 15 -
.../parser/test-fixtures/comment_lastline.hcl | 1 -
.../parser/test-fixtures/comment_single.hcl | 1 -
.../hcl/hcl/parser/test-fixtures/complex.hcl | 42 -
.../hcl/parser/test-fixtures/complex_crlf.hcl | 42 -
.../hcl/parser/test-fixtures/complex_key.hcl | 1 -
.../hcl/hcl/parser/test-fixtures/empty.hcl | 0
.../hcl/parser/test-fixtures/git_crypt.hcl | Bin 10 -> 0 bytes
.../test-fixtures/key_without_value.hcl | 1 -
.../hcl/hcl/parser/test-fixtures/list.hcl | 1 -
.../hcl/parser/test-fixtures/list_comma.hcl | 1 -
.../parser/test-fixtures/missing_braces.hcl | 4 -
.../hcl/hcl/parser/test-fixtures/multiple.hcl | 2 -
.../object_key_assign_without_value.hcl | 3 -
.../object_key_assign_without_value2.hcl | 4 -
.../object_key_assign_without_value3.hcl | 4 -
.../object_key_without_value.hcl | 3 -
.../test-fixtures/object_list_comma.hcl | 1 -
.../hcl/hcl/parser/test-fixtures/old.hcl | 3 -
.../hcl/parser/test-fixtures/structure.hcl | 5 -
.../parser/test-fixtures/structure_basic.hcl | 5 -
.../parser/test-fixtures/structure_empty.hcl | 1 -
.../hcl/hcl/parser/test-fixtures/types.hcl | 7 -
.../test-fixtures/unterminated_object.hcl | 2 -
.../test-fixtures/unterminated_object_2.hcl | 6 -
.../hashicorp/hcl/hcl/printer/nodes.go | 789 -
.../hashicorp/hcl/hcl/printer/printer.go | 66 -
.../hashicorp/hcl/hcl/printer/printer_test.go | 176 -
.../hcl/hcl/printer/testdata/comment.golden | 39 -
.../hcl/hcl/printer/testdata/comment.input | 39 -
.../printer/testdata/comment_aligned.golden | 32 -
.../printer/testdata/comment_aligned.input | 28 -
.../hcl/printer/testdata/comment_array.golden | 13 -
.../hcl/printer/testdata/comment_array.input | 13 -
.../hcl/printer/testdata/comment_crlf.input | 39 -
.../printer/testdata/comment_end_file.golden | 6 -
.../printer/testdata/comment_end_file.input | 5 -
.../testdata/comment_multiline_indent.golden | 12 -
.../testdata/comment_multiline_indent.input | 13 -
.../comment_multiline_no_stanza.golden | 7 -
.../comment_multiline_no_stanza.input | 6 -
.../testdata/comment_multiline_stanza.golden | 10 -
.../testdata/comment_multiline_stanza.input | 10 -
.../printer/testdata/comment_newline.golden | 3 -
.../printer/testdata/comment_newline.input | 2 -
.../testdata/comment_object_multi.golden | 9 -
.../testdata/comment_object_multi.input | 9 -
.../testdata/comment_standalone.golden | 17 -
.../printer/testdata/comment_standalone.input | 16 -
.../hcl/printer/testdata/complexhcl.golden | 54 -
.../hcl/hcl/printer/testdata/complexhcl.input | 53 -
.../hcl/printer/testdata/empty_block.golden | 12 -
.../hcl/printer/testdata/empty_block.input | 14 -
.../hcl/hcl/printer/testdata/list.golden | 46 -
.../hcl/hcl/printer/testdata/list.input | 37 -
.../hcl/printer/testdata/list_comment.golden | 13 -
.../hcl/printer/testdata/list_comment.input | 9 -
.../printer/testdata/list_of_objects.golden | 10 -
.../printer/testdata/list_of_objects.input | 10 -
.../printer/testdata/multiline_string.golden | 7 -
.../printer/testdata/multiline_string.input | 7 -
.../printer/testdata/object_singleline.golden | 26 -
.../printer/testdata/object_singleline.input | 19 -
.../testdata/object_with_heredoc.golden | 7 -
.../testdata/object_with_heredoc.input | 7 -
.../hashicorp/hcl/hcl/scanner/scanner.go | 652 -
.../hashicorp/hcl/hcl/scanner/scanner_test.go | 642 -
.../hashicorp/hcl/hcl/strconv/quote.go | 241 -
.../hashicorp/hcl/hcl/strconv/quote_test.go | 96 -
.../hcl/hcl/test-fixtures/array_comment.hcl | 4 -
.../hcl/hcl/test-fixtures/assign_colon.hcl | 6 -
.../hcl/hcl/test-fixtures/comment.hcl | 15 -
.../hcl/hcl/test-fixtures/comment_single.hcl | 1 -
.../hcl/hcl/test-fixtures/complex.hcl | 42 -
.../hcl/hcl/test-fixtures/complex_key.hcl | 1 -
.../hashicorp/hcl/hcl/test-fixtures/empty.hcl | 0
.../hashicorp/hcl/hcl/test-fixtures/list.hcl | 1 -
.../hcl/hcl/test-fixtures/list_comma.hcl | 1 -
.../hcl/hcl/test-fixtures/multiple.hcl | 2 -
.../hashicorp/hcl/hcl/test-fixtures/old.hcl | 3 -
.../hcl/hcl/test-fixtures/structure.hcl | 5 -
.../hcl/hcl/test-fixtures/structure_basic.hcl | 5 -
.../hcl/hcl/test-fixtures/structure_empty.hcl | 1 -
.../hashicorp/hcl/hcl/test-fixtures/types.hcl | 7 -
.../hashicorp/hcl/hcl/token/position.go | 46 -
.../hashicorp/hcl/hcl/token/token.go | 219 -
.../hashicorp/hcl/hcl/token/token_test.go | 69 -
vendor/github.com/hashicorp/hcl/hcl_test.go | 19 -
.../hashicorp/hcl/json/parser/flatten.go | 117 -
.../hashicorp/hcl/json/parser/parser.go | 313 -
.../hashicorp/hcl/json/parser/parser_test.go | 384 -
.../hcl/json/parser/test-fixtures/array.json | 4 -
.../parser/test-fixtures/bad_input_128.json | 1 -
.../test-fixtures/bad_input_tf_8110.json | 7 -
.../hcl/json/parser/test-fixtures/basic.json | 3 -
.../test-fixtures/good_input_tf_8110.json | 7 -
.../hcl/json/parser/test-fixtures/object.json | 5 -
.../hcl/json/parser/test-fixtures/types.json | 10 -
.../hashicorp/hcl/json/scanner/scanner.go | 451 -
.../hcl/json/scanner/scanner_test.go | 362 -
.../hcl/json/test-fixtures/array.json | 4 -
.../hcl/json/test-fixtures/basic.json | 3 -
.../hcl/json/test-fixtures/object.json | 5 -
.../hcl/json/test-fixtures/types.json | 10 -
.../hashicorp/hcl/json/token/position.go | 46 -
.../hashicorp/hcl/json/token/token.go | 118 -
.../hashicorp/hcl/json/token/token_test.go | 34 -
vendor/github.com/hashicorp/hcl/lex.go | 38 -
vendor/github.com/hashicorp/hcl/lex_test.go | 37 -
vendor/github.com/hashicorp/hcl/parse.go | 39 -
.../hcl/test-fixtures/assign_deep.hcl | 5 -
.../hashicorp/hcl/test-fixtures/basic.hcl | 2 -
.../hashicorp/hcl/test-fixtures/basic.json | 4 -
.../hcl/test-fixtures/basic_int_string.hcl | 1 -
.../hcl/test-fixtures/basic_squish.hcl | 3 -
.../hcl/test-fixtures/block_assign.hcl | 2 -
.../hcl/test-fixtures/decode_policy.hcl | 15 -
.../hcl/test-fixtures/decode_policy.json | 19 -
.../hcl/test-fixtures/decode_tf_variable.hcl | 10 -
.../hcl/test-fixtures/decode_tf_variable.json | 14 -
.../hashicorp/hcl/test-fixtures/empty.hcl | 1 -
.../hashicorp/hcl/test-fixtures/escape.hcl | 6 -
.../hcl/test-fixtures/escape_backslash.hcl | 5 -
.../hashicorp/hcl/test-fixtures/flat.hcl | 2 -
.../hashicorp/hcl/test-fixtures/float.hcl | 2 -
.../hashicorp/hcl/test-fixtures/float.json | 4 -
.../hashicorp/hcl/test-fixtures/git_crypt.hcl | Bin 10 -> 0 bytes
.../hcl/test-fixtures/interpolate.json | 3 -
.../hcl/test-fixtures/list_of_lists.hcl | 2 -
.../hcl/test-fixtures/list_of_maps.hcl | 4 -
.../hashicorp/hcl/test-fixtures/multiline.hcl | 4 -
.../hcl/test-fixtures/multiline.json | 3 -
.../hcl/test-fixtures/multiline_bad.hcl | 4 -
.../hcl/test-fixtures/multiline_indented.hcl | 4 -
.../hcl/test-fixtures/multiline_literal.hcl | 2 -
.../multiline_literal_with_hil.hcl | 2 -
.../hcl/test-fixtures/multiline_no_eof.hcl | 5 -
.../multiline_no_hanging_indent.hcl | 5 -
.../hcl/test-fixtures/multiline_no_marker.hcl | 1 -
.../test-fixtures/nested_block_comment.hcl | 5 -
.../hcl/test-fixtures/nested_provider_bad.hcl | 5 -
.../hcl/test-fixtures/null_strings.json | 7 -
.../hcl/test-fixtures/object_list.json | 15 -
.../hcl/test-fixtures/object_with_bool.hcl | 6 -
.../hcl/test-fixtures/scientific.hcl | 6 -
.../hcl/test-fixtures/scientific.json | 8 -
.../hcl/test-fixtures/slice_expand.hcl | 7 -
.../hashicorp/hcl/test-fixtures/structure.hcl | 5 -
.../hcl/test-fixtures/structure.json | 8 -
.../hcl/test-fixtures/structure2.hcl | 9 -
.../hcl/test-fixtures/structure2.json | 10 -
.../hcl/test-fixtures/structure_flat.json | 8 -
.../hcl/test-fixtures/structure_flatmap.hcl | 7 -
.../hcl/test-fixtures/structure_list.hcl | 6 -
.../hcl/test-fixtures/structure_list.json | 7 -
.../test-fixtures/structure_list_deep.json | 16 -
.../test-fixtures/structure_list_empty.json | 3 -
.../hcl/test-fixtures/structure_multi.hcl | 7 -
.../hcl/test-fixtures/structure_multi.json | 11 -
.../hcl/test-fixtures/terraform_heroku.hcl | 5 -
.../hcl/test-fixtures/terraform_heroku.json | 6 -
.../terraform_variable_invalid.json | 5 -
.../hashicorp/hcl/test-fixtures/tfvars.hcl | 3 -
.../unterminated_block_comment.hcl | 2 -
.../hcl/test-fixtures/unterminated_brace.hcl | 2 -
.../hashicorp/hcl/testhelper/unix2dos.go | 15 -
.../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 -
vendor/github.com/juju/ansiterm/LICENSE | 191 -
vendor/github.com/juju/ansiterm/Makefile | 14 -
vendor/github.com/juju/ansiterm/README.md | 323 -
vendor/github.com/juju/ansiterm/attribute.go | 50 -
.../juju/ansiterm/attribute_test.go | 30 -
vendor/github.com/juju/ansiterm/color.go | 119 -
vendor/github.com/juju/ansiterm/color_test.go | 22 -
vendor/github.com/juju/ansiterm/context.go | 95 -
.../github.com/juju/ansiterm/context_test.go | 104 -
vendor/github.com/juju/ansiterm/doc.go | 6 -
.../github.com/juju/ansiterm/package_test.go | 14 -
vendor/github.com/juju/ansiterm/style.go | 72 -
vendor/github.com/juju/ansiterm/style_test.go | 21 -
vendor/github.com/juju/ansiterm/tabwriter.go | 64 -
.../juju/ansiterm/tabwriter/LICENSE | 27 -
.../juju/ansiterm/tabwriter/tabwriter.go | 587 -
.../juju/ansiterm/tabwriter/tabwriter_test.go | 25 -
vendor/github.com/juju/ansiterm/terminal.go | 32 -
vendor/github.com/juju/ansiterm/writer.go | 74 -
.../github.com/juju/ansiterm/writer_test.go | 77 -
.../github.com/lunixbochs/vtclean/.travis.yml | 9 -
vendor/github.com/lunixbochs/vtclean/LICENSE | 19 -
.../github.com/lunixbochs/vtclean/README.md | 46 -
vendor/github.com/lunixbochs/vtclean/io.go | 93 -
vendor/github.com/lunixbochs/vtclean/line.go | 113 -
.../github.com/lunixbochs/vtclean/regex.txt | 14 -
.../github.com/lunixbochs/vtclean/vtclean.go | 88 -
.../lunixbochs/vtclean/vtclean/vtclean.go | 17 -
.../lunixbochs/vtclean/vtclean_test.go | 79 -
.../magiconair/properties/.gitignore | 6 -
.../magiconair/properties/.travis.yml | 10 -
.../magiconair/properties/CHANGELOG.md | 131 -
.../github.com/magiconair/properties/LICENSE | 25 -
.../magiconair/properties/README.md | 129 -
.../magiconair/properties/assert/assert.go | 90 -
.../properties/assert/assert_test.go | 55 -
.../magiconair/properties/benchmark_test.go | 24 -
.../magiconair/properties/decode.go | 289 -
.../magiconair/properties/decode_test.go | 299 -
.../github.com/magiconair/properties/doc.go | 156 -
.../magiconair/properties/example_test.go | 93 -
.../magiconair/properties/integrate.go | 34 -
.../magiconair/properties/integrate_test.go | 76 -
.../github.com/magiconair/properties/lex.go | 407 -
.../github.com/magiconair/properties/load.go | 292 -
.../magiconair/properties/load_test.go | 243 -
.../magiconair/properties/parser.go | 95 -
.../magiconair/properties/properties.go | 833 -
.../magiconair/properties/properties_test.go | 985 -
.../magiconair/properties/rangecheck.go | 31 -
.../promptui/.github/CONTRIBUTING.md | 73 -
.../manifoldco/promptui/.github/listbot.md | 3 -
.../github.com/manifoldco/promptui/.gitignore | 1 -
.../manifoldco/promptui/.travis.yml | 10 -
.../manifoldco/promptui/CHANGELOG.md | 46 -
.../manifoldco/promptui/CODE_OF_CONDUCT.md | 73 -
.../github.com/manifoldco/promptui/Gopkg.lock | 129 -
.../github.com/manifoldco/promptui/Gopkg.toml | 16 -
.../github.com/manifoldco/promptui/LICENSE.md | 29 -
.../github.com/manifoldco/promptui/Makefile | 55 -
.../github.com/manifoldco/promptui/README.md | 106 -
.../promptui/_examples/confirm/main.go | 23 -
.../promptui/_examples/custom_prompt/main.go | 43 -
.../promptui/_examples/custom_select/main.go | 66 -
.../promptui/_examples/prompt/main.go | 33 -
.../promptui/_examples/prompt_default/main.go | 39 -
.../_examples/prompt_password/main.go | 32 -
.../promptui/_examples/select/main.go | 24 -
.../promptui/_examples/select_add/main.go | 24 -
.../github.com/manifoldco/promptui/codes.go | 108 -
.../manifoldco/promptui/codes_test.go | 30 -
.../manifoldco/promptui/keycodes.go | 25 -
.../manifoldco/promptui/keycodes_windows.go | 25 -
.../manifoldco/promptui/list/list.go | 197 -
.../manifoldco/promptui/list/list_test.go | 164 -
.../github.com/manifoldco/promptui/prompt.go | 338 -
.../manifoldco/promptui/promptui.go | 18 -
.../promptui/screenbuf/screenbuf.go | 138 -
.../promptui/screenbuf/screenbuf_test.go | 119 -
.../github.com/manifoldco/promptui/select.go | 503 -
.../manifoldco/promptui/select_test.go | 150 -
.../github.com/manifoldco/promptui/styles.go | 12 -
.../manifoldco/promptui/styles_windows.go | 10 -
.../github.com/mattn/go-colorable/.travis.yml | 9 -
vendor/github.com/mattn/go-colorable/LICENSE | 21 -
.../github.com/mattn/go-colorable/README.md | 48 -
.../go-colorable/_example/escape-seq/main.go | 16 -
.../go-colorable/_example/logrus/main.go | 16 -
.../mattn/go-colorable/_example/title/main.go | 14 -
.../mattn/go-colorable/colorable_appengine.go | 29 -
.../mattn/go-colorable/colorable_others.go | 30 -
.../mattn/go-colorable/colorable_test.go | 83 -
.../mattn/go-colorable/colorable_windows.go | 884 -
.../mattn/go-colorable/noncolorable.go | 55 -
vendor/github.com/mattn/go-isatty/.travis.yml | 9 -
vendor/github.com/mattn/go-isatty/LICENSE | 9 -
vendor/github.com/mattn/go-isatty/README.md | 50 -
vendor/github.com/mattn/go-isatty/doc.go | 2 -
.../mattn/go-isatty/example_test.go | 18 -
.../mattn/go-isatty/isatty_appengine.go | 15 -
.../github.com/mattn/go-isatty/isatty_bsd.go | 18 -
.../mattn/go-isatty/isatty_linux.go | 18 -
.../mattn/go-isatty/isatty_linux_ppc64x.go | 19 -
.../mattn/go-isatty/isatty_others.go | 10 -
.../mattn/go-isatty/isatty_others_test.go | 19 -
.../mattn/go-isatty/isatty_solaris.go | 16 -
.../mattn/go-isatty/isatty_windows.go | 94 -
.../mattn/go-isatty/isatty_windows_test.go | 35 -
.../github.com/mattn/go-runewidth/.travis.yml | 8 -
vendor/github.com/mattn/go-runewidth/LICENSE | 21 -
.../github.com/mattn/go-runewidth/README.mkd | 27 -
.../mattn/go-runewidth/runewidth.go | 1223 -
.../mattn/go-runewidth/runewidth_js.go | 8 -
.../mattn/go-runewidth/runewidth_posix.go | 77 -
.../mattn/go-runewidth/runewidth_test.go | 275 -
.../mattn/go-runewidth/runewidth_windows.go | 25 -
.../mitchellh/mapstructure/.travis.yml | 8 -
.../github.com/mitchellh/mapstructure/LICENSE | 21 -
.../mitchellh/mapstructure/README.md | 46 -
.../mitchellh/mapstructure/decode_hooks.go | 171 -
.../mapstructure/decode_hooks_test.go | 259 -
.../mitchellh/mapstructure/error.go | 50 -
.../mitchellh/mapstructure/mapstructure.go | 1061 -
.../mapstructure_benchmark_test.go | 279 -
.../mapstructure/mapstructure_bugs_test.go | 372 -
.../mapstructure_examples_test.go | 203 -
.../mapstructure/mapstructure_test.go | 1776 -
.../olekukonko/tablewriter/.gitignore | 15 -
.../olekukonko/tablewriter/.travis.yml | 12 -
.../olekukonko/tablewriter/LICENCE.md | 19 -
.../olekukonko/tablewriter/README.md | 277 -
.../github.com/olekukonko/tablewriter/csv.go | 52 -
.../tablewriter/csv2table/README.md | 43 -
.../tablewriter/csv2table/csv2table.go | 85 -
.../olekukonko/tablewriter/table.go | 839 -
.../olekukonko/tablewriter/table_test.go | 1093 -
.../tablewriter/table_with_color.go | 134 -
.../olekukonko/tablewriter/testdata/test.csv | 4 -
.../tablewriter/testdata/test_info.csv | 4 -
.../github.com/olekukonko/tablewriter/util.go | 93 -
.../github.com/olekukonko/tablewriter/wrap.go | 99 -
.../olekukonko/tablewriter/wrap_test.go | 58 -
.../github.com/packethost/packngo/.drone.yml | 28 -
.../github.com/packethost/packngo/.gitignore | 28 -
.../packethost/packngo/CHANGELOG.md | 54 -
.../github.com/packethost/packngo/LICENSE.txt | 56 -
.../github.com/packethost/packngo/README.md | 72 -
.../packethost/packngo/billing_address.go | 7 -
.../github.com/packethost/packngo/devices.go | 254 -
.../packethost/packngo/devices_test.go | 577 -
vendor/github.com/packethost/packngo/email.go | 86 -
.../packethost/packngo/email_test.go | 46 -
.../github.com/packethost/packngo/events.go | 81 -
.../packethost/packngo/events_test.go | 28 -
.../packethost/packngo/examples/otp.go | 116 -
.../packethost/packngo/facilities.go | 52 -
.../packngo/hardware_reservations.go | 100 -
.../packngo/hardware_reservations_test.go | 19 -
vendor/github.com/packethost/packngo/ip.go | 194 -
.../github.com/packethost/packngo/ip_test.go | 94 -
.../packethost/packngo/metadata/metadata.go | 165 -
.../packngo/metadata/metadata_test.go | 48 -
.../packngo/metadata/testdata/device.json | 181 -
.../packethost/packngo/operatingsystems.go | 41 -
.../packethost/packngo/organizations.go | 155 -
.../packethost/packngo/organizations_test.go | 97 -
.../github.com/packethost/packngo/packngo.go | 334 -
.../packethost/packngo/packngo_test.go | 123 -
.../packethost/packngo/payment_methods.go | 72 -
vendor/github.com/packethost/packngo/plans.go | 117 -
vendor/github.com/packethost/packngo/ports.go | 225 -
.../packethost/packngo/ports_test.go | 431 -
.../github.com/packethost/packngo/projects.go | 168 -
.../packethost/packngo/projects_test.go | 256 -
vendor/github.com/packethost/packngo/rate.go | 12 -
.../packethost/packngo/spotmarket.go | 39 -
.../packethost/packngo/spotmarket_test.go | 26 -
.../packethost/packngo/spotmarketrequest.go | 112 -
.../packngo/spotmarketrequest_test.go | 148 -
.../github.com/packethost/packngo/sshkeys.go | 138 -
.../packethost/packngo/sshkeys_test.go | 241 -
.../packethost/packngo/timestamp.go | 35 -
.../packethost/packngo/two_factor_auth.go | 56 -
vendor/github.com/packethost/packngo/user.go | 65 -
.../packethost/packngo/user_test.go | 20 -
vendor/github.com/packethost/packngo/utils.go | 91 -
.../packethost/packngo/virtualnetworks.go | 81 -
.../packngo/virtualnetworks_test.go | 68 -
.../github.com/packethost/packngo/volumes.go | 239 -
.../packethost/packngo/volumes_test.go | 235 -
vendor/github.com/packethost/packngo/vpn.go | 46 -
.../github.com/packethost/packngo/vpn_test.go | 40 -
.../github.com/pelletier/go-toml/.gitignore | 2 -
.../github.com/pelletier/go-toml/.travis.yml | 23 -
vendor/github.com/pelletier/go-toml/LICENSE | 21 -
vendor/github.com/pelletier/go-toml/README.md | 131 -
.../pelletier/go-toml/benchmark.json | 164 -
.../github.com/pelletier/go-toml/benchmark.sh | 32 -
.../pelletier/go-toml/benchmark.toml | 244 -
.../pelletier/go-toml/benchmark.yml | 121 -
.../pelletier/go-toml/benchmark_test.go | 192 -
.../pelletier/go-toml/cmd/test_program.go | 91 -
.../pelletier/go-toml/cmd/tomljson/main.go | 71 -
.../go-toml/cmd/tomljson/main_test.go | 82 -
.../pelletier/go-toml/cmd/tomll/main.go | 65 -
vendor/github.com/pelletier/go-toml/doc.go | 23 -
.../github.com/pelletier/go-toml/doc_test.go | 105 -
.../pelletier/go-toml/example-crlf.toml | 29 -
.../github.com/pelletier/go-toml/example.toml | 29 -
vendor/github.com/pelletier/go-toml/fuzz.go | 31 -
vendor/github.com/pelletier/go-toml/fuzz.sh | 15 -
.../pelletier/go-toml/keysparsing.go | 85 -
.../pelletier/go-toml/keysparsing_test.go | 63 -
vendor/github.com/pelletier/go-toml/lexer.go | 750 -
.../pelletier/go-toml/lexer_test.go | 750 -
.../github.com/pelletier/go-toml/marshal.go | 609 -
.../pelletier/go-toml/marshal_test.go | 806 -
.../pelletier/go-toml/marshal_test.toml | 38 -
vendor/github.com/pelletier/go-toml/parser.go | 430 -
.../pelletier/go-toml/parser_test.go | 899 -
.../github.com/pelletier/go-toml/position.go | 29 -
.../pelletier/go-toml/position_test.go | 29 -
.../github.com/pelletier/go-toml/query/doc.go | 175 -
.../pelletier/go-toml/query/lexer.go | 357 -
.../pelletier/go-toml/query/lexer_test.go | 179 -
.../pelletier/go-toml/query/match.go | 232 -
.../pelletier/go-toml/query/match_test.go | 202 -
.../pelletier/go-toml/query/parser.go | 275 -
.../pelletier/go-toml/query/parser_test.go | 482 -
.../pelletier/go-toml/query/query.go | 158 -
.../pelletier/go-toml/query/query_test.go | 157 -
.../pelletier/go-toml/query/tokens.go | 106 -
vendor/github.com/pelletier/go-toml/test.sh | 88 -
vendor/github.com/pelletier/go-toml/token.go | 144 -
.../pelletier/go-toml/token_test.go | 67 -
vendor/github.com/pelletier/go-toml/toml.go | 367 -
.../github.com/pelletier/go-toml/toml_test.go | 106 -
.../pelletier/go-toml/tomltree_create.go | 142 -
.../pelletier/go-toml/tomltree_create_test.go | 126 -
.../pelletier/go-toml/tomltree_write.go | 333 -
.../pelletier/go-toml/tomltree_write_test.go | 376 -
.../russross/blackfriday/.gitignore | 8 -
.../russross/blackfriday/.travis.yml | 30 -
.../russross/blackfriday/LICENSE.txt | 29 -
.../github.com/russross/blackfriday/README.md | 363 -
.../github.com/russross/blackfriday/block.go | 1450 -
.../russross/blackfriday/block_test.go | 1781 -
vendor/github.com/russross/blackfriday/doc.go | 32 -
.../github.com/russross/blackfriday/html.go | 950 -
.../github.com/russross/blackfriday/inline.go | 1154 -
.../russross/blackfriday/inline_test.go | 1272 -
.../github.com/russross/blackfriday/latex.go | 332 -
.../russross/blackfriday/markdown.go | 931 -
.../russross/blackfriday/markdown_test.go | 75 -
.../russross/blackfriday/ref_test.go | 128 -
.../russross/blackfriday/smartypants.go | 430 -
.../testdata/Amps and angle encoding.html | 17 -
.../testdata/Amps and angle encoding.text | 21 -
.../blackfriday/testdata/Auto links.html | 18 -
.../blackfriday/testdata/Auto links.text | 13 -
.../testdata/Backslash escapes.html | 123 -
.../testdata/Backslash escapes.text | 126 -
.../Blockquotes with code blocks.html | 15 -
.../Blockquotes with code blocks.text | 11 -
.../blackfriday/testdata/Code Blocks.html | 18 -
.../blackfriday/testdata/Code Blocks.text | 14 -
.../blackfriday/testdata/Code Spans.html | 5 -
.../blackfriday/testdata/Code Spans.text | 6 -
...like lines no empty line before block.html | 14 -
...like lines no empty line before block.text | 8 -
...apped paragraphs with list-like lines.html | 8 -
...apped paragraphs with list-like lines.text | 8 -
.../testdata/Horizontal rules.html | 71 -
.../testdata/Horizontal rules.text | 67 -
.../testdata/Inline HTML (Advanced).html | 15 -
.../testdata/Inline HTML (Advanced).text | 15 -
.../testdata/Inline HTML (Simple).html | 72 -
.../testdata/Inline HTML (Simple).text | 69 -
.../testdata/Inline HTML comments.html | 13 -
.../testdata/Inline HTML comments.text | 13 -
.../testdata/Links, inline style.html | 11 -
.../testdata/Links, inline style.text | 12 -
.../testdata/Links, reference style.html | 52 -
.../testdata/Links, reference style.text | 71 -
.../testdata/Links, shortcut references.html | 9 -
.../testdata/Links, shortcut references.text | 20 -
.../testdata/Literal quotes in titles.html | 3 -
.../testdata/Literal quotes in titles.text | 7 -
.../Markdown Documentation - Basics.html | 314 -
.../Markdown Documentation - Basics.text | 306 -
.../Markdown Documentation - Syntax.html | 946 -
.../Markdown Documentation - Syntax.text | 888 -
.../testdata/Nested blockquotes.html | 9 -
.../testdata/Nested blockquotes.text | 5 -
.../testdata/Ordered and unordered lists.html | 166 -
.../testdata/Ordered and unordered lists.text | 131 -
.../testdata/Strong and em together.html | 7 -
.../testdata/Strong and em together.text | 7 -
.../russross/blackfriday/testdata/Tabs.html | 26 -
.../russross/blackfriday/testdata/Tabs.text | 21 -
.../blackfriday/testdata/Tidyness.html | 9 -
.../blackfriday/testdata/Tidyness.text | 5 -
vendor/github.com/spf13/afero/.travis.yml | 21 -
vendor/github.com/spf13/afero/LICENSE.txt | 174 -
vendor/github.com/spf13/afero/README.md | 452 -
vendor/github.com/spf13/afero/afero.go | 108 -
vendor/github.com/spf13/afero/afero_test.go | 718 -
vendor/github.com/spf13/afero/appveyor.yml | 15 -
vendor/github.com/spf13/afero/basepath.go | 180 -
.../github.com/spf13/afero/basepath_test.go | 190 -
.../github.com/spf13/afero/cacheOnReadFs.go | 290 -
.../github.com/spf13/afero/composite_test.go | 403 -
vendor/github.com/spf13/afero/const_bsds.go | 22 -
.../github.com/spf13/afero/const_win_unix.go | 25 -
.../github.com/spf13/afero/copyOnWriteFs.go | 292 -
.../spf13/afero/copyOnWriteFs_test.go | 40 -
vendor/github.com/spf13/afero/httpFs.go | 110 -
vendor/github.com/spf13/afero/ioutil.go | 230 -
vendor/github.com/spf13/afero/ioutil_test.go | 112 -
vendor/github.com/spf13/afero/lstater.go | 27 -
vendor/github.com/spf13/afero/lstater_test.go | 102 -
vendor/github.com/spf13/afero/match.go | 110 -
vendor/github.com/spf13/afero/match_test.go | 183 -
vendor/github.com/spf13/afero/mem/dir.go | 37 -
vendor/github.com/spf13/afero/mem/dirmap.go | 43 -
vendor/github.com/spf13/afero/mem/file.go | 317 -
.../github.com/spf13/afero/mem/file_test.go | 154 -
vendor/github.com/spf13/afero/memmap.go | 365 -
vendor/github.com/spf13/afero/memmap_test.go | 451 -
vendor/github.com/spf13/afero/os.go | 101 -
vendor/github.com/spf13/afero/path.go | 106 -
vendor/github.com/spf13/afero/path_test.go | 69 -
vendor/github.com/spf13/afero/readonlyfs.go | 80 -
vendor/github.com/spf13/afero/regexpfs.go | 214 -
.../github.com/spf13/afero/ro_regexp_test.go | 96 -
vendor/github.com/spf13/afero/sftpfs/file.go | 95 -
vendor/github.com/spf13/afero/sftpfs/sftp.go | 129 -
.../spf13/afero/sftpfs/sftp_test_go | 286 -
vendor/github.com/spf13/afero/unionFile.go | 305 -
vendor/github.com/spf13/afero/util.go | 330 -
vendor/github.com/spf13/afero/util_test.go | 450 -
vendor/github.com/spf13/cast/.gitignore | 25 -
vendor/github.com/spf13/cast/.travis.yml | 14 -
vendor/github.com/spf13/cast/LICENSE | 21 -
vendor/github.com/spf13/cast/Makefile | 38 -
vendor/github.com/spf13/cast/README.md | 75 -
vendor/github.com/spf13/cast/cast.go | 159 -
vendor/github.com/spf13/cast/cast_test.go | 1208 -
vendor/github.com/spf13/cast/caste.go | 1166 -
.../spf13/cobra/.circleci/config.yml | 38 -
vendor/github.com/spf13/cobra/.gitignore | 36 -
vendor/github.com/spf13/cobra/.mailmap | 3 -
vendor/github.com/spf13/cobra/.travis.yml | 21 -
vendor/github.com/spf13/cobra/LICENSE.txt | 174 -
vendor/github.com/spf13/cobra/README.md | 736 -
vendor/github.com/spf13/cobra/args.go | 89 -
vendor/github.com/spf13/cobra/args_test.go | 241 -
.../spf13/cobra/bash_completions.go | 584 -
.../spf13/cobra/bash_completions.md | 221 -
.../spf13/cobra/bash_completions_test.go | 217 -
vendor/github.com/spf13/cobra/cobra.go | 200 -
vendor/github.com/spf13/cobra/cobra/README.md | 94 -
.../github.com/spf13/cobra/cobra/cmd/add.go | 179 -
.../spf13/cobra/cobra/cmd/add_test.go | 109 -
.../spf13/cobra/cobra/cmd/golden_test.go | 77 -
.../spf13/cobra/cobra/cmd/helpers.go | 168 -
.../github.com/spf13/cobra/cobra/cmd/init.go | 234 -
.../spf13/cobra/cobra/cmd/init_test.go | 83 -
.../spf13/cobra/cobra/cmd/license_agpl.go | 683 -
.../spf13/cobra/cobra/cmd/license_apache_2.go | 238 -
.../cobra/cobra/cmd/license_bsd_clause_2.go | 71 -
.../cobra/cobra/cmd/license_bsd_clause_3.go | 78 -
.../spf13/cobra/cobra/cmd/license_gpl_2.go | 376 -
.../spf13/cobra/cobra/cmd/license_gpl_3.go | 711 -
.../spf13/cobra/cobra/cmd/license_lgpl.go | 186 -
.../spf13/cobra/cobra/cmd/license_mit.go | 63 -
.../spf13/cobra/cobra/cmd/licenses.go | 118 -
.../spf13/cobra/cobra/cmd/project.go | 200 -
.../spf13/cobra/cobra/cmd/project_test.go | 24 -
.../github.com/spf13/cobra/cobra/cmd/root.go | 79 -
.../cobra/cobra/cmd/testdata/LICENSE.golden | 202 -
.../cobra/cobra/cmd/testdata/main.go.golden | 21 -
.../cobra/cobra/cmd/testdata/root.go.golden | 89 -
.../cobra/cobra/cmd/testdata/test.go.golden | 50 -
vendor/github.com/spf13/cobra/cobra/main.go | 20 -
vendor/github.com/spf13/cobra/cobra_test.go | 22 -
vendor/github.com/spf13/cobra/command.go | 1517 -
.../github.com/spf13/cobra/command_notwin.go | 5 -
vendor/github.com/spf13/cobra/command_test.go | 1733 -
vendor/github.com/spf13/cobra/command_win.go | 20 -
vendor/github.com/spf13/cobra/doc/cmd_test.go | 86 -
vendor/github.com/spf13/cobra/doc/man_docs.go | 236 -
vendor/github.com/spf13/cobra/doc/man_docs.md | 31 -
.../spf13/cobra/doc/man_docs_test.go | 213 -
.../spf13/cobra/doc/man_examples_test.go | 35 -
vendor/github.com/spf13/cobra/doc/md_docs.go | 159 -
vendor/github.com/spf13/cobra/doc/md_docs.md | 115 -
.../spf13/cobra/doc/md_docs_test.go | 98 -
.../github.com/spf13/cobra/doc/rest_docs.go | 185 -
.../github.com/spf13/cobra/doc/rest_docs.md | 114 -
.../spf13/cobra/doc/rest_docs_test.go | 99 -
vendor/github.com/spf13/cobra/doc/util.go | 51 -
.../github.com/spf13/cobra/doc/yaml_docs.go | 169 -
.../github.com/spf13/cobra/doc/yaml_docs.md | 112 -
.../spf13/cobra/doc/yaml_docs_test.go | 74 -
.../github.com/spf13/cobra/zsh_completions.go | 126 -
.../spf13/cobra/zsh_completions_test.go | 89 -
.../spf13/jwalterweatherman/.gitignore | 22 -
.../spf13/jwalterweatherman/LICENSE | 21 -
.../spf13/jwalterweatherman/README.md | 148 -
.../jwalterweatherman/default_notepad.go | 113 -
.../jwalterweatherman/default_notepad_test.go | 102 -
.../spf13/jwalterweatherman/log_counter.go | 55 -
.../spf13/jwalterweatherman/notepad.go | 194 -
.../spf13/jwalterweatherman/notepad_test.go | 50 -
vendor/github.com/spf13/pflag/.gitignore | 2 -
vendor/github.com/spf13/pflag/.travis.yml | 21 -
vendor/github.com/spf13/pflag/LICENSE | 28 -
vendor/github.com/spf13/pflag/README.md | 296 -
vendor/github.com/spf13/pflag/bool.go | 94 -
vendor/github.com/spf13/pflag/bool_slice.go | 147 -
.../github.com/spf13/pflag/bool_slice_test.go | 215 -
vendor/github.com/spf13/pflag/bool_test.go | 179 -
vendor/github.com/spf13/pflag/bytes.go | 105 -
vendor/github.com/spf13/pflag/bytes_test.go | 72 -
vendor/github.com/spf13/pflag/count.go | 96 -
vendor/github.com/spf13/pflag/count_test.go | 56 -
vendor/github.com/spf13/pflag/duration.go | 86 -
.../github.com/spf13/pflag/duration_slice.go | 128 -
.../spf13/pflag/duration_slice_test.go | 165 -
vendor/github.com/spf13/pflag/example_test.go | 36 -
vendor/github.com/spf13/pflag/export_test.go | 29 -
vendor/github.com/spf13/pflag/flag.go | 1223 -
vendor/github.com/spf13/pflag/flag_test.go | 1259 -
vendor/github.com/spf13/pflag/float32.go | 88 -
vendor/github.com/spf13/pflag/float64.go | 84 -
vendor/github.com/spf13/pflag/golangflag.go | 105 -
.../github.com/spf13/pflag/golangflag_test.go | 47 -
vendor/github.com/spf13/pflag/int.go | 84 -
vendor/github.com/spf13/pflag/int16.go | 88 -
vendor/github.com/spf13/pflag/int32.go | 88 -
vendor/github.com/spf13/pflag/int64.go | 84 -
vendor/github.com/spf13/pflag/int8.go | 88 -
vendor/github.com/spf13/pflag/int_slice.go | 128 -
.../github.com/spf13/pflag/int_slice_test.go | 165 -
vendor/github.com/spf13/pflag/ip.go | 94 -
vendor/github.com/spf13/pflag/ip_slice.go | 148 -
.../github.com/spf13/pflag/ip_slice_test.go | 222 -
vendor/github.com/spf13/pflag/ip_test.go | 63 -
vendor/github.com/spf13/pflag/ipmask.go | 122 -
vendor/github.com/spf13/pflag/ipnet.go | 98 -
vendor/github.com/spf13/pflag/ipnet_test.go | 70 -
.../github.com/spf13/pflag/printusage_test.go | 74 -
vendor/github.com/spf13/pflag/string.go | 80 -
vendor/github.com/spf13/pflag/string_array.go | 103 -
.../spf13/pflag/string_array_test.go | 233 -
vendor/github.com/spf13/pflag/string_slice.go | 149 -
.../spf13/pflag/string_slice_test.go | 253 -
vendor/github.com/spf13/pflag/uint.go | 88 -
vendor/github.com/spf13/pflag/uint16.go | 88 -
vendor/github.com/spf13/pflag/uint32.go | 88 -
vendor/github.com/spf13/pflag/uint64.go | 88 -
vendor/github.com/spf13/pflag/uint8.go | 88 -
vendor/github.com/spf13/pflag/uint_slice.go | 126 -
.../github.com/spf13/pflag/uint_slice_test.go | 161 -
vendor/github.com/spf13/pflag/verify/all.sh | 69 -
vendor/github.com/spf13/pflag/verify/gofmt.sh | 19 -
.../github.com/spf13/pflag/verify/golint.sh | 15 -
vendor/github.com/spf13/viper/.gitignore | 24 -
vendor/github.com/spf13/viper/.travis.yml | 28 -
vendor/github.com/spf13/viper/LICENSE | 21 -
vendor/github.com/spf13/viper/README.md | 643 -
vendor/github.com/spf13/viper/flags.go | 57 -
vendor/github.com/spf13/viper/flags_test.go | 65 -
.../github.com/spf13/viper/overrides_test.go | 173 -
.../github.com/spf13/viper/remote/remote.go | 105 -
vendor/github.com/spf13/viper/util.go | 221 -
vendor/github.com/spf13/viper/util_test.go | 54 -
vendor/github.com/spf13/viper/viper.go | 1771 -
vendor/github.com/spf13/viper/viper_test.go | 1406 -
vendor/golang.org/x/sys/.gitattributes | 10 -
vendor/golang.org/x/sys/.gitignore | 2 -
vendor/golang.org/x/sys/AUTHORS | 3 -
vendor/golang.org/x/sys/CONTRIBUTING.md | 26 -
vendor/golang.org/x/sys/CONTRIBUTORS | 3 -
vendor/golang.org/x/sys/LICENSE | 27 -
vendor/golang.org/x/sys/PATENTS | 22 -
vendor/golang.org/x/sys/README.md | 18 -
vendor/golang.org/x/sys/codereview.cfg | 1 -
vendor/golang.org/x/sys/cpu/cpu.go | 38 -
vendor/golang.org/x/sys/cpu/cpu_arm.go | 7 -
vendor/golang.org/x/sys/cpu/cpu_arm64.go | 7 -
vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 16 -
vendor/golang.org/x/sys/cpu/cpu_gccgo.c | 43 -
vendor/golang.org/x/sys/cpu/cpu_gccgo.go | 26 -
vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 9 -
vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 9 -
vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 9 -
vendor/golang.org/x/sys/cpu/cpu_s390x.go | 7 -
vendor/golang.org/x/sys/cpu/cpu_test.go | 28 -
vendor/golang.org/x/sys/cpu/cpu_x86.go | 55 -
vendor/golang.org/x/sys/cpu/cpu_x86.s | 27 -
vendor/golang.org/x/sys/plan9/asm.s | 8 -
vendor/golang.org/x/sys/plan9/asm_plan9_386.s | 30 -
.../golang.org/x/sys/plan9/asm_plan9_amd64.s | 30 -
vendor/golang.org/x/sys/plan9/asm_plan9_arm.s | 25 -
vendor/golang.org/x/sys/plan9/const_plan9.go | 70 -
vendor/golang.org/x/sys/plan9/dir_plan9.go | 212 -
vendor/golang.org/x/sys/plan9/env_plan9.go | 31 -
vendor/golang.org/x/sys/plan9/errors_plan9.go | 50 -
vendor/golang.org/x/sys/plan9/mkall.sh | 138 -
vendor/golang.org/x/sys/plan9/mkerrors.sh | 246 -
vendor/golang.org/x/sys/plan9/mksyscall.pl | 319 -
.../golang.org/x/sys/plan9/mksysnum_plan9.sh | 23 -
.../golang.org/x/sys/plan9/pwd_go15_plan9.go | 21 -
vendor/golang.org/x/sys/plan9/pwd_plan9.go | 23 -
vendor/golang.org/x/sys/plan9/race.go | 30 -
vendor/golang.org/x/sys/plan9/race0.go | 25 -
vendor/golang.org/x/sys/plan9/str.go | 22 -
vendor/golang.org/x/sys/plan9/syscall.go | 77 -
.../golang.org/x/sys/plan9/syscall_plan9.go | 349 -
vendor/golang.org/x/sys/plan9/syscall_test.go | 33 -
.../x/sys/plan9/zsyscall_plan9_386.go | 292 -
.../x/sys/plan9/zsyscall_plan9_amd64.go | 292 -
.../x/sys/plan9/zsyscall_plan9_arm.go | 284 -
.../golang.org/x/sys/plan9/zsysnum_plan9.go | 49 -
vendor/golang.org/x/sys/unix/.gitignore | 2 -
vendor/golang.org/x/sys/unix/README.md | 173 -
.../golang.org/x/sys/unix/affinity_linux.go | 124 -
vendor/golang.org/x/sys/unix/asm_darwin_386.s | 29 -
.../golang.org/x/sys/unix/asm_darwin_amd64.s | 29 -
vendor/golang.org/x/sys/unix/asm_darwin_arm.s | 30 -
.../golang.org/x/sys/unix/asm_darwin_arm64.s | 30 -
.../x/sys/unix/asm_dragonfly_amd64.s | 29 -
.../golang.org/x/sys/unix/asm_freebsd_386.s | 29 -
.../golang.org/x/sys/unix/asm_freebsd_amd64.s | 29 -
.../golang.org/x/sys/unix/asm_freebsd_arm.s | 29 -
vendor/golang.org/x/sys/unix/asm_linux_386.s | 65 -
.../golang.org/x/sys/unix/asm_linux_amd64.s | 57 -
vendor/golang.org/x/sys/unix/asm_linux_arm.s | 56 -
.../golang.org/x/sys/unix/asm_linux_arm64.s | 52 -
.../golang.org/x/sys/unix/asm_linux_mips64x.s | 56 -
.../golang.org/x/sys/unix/asm_linux_mipsx.s | 54 -
.../golang.org/x/sys/unix/asm_linux_ppc64x.s | 56 -
.../golang.org/x/sys/unix/asm_linux_s390x.s | 56 -
vendor/golang.org/x/sys/unix/asm_netbsd_386.s | 29 -
.../golang.org/x/sys/unix/asm_netbsd_amd64.s | 29 -
vendor/golang.org/x/sys/unix/asm_netbsd_arm.s | 29 -
.../golang.org/x/sys/unix/asm_openbsd_386.s | 29 -
.../golang.org/x/sys/unix/asm_openbsd_amd64.s | 29 -
.../golang.org/x/sys/unix/asm_openbsd_arm.s | 29 -
.../golang.org/x/sys/unix/asm_solaris_amd64.s | 17 -
.../golang.org/x/sys/unix/bluetooth_linux.go | 35 -
vendor/golang.org/x/sys/unix/cap_freebsd.go | 195 -
vendor/golang.org/x/sys/unix/constants.go | 13 -
vendor/golang.org/x/sys/unix/creds_test.go | 134 -
vendor/golang.org/x/sys/unix/dev_darwin.go | 24 -
vendor/golang.org/x/sys/unix/dev_dragonfly.go | 30 -
vendor/golang.org/x/sys/unix/dev_freebsd.go | 30 -
vendor/golang.org/x/sys/unix/dev_linux.go | 42 -
.../golang.org/x/sys/unix/dev_linux_test.go | 56 -
vendor/golang.org/x/sys/unix/dev_netbsd.go | 29 -
vendor/golang.org/x/sys/unix/dev_openbsd.go | 29 -
vendor/golang.org/x/sys/unix/dirent.go | 17 -
vendor/golang.org/x/sys/unix/endian_big.go | 9 -
vendor/golang.org/x/sys/unix/endian_little.go | 9 -
vendor/golang.org/x/sys/unix/env_unix.go | 31 -
.../x/sys/unix/errors_freebsd_386.go | 227 -
.../x/sys/unix/errors_freebsd_amd64.go | 227 -
.../x/sys/unix/errors_freebsd_arm.go | 226 -
vendor/golang.org/x/sys/unix/example_test.go | 19 -
vendor/golang.org/x/sys/unix/export_test.go | 9 -
vendor/golang.org/x/sys/unix/fcntl.go | 28 -
.../x/sys/unix/fcntl_linux_32bit.go | 13 -
vendor/golang.org/x/sys/unix/gccgo.go | 61 -
vendor/golang.org/x/sys/unix/gccgo_c.c | 38 -
.../x/sys/unix/gccgo_linux_amd64.go | 20 -
vendor/golang.org/x/sys/unix/linux/Dockerfile | 52 -
vendor/golang.org/x/sys/unix/linux/mkall.go | 750 -
.../golang.org/x/sys/unix/linux/mksysnum.pl | 85 -
vendor/golang.org/x/sys/unix/linux/types.go | 1494 -
vendor/golang.org/x/sys/unix/mkall.sh | 188 -
vendor/golang.org/x/sys/unix/mkerrors.sh | 604 -
vendor/golang.org/x/sys/unix/mkpost.go | 98 -
vendor/golang.org/x/sys/unix/mksyscall.pl | 341 -
.../x/sys/unix/mksyscall_solaris.pl | 289 -
.../golang.org/x/sys/unix/mksysctl_openbsd.pl | 264 -
.../golang.org/x/sys/unix/mksysnum_darwin.pl | 39 -
.../x/sys/unix/mksysnum_dragonfly.pl | 50 -
.../golang.org/x/sys/unix/mksysnum_freebsd.pl | 50 -
.../golang.org/x/sys/unix/mksysnum_netbsd.pl | 58 -
.../golang.org/x/sys/unix/mksysnum_openbsd.pl | 50 -
.../golang.org/x/sys/unix/mmap_unix_test.go | 35 -
.../golang.org/x/sys/unix/openbsd_pledge.go | 38 -
vendor/golang.org/x/sys/unix/openbsd_test.go | 113 -
vendor/golang.org/x/sys/unix/pagesize_unix.go | 15 -
vendor/golang.org/x/sys/unix/race.go | 30 -
vendor/golang.org/x/sys/unix/race0.go | 25 -
.../golang.org/x/sys/unix/sockcmsg_linux.go | 36 -
vendor/golang.org/x/sys/unix/sockcmsg_unix.go | 104 -
vendor/golang.org/x/sys/unix/str.go | 26 -
vendor/golang.org/x/sys/unix/syscall.go | 54 -
vendor/golang.org/x/sys/unix/syscall_bsd.go | 624 -
.../golang.org/x/sys/unix/syscall_bsd_test.go | 93 -
.../golang.org/x/sys/unix/syscall_darwin.go | 680 -
.../x/sys/unix/syscall_darwin_386.go | 68 -
.../x/sys/unix/syscall_darwin_amd64.go | 68 -
.../x/sys/unix/syscall_darwin_arm.go | 66 -
.../x/sys/unix/syscall_darwin_arm64.go | 68 -
.../x/sys/unix/syscall_darwin_test.go | 19 -
.../x/sys/unix/syscall_dragonfly.go | 523 -
.../x/sys/unix/syscall_dragonfly_amd64.go | 52 -
.../golang.org/x/sys/unix/syscall_freebsd.go | 756 -
.../x/sys/unix/syscall_freebsd_386.go | 52 -
.../x/sys/unix/syscall_freebsd_amd64.go | 52 -
.../x/sys/unix/syscall_freebsd_arm.go | 52 -
.../x/sys/unix/syscall_freebsd_test.go | 312 -
vendor/golang.org/x/sys/unix/syscall_linux.go | 1474 -
.../x/sys/unix/syscall_linux_386.go | 383 -
.../x/sys/unix/syscall_linux_amd64.go | 157 -
.../x/sys/unix/syscall_linux_amd64_gc.go | 13 -
.../x/sys/unix/syscall_linux_arm.go | 255 -
.../x/sys/unix/syscall_linux_arm64.go | 190 -
.../golang.org/x/sys/unix/syscall_linux_gc.go | 14 -
.../x/sys/unix/syscall_linux_gc_386.go | 16 -
.../x/sys/unix/syscall_linux_gccgo_386.go | 30 -
.../x/sys/unix/syscall_linux_gccgo_arm.go | 20 -
.../x/sys/unix/syscall_linux_mips64x.go | 210 -
.../x/sys/unix/syscall_linux_mipsx.go | 232 -
.../x/sys/unix/syscall_linux_ppc64x.go | 128 -
.../x/sys/unix/syscall_linux_s390x.go | 320 -
.../x/sys/unix/syscall_linux_sparc64.go | 144 -
.../x/sys/unix/syscall_linux_test.go | 386 -
.../golang.org/x/sys/unix/syscall_netbsd.go | 568 -
.../x/sys/unix/syscall_netbsd_386.go | 33 -
.../x/sys/unix/syscall_netbsd_amd64.go | 33 -
.../x/sys/unix/syscall_netbsd_arm.go | 33 -
.../golang.org/x/sys/unix/syscall_openbsd.go | 368 -
.../x/sys/unix/syscall_openbsd_386.go | 33 -
.../x/sys/unix/syscall_openbsd_amd64.go | 37 -
.../x/sys/unix/syscall_openbsd_arm.go | 33 -
.../golang.org/x/sys/unix/syscall_solaris.go | 725 -
.../x/sys/unix/syscall_solaris_amd64.go | 23 -
.../x/sys/unix/syscall_solaris_test.go | 55 -
vendor/golang.org/x/sys/unix/syscall_test.go | 60 -
vendor/golang.org/x/sys/unix/syscall_unix.go | 394 -
.../golang.org/x/sys/unix/syscall_unix_gc.go | 15 -
.../x/sys/unix/syscall_unix_test.go | 639 -
vendor/golang.org/x/sys/unix/timestruct.go | 82 -
.../golang.org/x/sys/unix/timestruct_test.go | 54 -
vendor/golang.org/x/sys/unix/types_darwin.go | 277 -
.../golang.org/x/sys/unix/types_dragonfly.go | 280 -
vendor/golang.org/x/sys/unix/types_freebsd.go | 402 -
vendor/golang.org/x/sys/unix/types_netbsd.go | 281 -
vendor/golang.org/x/sys/unix/types_openbsd.go | 282 -
vendor/golang.org/x/sys/unix/types_solaris.go | 283 -
vendor/golang.org/x/sys/unix/xattr_test.go | 119 -
.../x/sys/unix/zerrors_darwin_386.go | 1783 -
.../x/sys/unix/zerrors_darwin_amd64.go | 1783 -
.../x/sys/unix/zerrors_darwin_arm.go | 1783 -
.../x/sys/unix/zerrors_darwin_arm64.go | 1783 -
.../x/sys/unix/zerrors_dragonfly_amd64.go | 1586 -
.../x/sys/unix/zerrors_freebsd_386.go | 1764 -
.../x/sys/unix/zerrors_freebsd_amd64.go | 1765 -
.../x/sys/unix/zerrors_freebsd_arm.go | 1773 -
.../x/sys/unix/zerrors_linux_386.go | 2602 -
.../x/sys/unix/zerrors_linux_amd64.go | 2602 -
.../x/sys/unix/zerrors_linux_arm.go | 2608 -
.../x/sys/unix/zerrors_linux_arm64.go | 2593 -
.../x/sys/unix/zerrors_linux_mips.go | 2610 -
.../x/sys/unix/zerrors_linux_mips64.go | 2610 -
.../x/sys/unix/zerrors_linux_mips64le.go | 2610 -
.../x/sys/unix/zerrors_linux_mipsle.go | 2610 -
.../x/sys/unix/zerrors_linux_ppc64.go | 2663 -
.../x/sys/unix/zerrors_linux_ppc64le.go | 2663 -
.../x/sys/unix/zerrors_linux_s390x.go | 2662 -
.../x/sys/unix/zerrors_linux_sparc64.go | 2142 -
.../x/sys/unix/zerrors_netbsd_386.go | 1728 -
.../x/sys/unix/zerrors_netbsd_amd64.go | 1718 -
.../x/sys/unix/zerrors_netbsd_arm.go | 1707 -
.../x/sys/unix/zerrors_openbsd_386.go | 1600 -
.../x/sys/unix/zerrors_openbsd_amd64.go | 1706 -
.../x/sys/unix/zerrors_openbsd_arm.go | 1602 -
.../x/sys/unix/zerrors_solaris_amd64.go | 1497 -
.../golang.org/x/sys/unix/zptrace386_linux.go | 80 -
.../golang.org/x/sys/unix/zptracearm_linux.go | 41 -
.../x/sys/unix/zptracemips_linux.go | 50 -
.../x/sys/unix/zptracemipsle_linux.go | 50 -
.../x/sys/unix/zsyscall_darwin_386.go | 1712 -
.../x/sys/unix/zsyscall_darwin_amd64.go | 1712 -
.../x/sys/unix/zsyscall_darwin_arm.go | 1712 -
.../x/sys/unix/zsyscall_darwin_arm64.go | 1712 -
.../x/sys/unix/zsyscall_dragonfly_amd64.go | 1508 -
.../x/sys/unix/zsyscall_freebsd_386.go | 1937 -
.../x/sys/unix/zsyscall_freebsd_amd64.go | 1937 -
.../x/sys/unix/zsyscall_freebsd_arm.go | 1937 -
.../x/sys/unix/zsyscall_linux_386.go | 2005 -
.../x/sys/unix/zsyscall_linux_amd64.go | 2172 -
.../x/sys/unix/zsyscall_linux_arm.go | 2107 -
.../x/sys/unix/zsyscall_linux_arm64.go | 2065 -
.../x/sys/unix/zsyscall_linux_mips.go | 2173 -
.../x/sys/unix/zsyscall_linux_mips64.go | 2156 -
.../x/sys/unix/zsyscall_linux_mips64le.go | 2156 -
.../x/sys/unix/zsyscall_linux_mipsle.go | 2173 -
.../x/sys/unix/zsyscall_linux_ppc64.go | 2219 -
.../x/sys/unix/zsyscall_linux_ppc64le.go | 2219 -
.../x/sys/unix/zsyscall_linux_s390x.go | 1989 -
.../x/sys/unix/zsyscall_linux_sparc64.go | 1843 -
.../x/sys/unix/zsyscall_netbsd_386.go | 1439 -
.../x/sys/unix/zsyscall_netbsd_amd64.go | 1439 -
.../x/sys/unix/zsyscall_netbsd_arm.go | 1439 -
.../x/sys/unix/zsyscall_openbsd_386.go | 1508 -
.../x/sys/unix/zsyscall_openbsd_amd64.go | 1508 -
.../x/sys/unix/zsyscall_openbsd_arm.go | 1508 -
.../x/sys/unix/zsyscall_solaris_amd64.go | 1681 -
.../x/sys/unix/zsysctl_openbsd_386.go | 270 -
.../x/sys/unix/zsysctl_openbsd_amd64.go | 257 -
.../x/sys/unix/zsysctl_openbsd_arm.go | 270 -
.../x/sys/unix/zsysnum_darwin_386.go | 436 -
.../x/sys/unix/zsysnum_darwin_amd64.go | 436 -
.../x/sys/unix/zsysnum_darwin_arm.go | 436 -
.../x/sys/unix/zsysnum_darwin_arm64.go | 436 -
.../x/sys/unix/zsysnum_dragonfly_amd64.go | 315 -
.../x/sys/unix/zsysnum_freebsd_386.go | 353 -
.../x/sys/unix/zsysnum_freebsd_amd64.go | 353 -
.../x/sys/unix/zsysnum_freebsd_arm.go | 353 -
.../x/sys/unix/zsysnum_linux_386.go | 390 -
.../x/sys/unix/zsysnum_linux_amd64.go | 342 -
.../x/sys/unix/zsysnum_linux_arm.go | 362 -
.../x/sys/unix/zsysnum_linux_arm64.go | 286 -
.../x/sys/unix/zsysnum_linux_mips.go | 375 -
.../x/sys/unix/zsysnum_linux_mips64.go | 335 -
.../x/sys/unix/zsysnum_linux_mips64le.go | 335 -
.../x/sys/unix/zsysnum_linux_mipsle.go | 375 -
.../x/sys/unix/zsysnum_linux_ppc64.go | 373 -
.../x/sys/unix/zsysnum_linux_ppc64le.go | 373 -
.../x/sys/unix/zsysnum_linux_s390x.go | 335 -
.../x/sys/unix/zsysnum_linux_sparc64.go | 348 -
.../x/sys/unix/zsysnum_netbsd_386.go | 274 -
.../x/sys/unix/zsysnum_netbsd_amd64.go | 274 -
.../x/sys/unix/zsysnum_netbsd_arm.go | 274 -
.../x/sys/unix/zsysnum_openbsd_386.go | 207 -
.../x/sys/unix/zsysnum_openbsd_amd64.go | 217 -
.../x/sys/unix/zsysnum_openbsd_arm.go | 213 -
.../x/sys/unix/ztypes_darwin_386.go | 489 -
.../x/sys/unix/ztypes_darwin_amd64.go | 499 -
.../x/sys/unix/ztypes_darwin_arm.go | 490 -
.../x/sys/unix/ztypes_darwin_arm64.go | 499 -
.../x/sys/unix/ztypes_dragonfly_amd64.go | 486 -
.../x/sys/unix/ztypes_freebsd_386.go | 553 -
.../x/sys/unix/ztypes_freebsd_amd64.go | 556 -
.../x/sys/unix/ztypes_freebsd_arm.go | 556 -
.../golang.org/x/sys/unix/ztypes_linux_386.go | 1844 -
.../x/sys/unix/ztypes_linux_amd64.go | 1864 -
.../golang.org/x/sys/unix/ztypes_linux_arm.go | 1833 -
.../x/sys/unix/ztypes_linux_arm64.go | 1843 -
.../x/sys/unix/ztypes_linux_mips.go | 1838 -
.../x/sys/unix/ztypes_linux_mips64.go | 1845 -
.../x/sys/unix/ztypes_linux_mips64le.go | 1845 -
.../x/sys/unix/ztypes_linux_mipsle.go | 1838 -
.../x/sys/unix/ztypes_linux_ppc64.go | 1853 -
.../x/sys/unix/ztypes_linux_ppc64le.go | 1853 -
.../x/sys/unix/ztypes_linux_s390x.go | 1870 -
.../x/sys/unix/ztypes_linux_sparc64.go | 690 -
.../x/sys/unix/ztypes_netbsd_386.go | 448 -
.../x/sys/unix/ztypes_netbsd_amd64.go | 455 -
.../x/sys/unix/ztypes_netbsd_arm.go | 453 -
.../x/sys/unix/ztypes_openbsd_386.go | 484 -
.../x/sys/unix/ztypes_openbsd_amd64.go | 484 -
.../x/sys/unix/ztypes_openbsd_arm.go | 477 -
.../x/sys/unix/ztypes_solaris_amd64.go | 459 -
.../x/sys/windows/asm_windows_386.s | 13 -
.../x/sys/windows/asm_windows_amd64.s | 13 -
.../golang.org/x/sys/windows/dll_windows.go | 378 -
.../golang.org/x/sys/windows/env_windows.go | 29 -
vendor/golang.org/x/sys/windows/eventlog.go | 20 -
.../golang.org/x/sys/windows/exec_windows.go | 97 -
.../x/sys/windows/memory_windows.go | 26 -
vendor/golang.org/x/sys/windows/mksyscall.go | 7 -
vendor/golang.org/x/sys/windows/race.go | 30 -
vendor/golang.org/x/sys/windows/race0.go | 25 -
.../x/sys/windows/registry/export_test.go | 11 -
.../golang.org/x/sys/windows/registry/key.go | 198 -
.../x/sys/windows/registry/mksyscall.go | 7 -
.../x/sys/windows/registry/registry_test.go | 756 -
.../x/sys/windows/registry/syscall.go | 32 -
.../x/sys/windows/registry/value.go | 384 -
.../sys/windows/registry/zsyscall_windows.go | 120 -
.../x/sys/windows/security_windows.go | 478 -
vendor/golang.org/x/sys/windows/service.go | 165 -
vendor/golang.org/x/sys/windows/str.go | 22 -
.../golang.org/x/sys/windows/svc/debug/log.go | 56 -
.../x/sys/windows/svc/debug/service.go | 45 -
vendor/golang.org/x/sys/windows/svc/event.go | 48 -
.../x/sys/windows/svc/eventlog/install.go | 80 -
.../x/sys/windows/svc/eventlog/log.go | 70 -
.../x/sys/windows/svc/eventlog/log_test.go | 51 -
.../x/sys/windows/svc/example/beep.go | 22 -
.../x/sys/windows/svc/example/install.go | 92 -
.../x/sys/windows/svc/example/main.go | 76 -
.../x/sys/windows/svc/example/manage.go | 62 -
.../x/sys/windows/svc/example/service.go | 84 -
vendor/golang.org/x/sys/windows/svc/go12.c | 24 -
vendor/golang.org/x/sys/windows/svc/go12.go | 11 -
vendor/golang.org/x/sys/windows/svc/go13.go | 31 -
.../x/sys/windows/svc/mgr/config.go | 139 -
.../golang.org/x/sys/windows/svc/mgr/mgr.go | 162 -
.../x/sys/windows/svc/mgr/mgr_test.go | 169 -
.../x/sys/windows/svc/mgr/service.go | 72 -
.../golang.org/x/sys/windows/svc/security.go | 62 -
.../golang.org/x/sys/windows/svc/service.go | 363 -
.../golang.org/x/sys/windows/svc/svc_test.go | 135 -
vendor/golang.org/x/sys/windows/svc/sys_386.s | 68 -
.../golang.org/x/sys/windows/svc/sys_amd64.s | 42 -
vendor/golang.org/x/sys/windows/syscall.go | 74 -
.../golang.org/x/sys/windows/syscall_test.go | 53 -
.../x/sys/windows/syscall_windows.go | 1153 -
.../x/sys/windows/syscall_windows_test.go | 113 -
.../golang.org/x/sys/windows/types_windows.go | 1333 -
.../x/sys/windows/types_windows_386.go | 22 -
.../x/sys/windows/types_windows_amd64.go | 22 -
.../x/sys/windows/zsyscall_windows.go | 2700 -
vendor/golang.org/x/text/.gitattributes | 10 -
vendor/golang.org/x/text/.gitignore | 6 -
vendor/golang.org/x/text/AUTHORS | 3 -
vendor/golang.org/x/text/CONTRIBUTING.md | 31 -
vendor/golang.org/x/text/CONTRIBUTORS | 3 -
vendor/golang.org/x/text/LICENSE | 27 -
vendor/golang.org/x/text/PATENTS | 22 -
vendor/golang.org/x/text/README.md | 93 -
vendor/golang.org/x/text/cases/cases.go | 162 -
vendor/golang.org/x/text/cases/context.go | 376 -
.../golang.org/x/text/cases/context_test.go | 438 -
.../golang.org/x/text/cases/example_test.go | 53 -
vendor/golang.org/x/text/cases/fold.go | 34 -
vendor/golang.org/x/text/cases/fold_test.go | 51 -
vendor/golang.org/x/text/cases/gen.go | 839 -
vendor/golang.org/x/text/cases/gen_trieval.go | 219 -
vendor/golang.org/x/text/cases/icu.go | 61 -
vendor/golang.org/x/text/cases/icu_test.go | 210 -
vendor/golang.org/x/text/cases/info.go | 82 -
vendor/golang.org/x/text/cases/map.go | 816 -
vendor/golang.org/x/text/cases/map_test.go | 950 -
.../golang.org/x/text/cases/tables10.0.0.go | 2253 -
.../x/text/cases/tables10.0.0_test.go | 1160 -
vendor/golang.org/x/text/cases/tables9.0.0.go | 2213 -
.../x/text/cases/tables9.0.0_test.go | 1156 -
vendor/golang.org/x/text/cases/trieval.go | 215 -
vendor/golang.org/x/text/cmd/gotext/common.go | 46 -
vendor/golang.org/x/text/cmd/gotext/doc.go | 53 -
.../cmd/gotext/examples/extract/catalog.go | 76 -
.../extract/locales/de/messages.gotext.json | 186 -
.../extract/locales/de/out.gotext.json | 206 -
.../locales/en-US/messages.gotext.json | 82 -
.../extract/locales/en-US/out.gotext.json | 206 -
.../extract/locales/extracted.gotext.json | 206 -
.../extract/locales/zh/messages.gotext.json | 203 -
.../extract/locales/zh/out.gotext.json | 206 -
.../text/cmd/gotext/examples/extract/main.go | 87 -
.../extract_http/locales/de/out.gotext.json | 39 -
.../locales/en-US/out.gotext.json | 39 -
.../locales/extracted.gotext.json | 39 -
.../extract_http/locales/zh/out.gotext.json | 39 -
.../cmd/gotext/examples/extract_http/main.go | 17 -
.../gotext/examples/extract_http/pkg/pkg.go | 25 -
.../text/cmd/gotext/examples/rewrite/main.go | 37 -
.../cmd/gotext/examples/rewrite/printer.go | 16 -
.../golang.org/x/text/cmd/gotext/extract.go | 81 -
.../golang.org/x/text/cmd/gotext/generate.go | 104 -
vendor/golang.org/x/text/cmd/gotext/main.go | 352 -
.../golang.org/x/text/cmd/gotext/rewrite.go | 55 -
vendor/golang.org/x/text/codereview.cfg | 1 -
.../x/text/collate/build/builder.go | 702 -
.../x/text/collate/build/builder_test.go | 290 -
.../x/text/collate/build/colelem.go | 294 -
.../x/text/collate/build/colelem_test.go | 215 -
.../x/text/collate/build/contract.go | 309 -
.../x/text/collate/build/contract_test.go | 266 -
.../golang.org/x/text/collate/build/order.go | 393 -
.../x/text/collate/build/order_test.go | 229 -
.../golang.org/x/text/collate/build/table.go | 81 -
.../golang.org/x/text/collate/build/trie.go | 290 -
.../x/text/collate/build/trie_test.go | 107 -
vendor/golang.org/x/text/collate/collate.go | 403 -
.../golang.org/x/text/collate/collate_test.go | 482 -
.../golang.org/x/text/collate/export_test.go | 51 -
vendor/golang.org/x/text/collate/index.go | 32 -
.../golang.org/x/text/collate/maketables.go | 553 -
vendor/golang.org/x/text/collate/option.go | 239 -
.../golang.org/x/text/collate/option_test.go | 209 -
vendor/golang.org/x/text/collate/reg_test.go | 230 -
vendor/golang.org/x/text/collate/sort.go | 81 -
vendor/golang.org/x/text/collate/sort_test.go | 55 -
.../golang.org/x/text/collate/table_test.go | 291 -
vendor/golang.org/x/text/collate/tables.go | 73789 ----------------
.../x/text/collate/tools/colcmp/Makefile | 7 -
.../x/text/collate/tools/colcmp/chars.go | 1156 -
.../x/text/collate/tools/colcmp/col.go | 97 -
.../x/text/collate/tools/colcmp/colcmp.go | 529 -
.../x/text/collate/tools/colcmp/darwin.go | 111 -
.../x/text/collate/tools/colcmp/gen.go | 183 -
.../x/text/collate/tools/colcmp/icu.go | 209 -
vendor/golang.org/x/text/currency/common.go | 67 -
vendor/golang.org/x/text/currency/currency.go | 185 -
.../x/text/currency/currency_test.go | 171 -
.../x/text/currency/example_test.go | 27 -
vendor/golang.org/x/text/currency/format.go | 215 -
.../golang.org/x/text/currency/format_test.go | 70 -
vendor/golang.org/x/text/currency/gen.go | 400 -
.../golang.org/x/text/currency/gen_common.go | 71 -
vendor/golang.org/x/text/currency/query.go | 152 -
.../golang.org/x/text/currency/query_test.go | 107 -
vendor/golang.org/x/text/currency/tables.go | 2629 -
.../golang.org/x/text/currency/tables_test.go | 93 -
vendor/golang.org/x/text/date/data_test.go | 335 -
vendor/golang.org/x/text/date/gen.go | 329 -
vendor/golang.org/x/text/date/gen_test.go | 241 -
vendor/golang.org/x/text/date/tables.go | 64522 --------------
vendor/golang.org/x/text/doc.go | 13 -
.../x/text/encoding/charmap/charmap.go | 249 -
.../x/text/encoding/charmap/charmap_test.go | 258 -
.../x/text/encoding/charmap/maketables.go | 556 -
.../x/text/encoding/charmap/tables.go | 7410 --
vendor/golang.org/x/text/encoding/encoding.go | 335 -
.../x/text/encoding/encoding_test.go | 290 -
.../x/text/encoding/example_test.go | 42 -
.../x/text/encoding/htmlindex/gen.go | 173 -
.../x/text/encoding/htmlindex/htmlindex.go | 86 -
.../text/encoding/htmlindex/htmlindex_test.go | 144 -
.../x/text/encoding/htmlindex/map.go | 105 -
.../x/text/encoding/htmlindex/tables.go | 352 -
.../x/text/encoding/ianaindex/example_test.go | 27 -
.../x/text/encoding/ianaindex/gen.go | 192 -
.../x/text/encoding/ianaindex/ianaindex.go | 209 -
.../text/encoding/ianaindex/ianaindex_test.go | 192 -
.../x/text/encoding/ianaindex/tables.go | 2348 -
.../text/encoding/internal/enctest/enctest.go | 180 -
.../text/encoding/internal/identifier/gen.go | 137 -
.../internal/identifier/identifier.go | 81 -
.../text/encoding/internal/identifier/mib.go | 1621 -
.../x/text/encoding/internal/internal.go | 75 -
.../x/text/encoding/japanese/all.go | 12 -
.../x/text/encoding/japanese/all_test.go | 248 -
.../x/text/encoding/japanese/eucjp.go | 225 -
.../x/text/encoding/japanese/iso2022jp.go | 299 -
.../x/text/encoding/japanese/maketables.go | 161 -
.../x/text/encoding/japanese/shiftjis.go | 189 -
.../x/text/encoding/japanese/tables.go | 26971 ------
.../x/text/encoding/korean/all_test.go | 94 -
.../x/text/encoding/korean/euckr.go | 177 -
.../x/text/encoding/korean/maketables.go | 143 -
.../x/text/encoding/korean/tables.go | 34152 -------
.../x/text/encoding/simplifiedchinese/all.go | 12 -
.../encoding/simplifiedchinese/all_test.go | 143 -
.../x/text/encoding/simplifiedchinese/gbk.go | 269 -
.../encoding/simplifiedchinese/hzgb2312.go | 245 -
.../encoding/simplifiedchinese/maketables.go | 161 -
.../text/encoding/simplifiedchinese/tables.go | 43999 ---------
.../encoding/testdata/candide-gb18030.txt | 510 -
.../encoding/testdata/candide-utf-16le.txt | Bin 51932 -> 0 bytes
.../encoding/testdata/candide-utf-32be.txt | Bin 103864 -> 0 bytes
.../text/encoding/testdata/candide-utf-8.txt | 510 -
.../testdata/candide-windows-1252.txt | 510 -
.../encoding/testdata/rashomon-euc-jp.txt | 178 -
.../testdata/rashomon-iso-2022-jp.txt | 178 -
.../encoding/testdata/rashomon-shift-jis.txt | 178 -
.../text/encoding/testdata/rashomon-utf-8.txt | 178 -
...nzi-bingfa-gb-levels-1-and-2-hz-gb2312.txt | 107 -
.../sunzi-bingfa-gb-levels-1-and-2-utf-8.txt | 107 -
.../testdata/sunzi-bingfa-simplified-gbk.txt | 107 -
.../sunzi-bingfa-simplified-utf-8.txt | 107 -
.../sunzi-bingfa-traditional-big5.txt | 106 -
.../sunzi-bingfa-traditional-utf-8.txt | 106 -
.../testdata/unsu-joh-eun-nal-euc-kr.txt | 175 -
.../testdata/unsu-joh-eun-nal-utf-8.txt | 175 -
.../encoding/traditionalchinese/all_test.go | 114 -
.../text/encoding/traditionalchinese/big5.go | 199 -
.../encoding/traditionalchinese/maketables.go | 140 -
.../encoding/traditionalchinese/tables.go | 37142 --------
.../x/text/encoding/unicode/override.go | 82 -
.../x/text/encoding/unicode/unicode.go | 434 -
.../x/text/encoding/unicode/unicode_test.go | 499 -
.../x/text/encoding/unicode/utf32/utf32.go | 296 -
.../text/encoding/unicode/utf32/utf32_test.go | 248 -
.../x/text/feature/plural/common.go | 70 -
.../x/text/feature/plural/data_test.go | 197 -
.../x/text/feature/plural/example_test.go | 46 -
.../golang.org/x/text/feature/plural/gen.go | 513 -
.../x/text/feature/plural/gen_common.go | 74 -
.../x/text/feature/plural/message.go | 244 -
.../x/text/feature/plural/message_test.go | 197 -
.../x/text/feature/plural/plural.go | 258 -
.../x/text/feature/plural/plural_test.go | 216 -
.../x/text/feature/plural/tables.go | 548 -
vendor/golang.org/x/text/gen.go | 319 -
.../x/text/internal/catmsg/catmsg.go | 376 -
.../x/text/internal/catmsg/catmsg_test.go | 316 -
.../x/text/internal/catmsg/codec.go | 407 -
.../x/text/internal/catmsg/varint.go | 62 -
.../x/text/internal/catmsg/varint_test.go | 123 -
.../x/text/internal/cldrtree/cldrtree.go | 353 -
.../x/text/internal/cldrtree/cldrtree_test.go | 456 -
.../x/text/internal/cldrtree/generate.go | 208 -
.../x/text/internal/cldrtree/option.go | 86 -
.../testdata/test1/common/main/root.xml | 89 -
.../cldrtree/testdata/test1/output.go | 350 -
.../testdata/test2/common/main/en.xml | 171 -
.../testdata/test2/common/main/en_001.xml | 60 -
.../testdata/test2/common/main/en_GB.xml | 63 -
.../testdata/test2/common/main/root.xml | 646 -
.../cldrtree/testdata/test2/output.go | 889 -
.../x/text/internal/cldrtree/tree.go | 181 -
.../x/text/internal/cldrtree/type.go | 139 -
.../x/text/internal/colltab/collate_test.go | 121 -
.../x/text/internal/colltab/collelem.go | 371 -
.../x/text/internal/colltab/collelem_test.go | 183 -
.../x/text/internal/colltab/colltab.go | 105 -
.../x/text/internal/colltab/colltab_test.go | 64 -
.../x/text/internal/colltab/contract.go | 145 -
.../x/text/internal/colltab/contract_test.go | 131 -
.../x/text/internal/colltab/iter.go | 178 -
.../x/text/internal/colltab/iter_test.go | 63 -
.../x/text/internal/colltab/numeric.go | 236 -
.../x/text/internal/colltab/numeric_test.go | 159 -
.../x/text/internal/colltab/table.go | 275 -
.../x/text/internal/colltab/trie.go | 159 -
.../x/text/internal/colltab/trie_test.go | 106 -
.../x/text/internal/colltab/weighter.go | 31 -
.../x/text/internal/colltab/weighter_test.go | 42 -
.../golang.org/x/text/internal/export/README | 4 -
.../text/internal/export/idna/common_test.go | 55 -
.../text/internal/export/idna/example_test.go | 68 -
.../x/text/internal/export/idna/gen.go | 276 -
.../internal/export/idna/gen10.0.0_test.go | 93 -
.../internal/export/idna/gen9.0.0_test.go | 84 -
.../x/text/internal/export/idna/gen_common.go | 59 -
.../text/internal/export/idna/gen_trieval.go | 123 -
.../x/text/internal/export/idna/idna10.0.0.go | 733 -
.../internal/export/idna/idna10.0.0_test.go | 140 -
.../x/text/internal/export/idna/idna9.0.0.go | 681 -
.../internal/export/idna/idna9.0.0_test.go | 136 -
.../x/text/internal/export/idna/idna_test.go | 178 -
.../x/text/internal/export/idna/punycode.go | 201 -
.../internal/export/idna/punycode_test.go | 198 -
.../text/internal/export/idna/tables10.0.0.go | 4559 -
.../text/internal/export/idna/tables9.0.0.go | 4486 -
.../x/text/internal/export/idna/trie.go | 70 -
.../x/text/internal/export/idna/trieval.go | 119 -
.../x/text/internal/format/format.go | 41 -
.../x/text/internal/format/parser.go | 357 -
.../x/text/internal/format/parser_test.go | 32 -
vendor/golang.org/x/text/internal/gen.go | 52 -
vendor/golang.org/x/text/internal/gen/code.go | 369 -
vendor/golang.org/x/text/internal/gen/gen.go | 333 -
vendor/golang.org/x/text/internal/gen_test.go | 38 -
vendor/golang.org/x/text/internal/internal.go | 51 -
.../x/text/internal/internal_test.go | 38 -
vendor/golang.org/x/text/internal/match.go | 67 -
.../golang.org/x/text/internal/match_test.go | 56 -
.../x/text/internal/number/common.go | 51 -
.../x/text/internal/number/decimal.go | 498 -
.../x/text/internal/number/decimal_test.go | 329 -
.../x/text/internal/number/format.go | 540 -
.../x/text/internal/number/format_test.go | 522 -
.../golang.org/x/text/internal/number/gen.go | 458 -
.../x/text/internal/number/gen_common.go | 55 -
.../x/text/internal/number/number.go | 156 -
.../x/text/internal/number/number_test.go | 104 -
.../x/text/internal/number/pattern.go | 485 -
.../x/text/internal/number/pattern_test.go | 438 -
.../internal/number/roundingmode_string.go | 16 -
.../x/text/internal/number/tables.go | 1211 -
.../x/text/internal/number/tables_test.go | 125 -
.../x/text/internal/stringset/set.go | 86 -
.../x/text/internal/stringset/set_test.go | 53 -
vendor/golang.org/x/text/internal/tables.go | 118 -
vendor/golang.org/x/text/internal/tag/tag.go | 100 -
.../x/text/internal/tag/tag_test.go | 67 -
.../x/text/internal/testtext/codesize.go | 53 -
.../x/text/internal/testtext/flag.go | 22 -
.../golang.org/x/text/internal/testtext/gc.go | 14 -
.../x/text/internal/testtext/gccgo.go | 11 -
.../x/text/internal/testtext/go1_6.go | 23 -
.../x/text/internal/testtext/go1_7.go | 17 -
.../x/text/internal/testtext/text.go | 105 -
.../x/text/internal/triegen/compact.go | 58 -
.../x/text/internal/triegen/data_test.go | 875 -
.../internal/triegen/example_compact_test.go | 71 -
.../x/text/internal/triegen/example_test.go | 148 -
.../x/text/internal/triegen/gen_test.go | 68 -
.../x/text/internal/triegen/print.go | 251 -
.../x/text/internal/triegen/triegen.go | 494 -
.../x/text/internal/ucd/example_test.go | 81 -
vendor/golang.org/x/text/internal/ucd/ucd.go | 371 -
.../x/text/internal/ucd/ucd_test.go | 105 -
.../internal/utf8internal/utf8internal.go | 87 -
vendor/golang.org/x/text/language/Makefile | 16 -
vendor/golang.org/x/text/language/common.go | 16 -
vendor/golang.org/x/text/language/coverage.go | 197 -
.../x/text/language/coverage_test.go | 154 -
.../x/text/language/display/dict.go | 92 -
.../x/text/language/display/dict_test.go | 39 -
.../x/text/language/display/display.go | 420 -
.../x/text/language/display/display_test.go | 714 -
.../x/text/language/display/examples_test.go | 116 -
.../x/text/language/display/lookup.go | 251 -
.../x/text/language/display/maketables.go | 602 -
.../x/text/language/display/tables.go | 53114 -----------
vendor/golang.org/x/text/language/doc.go | 102 -
.../x/text/language/examples_test.go | 413 -
vendor/golang.org/x/text/language/gen.go | 1712 -
.../golang.org/x/text/language/gen_common.go | 20 -
.../golang.org/x/text/language/gen_index.go | 162 -
vendor/golang.org/x/text/language/go1_1.go | 38 -
vendor/golang.org/x/text/language/go1_2.go | 11 -
.../x/text/language/httpexample_test.go | 48 -
vendor/golang.org/x/text/language/index.go | 783 -
vendor/golang.org/x/text/language/language.go | 907 -
.../x/text/language/language_test.go | 911 -
vendor/golang.org/x/text/language/lookup.go | 396 -
.../golang.org/x/text/language/lookup_test.go | 457 -
vendor/golang.org/x/text/language/match.go | 933 -
.../golang.org/x/text/language/match_test.go | 505 -
vendor/golang.org/x/text/language/parse.go | 859 -
.../golang.org/x/text/language/parse_test.go | 517 -
vendor/golang.org/x/text/language/tables.go | 3686 -
vendor/golang.org/x/text/language/tags.go | 143 -
.../testdata/CLDRLocaleMatcherTest.txt | 389 -
.../language/testdata/GoLocaleMatcherTest.txt | 226 -
vendor/golang.org/x/text/message/catalog.go | 36 -
.../x/text/message/catalog/catalog.go | 369 -
.../x/text/message/catalog/catalog_test.go | 296 -
.../golang.org/x/text/message/catalog/dict.go | 129 -
.../golang.org/x/text/message/catalog/go19.go | 15 -
.../x/text/message/catalog/gopre19.go | 23 -
.../golang.org/x/text/message/catalog_test.go | 43 -
vendor/golang.org/x/text/message/doc.go | 100 -
.../x/text/message/examples_test.go | 42 -
vendor/golang.org/x/text/message/fmt_test.go | 1871 -
vendor/golang.org/x/text/message/format.go | 510 -
vendor/golang.org/x/text/message/message.go | 186 -
.../golang.org/x/text/message/message_test.go | 181 -
.../x/text/message/pipeline/extract.go | 305 -
.../x/text/message/pipeline/generate.go | 251 -
.../x/text/message/pipeline/message.go | 241 -
.../x/text/message/pipeline/pipeline.go | 57 -
.../x/text/message/pipeline/rewrite.go | 268 -
vendor/golang.org/x/text/message/print.go | 979 -
vendor/golang.org/x/text/number/doc.go | 28 -
.../golang.org/x/text/number/examples_test.go | 28 -
vendor/golang.org/x/text/number/format.go | 122 -
.../golang.org/x/text/number/format_test.go | 112 -
vendor/golang.org/x/text/number/number.go | 77 -
.../golang.org/x/text/number/number_test.go | 190 -
vendor/golang.org/x/text/number/option.go | 177 -
vendor/golang.org/x/text/runes/cond.go | 187 -
vendor/golang.org/x/text/runes/cond_test.go | 282 -
.../golang.org/x/text/runes/example_test.go | 60 -
vendor/golang.org/x/text/runes/runes.go | 355 -
vendor/golang.org/x/text/runes/runes_test.go | 664 -
vendor/golang.org/x/text/search/index.go | 35 -
vendor/golang.org/x/text/search/pattern.go | 155 -
.../golang.org/x/text/search/pattern_test.go | 357 -
vendor/golang.org/x/text/search/search.go | 237 -
vendor/golang.org/x/text/search/tables.go | 12448 ---
.../x/text/secure/bidirule/bench_test.go | 54 -
.../x/text/secure/bidirule/bidirule.go | 336 -
.../x/text/secure/bidirule/bidirule10.0.0.go | 11 -
.../secure/bidirule/bidirule10.0.0_test.go | 694 -
.../x/text/secure/bidirule/bidirule9.0.0.go | 14 -
.../secure/bidirule/bidirule9.0.0_test.go | 668 -
.../x/text/secure/bidirule/bidirule_test.go | 168 -
vendor/golang.org/x/text/secure/doc.go | 6 -
.../x/text/secure/precis/benchmark_test.go | 82 -
.../golang.org/x/text/secure/precis/class.go | 36 -
.../x/text/secure/precis/class_test.go | 50 -
.../x/text/secure/precis/context.go | 139 -
vendor/golang.org/x/text/secure/precis/doc.go | 14 -
.../text/secure/precis/enforce10.0.0_test.go | 244 -
.../x/text/secure/precis/enforce9.0.0_test.go | 244 -
.../x/text/secure/precis/enforce_test.go | 162 -
vendor/golang.org/x/text/secure/precis/gen.go | 310 -
.../x/text/secure/precis/gen_trieval.go | 68 -
.../x/text/secure/precis/nickname.go | 72 -
.../x/text/secure/precis/options.go | 157 -
.../x/text/secure/precis/profile.go | 402 -
.../x/text/secure/precis/profile_test.go | 149 -
.../x/text/secure/precis/profiles.go | 78 -
.../x/text/secure/precis/tables10.0.0.go | 3889 -
.../x/text/secure/precis/tables9.0.0.go | 3790 -
.../x/text/secure/precis/tables_test.go | 69 -
.../x/text/secure/precis/transformer.go | 32 -
.../x/text/secure/precis/trieval.go | 64 -
.../x/text/transform/examples_test.go | 37 -
.../golang.org/x/text/transform/transform.go | 705 -
.../x/text/transform/transform_test.go | 1317 -
vendor/golang.org/x/text/unicode/bidi/bidi.go | 198 -
.../golang.org/x/text/unicode/bidi/bracket.go | 335 -
vendor/golang.org/x/text/unicode/bidi/core.go | 1058 -
.../x/text/unicode/bidi/core_test.go | 224 -
vendor/golang.org/x/text/unicode/bidi/gen.go | 133 -
.../x/text/unicode/bidi/gen_ranges.go | 57 -
.../x/text/unicode/bidi/gen_trieval.go | 64 -
vendor/golang.org/x/text/unicode/bidi/prop.go | 206 -
.../x/text/unicode/bidi/ranges_test.go | 53 -
.../x/text/unicode/bidi/tables10.0.0.go | 1815 -
.../x/text/unicode/bidi/tables9.0.0.go | 1781 -
.../x/text/unicode/bidi/tables_test.go | 82 -
.../golang.org/x/text/unicode/bidi/trieval.go | 60 -
vendor/golang.org/x/text/unicode/cldr/base.go | 105 -
vendor/golang.org/x/text/unicode/cldr/cldr.go | 130 -
.../x/text/unicode/cldr/cldr_test.go | 27 -
.../golang.org/x/text/unicode/cldr/collate.go | 359 -
.../x/text/unicode/cldr/collate_test.go | 275 -
.../x/text/unicode/cldr/data_test.go | 186 -
.../golang.org/x/text/unicode/cldr/decode.go | 171 -
.../x/text/unicode/cldr/examples_test.go | 21 -
.../golang.org/x/text/unicode/cldr/makexml.go | 400 -
.../golang.org/x/text/unicode/cldr/resolve.go | 602 -
.../x/text/unicode/cldr/resolve_test.go | 368 -
.../golang.org/x/text/unicode/cldr/slice.go | 144 -
.../x/text/unicode/cldr/slice_test.go | 175 -
vendor/golang.org/x/text/unicode/cldr/xml.go | 1494 -
vendor/golang.org/x/text/unicode/doc.go | 8 -
.../x/text/unicode/norm/composition.go | 508 -
.../x/text/unicode/norm/composition_test.go | 130 -
.../x/text/unicode/norm/data10.0.0_test.go | 7424 --
.../x/text/unicode/norm/data9.0.0_test.go | 7409 --
.../x/text/unicode/norm/example_iter_test.go | 82 -
.../x/text/unicode/norm/example_test.go | 27 -
.../x/text/unicode/norm/forminfo.go | 259 -
.../x/text/unicode/norm/forminfo_test.go | 54 -
.../golang.org/x/text/unicode/norm/input.go | 109 -
vendor/golang.org/x/text/unicode/norm/iter.go | 457 -
.../x/text/unicode/norm/iter_test.go | 98 -
.../x/text/unicode/norm/maketables.go | 976 -
.../x/text/unicode/norm/normalize.go | 609 -
.../x/text/unicode/norm/normalize_test.go | 1287 -
.../x/text/unicode/norm/readwriter.go | 125 -
.../x/text/unicode/norm/readwriter_test.go | 56 -
.../x/text/unicode/norm/tables10.0.0.go | 7653 --
.../x/text/unicode/norm/tables9.0.0.go | 7633 --
.../x/text/unicode/norm/transform.go | 88 -
.../x/text/unicode/norm/transform_test.go | 101 -
vendor/golang.org/x/text/unicode/norm/trie.go | 54 -
.../golang.org/x/text/unicode/norm/triegen.go | 117 -
.../x/text/unicode/norm/ucd_test.go | 275 -
.../x/text/unicode/rangetable/gen.go | 115 -
.../x/text/unicode/rangetable/merge.go | 260 -
.../x/text/unicode/rangetable/merge_test.go | 184 -
.../x/text/unicode/rangetable/rangetable.go | 70 -
.../unicode/rangetable/rangetable_test.go | 55 -
.../x/text/unicode/rangetable/tables10.0.0.go | 6378 --
.../x/text/unicode/rangetable/tables9.0.0.go | 5737 --
.../x/text/unicode/runenames/bits.go | 59 -
.../x/text/unicode/runenames/example_test.go | 118 -
.../x/text/unicode/runenames/gen.go | 195 -
.../x/text/unicode/runenames/gen_bits.go | 63 -
.../x/text/unicode/runenames/runenames.go | 48 -
.../text/unicode/runenames/runenames_test.go | 46 -
.../x/text/unicode/runenames/tables.go | 15514 ----
vendor/golang.org/x/text/width/common_test.go | 92 -
.../golang.org/x/text/width/example_test.go | 52 -
vendor/golang.org/x/text/width/gen.go | 115 -
vendor/golang.org/x/text/width/gen_common.go | 96 -
vendor/golang.org/x/text/width/gen_trieval.go | 34 -
vendor/golang.org/x/text/width/kind_string.go | 16 -
vendor/golang.org/x/text/width/runes_test.go | 461 -
.../golang.org/x/text/width/tables10.0.0.go | 1318 -
vendor/golang.org/x/text/width/tables9.0.0.go | 1286 -
vendor/golang.org/x/text/width/tables_test.go | 59 -
vendor/golang.org/x/text/width/transform.go | 239 -
.../golang.org/x/text/width/transform_test.go | 701 -
vendor/golang.org/x/text/width/trieval.go | 30 -
vendor/golang.org/x/text/width/width.go | 206 -
vendor/gopkg.in/yaml.v2/.travis.yml | 12 -
vendor/gopkg.in/yaml.v2/LICENSE | 201 -
vendor/gopkg.in/yaml.v2/LICENSE.libyaml | 31 -
vendor/gopkg.in/yaml.v2/NOTICE | 13 -
vendor/gopkg.in/yaml.v2/README.md | 133 -
vendor/gopkg.in/yaml.v2/apic.go | 739 -
vendor/gopkg.in/yaml.v2/decode.go | 775 -
vendor/gopkg.in/yaml.v2/decode_test.go | 1326 -
vendor/gopkg.in/yaml.v2/emitterc.go | 1685 -
vendor/gopkg.in/yaml.v2/encode.go | 362 -
vendor/gopkg.in/yaml.v2/encode_test.go | 595 -
.../gopkg.in/yaml.v2/example_embedded_test.go | 41 -
vendor/gopkg.in/yaml.v2/go.mod | 5 -
vendor/gopkg.in/yaml.v2/parserc.go | 1095 -
vendor/gopkg.in/yaml.v2/readerc.go | 412 -
vendor/gopkg.in/yaml.v2/resolve.go | 258 -
vendor/gopkg.in/yaml.v2/scannerc.go | 2696 -
vendor/gopkg.in/yaml.v2/sorter.go | 113 -
vendor/gopkg.in/yaml.v2/suite_test.go | 12 -
vendor/gopkg.in/yaml.v2/writerc.go | 26 -
vendor/gopkg.in/yaml.v2/yaml.go | 466 -
vendor/gopkg.in/yaml.v2/yamlh.go | 738 -
vendor/gopkg.in/yaml.v2/yamlprivateh.go | 173 -
1677 files changed, 211 insertions(+), 844360 deletions(-)
delete mode 100644 vendor/github.com/chzyer/readline/.gitignore
delete mode 100644 vendor/github.com/chzyer/readline/.travis.yml
delete mode 100644 vendor/github.com/chzyer/readline/CHANGELOG.md
delete mode 100644 vendor/github.com/chzyer/readline/LICENSE
delete mode 100644 vendor/github.com/chzyer/readline/README.md
delete mode 100644 vendor/github.com/chzyer/readline/ansi_windows.go
delete mode 100644 vendor/github.com/chzyer/readline/complete.go
delete mode 100644 vendor/github.com/chzyer/readline/complete_helper.go
delete mode 100644 vendor/github.com/chzyer/readline/complete_segment.go
delete mode 100644 vendor/github.com/chzyer/readline/complete_segment_test.go
delete mode 100644 vendor/github.com/chzyer/readline/doc/shortcut.md
delete mode 100644 vendor/github.com/chzyer/readline/example/readline-demo/readline-demo.go
delete mode 100644 vendor/github.com/chzyer/readline/example/readline-im/README.md
delete mode 100644 vendor/github.com/chzyer/readline/example/readline-im/readline-im.go
delete mode 100644 vendor/github.com/chzyer/readline/example/readline-multiline/readline-multiline.go
delete mode 100644 vendor/github.com/chzyer/readline/example/readline-pass-strength/readline-pass-strength.go
delete mode 100644 vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-client/client.go
delete mode 100644 vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-server/server.go
delete mode 100644 vendor/github.com/chzyer/readline/history.go
delete mode 100644 vendor/github.com/chzyer/readline/operation.go
delete mode 100644 vendor/github.com/chzyer/readline/password.go
delete mode 100644 vendor/github.com/chzyer/readline/rawreader_windows.go
delete mode 100644 vendor/github.com/chzyer/readline/readline.go
delete mode 100644 vendor/github.com/chzyer/readline/readline_test.go
delete mode 100644 vendor/github.com/chzyer/readline/remote.go
delete mode 100644 vendor/github.com/chzyer/readline/runebuf.go
delete mode 100644 vendor/github.com/chzyer/readline/runes.go
delete mode 100644 vendor/github.com/chzyer/readline/runes/runes.go
delete mode 100644 vendor/github.com/chzyer/readline/runes/runes_test.go
delete mode 100644 vendor/github.com/chzyer/readline/runes_test.go
delete mode 100644 vendor/github.com/chzyer/readline/search.go
delete mode 100644 vendor/github.com/chzyer/readline/std.go
delete mode 100644 vendor/github.com/chzyer/readline/std_windows.go
delete mode 100644 vendor/github.com/chzyer/readline/term.go
delete mode 100644 vendor/github.com/chzyer/readline/term_bsd.go
delete mode 100644 vendor/github.com/chzyer/readline/term_linux.go
delete mode 100644 vendor/github.com/chzyer/readline/term_solaris.go
delete mode 100644 vendor/github.com/chzyer/readline/term_unix.go
delete mode 100644 vendor/github.com/chzyer/readline/term_windows.go
delete mode 100644 vendor/github.com/chzyer/readline/terminal.go
delete mode 100644 vendor/github.com/chzyer/readline/utils.go
delete mode 100644 vendor/github.com/chzyer/readline/utils_test.go
delete mode 100644 vendor/github.com/chzyer/readline/utils_unix.go
delete mode 100644 vendor/github.com/chzyer/readline/utils_windows.go
delete mode 100644 vendor/github.com/chzyer/readline/vim.go
delete mode 100644 vendor/github.com/chzyer/readline/windows_api.go
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/.gitignore
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/.gometalinter.json
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/.travis.yml
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/Dockerfile
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/Gopkg.lock
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/Gopkg.toml
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/LICENSE.md
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/Makefile
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/README.md
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/go-md2man.1.md
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/md2man.go
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/md2man/roff.go
delete mode 100644 vendor/github.com/cpuguy83/go-md2man/md2man/roff_test.go
delete mode 100755 vendor/github.com/cpuguy83/go-md2man/script/setup/dev-tools
delete mode 100755 vendor/github.com/cpuguy83/go-md2man/script/validate/vendor
delete mode 100644 vendor/github.com/fsnotify/fsnotify/.editorconfig
delete mode 100644 vendor/github.com/fsnotify/fsnotify/.github/ISSUE_TEMPLATE.md
delete mode 100644 vendor/github.com/fsnotify/fsnotify/.github/PULL_REQUEST_TEMPLATE.md
delete mode 100644 vendor/github.com/fsnotify/fsnotify/.gitignore
delete mode 100644 vendor/github.com/fsnotify/fsnotify/.travis.yml
delete mode 100644 vendor/github.com/fsnotify/fsnotify/AUTHORS
delete mode 100644 vendor/github.com/fsnotify/fsnotify/CHANGELOG.md
delete mode 100644 vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md
delete mode 100644 vendor/github.com/fsnotify/fsnotify/LICENSE
delete mode 100644 vendor/github.com/fsnotify/fsnotify/README.md
delete mode 100644 vendor/github.com/fsnotify/fsnotify/example_test.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/fen.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/fsnotify.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/fsnotify_test.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/inotify.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/inotify_poller.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/inotify_poller_test.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/inotify_test.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/integration_darwin_test.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/integration_test.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/kqueue.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go
delete mode 100644 vendor/github.com/fsnotify/fsnotify/windows.go
delete mode 100644 vendor/github.com/ghodss/yaml/.gitignore
delete mode 100644 vendor/github.com/ghodss/yaml/.travis.yml
delete mode 100644 vendor/github.com/ghodss/yaml/LICENSE
delete mode 100644 vendor/github.com/ghodss/yaml/README.md
delete mode 100644 vendor/github.com/ghodss/yaml/fields.go
delete mode 100644 vendor/github.com/ghodss/yaml/yaml.go
delete mode 100644 vendor/github.com/ghodss/yaml/yaml_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/.github/ISSUE_TEMPLATE.md
delete mode 100644 vendor/github.com/hashicorp/hcl/.gitignore
delete mode 100644 vendor/github.com/hashicorp/hcl/.travis.yml
delete mode 100644 vendor/github.com/hashicorp/hcl/LICENSE
delete mode 100644 vendor/github.com/hashicorp/hcl/Makefile
delete mode 100644 vendor/github.com/hashicorp/hcl/README.md
delete mode 100644 vendor/github.com/hashicorp/hcl/appveyor.yml
delete mode 100644 vendor/github.com/hashicorp/hcl/decoder.go
delete mode 100644 vendor/github.com/hashicorp/hcl/decoder_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/ast/ast.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/ast/walk.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/.hidden.ignore
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/dir.ignore
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/file.ignore
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/good.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/error.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment_2.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_colon.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_deep.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_crlf.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_lastline.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_single.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_crlf.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_key.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/empty.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/git_crypt.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/key_without_value.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list_comma.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/missing_braces.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/multiple.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value2.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value3.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_without_value.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_list_comma.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/old.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_basic.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_empty.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/types.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object_2.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/printer.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_crlf.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.golden
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.input
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/array_comment.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/assign_colon.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment_single.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex_key.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/empty.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list_comma.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/multiple.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/old.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_basic.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_empty.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/test-fixtures/types.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/token/position.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/token/token.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/token/token_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/hcl_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/flatten.go
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/parser.go
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/parser_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/array.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_128.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_tf_8110.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/basic.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/good_input_tf_8110.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/object.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/types.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/scanner/scanner.go
delete mode 100644 vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/json/test-fixtures/array.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/test-fixtures/basic.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/test-fixtures/object.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/test-fixtures/types.json
delete mode 100644 vendor/github.com/hashicorp/hcl/json/token/position.go
delete mode 100644 vendor/github.com/hashicorp/hcl/json/token/token.go
delete mode 100644 vendor/github.com/hashicorp/hcl/json/token/token_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/lex.go
delete mode 100644 vendor/github.com/hashicorp/hcl/lex_test.go
delete mode 100644 vendor/github.com/hashicorp/hcl/parse.go
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/assign_deep.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/basic.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/basic.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/block_assign.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/empty.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/escape.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/escape_backslash.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/flat.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/float.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/float.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/git_crypt.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/interpolate.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/list_of_lists.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/list_of_maps.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline_indented.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal_with_hil.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_hanging_indent.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/nested_provider_bad.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/null_strings.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/object_list.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/object_with_bool.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/scientific.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/scientific.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure2.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure2.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure_flat.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_empty.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/terraform_variable_invalid.json
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl
delete mode 100644 vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go
delete mode 100644 vendor/github.com/inconshreveable/mousetrap/LICENSE
delete mode 100644 vendor/github.com/inconshreveable/mousetrap/README.md
delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_others.go
delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_windows.go
delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
delete mode 100644 vendor/github.com/juju/ansiterm/LICENSE
delete mode 100644 vendor/github.com/juju/ansiterm/Makefile
delete mode 100644 vendor/github.com/juju/ansiterm/README.md
delete mode 100644 vendor/github.com/juju/ansiterm/attribute.go
delete mode 100644 vendor/github.com/juju/ansiterm/attribute_test.go
delete mode 100644 vendor/github.com/juju/ansiterm/color.go
delete mode 100644 vendor/github.com/juju/ansiterm/color_test.go
delete mode 100644 vendor/github.com/juju/ansiterm/context.go
delete mode 100644 vendor/github.com/juju/ansiterm/context_test.go
delete mode 100644 vendor/github.com/juju/ansiterm/doc.go
delete mode 100644 vendor/github.com/juju/ansiterm/package_test.go
delete mode 100644 vendor/github.com/juju/ansiterm/style.go
delete mode 100644 vendor/github.com/juju/ansiterm/style_test.go
delete mode 100644 vendor/github.com/juju/ansiterm/tabwriter.go
delete mode 100644 vendor/github.com/juju/ansiterm/tabwriter/LICENSE
delete mode 100644 vendor/github.com/juju/ansiterm/tabwriter/tabwriter.go
delete mode 100644 vendor/github.com/juju/ansiterm/tabwriter/tabwriter_test.go
delete mode 100644 vendor/github.com/juju/ansiterm/terminal.go
delete mode 100644 vendor/github.com/juju/ansiterm/writer.go
delete mode 100644 vendor/github.com/juju/ansiterm/writer_test.go
delete mode 100644 vendor/github.com/lunixbochs/vtclean/.travis.yml
delete mode 100644 vendor/github.com/lunixbochs/vtclean/LICENSE
delete mode 100644 vendor/github.com/lunixbochs/vtclean/README.md
delete mode 100644 vendor/github.com/lunixbochs/vtclean/io.go
delete mode 100644 vendor/github.com/lunixbochs/vtclean/line.go
delete mode 100644 vendor/github.com/lunixbochs/vtclean/regex.txt
delete mode 100644 vendor/github.com/lunixbochs/vtclean/vtclean.go
delete mode 100644 vendor/github.com/lunixbochs/vtclean/vtclean/vtclean.go
delete mode 100644 vendor/github.com/lunixbochs/vtclean/vtclean_test.go
delete mode 100644 vendor/github.com/magiconair/properties/.gitignore
delete mode 100644 vendor/github.com/magiconair/properties/.travis.yml
delete mode 100644 vendor/github.com/magiconair/properties/CHANGELOG.md
delete mode 100644 vendor/github.com/magiconair/properties/LICENSE
delete mode 100644 vendor/github.com/magiconair/properties/README.md
delete mode 100644 vendor/github.com/magiconair/properties/assert/assert.go
delete mode 100644 vendor/github.com/magiconair/properties/assert/assert_test.go
delete mode 100644 vendor/github.com/magiconair/properties/benchmark_test.go
delete mode 100644 vendor/github.com/magiconair/properties/decode.go
delete mode 100644 vendor/github.com/magiconair/properties/decode_test.go
delete mode 100644 vendor/github.com/magiconair/properties/doc.go
delete mode 100644 vendor/github.com/magiconair/properties/example_test.go
delete mode 100644 vendor/github.com/magiconair/properties/integrate.go
delete mode 100644 vendor/github.com/magiconair/properties/integrate_test.go
delete mode 100644 vendor/github.com/magiconair/properties/lex.go
delete mode 100644 vendor/github.com/magiconair/properties/load.go
delete mode 100644 vendor/github.com/magiconair/properties/load_test.go
delete mode 100644 vendor/github.com/magiconair/properties/parser.go
delete mode 100644 vendor/github.com/magiconair/properties/properties.go
delete mode 100644 vendor/github.com/magiconair/properties/properties_test.go
delete mode 100644 vendor/github.com/magiconair/properties/rangecheck.go
delete mode 100644 vendor/github.com/manifoldco/promptui/.github/CONTRIBUTING.md
delete mode 100644 vendor/github.com/manifoldco/promptui/.github/listbot.md
delete mode 100644 vendor/github.com/manifoldco/promptui/.gitignore
delete mode 100644 vendor/github.com/manifoldco/promptui/.travis.yml
delete mode 100644 vendor/github.com/manifoldco/promptui/CHANGELOG.md
delete mode 100644 vendor/github.com/manifoldco/promptui/CODE_OF_CONDUCT.md
delete mode 100644 vendor/github.com/manifoldco/promptui/Gopkg.lock
delete mode 100644 vendor/github.com/manifoldco/promptui/Gopkg.toml
delete mode 100644 vendor/github.com/manifoldco/promptui/LICENSE.md
delete mode 100644 vendor/github.com/manifoldco/promptui/Makefile
delete mode 100644 vendor/github.com/manifoldco/promptui/README.md
delete mode 100644 vendor/github.com/manifoldco/promptui/_examples/confirm/main.go
delete mode 100644 vendor/github.com/manifoldco/promptui/_examples/custom_prompt/main.go
delete mode 100644 vendor/github.com/manifoldco/promptui/_examples/custom_select/main.go
delete mode 100644 vendor/github.com/manifoldco/promptui/_examples/prompt/main.go
delete mode 100644 vendor/github.com/manifoldco/promptui/_examples/prompt_default/main.go
delete mode 100644 vendor/github.com/manifoldco/promptui/_examples/prompt_password/main.go
delete mode 100644 vendor/github.com/manifoldco/promptui/_examples/select/main.go
delete mode 100644 vendor/github.com/manifoldco/promptui/_examples/select_add/main.go
delete mode 100644 vendor/github.com/manifoldco/promptui/codes.go
delete mode 100644 vendor/github.com/manifoldco/promptui/codes_test.go
delete mode 100644 vendor/github.com/manifoldco/promptui/keycodes.go
delete mode 100644 vendor/github.com/manifoldco/promptui/keycodes_windows.go
delete mode 100644 vendor/github.com/manifoldco/promptui/list/list.go
delete mode 100644 vendor/github.com/manifoldco/promptui/list/list_test.go
delete mode 100644 vendor/github.com/manifoldco/promptui/prompt.go
delete mode 100644 vendor/github.com/manifoldco/promptui/promptui.go
delete mode 100644 vendor/github.com/manifoldco/promptui/screenbuf/screenbuf.go
delete mode 100644 vendor/github.com/manifoldco/promptui/screenbuf/screenbuf_test.go
delete mode 100644 vendor/github.com/manifoldco/promptui/select.go
delete mode 100644 vendor/github.com/manifoldco/promptui/select_test.go
delete mode 100644 vendor/github.com/manifoldco/promptui/styles.go
delete mode 100644 vendor/github.com/manifoldco/promptui/styles_windows.go
delete mode 100644 vendor/github.com/mattn/go-colorable/.travis.yml
delete mode 100644 vendor/github.com/mattn/go-colorable/LICENSE
delete mode 100644 vendor/github.com/mattn/go-colorable/README.md
delete mode 100644 vendor/github.com/mattn/go-colorable/_example/escape-seq/main.go
delete mode 100644 vendor/github.com/mattn/go-colorable/_example/logrus/main.go
delete mode 100644 vendor/github.com/mattn/go-colorable/_example/title/main.go
delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_appengine.go
delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_others.go
delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_test.go
delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_windows.go
delete mode 100644 vendor/github.com/mattn/go-colorable/noncolorable.go
delete mode 100644 vendor/github.com/mattn/go-isatty/.travis.yml
delete mode 100644 vendor/github.com/mattn/go-isatty/LICENSE
delete mode 100644 vendor/github.com/mattn/go-isatty/README.md
delete mode 100644 vendor/github.com/mattn/go-isatty/doc.go
delete mode 100644 vendor/github.com/mattn/go-isatty/example_test.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_appengine.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_bsd.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_linux.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_others.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_others_test.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_solaris.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_windows.go
delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_windows_test.go
delete mode 100644 vendor/github.com/mattn/go-runewidth/.travis.yml
delete mode 100644 vendor/github.com/mattn/go-runewidth/LICENSE
delete mode 100644 vendor/github.com/mattn/go-runewidth/README.mkd
delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth.go
delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_js.go
delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_posix.go
delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_test.go
delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_windows.go
delete mode 100644 vendor/github.com/mitchellh/mapstructure/.travis.yml
delete mode 100644 vendor/github.com/mitchellh/mapstructure/LICENSE
delete mode 100644 vendor/github.com/mitchellh/mapstructure/README.md
delete mode 100644 vendor/github.com/mitchellh/mapstructure/decode_hooks.go
delete mode 100644 vendor/github.com/mitchellh/mapstructure/decode_hooks_test.go
delete mode 100644 vendor/github.com/mitchellh/mapstructure/error.go
delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure.go
delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go
delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go
delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure_examples_test.go
delete mode 100644 vendor/github.com/mitchellh/mapstructure/mapstructure_test.go
delete mode 100644 vendor/github.com/olekukonko/tablewriter/.gitignore
delete mode 100644 vendor/github.com/olekukonko/tablewriter/.travis.yml
delete mode 100644 vendor/github.com/olekukonko/tablewriter/LICENCE.md
delete mode 100644 vendor/github.com/olekukonko/tablewriter/README.md
delete mode 100644 vendor/github.com/olekukonko/tablewriter/csv.go
delete mode 100644 vendor/github.com/olekukonko/tablewriter/csv2table/README.md
delete mode 100644 vendor/github.com/olekukonko/tablewriter/csv2table/csv2table.go
delete mode 100644 vendor/github.com/olekukonko/tablewriter/table.go
delete mode 100644 vendor/github.com/olekukonko/tablewriter/table_test.go
delete mode 100644 vendor/github.com/olekukonko/tablewriter/table_with_color.go
delete mode 100644 vendor/github.com/olekukonko/tablewriter/testdata/test.csv
delete mode 100644 vendor/github.com/olekukonko/tablewriter/testdata/test_info.csv
delete mode 100644 vendor/github.com/olekukonko/tablewriter/util.go
delete mode 100644 vendor/github.com/olekukonko/tablewriter/wrap.go
delete mode 100644 vendor/github.com/olekukonko/tablewriter/wrap_test.go
delete mode 100644 vendor/github.com/packethost/packngo/.drone.yml
delete mode 100644 vendor/github.com/packethost/packngo/.gitignore
delete mode 100644 vendor/github.com/packethost/packngo/CHANGELOG.md
delete mode 100644 vendor/github.com/packethost/packngo/LICENSE.txt
delete mode 100644 vendor/github.com/packethost/packngo/README.md
delete mode 100644 vendor/github.com/packethost/packngo/billing_address.go
delete mode 100644 vendor/github.com/packethost/packngo/devices.go
delete mode 100644 vendor/github.com/packethost/packngo/devices_test.go
delete mode 100644 vendor/github.com/packethost/packngo/email.go
delete mode 100644 vendor/github.com/packethost/packngo/email_test.go
delete mode 100644 vendor/github.com/packethost/packngo/events.go
delete mode 100644 vendor/github.com/packethost/packngo/events_test.go
delete mode 100644 vendor/github.com/packethost/packngo/examples/otp.go
delete mode 100644 vendor/github.com/packethost/packngo/facilities.go
delete mode 100644 vendor/github.com/packethost/packngo/hardware_reservations.go
delete mode 100644 vendor/github.com/packethost/packngo/hardware_reservations_test.go
delete mode 100644 vendor/github.com/packethost/packngo/ip.go
delete mode 100644 vendor/github.com/packethost/packngo/ip_test.go
delete mode 100644 vendor/github.com/packethost/packngo/metadata/metadata.go
delete mode 100644 vendor/github.com/packethost/packngo/metadata/metadata_test.go
delete mode 100644 vendor/github.com/packethost/packngo/metadata/testdata/device.json
delete mode 100644 vendor/github.com/packethost/packngo/operatingsystems.go
delete mode 100644 vendor/github.com/packethost/packngo/organizations.go
delete mode 100644 vendor/github.com/packethost/packngo/organizations_test.go
delete mode 100644 vendor/github.com/packethost/packngo/packngo.go
delete mode 100644 vendor/github.com/packethost/packngo/packngo_test.go
delete mode 100644 vendor/github.com/packethost/packngo/payment_methods.go
delete mode 100644 vendor/github.com/packethost/packngo/plans.go
delete mode 100644 vendor/github.com/packethost/packngo/ports.go
delete mode 100644 vendor/github.com/packethost/packngo/ports_test.go
delete mode 100644 vendor/github.com/packethost/packngo/projects.go
delete mode 100644 vendor/github.com/packethost/packngo/projects_test.go
delete mode 100644 vendor/github.com/packethost/packngo/rate.go
delete mode 100644 vendor/github.com/packethost/packngo/spotmarket.go
delete mode 100644 vendor/github.com/packethost/packngo/spotmarket_test.go
delete mode 100644 vendor/github.com/packethost/packngo/spotmarketrequest.go
delete mode 100644 vendor/github.com/packethost/packngo/spotmarketrequest_test.go
delete mode 100644 vendor/github.com/packethost/packngo/sshkeys.go
delete mode 100644 vendor/github.com/packethost/packngo/sshkeys_test.go
delete mode 100644 vendor/github.com/packethost/packngo/timestamp.go
delete mode 100644 vendor/github.com/packethost/packngo/two_factor_auth.go
delete mode 100644 vendor/github.com/packethost/packngo/user.go
delete mode 100644 vendor/github.com/packethost/packngo/user_test.go
delete mode 100644 vendor/github.com/packethost/packngo/utils.go
delete mode 100644 vendor/github.com/packethost/packngo/virtualnetworks.go
delete mode 100644 vendor/github.com/packethost/packngo/virtualnetworks_test.go
delete mode 100644 vendor/github.com/packethost/packngo/volumes.go
delete mode 100644 vendor/github.com/packethost/packngo/volumes_test.go
delete mode 100644 vendor/github.com/packethost/packngo/vpn.go
delete mode 100644 vendor/github.com/packethost/packngo/vpn_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/.gitignore
delete mode 100644 vendor/github.com/pelletier/go-toml/.travis.yml
delete mode 100644 vendor/github.com/pelletier/go-toml/LICENSE
delete mode 100644 vendor/github.com/pelletier/go-toml/README.md
delete mode 100644 vendor/github.com/pelletier/go-toml/benchmark.json
delete mode 100755 vendor/github.com/pelletier/go-toml/benchmark.sh
delete mode 100644 vendor/github.com/pelletier/go-toml/benchmark.toml
delete mode 100644 vendor/github.com/pelletier/go-toml/benchmark.yml
delete mode 100644 vendor/github.com/pelletier/go-toml/benchmark_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/cmd/test_program.go
delete mode 100644 vendor/github.com/pelletier/go-toml/cmd/tomljson/main.go
delete mode 100644 vendor/github.com/pelletier/go-toml/cmd/tomljson/main_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/cmd/tomll/main.go
delete mode 100644 vendor/github.com/pelletier/go-toml/doc.go
delete mode 100644 vendor/github.com/pelletier/go-toml/doc_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/example-crlf.toml
delete mode 100644 vendor/github.com/pelletier/go-toml/example.toml
delete mode 100644 vendor/github.com/pelletier/go-toml/fuzz.go
delete mode 100755 vendor/github.com/pelletier/go-toml/fuzz.sh
delete mode 100644 vendor/github.com/pelletier/go-toml/keysparsing.go
delete mode 100644 vendor/github.com/pelletier/go-toml/keysparsing_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/lexer.go
delete mode 100644 vendor/github.com/pelletier/go-toml/lexer_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/marshal.go
delete mode 100644 vendor/github.com/pelletier/go-toml/marshal_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/marshal_test.toml
delete mode 100644 vendor/github.com/pelletier/go-toml/parser.go
delete mode 100644 vendor/github.com/pelletier/go-toml/parser_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/position.go
delete mode 100644 vendor/github.com/pelletier/go-toml/position_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/doc.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/lexer.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/lexer_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/match.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/match_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/parser.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/parser_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/query.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/query_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/query/tokens.go
delete mode 100755 vendor/github.com/pelletier/go-toml/test.sh
delete mode 100644 vendor/github.com/pelletier/go-toml/token.go
delete mode 100644 vendor/github.com/pelletier/go-toml/token_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/toml.go
delete mode 100644 vendor/github.com/pelletier/go-toml/toml_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/tomltree_create.go
delete mode 100644 vendor/github.com/pelletier/go-toml/tomltree_create_test.go
delete mode 100644 vendor/github.com/pelletier/go-toml/tomltree_write.go
delete mode 100644 vendor/github.com/pelletier/go-toml/tomltree_write_test.go
delete mode 100644 vendor/github.com/russross/blackfriday/.gitignore
delete mode 100644 vendor/github.com/russross/blackfriday/.travis.yml
delete mode 100644 vendor/github.com/russross/blackfriday/LICENSE.txt
delete mode 100644 vendor/github.com/russross/blackfriday/README.md
delete mode 100644 vendor/github.com/russross/blackfriday/block.go
delete mode 100644 vendor/github.com/russross/blackfriday/block_test.go
delete mode 100644 vendor/github.com/russross/blackfriday/doc.go
delete mode 100644 vendor/github.com/russross/blackfriday/html.go
delete mode 100644 vendor/github.com/russross/blackfriday/inline.go
delete mode 100644 vendor/github.com/russross/blackfriday/inline_test.go
delete mode 100644 vendor/github.com/russross/blackfriday/latex.go
delete mode 100644 vendor/github.com/russross/blackfriday/markdown.go
delete mode 100644 vendor/github.com/russross/blackfriday/markdown_test.go
delete mode 100644 vendor/github.com/russross/blackfriday/ref_test.go
delete mode 100644 vendor/github.com/russross/blackfriday/smartypants.go
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Amps and angle encoding.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Amps and angle encoding.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Auto links.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Auto links.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Backslash escapes.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Backslash escapes.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Blockquotes with code blocks.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Blockquotes with code blocks.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Code Blocks.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Code Blocks.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Code Spans.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Code Spans.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Hard-wrapped paragraphs with list-like lines no empty line before block.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Hard-wrapped paragraphs with list-like lines no empty line before block.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Hard-wrapped paragraphs with list-like lines.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Hard-wrapped paragraphs with list-like lines.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Horizontal rules.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Horizontal rules.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Inline HTML (Advanced).html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Inline HTML (Advanced).text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Inline HTML (Simple).html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Inline HTML (Simple).text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Inline HTML comments.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Inline HTML comments.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Links, inline style.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Links, inline style.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Links, reference style.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Links, reference style.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Links, shortcut references.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Links, shortcut references.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Literal quotes in titles.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Literal quotes in titles.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Markdown Documentation - Basics.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Markdown Documentation - Basics.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Markdown Documentation - Syntax.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Markdown Documentation - Syntax.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Nested blockquotes.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Nested blockquotes.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Ordered and unordered lists.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Ordered and unordered lists.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Strong and em together.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Strong and em together.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Tabs.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Tabs.text
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Tidyness.html
delete mode 100644 vendor/github.com/russross/blackfriday/testdata/Tidyness.text
delete mode 100644 vendor/github.com/spf13/afero/.travis.yml
delete mode 100644 vendor/github.com/spf13/afero/LICENSE.txt
delete mode 100644 vendor/github.com/spf13/afero/README.md
delete mode 100644 vendor/github.com/spf13/afero/afero.go
delete mode 100644 vendor/github.com/spf13/afero/afero_test.go
delete mode 100644 vendor/github.com/spf13/afero/appveyor.yml
delete mode 100644 vendor/github.com/spf13/afero/basepath.go
delete mode 100644 vendor/github.com/spf13/afero/basepath_test.go
delete mode 100644 vendor/github.com/spf13/afero/cacheOnReadFs.go
delete mode 100644 vendor/github.com/spf13/afero/composite_test.go
delete mode 100644 vendor/github.com/spf13/afero/const_bsds.go
delete mode 100644 vendor/github.com/spf13/afero/const_win_unix.go
delete mode 100644 vendor/github.com/spf13/afero/copyOnWriteFs.go
delete mode 100644 vendor/github.com/spf13/afero/copyOnWriteFs_test.go
delete mode 100644 vendor/github.com/spf13/afero/httpFs.go
delete mode 100644 vendor/github.com/spf13/afero/ioutil.go
delete mode 100644 vendor/github.com/spf13/afero/ioutil_test.go
delete mode 100644 vendor/github.com/spf13/afero/lstater.go
delete mode 100644 vendor/github.com/spf13/afero/lstater_test.go
delete mode 100644 vendor/github.com/spf13/afero/match.go
delete mode 100644 vendor/github.com/spf13/afero/match_test.go
delete mode 100644 vendor/github.com/spf13/afero/mem/dir.go
delete mode 100644 vendor/github.com/spf13/afero/mem/dirmap.go
delete mode 100644 vendor/github.com/spf13/afero/mem/file.go
delete mode 100644 vendor/github.com/spf13/afero/mem/file_test.go
delete mode 100644 vendor/github.com/spf13/afero/memmap.go
delete mode 100644 vendor/github.com/spf13/afero/memmap_test.go
delete mode 100644 vendor/github.com/spf13/afero/os.go
delete mode 100644 vendor/github.com/spf13/afero/path.go
delete mode 100644 vendor/github.com/spf13/afero/path_test.go
delete mode 100644 vendor/github.com/spf13/afero/readonlyfs.go
delete mode 100644 vendor/github.com/spf13/afero/regexpfs.go
delete mode 100644 vendor/github.com/spf13/afero/ro_regexp_test.go
delete mode 100644 vendor/github.com/spf13/afero/sftpfs/file.go
delete mode 100644 vendor/github.com/spf13/afero/sftpfs/sftp.go
delete mode 100644 vendor/github.com/spf13/afero/sftpfs/sftp_test_go
delete mode 100644 vendor/github.com/spf13/afero/unionFile.go
delete mode 100644 vendor/github.com/spf13/afero/util.go
delete mode 100644 vendor/github.com/spf13/afero/util_test.go
delete mode 100644 vendor/github.com/spf13/cast/.gitignore
delete mode 100644 vendor/github.com/spf13/cast/.travis.yml
delete mode 100644 vendor/github.com/spf13/cast/LICENSE
delete mode 100644 vendor/github.com/spf13/cast/Makefile
delete mode 100644 vendor/github.com/spf13/cast/README.md
delete mode 100644 vendor/github.com/spf13/cast/cast.go
delete mode 100644 vendor/github.com/spf13/cast/cast_test.go
delete mode 100644 vendor/github.com/spf13/cast/caste.go
delete mode 100644 vendor/github.com/spf13/cobra/.circleci/config.yml
delete mode 100644 vendor/github.com/spf13/cobra/.gitignore
delete mode 100644 vendor/github.com/spf13/cobra/.mailmap
delete mode 100644 vendor/github.com/spf13/cobra/.travis.yml
delete mode 100644 vendor/github.com/spf13/cobra/LICENSE.txt
delete mode 100644 vendor/github.com/spf13/cobra/README.md
delete mode 100644 vendor/github.com/spf13/cobra/args.go
delete mode 100644 vendor/github.com/spf13/cobra/args_test.go
delete mode 100644 vendor/github.com/spf13/cobra/bash_completions.go
delete mode 100644 vendor/github.com/spf13/cobra/bash_completions.md
delete mode 100644 vendor/github.com/spf13/cobra/bash_completions_test.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/README.md
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/add.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/add_test.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/helpers.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/init.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/init_test.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/licenses.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/project.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/project_test.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/root.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/testdata/main.go.golden
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/testdata/root.go.golden
delete mode 100644 vendor/github.com/spf13/cobra/cobra/cmd/testdata/test.go.golden
delete mode 100644 vendor/github.com/spf13/cobra/cobra/main.go
delete mode 100644 vendor/github.com/spf13/cobra/cobra_test.go
delete mode 100644 vendor/github.com/spf13/cobra/command.go
delete mode 100644 vendor/github.com/spf13/cobra/command_notwin.go
delete mode 100644 vendor/github.com/spf13/cobra/command_test.go
delete mode 100644 vendor/github.com/spf13/cobra/command_win.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/cmd_test.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/man_docs.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/man_docs.md
delete mode 100644 vendor/github.com/spf13/cobra/doc/man_docs_test.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/man_examples_test.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/md_docs.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/md_docs.md
delete mode 100644 vendor/github.com/spf13/cobra/doc/md_docs_test.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/rest_docs.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/rest_docs.md
delete mode 100644 vendor/github.com/spf13/cobra/doc/rest_docs_test.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/util.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/yaml_docs.go
delete mode 100644 vendor/github.com/spf13/cobra/doc/yaml_docs.md
delete mode 100644 vendor/github.com/spf13/cobra/doc/yaml_docs_test.go
delete mode 100644 vendor/github.com/spf13/cobra/zsh_completions.go
delete mode 100644 vendor/github.com/spf13/cobra/zsh_completions_test.go
delete mode 100644 vendor/github.com/spf13/jwalterweatherman/.gitignore
delete mode 100644 vendor/github.com/spf13/jwalterweatherman/LICENSE
delete mode 100644 vendor/github.com/spf13/jwalterweatherman/README.md
delete mode 100644 vendor/github.com/spf13/jwalterweatherman/default_notepad.go
delete mode 100644 vendor/github.com/spf13/jwalterweatherman/default_notepad_test.go
delete mode 100644 vendor/github.com/spf13/jwalterweatherman/log_counter.go
delete mode 100644 vendor/github.com/spf13/jwalterweatherman/notepad.go
delete mode 100644 vendor/github.com/spf13/jwalterweatherman/notepad_test.go
delete mode 100644 vendor/github.com/spf13/pflag/.gitignore
delete mode 100644 vendor/github.com/spf13/pflag/.travis.yml
delete mode 100644 vendor/github.com/spf13/pflag/LICENSE
delete mode 100644 vendor/github.com/spf13/pflag/README.md
delete mode 100644 vendor/github.com/spf13/pflag/bool.go
delete mode 100644 vendor/github.com/spf13/pflag/bool_slice.go
delete mode 100644 vendor/github.com/spf13/pflag/bool_slice_test.go
delete mode 100644 vendor/github.com/spf13/pflag/bool_test.go
delete mode 100644 vendor/github.com/spf13/pflag/bytes.go
delete mode 100644 vendor/github.com/spf13/pflag/bytes_test.go
delete mode 100644 vendor/github.com/spf13/pflag/count.go
delete mode 100644 vendor/github.com/spf13/pflag/count_test.go
delete mode 100644 vendor/github.com/spf13/pflag/duration.go
delete mode 100644 vendor/github.com/spf13/pflag/duration_slice.go
delete mode 100644 vendor/github.com/spf13/pflag/duration_slice_test.go
delete mode 100644 vendor/github.com/spf13/pflag/example_test.go
delete mode 100644 vendor/github.com/spf13/pflag/export_test.go
delete mode 100644 vendor/github.com/spf13/pflag/flag.go
delete mode 100644 vendor/github.com/spf13/pflag/flag_test.go
delete mode 100644 vendor/github.com/spf13/pflag/float32.go
delete mode 100644 vendor/github.com/spf13/pflag/float64.go
delete mode 100644 vendor/github.com/spf13/pflag/golangflag.go
delete mode 100644 vendor/github.com/spf13/pflag/golangflag_test.go
delete mode 100644 vendor/github.com/spf13/pflag/int.go
delete mode 100644 vendor/github.com/spf13/pflag/int16.go
delete mode 100644 vendor/github.com/spf13/pflag/int32.go
delete mode 100644 vendor/github.com/spf13/pflag/int64.go
delete mode 100644 vendor/github.com/spf13/pflag/int8.go
delete mode 100644 vendor/github.com/spf13/pflag/int_slice.go
delete mode 100644 vendor/github.com/spf13/pflag/int_slice_test.go
delete mode 100644 vendor/github.com/spf13/pflag/ip.go
delete mode 100644 vendor/github.com/spf13/pflag/ip_slice.go
delete mode 100644 vendor/github.com/spf13/pflag/ip_slice_test.go
delete mode 100644 vendor/github.com/spf13/pflag/ip_test.go
delete mode 100644 vendor/github.com/spf13/pflag/ipmask.go
delete mode 100644 vendor/github.com/spf13/pflag/ipnet.go
delete mode 100644 vendor/github.com/spf13/pflag/ipnet_test.go
delete mode 100644 vendor/github.com/spf13/pflag/printusage_test.go
delete mode 100644 vendor/github.com/spf13/pflag/string.go
delete mode 100644 vendor/github.com/spf13/pflag/string_array.go
delete mode 100644 vendor/github.com/spf13/pflag/string_array_test.go
delete mode 100644 vendor/github.com/spf13/pflag/string_slice.go
delete mode 100644 vendor/github.com/spf13/pflag/string_slice_test.go
delete mode 100644 vendor/github.com/spf13/pflag/uint.go
delete mode 100644 vendor/github.com/spf13/pflag/uint16.go
delete mode 100644 vendor/github.com/spf13/pflag/uint32.go
delete mode 100644 vendor/github.com/spf13/pflag/uint64.go
delete mode 100644 vendor/github.com/spf13/pflag/uint8.go
delete mode 100644 vendor/github.com/spf13/pflag/uint_slice.go
delete mode 100644 vendor/github.com/spf13/pflag/uint_slice_test.go
delete mode 100755 vendor/github.com/spf13/pflag/verify/all.sh
delete mode 100755 vendor/github.com/spf13/pflag/verify/gofmt.sh
delete mode 100755 vendor/github.com/spf13/pflag/verify/golint.sh
delete mode 100644 vendor/github.com/spf13/viper/.gitignore
delete mode 100644 vendor/github.com/spf13/viper/.travis.yml
delete mode 100644 vendor/github.com/spf13/viper/LICENSE
delete mode 100644 vendor/github.com/spf13/viper/README.md
delete mode 100644 vendor/github.com/spf13/viper/flags.go
delete mode 100644 vendor/github.com/spf13/viper/flags_test.go
delete mode 100644 vendor/github.com/spf13/viper/overrides_test.go
delete mode 100644 vendor/github.com/spf13/viper/remote/remote.go
delete mode 100644 vendor/github.com/spf13/viper/util.go
delete mode 100644 vendor/github.com/spf13/viper/util_test.go
delete mode 100644 vendor/github.com/spf13/viper/viper.go
delete mode 100644 vendor/github.com/spf13/viper/viper_test.go
delete mode 100644 vendor/golang.org/x/sys/.gitattributes
delete mode 100644 vendor/golang.org/x/sys/.gitignore
delete mode 100644 vendor/golang.org/x/sys/AUTHORS
delete mode 100644 vendor/golang.org/x/sys/CONTRIBUTING.md
delete mode 100644 vendor/golang.org/x/sys/CONTRIBUTORS
delete mode 100644 vendor/golang.org/x/sys/LICENSE
delete mode 100644 vendor/golang.org/x/sys/PATENTS
delete mode 100644 vendor/golang.org/x/sys/README.md
delete mode 100644 vendor/golang.org/x/sys/codereview.cfg
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm64.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.c
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_mips64x.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_mipsx.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_ppc64x.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_s390x.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_test.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.go
delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.s
delete mode 100644 vendor/golang.org/x/sys/plan9/asm.s
delete mode 100644 vendor/golang.org/x/sys/plan9/asm_plan9_386.s
delete mode 100644 vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s
delete mode 100644 vendor/golang.org/x/sys/plan9/asm_plan9_arm.s
delete mode 100644 vendor/golang.org/x/sys/plan9/const_plan9.go
delete mode 100644 vendor/golang.org/x/sys/plan9/dir_plan9.go
delete mode 100644 vendor/golang.org/x/sys/plan9/env_plan9.go
delete mode 100644 vendor/golang.org/x/sys/plan9/errors_plan9.go
delete mode 100755 vendor/golang.org/x/sys/plan9/mkall.sh
delete mode 100755 vendor/golang.org/x/sys/plan9/mkerrors.sh
delete mode 100755 vendor/golang.org/x/sys/plan9/mksyscall.pl
delete mode 100755 vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh
delete mode 100644 vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go
delete mode 100644 vendor/golang.org/x/sys/plan9/pwd_plan9.go
delete mode 100644 vendor/golang.org/x/sys/plan9/race.go
delete mode 100644 vendor/golang.org/x/sys/plan9/race0.go
delete mode 100644 vendor/golang.org/x/sys/plan9/str.go
delete mode 100644 vendor/golang.org/x/sys/plan9/syscall.go
delete mode 100644 vendor/golang.org/x/sys/plan9/syscall_plan9.go
delete mode 100644 vendor/golang.org/x/sys/plan9/syscall_test.go
delete mode 100644 vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go
delete mode 100644 vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go
delete mode 100644 vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go
delete mode 100644 vendor/golang.org/x/sys/plan9/zsysnum_plan9.go
delete mode 100644 vendor/golang.org/x/sys/unix/.gitignore
delete mode 100644 vendor/golang.org/x/sys/unix/README.md
delete mode 100644 vendor/golang.org/x/sys/unix/affinity_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_386.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_arm.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_386.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_386.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_amd64.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm64.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_s390x.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_386.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_386.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
delete mode 100644 vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
delete mode 100644 vendor/golang.org/x/sys/unix/bluetooth_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/cap_freebsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/constants.go
delete mode 100644 vendor/golang.org/x/sys/unix/creds_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/dev_darwin.go
delete mode 100644 vendor/golang.org/x/sys/unix/dev_dragonfly.go
delete mode 100644 vendor/golang.org/x/sys/unix/dev_freebsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/dev_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/dev_linux_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/dev_netbsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/dev_openbsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/dirent.go
delete mode 100644 vendor/golang.org/x/sys/unix/endian_big.go
delete mode 100644 vendor/golang.org/x/sys/unix/endian_little.go
delete mode 100644 vendor/golang.org/x/sys/unix/env_unix.go
delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/example_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/export_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/fcntl.go
delete mode 100644 vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
delete mode 100644 vendor/golang.org/x/sys/unix/gccgo.go
delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_c.c
delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/linux/Dockerfile
delete mode 100644 vendor/golang.org/x/sys/unix/linux/mkall.go
delete mode 100755 vendor/golang.org/x/sys/unix/linux/mksysnum.pl
delete mode 100644 vendor/golang.org/x/sys/unix/linux/types.go
delete mode 100755 vendor/golang.org/x/sys/unix/mkall.sh
delete mode 100755 vendor/golang.org/x/sys/unix/mkerrors.sh
delete mode 100644 vendor/golang.org/x/sys/unix/mkpost.go
delete mode 100755 vendor/golang.org/x/sys/unix/mksyscall.pl
delete mode 100755 vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
delete mode 100755 vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl
delete mode 100755 vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
delete mode 100755 vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
delete mode 100755 vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
delete mode 100755 vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
delete mode 100755 vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
delete mode 100644 vendor/golang.org/x/sys/unix/mmap_unix_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/openbsd_pledge.go
delete mode 100644 vendor/golang.org/x/sys/unix/openbsd_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/pagesize_unix.go
delete mode 100644 vendor/golang.org/x/sys/unix/race.go
delete mode 100644 vendor/golang.org/x/sys/unix/race0.go
delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_unix.go
delete mode 100644 vendor/golang.org/x/sys/unix/str.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_bsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_bsd_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_dragonfly.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_gc.go
delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/timestruct.go
delete mode 100644 vendor/golang.org/x/sys/unix/timestruct_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/types_darwin.go
delete mode 100644 vendor/golang.org/x/sys/unix/types_dragonfly.go
delete mode 100644 vendor/golang.org/x/sys/unix/types_freebsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/types_netbsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/types_openbsd.go
delete mode 100644 vendor/golang.org/x/sys/unix/types_solaris.go
delete mode 100644 vendor/golang.org/x/sys/unix/xattr_test.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zptrace386_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/zptracearm_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/zptracemips_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/zptracemipsle_linux.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go
delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
delete mode 100644 vendor/golang.org/x/sys/windows/asm_windows_386.s
delete mode 100644 vendor/golang.org/x/sys/windows/asm_windows_amd64.s
delete mode 100644 vendor/golang.org/x/sys/windows/dll_windows.go
delete mode 100644 vendor/golang.org/x/sys/windows/env_windows.go
delete mode 100644 vendor/golang.org/x/sys/windows/eventlog.go
delete mode 100644 vendor/golang.org/x/sys/windows/exec_windows.go
delete mode 100644 vendor/golang.org/x/sys/windows/memory_windows.go
delete mode 100644 vendor/golang.org/x/sys/windows/mksyscall.go
delete mode 100644 vendor/golang.org/x/sys/windows/race.go
delete mode 100644 vendor/golang.org/x/sys/windows/race0.go
delete mode 100644 vendor/golang.org/x/sys/windows/registry/export_test.go
delete mode 100644 vendor/golang.org/x/sys/windows/registry/key.go
delete mode 100644 vendor/golang.org/x/sys/windows/registry/mksyscall.go
delete mode 100644 vendor/golang.org/x/sys/windows/registry/registry_test.go
delete mode 100644 vendor/golang.org/x/sys/windows/registry/syscall.go
delete mode 100644 vendor/golang.org/x/sys/windows/registry/value.go
delete mode 100644 vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go
delete mode 100644 vendor/golang.org/x/sys/windows/security_windows.go
delete mode 100644 vendor/golang.org/x/sys/windows/service.go
delete mode 100644 vendor/golang.org/x/sys/windows/str.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/debug/log.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/debug/service.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/event.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/eventlog/install.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/eventlog/log.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/eventlog/log_test.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/example/beep.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/example/install.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/example/main.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/example/manage.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/example/service.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/go12.c
delete mode 100644 vendor/golang.org/x/sys/windows/svc/go12.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/go13.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/mgr/config.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/mgr/mgr.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/mgr/mgr_test.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/mgr/service.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/security.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/service.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/svc_test.go
delete mode 100644 vendor/golang.org/x/sys/windows/svc/sys_386.s
delete mode 100644 vendor/golang.org/x/sys/windows/svc/sys_amd64.s
delete mode 100644 vendor/golang.org/x/sys/windows/syscall.go
delete mode 100644 vendor/golang.org/x/sys/windows/syscall_test.go
delete mode 100644 vendor/golang.org/x/sys/windows/syscall_windows.go
delete mode 100644 vendor/golang.org/x/sys/windows/syscall_windows_test.go
delete mode 100644 vendor/golang.org/x/sys/windows/types_windows.go
delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_386.go
delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_amd64.go
delete mode 100644 vendor/golang.org/x/sys/windows/zsyscall_windows.go
delete mode 100644 vendor/golang.org/x/text/.gitattributes
delete mode 100644 vendor/golang.org/x/text/.gitignore
delete mode 100644 vendor/golang.org/x/text/AUTHORS
delete mode 100644 vendor/golang.org/x/text/CONTRIBUTING.md
delete mode 100644 vendor/golang.org/x/text/CONTRIBUTORS
delete mode 100644 vendor/golang.org/x/text/LICENSE
delete mode 100644 vendor/golang.org/x/text/PATENTS
delete mode 100644 vendor/golang.org/x/text/README.md
delete mode 100644 vendor/golang.org/x/text/cases/cases.go
delete mode 100644 vendor/golang.org/x/text/cases/context.go
delete mode 100644 vendor/golang.org/x/text/cases/context_test.go
delete mode 100644 vendor/golang.org/x/text/cases/example_test.go
delete mode 100644 vendor/golang.org/x/text/cases/fold.go
delete mode 100644 vendor/golang.org/x/text/cases/fold_test.go
delete mode 100644 vendor/golang.org/x/text/cases/gen.go
delete mode 100644 vendor/golang.org/x/text/cases/gen_trieval.go
delete mode 100644 vendor/golang.org/x/text/cases/icu.go
delete mode 100644 vendor/golang.org/x/text/cases/icu_test.go
delete mode 100644 vendor/golang.org/x/text/cases/info.go
delete mode 100644 vendor/golang.org/x/text/cases/map.go
delete mode 100644 vendor/golang.org/x/text/cases/map_test.go
delete mode 100644 vendor/golang.org/x/text/cases/tables10.0.0.go
delete mode 100644 vendor/golang.org/x/text/cases/tables10.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/cases/tables9.0.0.go
delete mode 100644 vendor/golang.org/x/text/cases/tables9.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/cases/trieval.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/common.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/doc.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/extracted.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/extracted.gotext.json
delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/rewrite/main.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/rewrite/printer.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/extract.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/generate.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/main.go
delete mode 100644 vendor/golang.org/x/text/cmd/gotext/rewrite.go
delete mode 100644 vendor/golang.org/x/text/codereview.cfg
delete mode 100644 vendor/golang.org/x/text/collate/build/builder.go
delete mode 100644 vendor/golang.org/x/text/collate/build/builder_test.go
delete mode 100644 vendor/golang.org/x/text/collate/build/colelem.go
delete mode 100644 vendor/golang.org/x/text/collate/build/colelem_test.go
delete mode 100644 vendor/golang.org/x/text/collate/build/contract.go
delete mode 100644 vendor/golang.org/x/text/collate/build/contract_test.go
delete mode 100644 vendor/golang.org/x/text/collate/build/order.go
delete mode 100644 vendor/golang.org/x/text/collate/build/order_test.go
delete mode 100644 vendor/golang.org/x/text/collate/build/table.go
delete mode 100644 vendor/golang.org/x/text/collate/build/trie.go
delete mode 100644 vendor/golang.org/x/text/collate/build/trie_test.go
delete mode 100644 vendor/golang.org/x/text/collate/collate.go
delete mode 100644 vendor/golang.org/x/text/collate/collate_test.go
delete mode 100644 vendor/golang.org/x/text/collate/export_test.go
delete mode 100644 vendor/golang.org/x/text/collate/index.go
delete mode 100644 vendor/golang.org/x/text/collate/maketables.go
delete mode 100644 vendor/golang.org/x/text/collate/option.go
delete mode 100644 vendor/golang.org/x/text/collate/option_test.go
delete mode 100644 vendor/golang.org/x/text/collate/reg_test.go
delete mode 100644 vendor/golang.org/x/text/collate/sort.go
delete mode 100644 vendor/golang.org/x/text/collate/sort_test.go
delete mode 100644 vendor/golang.org/x/text/collate/table_test.go
delete mode 100644 vendor/golang.org/x/text/collate/tables.go
delete mode 100644 vendor/golang.org/x/text/collate/tools/colcmp/Makefile
delete mode 100644 vendor/golang.org/x/text/collate/tools/colcmp/chars.go
delete mode 100644 vendor/golang.org/x/text/collate/tools/colcmp/col.go
delete mode 100644 vendor/golang.org/x/text/collate/tools/colcmp/colcmp.go
delete mode 100644 vendor/golang.org/x/text/collate/tools/colcmp/darwin.go
delete mode 100644 vendor/golang.org/x/text/collate/tools/colcmp/gen.go
delete mode 100644 vendor/golang.org/x/text/collate/tools/colcmp/icu.go
delete mode 100644 vendor/golang.org/x/text/currency/common.go
delete mode 100644 vendor/golang.org/x/text/currency/currency.go
delete mode 100644 vendor/golang.org/x/text/currency/currency_test.go
delete mode 100644 vendor/golang.org/x/text/currency/example_test.go
delete mode 100644 vendor/golang.org/x/text/currency/format.go
delete mode 100644 vendor/golang.org/x/text/currency/format_test.go
delete mode 100644 vendor/golang.org/x/text/currency/gen.go
delete mode 100644 vendor/golang.org/x/text/currency/gen_common.go
delete mode 100644 vendor/golang.org/x/text/currency/query.go
delete mode 100644 vendor/golang.org/x/text/currency/query_test.go
delete mode 100644 vendor/golang.org/x/text/currency/tables.go
delete mode 100644 vendor/golang.org/x/text/currency/tables_test.go
delete mode 100644 vendor/golang.org/x/text/date/data_test.go
delete mode 100644 vendor/golang.org/x/text/date/gen.go
delete mode 100644 vendor/golang.org/x/text/date/gen_test.go
delete mode 100644 vendor/golang.org/x/text/date/tables.go
delete mode 100644 vendor/golang.org/x/text/doc.go
delete mode 100644 vendor/golang.org/x/text/encoding/charmap/charmap.go
delete mode 100644 vendor/golang.org/x/text/encoding/charmap/charmap_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/charmap/maketables.go
delete mode 100644 vendor/golang.org/x/text/encoding/charmap/tables.go
delete mode 100644 vendor/golang.org/x/text/encoding/encoding.go
delete mode 100644 vendor/golang.org/x/text/encoding/encoding_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/example_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/htmlindex/gen.go
delete mode 100644 vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go
delete mode 100644 vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/htmlindex/map.go
delete mode 100644 vendor/golang.org/x/text/encoding/htmlindex/tables.go
delete mode 100644 vendor/golang.org/x/text/encoding/ianaindex/example_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/ianaindex/gen.go
delete mode 100644 vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go
delete mode 100644 vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/ianaindex/tables.go
delete mode 100644 vendor/golang.org/x/text/encoding/internal/enctest/enctest.go
delete mode 100644 vendor/golang.org/x/text/encoding/internal/identifier/gen.go
delete mode 100644 vendor/golang.org/x/text/encoding/internal/identifier/identifier.go
delete mode 100644 vendor/golang.org/x/text/encoding/internal/identifier/mib.go
delete mode 100644 vendor/golang.org/x/text/encoding/internal/internal.go
delete mode 100644 vendor/golang.org/x/text/encoding/japanese/all.go
delete mode 100644 vendor/golang.org/x/text/encoding/japanese/all_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/japanese/eucjp.go
delete mode 100644 vendor/golang.org/x/text/encoding/japanese/iso2022jp.go
delete mode 100644 vendor/golang.org/x/text/encoding/japanese/maketables.go
delete mode 100644 vendor/golang.org/x/text/encoding/japanese/shiftjis.go
delete mode 100644 vendor/golang.org/x/text/encoding/japanese/tables.go
delete mode 100644 vendor/golang.org/x/text/encoding/korean/all_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/korean/euckr.go
delete mode 100644 vendor/golang.org/x/text/encoding/korean/maketables.go
delete mode 100644 vendor/golang.org/x/text/encoding/korean/tables.go
delete mode 100644 vendor/golang.org/x/text/encoding/simplifiedchinese/all.go
delete mode 100644 vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go
delete mode 100644 vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go
delete mode 100644 vendor/golang.org/x/text/encoding/simplifiedchinese/maketables.go
delete mode 100644 vendor/golang.org/x/text/encoding/simplifiedchinese/tables.go
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/candide-gb18030.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/candide-utf-16le.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/candide-utf-32be.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/candide-utf-8.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/candide-windows-1252.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/rashomon-euc-jp.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/rashomon-iso-2022-jp.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/rashomon-shift-jis.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/rashomon-utf-8.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-hz-gb2312.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-utf-8.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-gbk.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-utf-8.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-big5.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-utf-8.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-euc-kr.txt
delete mode 100644 vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-utf-8.txt
delete mode 100644 vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/traditionalchinese/big5.go
delete mode 100644 vendor/golang.org/x/text/encoding/traditionalchinese/maketables.go
delete mode 100644 vendor/golang.org/x/text/encoding/traditionalchinese/tables.go
delete mode 100644 vendor/golang.org/x/text/encoding/unicode/override.go
delete mode 100644 vendor/golang.org/x/text/encoding/unicode/unicode.go
delete mode 100644 vendor/golang.org/x/text/encoding/unicode/unicode_test.go
delete mode 100644 vendor/golang.org/x/text/encoding/unicode/utf32/utf32.go
delete mode 100644 vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/common.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/data_test.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/example_test.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/gen.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/gen_common.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/message.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/message_test.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/plural.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/plural_test.go
delete mode 100644 vendor/golang.org/x/text/feature/plural/tables.go
delete mode 100644 vendor/golang.org/x/text/gen.go
delete mode 100644 vendor/golang.org/x/text/internal/catmsg/catmsg.go
delete mode 100644 vendor/golang.org/x/text/internal/catmsg/catmsg_test.go
delete mode 100644 vendor/golang.org/x/text/internal/catmsg/codec.go
delete mode 100644 vendor/golang.org/x/text/internal/catmsg/varint.go
delete mode 100644 vendor/golang.org/x/text/internal/catmsg/varint_test.go
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/cldrtree.go
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/cldrtree_test.go
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/generate.go
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/option.go
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/testdata/test1/common/main/root.xml
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/testdata/test1/output.go
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/testdata/test2/common/main/en.xml
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/testdata/test2/common/main/en_001.xml
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/testdata/test2/common/main/en_GB.xml
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/testdata/test2/common/main/root.xml
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/testdata/test2/output.go
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/tree.go
delete mode 100644 vendor/golang.org/x/text/internal/cldrtree/type.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/collate_test.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/collelem.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/collelem_test.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/colltab.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/colltab_test.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/contract.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/contract_test.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/iter.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/iter_test.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/numeric.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/numeric_test.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/table.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/trie.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/trie_test.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/weighter.go
delete mode 100644 vendor/golang.org/x/text/internal/colltab/weighter_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/README
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/common_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/example_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/gen.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/gen10.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/gen9.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/gen_common.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/gen_trieval.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/idna10.0.0.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/idna10.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/idna9.0.0.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/idna9.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/idna_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/punycode.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/punycode_test.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/tables10.0.0.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/tables9.0.0.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/trie.go
delete mode 100644 vendor/golang.org/x/text/internal/export/idna/trieval.go
delete mode 100644 vendor/golang.org/x/text/internal/format/format.go
delete mode 100644 vendor/golang.org/x/text/internal/format/parser.go
delete mode 100644 vendor/golang.org/x/text/internal/format/parser_test.go
delete mode 100644 vendor/golang.org/x/text/internal/gen.go
delete mode 100644 vendor/golang.org/x/text/internal/gen/code.go
delete mode 100644 vendor/golang.org/x/text/internal/gen/gen.go
delete mode 100644 vendor/golang.org/x/text/internal/gen_test.go
delete mode 100644 vendor/golang.org/x/text/internal/internal.go
delete mode 100644 vendor/golang.org/x/text/internal/internal_test.go
delete mode 100644 vendor/golang.org/x/text/internal/match.go
delete mode 100644 vendor/golang.org/x/text/internal/match_test.go
delete mode 100644 vendor/golang.org/x/text/internal/number/common.go
delete mode 100644 vendor/golang.org/x/text/internal/number/decimal.go
delete mode 100644 vendor/golang.org/x/text/internal/number/decimal_test.go
delete mode 100644 vendor/golang.org/x/text/internal/number/format.go
delete mode 100644 vendor/golang.org/x/text/internal/number/format_test.go
delete mode 100644 vendor/golang.org/x/text/internal/number/gen.go
delete mode 100644 vendor/golang.org/x/text/internal/number/gen_common.go
delete mode 100644 vendor/golang.org/x/text/internal/number/number.go
delete mode 100644 vendor/golang.org/x/text/internal/number/number_test.go
delete mode 100644 vendor/golang.org/x/text/internal/number/pattern.go
delete mode 100644 vendor/golang.org/x/text/internal/number/pattern_test.go
delete mode 100644 vendor/golang.org/x/text/internal/number/roundingmode_string.go
delete mode 100644 vendor/golang.org/x/text/internal/number/tables.go
delete mode 100644 vendor/golang.org/x/text/internal/number/tables_test.go
delete mode 100644 vendor/golang.org/x/text/internal/stringset/set.go
delete mode 100644 vendor/golang.org/x/text/internal/stringset/set_test.go
delete mode 100644 vendor/golang.org/x/text/internal/tables.go
delete mode 100644 vendor/golang.org/x/text/internal/tag/tag.go
delete mode 100644 vendor/golang.org/x/text/internal/tag/tag_test.go
delete mode 100644 vendor/golang.org/x/text/internal/testtext/codesize.go
delete mode 100644 vendor/golang.org/x/text/internal/testtext/flag.go
delete mode 100644 vendor/golang.org/x/text/internal/testtext/gc.go
delete mode 100644 vendor/golang.org/x/text/internal/testtext/gccgo.go
delete mode 100644 vendor/golang.org/x/text/internal/testtext/go1_6.go
delete mode 100644 vendor/golang.org/x/text/internal/testtext/go1_7.go
delete mode 100644 vendor/golang.org/x/text/internal/testtext/text.go
delete mode 100644 vendor/golang.org/x/text/internal/triegen/compact.go
delete mode 100644 vendor/golang.org/x/text/internal/triegen/data_test.go
delete mode 100644 vendor/golang.org/x/text/internal/triegen/example_compact_test.go
delete mode 100644 vendor/golang.org/x/text/internal/triegen/example_test.go
delete mode 100644 vendor/golang.org/x/text/internal/triegen/gen_test.go
delete mode 100644 vendor/golang.org/x/text/internal/triegen/print.go
delete mode 100644 vendor/golang.org/x/text/internal/triegen/triegen.go
delete mode 100644 vendor/golang.org/x/text/internal/ucd/example_test.go
delete mode 100644 vendor/golang.org/x/text/internal/ucd/ucd.go
delete mode 100644 vendor/golang.org/x/text/internal/ucd/ucd_test.go
delete mode 100644 vendor/golang.org/x/text/internal/utf8internal/utf8internal.go
delete mode 100644 vendor/golang.org/x/text/language/Makefile
delete mode 100644 vendor/golang.org/x/text/language/common.go
delete mode 100644 vendor/golang.org/x/text/language/coverage.go
delete mode 100644 vendor/golang.org/x/text/language/coverage_test.go
delete mode 100644 vendor/golang.org/x/text/language/display/dict.go
delete mode 100644 vendor/golang.org/x/text/language/display/dict_test.go
delete mode 100644 vendor/golang.org/x/text/language/display/display.go
delete mode 100644 vendor/golang.org/x/text/language/display/display_test.go
delete mode 100644 vendor/golang.org/x/text/language/display/examples_test.go
delete mode 100644 vendor/golang.org/x/text/language/display/lookup.go
delete mode 100644 vendor/golang.org/x/text/language/display/maketables.go
delete mode 100644 vendor/golang.org/x/text/language/display/tables.go
delete mode 100644 vendor/golang.org/x/text/language/doc.go
delete mode 100644 vendor/golang.org/x/text/language/examples_test.go
delete mode 100644 vendor/golang.org/x/text/language/gen.go
delete mode 100644 vendor/golang.org/x/text/language/gen_common.go
delete mode 100644 vendor/golang.org/x/text/language/gen_index.go
delete mode 100644 vendor/golang.org/x/text/language/go1_1.go
delete mode 100644 vendor/golang.org/x/text/language/go1_2.go
delete mode 100644 vendor/golang.org/x/text/language/httpexample_test.go
delete mode 100644 vendor/golang.org/x/text/language/index.go
delete mode 100644 vendor/golang.org/x/text/language/language.go
delete mode 100644 vendor/golang.org/x/text/language/language_test.go
delete mode 100644 vendor/golang.org/x/text/language/lookup.go
delete mode 100644 vendor/golang.org/x/text/language/lookup_test.go
delete mode 100644 vendor/golang.org/x/text/language/match.go
delete mode 100644 vendor/golang.org/x/text/language/match_test.go
delete mode 100644 vendor/golang.org/x/text/language/parse.go
delete mode 100644 vendor/golang.org/x/text/language/parse_test.go
delete mode 100644 vendor/golang.org/x/text/language/tables.go
delete mode 100644 vendor/golang.org/x/text/language/tags.go
delete mode 100644 vendor/golang.org/x/text/language/testdata/CLDRLocaleMatcherTest.txt
delete mode 100644 vendor/golang.org/x/text/language/testdata/GoLocaleMatcherTest.txt
delete mode 100644 vendor/golang.org/x/text/message/catalog.go
delete mode 100644 vendor/golang.org/x/text/message/catalog/catalog.go
delete mode 100644 vendor/golang.org/x/text/message/catalog/catalog_test.go
delete mode 100644 vendor/golang.org/x/text/message/catalog/dict.go
delete mode 100644 vendor/golang.org/x/text/message/catalog/go19.go
delete mode 100644 vendor/golang.org/x/text/message/catalog/gopre19.go
delete mode 100644 vendor/golang.org/x/text/message/catalog_test.go
delete mode 100644 vendor/golang.org/x/text/message/doc.go
delete mode 100644 vendor/golang.org/x/text/message/examples_test.go
delete mode 100644 vendor/golang.org/x/text/message/fmt_test.go
delete mode 100644 vendor/golang.org/x/text/message/format.go
delete mode 100644 vendor/golang.org/x/text/message/message.go
delete mode 100644 vendor/golang.org/x/text/message/message_test.go
delete mode 100644 vendor/golang.org/x/text/message/pipeline/extract.go
delete mode 100644 vendor/golang.org/x/text/message/pipeline/generate.go
delete mode 100644 vendor/golang.org/x/text/message/pipeline/message.go
delete mode 100644 vendor/golang.org/x/text/message/pipeline/pipeline.go
delete mode 100644 vendor/golang.org/x/text/message/pipeline/rewrite.go
delete mode 100644 vendor/golang.org/x/text/message/print.go
delete mode 100644 vendor/golang.org/x/text/number/doc.go
delete mode 100644 vendor/golang.org/x/text/number/examples_test.go
delete mode 100644 vendor/golang.org/x/text/number/format.go
delete mode 100644 vendor/golang.org/x/text/number/format_test.go
delete mode 100644 vendor/golang.org/x/text/number/number.go
delete mode 100644 vendor/golang.org/x/text/number/number_test.go
delete mode 100644 vendor/golang.org/x/text/number/option.go
delete mode 100644 vendor/golang.org/x/text/runes/cond.go
delete mode 100644 vendor/golang.org/x/text/runes/cond_test.go
delete mode 100644 vendor/golang.org/x/text/runes/example_test.go
delete mode 100644 vendor/golang.org/x/text/runes/runes.go
delete mode 100644 vendor/golang.org/x/text/runes/runes_test.go
delete mode 100644 vendor/golang.org/x/text/search/index.go
delete mode 100644 vendor/golang.org/x/text/search/pattern.go
delete mode 100644 vendor/golang.org/x/text/search/pattern_test.go
delete mode 100644 vendor/golang.org/x/text/search/search.go
delete mode 100644 vendor/golang.org/x/text/search/tables.go
delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bench_test.go
delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule.go
delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go
delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go
delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule_test.go
delete mode 100644 vendor/golang.org/x/text/secure/doc.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/benchmark_test.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/class.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/class_test.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/context.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/doc.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/enforce10.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/enforce9.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/enforce_test.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/gen.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/gen_trieval.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/nickname.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/options.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/profile.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/profile_test.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/profiles.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/tables10.0.0.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/tables9.0.0.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/tables_test.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/transformer.go
delete mode 100644 vendor/golang.org/x/text/secure/precis/trieval.go
delete mode 100644 vendor/golang.org/x/text/transform/examples_test.go
delete mode 100644 vendor/golang.org/x/text/transform/transform.go
delete mode 100644 vendor/golang.org/x/text/transform/transform_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/bidi.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/bracket.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/core.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/core_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/gen.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/gen_ranges.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/gen_trieval.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/prop.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/ranges_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/bidi/trieval.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/base.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/cldr.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/cldr_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/collate.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/collate_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/data_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/decode.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/examples_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/makexml.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/resolve.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/resolve_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/slice.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/slice_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/cldr/xml.go
delete mode 100644 vendor/golang.org/x/text/unicode/doc.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/composition.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/composition_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/example_iter_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/example_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/forminfo.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/forminfo_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/input.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/iter.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/iter_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/maketables.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/normalize.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/normalize_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/readwriter.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/readwriter_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables9.0.0.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/transform.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/transform_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/trie.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/triegen.go
delete mode 100644 vendor/golang.org/x/text/unicode/norm/ucd_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/gen.go
delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/merge.go
delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/merge_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/rangetable.go
delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/tables10.0.0.go
delete mode 100644 vendor/golang.org/x/text/unicode/rangetable/tables9.0.0.go
delete mode 100644 vendor/golang.org/x/text/unicode/runenames/bits.go
delete mode 100644 vendor/golang.org/x/text/unicode/runenames/example_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/runenames/gen.go
delete mode 100644 vendor/golang.org/x/text/unicode/runenames/gen_bits.go
delete mode 100644 vendor/golang.org/x/text/unicode/runenames/runenames.go
delete mode 100644 vendor/golang.org/x/text/unicode/runenames/runenames_test.go
delete mode 100644 vendor/golang.org/x/text/unicode/runenames/tables.go
delete mode 100644 vendor/golang.org/x/text/width/common_test.go
delete mode 100644 vendor/golang.org/x/text/width/example_test.go
delete mode 100644 vendor/golang.org/x/text/width/gen.go
delete mode 100644 vendor/golang.org/x/text/width/gen_common.go
delete mode 100644 vendor/golang.org/x/text/width/gen_trieval.go
delete mode 100644 vendor/golang.org/x/text/width/kind_string.go
delete mode 100644 vendor/golang.org/x/text/width/runes_test.go
delete mode 100644 vendor/golang.org/x/text/width/tables10.0.0.go
delete mode 100644 vendor/golang.org/x/text/width/tables9.0.0.go
delete mode 100644 vendor/golang.org/x/text/width/tables_test.go
delete mode 100644 vendor/golang.org/x/text/width/transform.go
delete mode 100644 vendor/golang.org/x/text/width/transform_test.go
delete mode 100644 vendor/golang.org/x/text/width/trieval.go
delete mode 100644 vendor/golang.org/x/text/width/width.go
delete mode 100644 vendor/gopkg.in/yaml.v2/.travis.yml
delete mode 100644 vendor/gopkg.in/yaml.v2/LICENSE
delete mode 100644 vendor/gopkg.in/yaml.v2/LICENSE.libyaml
delete mode 100644 vendor/gopkg.in/yaml.v2/NOTICE
delete mode 100644 vendor/gopkg.in/yaml.v2/README.md
delete mode 100644 vendor/gopkg.in/yaml.v2/apic.go
delete mode 100644 vendor/gopkg.in/yaml.v2/decode.go
delete mode 100644 vendor/gopkg.in/yaml.v2/decode_test.go
delete mode 100644 vendor/gopkg.in/yaml.v2/emitterc.go
delete mode 100644 vendor/gopkg.in/yaml.v2/encode.go
delete mode 100644 vendor/gopkg.in/yaml.v2/encode_test.go
delete mode 100644 vendor/gopkg.in/yaml.v2/example_embedded_test.go
delete mode 100644 vendor/gopkg.in/yaml.v2/go.mod
delete mode 100644 vendor/gopkg.in/yaml.v2/parserc.go
delete mode 100644 vendor/gopkg.in/yaml.v2/readerc.go
delete mode 100644 vendor/gopkg.in/yaml.v2/resolve.go
delete mode 100644 vendor/gopkg.in/yaml.v2/scannerc.go
delete mode 100644 vendor/gopkg.in/yaml.v2/sorter.go
delete mode 100644 vendor/gopkg.in/yaml.v2/suite_test.go
delete mode 100644 vendor/gopkg.in/yaml.v2/writerc.go
delete mode 100644 vendor/gopkg.in/yaml.v2/yaml.go
delete mode 100644 vendor/gopkg.in/yaml.v2/yamlh.go
delete mode 100644 vendor/gopkg.in/yaml.v2/yamlprivateh.go
diff --git a/cmd/create_device.go b/cmd/create_device.go
index 73997617..63f663b4 100644
--- a/cmd/create_device.go
+++ b/cmd/create_device.go
@@ -63,7 +63,7 @@ packet device create --hostname [hostname] --plan [plan] --facility [facility_co
request := &packngo.DeviceCreateRequest{
Hostname: hostname,
Plan: plan,
- Facility: facility,
+ Facility: []string{facility},
OS: operatingSystem,
BillingCycle: billingCycle,
ProjectID: projectID,
@@ -102,7 +102,7 @@ packet device create --hostname [hostname] --plan [plan] --facility [facility_co
}
if terminationTime != "" {
- parsedTime, err := time.Parse(`"`+time.RFC3339+`"`, terminationTime)
+ parsedTime, err := time.Parse(time.RFC3339, terminationTime)
if err != nil {
fmt.Printf("Error occured while parsing time string: %s", err.Error())
return
diff --git a/cmd/create_virtual_network.go b/cmd/create_virtual_network.go
index f41f189d..17ae1030 100644
--- a/cmd/create_virtual_network.go
+++ b/cmd/create_virtual_network.go
@@ -47,15 +47,6 @@ packet virtual-network create --project-id [project_UUID] --facility [facility_c
ProjectID: projectID,
Facility: facility,
}
-
- if vxlan != 0 {
- req.VXLAN = vxlan
- }
-
- if vlan != 0 {
- req.VLAN = vlan
- }
-
if description != "" {
req.Description = description
}
@@ -78,8 +69,8 @@ packet virtual-network create --project-id [project_UUID] --facility [facility_c
func init() {
createVirtualNetworkCmd.Flags().StringVarP(&projectID, "project-id", "p", "", "UUID of the project")
createVirtualNetworkCmd.Flags().StringVarP(&facility, "facility", "f", "", "Code of the facility")
- createVirtualNetworkCmd.Flags().IntVarP(&vlan, "vlan", "l", 0, "Virtual LAN ID")
- createVirtualNetworkCmd.Flags().IntVarP(&vxlan, "vxlan", "x", 0, "VXLAN ID")
+ // createVirtualNetworkCmd.Flags().IntVarP(&vlan, "vlan", "l", 0, "Virtual LAN ID")
+ // createVirtualNetworkCmd.Flags().IntVarP(&vxlan, "vxlan", "x", 0, "VXLAN ID")
createVirtualNetworkCmd.Flags().StringVarP(&description, "description", "d", "", "Description of the virtual network")
createVirtualNetworkCmd.MarkFlagRequired("project-id")
diff --git a/cmd/request_ip.go b/cmd/request_ip.go
index f9dc13ae..bea34fe2 100644
--- a/cmd/request_ip.go
+++ b/cmd/request_ip.go
@@ -47,12 +47,9 @@ packet ip request --quantity [quantity] --facility [facility_code] --type [addre
req := &packngo.IPReservationRequest{
Type: ttype,
Quantity: quantity,
- Facility: facility,
+ Facility: &facility,
}
- if comments != "" {
- req.Comments = comments
- }
reservation, _, err := PacknGo.ProjectIPs.Request(projectID, req)
if err != nil {
fmt.Println("Client error:", err)
diff --git a/cmd/retrieve_device.go b/cmd/retrieve_device.go
index 8535f1ea..c845cae0 100644
--- a/cmd/retrieve_device.go
+++ b/cmd/retrieve_device.go
@@ -62,7 +62,7 @@ packet device get --id [device_UUID]
output(devices, header, &data)
} else if deviceID != "" {
- device, _, err := PacknGo.Devices.Get(deviceID)
+ device, _, err := PacknGo.Devices.Get(deviceID, nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_event.go b/cmd/retrieve_event.go
index efc89b51..03e16dac 100644
--- a/cmd/retrieve_event.go
+++ b/cmd/retrieve_event.go
@@ -56,7 +56,7 @@ packet event get
events := []packngo.Event{}
var err error
header := []string{"ID", "Body", "Type", "Created"}
- listOpt := &packngo.ListOptions{Includes: "relationships"}
+ listOpt := &packngo.ListOptions{Includes: []string{"relationships"}}
if deviceID != "" && projectID != "" && organizationID != "" && eventID != "" {
fmt.Println("The id, project-id, device-id, and organization-id parameters are mutually exclusive")
@@ -80,7 +80,8 @@ packet event get
return
}
} else if eventID != "" {
- event, _, err := PacknGo.Events.Get(eventID, listOpt)
+ getOpt := &packngo.GetOptions{Includes: listOpt.Includes}
+ event, _, err := PacknGo.Events.Get(eventID, getOpt)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_facilities.go b/cmd/retrieve_facilities.go
index 33ef9285..961c73fb 100644
--- a/cmd/retrieve_facilities.go
+++ b/cmd/retrieve_facilities.go
@@ -37,7 +37,7 @@ packet facilities get
`,
Run: func(cmd *cobra.Command, args []string) {
- facilities, _, err := PacknGo.Facilities.List()
+ facilities, _, err := PacknGo.Facilities.List(nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_hardware_reservations.go b/cmd/retrieve_hardware_reservations.go
index 167b281d..6fdb9745 100644
--- a/cmd/retrieve_hardware_reservations.go
+++ b/cmd/retrieve_hardware_reservations.go
@@ -38,7 +38,7 @@ packet hardware_reservations get -p [project_id]
`,
Run: func(cmd *cobra.Command, args []string) {
header := []string{"ID", "Facility", "Plan", "Created"}
- listOpt := &packngo.ListOptions{Includes: "project,facility,device"}
+ listOpt := &packngo.ListOptions{Includes: []string{"project,facility,device"}}
if hardwareReservationID == "" && projectID == "" {
fmt.Println("Either id or project-id should be set.")
@@ -61,7 +61,8 @@ packet hardware_reservations get -p [project_id]
output(reservations, header, &data)
} else if hardwareReservationID != "" {
- r, _, err := PacknGo.HardwareReservations.Get(hardwareReservationID, listOpt)
+ getOpt := &packngo.GetOptions{Includes: listOpt.Includes}
+ r, _, err := PacknGo.HardwareReservations.Get(hardwareReservationID, getOpt)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_ip.go b/cmd/retrieve_ip.go
index 09fd14a7..86a5916c 100644
--- a/cmd/retrieve_ip.go
+++ b/cmd/retrieve_ip.go
@@ -68,7 +68,7 @@ packet ip get --reservation-id [reservation_UUID]
output(ips, header, &data)
} else if projectID == "" && reservationID == "" && assignmentID != "" {
- ip, _, err := PacknGo.DeviceIPs.Get(assignmentID)
+ ip, _, err := PacknGo.DeviceIPs.Get(assignmentID, nil)
if err != nil {
fmt.Println("Client error:", err)
return
@@ -81,7 +81,7 @@ packet ip get --reservation-id [reservation_UUID]
output(ip, header, &data)
} else if projectID == "" && assignmentID == "" && reservationID != "" {
- ip, _, err := PacknGo.ProjectIPs.Get(reservationID)
+ ip, _, err := PacknGo.ProjectIPs.Get(reservationID, nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_organization.go b/cmd/retrieve_organization.go
index cc8ee19c..07093126 100644
--- a/cmd/retrieve_organization.go
+++ b/cmd/retrieve_organization.go
@@ -41,7 +41,7 @@ packet organization get -i [organization-id]
`,
Run: func(cmd *cobra.Command, args []string) {
if organizationID == "" {
- orgs, _, err := PacknGo.Organizations.List()
+ orgs, _, err := PacknGo.Organizations.List(nil)
if err != nil {
fmt.Println("Client error:", err)
return
@@ -56,7 +56,7 @@ packet organization get -i [organization-id]
output(orgs, header, &data)
} else {
- org, _, err := PacknGo.Organizations.Get(organizationID)
+ org, _, err := PacknGo.Organizations.Get(organizationID, nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_plans.go b/cmd/retrieve_plans.go
index 0b772ccc..74985b90 100644
--- a/cmd/retrieve_plans.go
+++ b/cmd/retrieve_plans.go
@@ -36,7 +36,7 @@ var retrievePlansCmd = &cobra.Command{
`,
Run: func(cmd *cobra.Command, args []string) {
- plans, _, err := PacknGo.Plans.List()
+ plans, _, err := PacknGo.Plans.List(nil)
if err != nil {
fmt.Println("Client error:", err)
return
@@ -45,6 +45,7 @@ var retrievePlansCmd = &cobra.Command{
data := make([][]string, len(plans))
for i, p := range plans {
+ fmt.Println(p.Pricing)
data[i] = []string{p.ID, p.Slug, p.Name}
}
header := []string{"ID", "Slug", "Name"}
diff --git a/cmd/retrieve_project.go b/cmd/retrieve_project.go
index f80d7002..0f104909 100644
--- a/cmd/retrieve_project.go
+++ b/cmd/retrieve_project.go
@@ -47,7 +47,7 @@ packet project get -n [project_name]
}
if projectID == "" {
listOpt := &packngo.ListOptions{
- Includes: "members",
+ Includes: []string{"members"},
}
projects, _, err := PacknGo.Projects.List(listOpt)
@@ -79,7 +79,7 @@ packet project get -n [project_name]
header := []string{"ID", "Name", "Created"}
output(projects, header, &data)
} else {
- p, _, err := PacknGo.Projects.GetExtra(projectID, []string{"members"}, []string{})
+ p, _, err := PacknGo.Projects.Get(projectID, &packngo.GetOptions{Includes: []string{"members"}})
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_ssh_key.go b/cmd/retrieve_ssh_key.go
index b16f5a8f..a3a356ad 100644
--- a/cmd/retrieve_ssh_key.go
+++ b/cmd/retrieve_ssh_key.go
@@ -60,7 +60,7 @@ packet ssh-key get --id [ssh-key_UUID]
output(sshKeys, header, &data)
} else {
- sshKey, _, err := PacknGo.SSHKeys.Get(sshKeyID)
+ sshKey, _, err := PacknGo.SSHKeys.Get(sshKeyID, nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_user.go b/cmd/retrieve_user.go
index 1fe41e8f..2905c849 100644
--- a/cmd/retrieve_user.go
+++ b/cmd/retrieve_user.go
@@ -54,7 +54,7 @@ packet user get --id [user_UUID]
return
}
} else {
- user, _, err = PacknGo.Users.Get(userID)
+ user, _, err = PacknGo.Users.Get(userID, nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_virtual_network.go b/cmd/retrieve_virtual_network.go
index e60cfd5a..df64093f 100644
--- a/cmd/retrieve_virtual_network.go
+++ b/cmd/retrieve_virtual_network.go
@@ -37,7 +37,7 @@ packet virtual-network get -p [project_UUID]
`,
Run: func(cmd *cobra.Command, args []string) {
- vnets, _, err := PacknGo.ProjectVirtualNetworks.List(projectID)
+ vnets, _, err := PacknGo.ProjectVirtualNetworks.List(projectID, nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_volume.go b/cmd/retrieve_volume.go
index c3a45ab1..0a6b54b9 100644
--- a/cmd/retrieve_volume.go
+++ b/cmd/retrieve_volume.go
@@ -67,7 +67,7 @@ packet volume get --id [volume_UUID]
output(volumes, header, &data)
} else if volumeID != "" {
- v, _, err := PacknGo.Volumes.Get(volumeID)
+ v, _, err := PacknGo.Volumes.Get(volumeID, nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/cmd/retrieve_vpn.go b/cmd/retrieve_vpn.go
index 63feb72e..943e68b0 100644
--- a/cmd/retrieve_vpn.go
+++ b/cmd/retrieve_vpn.go
@@ -36,7 +36,7 @@ Enable VPN service:
packet vpn get --faciliy ewr1
`,
Run: func(cmd *cobra.Command, args []string) {
- config, _, err := PacknGo.VPN.Get(facility)
+ config, _, err := PacknGo.VPN.Get(facility, nil)
if err != nil {
fmt.Println("Client error:", err)
return
diff --git a/docs/packet.md b/docs/packet.md
index efd7b176..8787a838 100644
--- a/docs/packet.md
+++ b/docs/packet.md
@@ -10,8 +10,8 @@ Command line interface for Packet Host
```
--config string Path to JSON or YAML configuration file
- -h, --help Help for packet
- --version Version for packet
+ -h, --help help for packet
+ --version version for packet
```
### SEE ALSO
@@ -32,4 +32,4 @@ Command line interface for Packet Host
* [packet volume](packet_volume.md) - Volume operations
* [packet vpn](packet_vpn.md) - VPN service operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_2fa.md b/docs/packet_2fa.md
index bbf52b33..bab88af1 100644
--- a/docs/packet_2fa.md
+++ b/docs/packet_2fa.md
@@ -9,7 +9,7 @@ Two Factor Authentication operations: enable, disable, receive
### Options
```
- -h, --help Help for 2fa
+ -h, --help help for 2fa
```
### Options inherited from parent commands
@@ -25,4 +25,4 @@ Two Factor Authentication operations: enable, disable, receive
* [packet 2fa enable](packet_2fa_enable.md) - Enables two factor authentication
* [packet 2fa receive](packet_2fa_receive.md) - Receive two factor authentication token
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_2fa_disable.md b/docs/packet_2fa_disable.md
index 7d937219..961a1d7a 100644
--- a/docs/packet_2fa_disable.md
+++ b/docs/packet_2fa_disable.md
@@ -21,7 +21,7 @@ packet 2fa disable [flags]
```
-a, --app Issues otp uri for auth application
- -h, --help Help for disable
+ -h, --help help for disable
-s, --sms Issues SMS otp token to user's phone
-t, --token string Two factor authentication token
```
@@ -36,4 +36,4 @@ packet 2fa disable [flags]
* [packet 2fa](packet_2fa.md) - Two Factor Authentication operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_2fa_enable.md b/docs/packet_2fa_enable.md
index f8bf5623..8a069ac9 100644
--- a/docs/packet_2fa_enable.md
+++ b/docs/packet_2fa_enable.md
@@ -21,7 +21,7 @@ packet 2fa enable [flags]
```
-a, --app Issues otp uri for auth application
- -h, --help Help for enable
+ -h, --help help for enable
-s, --sms Issues SMS otp token to user's phone
-t, --token string Two factor authentication token
```
@@ -36,4 +36,4 @@ packet 2fa enable [flags]
* [packet 2fa](packet_2fa.md) - Two Factor Authentication operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_2fa_receive.md b/docs/packet_2fa_receive.md
index 6a1581c9..1e8b6091 100644
--- a/docs/packet_2fa_receive.md
+++ b/docs/packet_2fa_receive.md
@@ -21,7 +21,7 @@ packet 2fa receive [flags]
```
-a, --app Issues otp uri for auth application
- -h, --help Help for receive
+ -h, --help help for receive
-s, --sms Issues SMS otp token to user's phone
```
@@ -35,4 +35,4 @@ packet 2fa receive [flags]
* [packet 2fa](packet_2fa.md) - Two Factor Authentication operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_device.md b/docs/packet_device.md
index b993f76e..ce117840 100644
--- a/docs/packet_device.md
+++ b/docs/packet_device.md
@@ -9,7 +9,7 @@ Device operations: create, delete, update, start/stop, reboot and get.
### Options
```
- -h, --help Help for device
+ -h, --help help for device
```
### Options inherited from parent commands
@@ -29,4 +29,4 @@ Device operations: create, delete, update, start/stop, reboot and get.
* [packet device stop](packet_device_stop.md) - Stops a device
* [packet device update](packet_device_update.md) - Updates a device
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_device_create.md b/docs/packet_device_create.md
index af136528..95819734 100644
--- a/docs/packet_device_create.md
+++ b/docs/packet_device_create.md
@@ -22,7 +22,7 @@ packet device create [flags]
-c, --customdata string Custom data
-f, --facility string Code of the facility where the device will be created
-r, --hardware-reservation-id string UUID of the hardware reservation
- -h, --help Help for create
+ -h, --help help for create
-H, --hostname string Hostname
-i, --ipxe-script-url string URL to the iPXE script
-j, --json JSON output
@@ -49,4 +49,4 @@ packet device create [flags]
* [packet device](packet_device.md) - Device operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_device_delete.md b/docs/packet_device_delete.md
index 09b688cc..5f356a3c 100644
--- a/docs/packet_device_delete.md
+++ b/docs/packet_device_delete.md
@@ -18,7 +18,7 @@ packet device delete [flags]
```
-f, --force Force removal of the device
- -h, --help Help for delete
+ -h, --help help for delete
-i, --id string UUID of the device
```
@@ -32,4 +32,4 @@ packet device delete [flags]
* [packet device](packet_device.md) - Device operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_device_get.md b/docs/packet_device_get.md
index 6b2ac545..f2e2b472 100644
--- a/docs/packet_device_get.md
+++ b/docs/packet_device_get.md
@@ -17,7 +17,7 @@ packet device get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-i, --id string UUID of the device
-j, --json JSON output
-p, --project-id string UUID of the project
@@ -34,4 +34,4 @@ packet device get [flags]
* [packet device](packet_device.md) - Device operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_device_reboot.md b/docs/packet_device_reboot.md
index 53c4dfcf..b5954256 100644
--- a/docs/packet_device_reboot.md
+++ b/docs/packet_device_reboot.md
@@ -17,7 +17,7 @@ packet device reboot [flags]
### Options
```
- -h, --help Help for reboot
+ -h, --help help for reboot
-i, --id string --id or -i [device_UUID]
```
@@ -31,4 +31,4 @@ packet device reboot [flags]
* [packet device](packet_device.md) - Device operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_device_start.md b/docs/packet_device_start.md
index 3ca0e624..4c2728fd 100644
--- a/docs/packet_device_start.md
+++ b/docs/packet_device_start.md
@@ -17,7 +17,7 @@ packet device start [flags]
### Options
```
- -h, --help Help for start
+ -h, --help help for start
-i, --id string UUID of the device
```
@@ -31,4 +31,4 @@ packet device start [flags]
* [packet device](packet_device.md) - Device operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_device_stop.md b/docs/packet_device_stop.md
index fc10d1fd..9cd4c66e 100644
--- a/docs/packet_device_stop.md
+++ b/docs/packet_device_stop.md
@@ -17,7 +17,7 @@ packet device stop [flags]
### Options
```
- -h, --help Help for stop
+ -h, --help help for stop
-i, --id string UUID of the device
```
@@ -31,4 +31,4 @@ packet device stop [flags]
* [packet device](packet_device.md) - Device operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_device_update.md b/docs/packet_device_update.md
index c8a5deac..2aa490cf 100644
--- a/docs/packet_device_update.md
+++ b/docs/packet_device_update.md
@@ -20,7 +20,7 @@ packet device update [flags]
-a, --always-pxe --alaways-pxe or -a
-c, --customdata string Custom data
-d, --description string Description for the device
- -h, --help Help for update
+ -h, --help help for update
-H, --hostname string Hostname
-i, --id string UUID of the device
-s, --ipxe-script-url string URL to the iPXE script
@@ -39,4 +39,4 @@ packet device update [flags]
* [packet device](packet_device.md) - Device operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_event.md b/docs/packet_event.md
index e25863a4..6179165d 100644
--- a/docs/packet_event.md
+++ b/docs/packet_event.md
@@ -9,7 +9,7 @@ Events operations: get
### Options
```
- -h, --help Help for event
+ -h, --help help for event
```
### Options inherited from parent commands
@@ -23,4 +23,4 @@ Events operations: get
* [packet](packet.md) - Command line interface for Packet Host
* [packet event get](packet_event_get.md) - Retrieves one or more events for organizations, projects, or devices.
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_event_get.md b/docs/packet_event_get.md
index 9e90bfc4..8b42d218 100644
--- a/docs/packet_event_get.md
+++ b/docs/packet_event_get.md
@@ -32,7 +32,7 @@ packet event get [flags]
```
-d, --device-id string UUID of the device
- -h, --help Help for get
+ -h, --help help for get
-i, --id string UUID of the event
-j, --json JSON output
-o, --organization-id string UUID of the organization
@@ -50,4 +50,4 @@ packet event get [flags]
* [packet event](packet_event.md) - Events operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_facilities.md b/docs/packet_facilities.md
index e8c4a21d..ed958bb1 100644
--- a/docs/packet_facilities.md
+++ b/docs/packet_facilities.md
@@ -9,7 +9,7 @@ Facility operations: get
### Options
```
- -h, --help Help for facilities
+ -h, --help help for facilities
```
### Options inherited from parent commands
@@ -23,4 +23,4 @@ Facility operations: get
* [packet](packet.md) - Command line interface for Packet Host
* [packet facilities get](packet_facilities_get.md) - Retrieves a list of available facilities.
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_facilities_get.md b/docs/packet_facilities_get.md
index 77fda5ea..1467e708 100644
--- a/docs/packet_facilities_get.md
+++ b/docs/packet_facilities_get.md
@@ -17,7 +17,7 @@ packet facilities get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-j, --json -j or --json JSON output
-y, --yaml -y or --yaml YAML output
```
@@ -32,4 +32,4 @@ packet facilities get [flags]
* [packet facilities](packet_facilities.md) - Facility operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_hardware-reservation.md b/docs/packet_hardware-reservation.md
index 9cd4eb9f..e1314136 100644
--- a/docs/packet_hardware-reservation.md
+++ b/docs/packet_hardware-reservation.md
@@ -9,7 +9,7 @@ Hardware reservation operations: get, move
### Options
```
- -h, --help Help for hardware-reservation
+ -h, --help help for hardware-reservation
```
### Options inherited from parent commands
@@ -24,4 +24,4 @@ Hardware reservation operations: get, move
* [packet hardware-reservation get](packet_hardware-reservation_get.md) - Retrieves all hardware reservations of a project or a single hardware reservation
* [packet hardware-reservation move](packet_hardware-reservation_move.md) - Move hardware reservation to another project
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_hardware-reservation_get.md b/docs/packet_hardware-reservation_get.md
index 6917b513..e5c99576 100644
--- a/docs/packet_hardware-reservation_get.md
+++ b/docs/packet_hardware-reservation_get.md
@@ -17,7 +17,7 @@ packet hardware-reservation get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-i, --id string UUID of the hardware reservation
-j, --json JSON output
-p, --project-id string UUID of the project
@@ -34,4 +34,4 @@ packet hardware-reservation get [flags]
* [packet hardware-reservation](packet_hardware-reservation.md) - Hardware reservation operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_hardware-reservation_move.md b/docs/packet_hardware-reservation_move.md
index d65aa41a..3e3c9a1c 100644
--- a/docs/packet_hardware-reservation_move.md
+++ b/docs/packet_hardware-reservation_move.md
@@ -16,7 +16,7 @@ packet hardware-reservation move [flags]
### Options
```
- -h, --help Help for move
+ -h, --help help for move
-i, --id string UUID of the hardware reservation
-p, --project-id string UUID of the project
```
@@ -31,4 +31,4 @@ packet hardware-reservation move [flags]
* [packet hardware-reservation](packet_hardware-reservation.md) - Hardware reservation operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ip.md b/docs/packet_ip.md
index b1242d1a..a09bd880 100644
--- a/docs/packet_ip.md
+++ b/docs/packet_ip.md
@@ -9,7 +9,7 @@ IP address, reservations and assignment operations: assign, unassign, remove, av
### Options
```
- -h, --help Help for ip
+ -h, --help help for ip
```
### Options inherited from parent commands
@@ -28,4 +28,4 @@ IP address, reservations and assignment operations: assign, unassign, remove, av
* [packet ip request](packet_ip_request.md) - Request an IP block
* [packet ip unassign](packet_ip_unassign.md) - Unassigns an IP address.
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ip_assign.md b/docs/packet_ip_assign.md
index 777a699e..3d89f8a1 100644
--- a/docs/packet_ip_assign.md
+++ b/docs/packet_ip_assign.md
@@ -19,7 +19,7 @@ packet ip assign [flags]
```
-a, --address string IP Address
-d, --device-id string UUID of the device
- -h, --help Help for assign
+ -h, --help help for assign
```
### Options inherited from parent commands
@@ -32,4 +32,4 @@ packet ip assign [flags]
* [packet ip](packet_ip.md) - IP operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ip_available.md b/docs/packet_ip_available.md
index b0d50d1e..0494a60c 100644
--- a/docs/packet_ip_available.md
+++ b/docs/packet_ip_available.md
@@ -18,7 +18,7 @@ packet ip available [flags]
```
-c, --cidr int Size of subnet
- -h, --help Help for available
+ -h, --help help for available
-r, --reservation-id string UUID of the reservation
```
@@ -32,4 +32,4 @@ packet ip available [flags]
* [packet ip](packet_ip.md) - IP operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ip_get.md b/docs/packet_ip_get.md
index 7da6b1c6..265f6b6c 100644
--- a/docs/packet_ip_get.md
+++ b/docs/packet_ip_get.md
@@ -28,7 +28,7 @@ packet ip get [flags]
```
-a, --assignment-id string UUID of the assignment
- -h, --help Help for get
+ -h, --help help for get
-j, --json JSON output
-p, --project-id string UUID of the project
-r, --reservation-id string UUID of the reservation
@@ -45,4 +45,4 @@ packet ip get [flags]
* [packet ip](packet_ip.md) - IP operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ip_remove.md b/docs/packet_ip_remove.md
index ccaaa50e..ee67b257 100644
--- a/docs/packet_ip_remove.md
+++ b/docs/packet_ip_remove.md
@@ -17,7 +17,7 @@ packet ip remove [flags]
### Options
```
- -h, --help Help for remove
+ -h, --help help for remove
-i, --id string UUID of the reservation
```
@@ -31,4 +31,4 @@ packet ip remove [flags]
* [packet ip](packet_ip.md) - IP operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ip_request.md b/docs/packet_ip_request.md
index d3b8b066..37323618 100644
--- a/docs/packet_ip_request.md
+++ b/docs/packet_ip_request.md
@@ -19,7 +19,7 @@ packet ip request [flags]
```
-c, --comments string General comments
-f, --facility string Code of the facility
- -h, --help Help for request
+ -h, --help help for request
-p, --project-id string UUID of the project
-q, --quantity int Number of IP addresses to reserve
-t, --type string Address type public_ipv4 or global_ipv6
@@ -35,4 +35,4 @@ packet ip request [flags]
* [packet ip](packet_ip.md) - IP operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ip_unassign.md b/docs/packet_ip_unassign.md
index 13187214..0d1d5ec1 100644
--- a/docs/packet_ip_unassign.md
+++ b/docs/packet_ip_unassign.md
@@ -17,7 +17,7 @@ packet ip unassign [flags]
### Options
```
- -h, --help Help for unassign
+ -h, --help help for unassign
-i, --id string UUID of the assignment
```
@@ -31,4 +31,4 @@ packet ip unassign [flags]
* [packet ip](packet_ip.md) - IP operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_operating-systems.md b/docs/packet_operating-systems.md
index 84314c20..0efcc25b 100644
--- a/docs/packet_operating-systems.md
+++ b/docs/packet_operating-systems.md
@@ -9,7 +9,7 @@ Operating system operations: get
### Options
```
- -h, --help Help for operating-systems
+ -h, --help help for operating-systems
```
### Options inherited from parent commands
@@ -23,4 +23,4 @@ Operating system operations: get
* [packet](packet.md) - Command line interface for Packet Host
* [packet operating-systems get](packet_operating-systems_get.md) - Retrieves a list of available operating systems.
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_operating-systems_get.md b/docs/packet_operating-systems_get.md
index e79b86b4..b1cb2b28 100644
--- a/docs/packet_operating-systems_get.md
+++ b/docs/packet_operating-systems_get.md
@@ -14,7 +14,7 @@ packet operating-systems get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-j, --json JSON output
-y, --yaml YAML output
```
@@ -29,4 +29,4 @@ packet operating-systems get [flags]
* [packet operating-systems](packet_operating-systems.md) - Operating system operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_organization.md b/docs/packet_organization.md
index 9b381c5f..10f0124a 100644
--- a/docs/packet_organization.md
+++ b/docs/packet_organization.md
@@ -9,7 +9,7 @@ Organization operations: create, update, delete and get
### Options
```
- -h, --help Help for organization
+ -h, --help help for organization
```
### Options inherited from parent commands
@@ -26,4 +26,4 @@ Organization operations: create, update, delete and get
* [packet organization get](packet_organization_get.md) - Retrieves an organization or list of organizations
* [packet organization update](packet_organization_update.md) - Updates an organization
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_organization_create.md b/docs/packet_organization_create.md
index 4139b138..9ea621e7 100644
--- a/docs/packet_organization_create.md
+++ b/docs/packet_organization_create.md
@@ -18,7 +18,7 @@ packet organization create [flags]
```
-d, --description string Description of the organization
- -h, --help Help for create
+ -h, --help help for create
-j, --json JSON output
-l, --logo string Logo URL]
-n, --name string Name of the organization
@@ -37,4 +37,4 @@ packet organization create [flags]
* [packet organization](packet_organization.md) - Organization operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_organization_delete.md b/docs/packet_organization_delete.md
index 323125e3..82de4366 100644
--- a/docs/packet_organization_delete.md
+++ b/docs/packet_organization_delete.md
@@ -18,7 +18,7 @@ packet organization delete [flags]
```
-f, --force Force removal of the organization
- -h, --help Help for delete
+ -h, --help help for delete
-i, --organization-id string UUID of the organization
```
@@ -32,4 +32,4 @@ packet organization delete [flags]
* [packet organization](packet_organization.md) - Organization operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_organization_get.md b/docs/packet_organization_get.md
index aff4011c..a01cbcc4 100644
--- a/docs/packet_organization_get.md
+++ b/docs/packet_organization_get.md
@@ -21,7 +21,7 @@ packet organization get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-j, --json JSON output
-i, --organization-id string UUID of the organization
-y, --yaml YAML output
@@ -38,4 +38,4 @@ packet organization get [flags]
* [packet organization](packet_organization.md) - Organization operations
* [packet organization get payment-methods](packet_organization_get_payment-methods.md) - Retrieves a list of payment methods for the organization
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_organization_get_payment-methods.md b/docs/packet_organization_get_payment-methods.md
index 0f8bd865..1c27c7bd 100644
--- a/docs/packet_organization_get_payment-methods.md
+++ b/docs/packet_organization_get_payment-methods.md
@@ -17,7 +17,7 @@ packet organization get payment-methods [flags]
### Options
```
- -h, --help Help for payment-methods
+ -h, --help help for payment-methods
-i, --id string UUID of the organization
```
@@ -33,4 +33,4 @@ packet organization get payment-methods [flags]
* [packet organization get](packet_organization_get.md) - Retrieves an organization or list of organizations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_organization_update.md b/docs/packet_organization_update.md
index 37437512..4b4f4fe3 100644
--- a/docs/packet_organization_update.md
+++ b/docs/packet_organization_update.md
@@ -18,7 +18,7 @@ packet organization update [flags]
```
-d, --description string Description of the organization
- -h, --help Help for update
+ -h, --help help for update
-i, --id string Organization ID
-l, --logo string Logo URL of the organization
-n, --name string Name of the organization
@@ -36,4 +36,4 @@ packet organization update [flags]
* [packet organization](packet_organization.md) - Organization operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_plan.md b/docs/packet_plan.md
index 810cab30..c0f6aced 100644
--- a/docs/packet_plan.md
+++ b/docs/packet_plan.md
@@ -9,7 +9,7 @@ Plan operations: get
### Options
```
- -h, --help Help for plan
+ -h, --help help for plan
```
### Options inherited from parent commands
@@ -23,4 +23,4 @@ Plan operations: get
* [packet](packet.md) - Command line interface for Packet Host
* [packet plan get](packet_plan_get.md) - Retrieves a list of all available plans.
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_plan_get.md b/docs/packet_plan_get.md
index 145c8c3a..1b260a5b 100644
--- a/docs/packet_plan_get.md
+++ b/docs/packet_plan_get.md
@@ -17,7 +17,7 @@ packet plan get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-j, --json JSON output
-y, --yaml YAML output
```
@@ -32,4 +32,4 @@ packet plan get [flags]
* [packet plan](packet_plan.md) - Plan operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_project.md b/docs/packet_project.md
index 8dbe3365..272ec9f0 100644
--- a/docs/packet_project.md
+++ b/docs/packet_project.md
@@ -9,7 +9,7 @@ Project operations: create, delete, update and get
### Options
```
- -h, --help Help for project
+ -h, --help help for project
```
### Options inherited from parent commands
@@ -26,4 +26,4 @@ Project operations: create, delete, update and get
* [packet project get](packet_project_get.md) - Retrieves all available projects or a single project
* [packet project update](packet_project_update.md) - Updates a project
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_project_create.md b/docs/packet_project_create.md
index b16fc358..46fbfd3e 100644
--- a/docs/packet_project_create.md
+++ b/docs/packet_project_create.md
@@ -17,7 +17,7 @@ packet project create [flags]
### Options
```
- -h, --help Help for create
+ -h, --help help for create
-j, --json JSON output
-n, --name string Name of the project
-o, --organization-id string UUID of the organization
@@ -35,4 +35,4 @@ packet project create [flags]
* [packet project](packet_project.md) - Project operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_project_delete.md b/docs/packet_project_delete.md
index d5afcad2..0e5d0bcf 100644
--- a/docs/packet_project_delete.md
+++ b/docs/packet_project_delete.md
@@ -18,7 +18,7 @@ packet project delete [flags]
```
-f, --force Force removal of the project
- -h, --help Help for delete
+ -h, --help help for delete
-i, --id string UUID of the project
```
@@ -32,4 +32,4 @@ packet project delete [flags]
* [packet project](packet_project.md) - Project operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_project_get.md b/docs/packet_project_get.md
index ba9ad354..48ac8511 100644
--- a/docs/packet_project_get.md
+++ b/docs/packet_project_get.md
@@ -21,7 +21,7 @@ packet project get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-j, --json JSON output
-n, --project string Name of the project
-i, --project-id string UUID of the project
@@ -38,4 +38,4 @@ packet project get [flags]
* [packet project](packet_project.md) - Project operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_project_update.md b/docs/packet_project_update.md
index b1dd0c89..9f25fec7 100644
--- a/docs/packet_project_update.md
+++ b/docs/packet_project_update.md
@@ -17,7 +17,7 @@ packet project update [flags]
### Options
```
- -h, --help Help for update
+ -h, --help help for update
-i, --id string UUID of the project
-n, --name string Name for the project
-m, --payment-method-id string UUID of the payment method
@@ -33,4 +33,4 @@ packet project update [flags]
* [packet project](packet_project.md) - Project operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ssh-key.md b/docs/packet_ssh-key.md
index 5f01f3e1..046e27e5 100644
--- a/docs/packet_ssh-key.md
+++ b/docs/packet_ssh-key.md
@@ -9,7 +9,7 @@ SSH key operations: create, delete, update and get
### Options
```
- -h, --help Help for ssh-key
+ -h, --help help for ssh-key
```
### Options inherited from parent commands
@@ -26,4 +26,4 @@ SSH key operations: create, delete, update and get
* [packet ssh-key get](packet_ssh-key_get.md) - Retrieves a list of available SSH keys or a single SSH key
* [packet ssh-key update](packet_ssh-key_update.md) - Updates a project
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ssh-key_create.md b/docs/packet_ssh-key_create.md
index 4cb8ae64..c3fc6a82 100644
--- a/docs/packet_ssh-key_create.md
+++ b/docs/packet_ssh-key_create.md
@@ -17,7 +17,7 @@ packet ssh-key create [flags]
### Options
```
- -h, --help Help for create
+ -h, --help help for create
-j, --json JSON output
-k, --key string Public SSH key string
-l, --label string Name of the SSH key
@@ -34,4 +34,4 @@ packet ssh-key create [flags]
* [packet ssh-key](packet_ssh-key.md) - SSH key operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ssh-key_delete.md b/docs/packet_ssh-key_delete.md
index a9f23e17..49746313 100644
--- a/docs/packet_ssh-key_delete.md
+++ b/docs/packet_ssh-key_delete.md
@@ -18,7 +18,7 @@ packet ssh-key delete [flags]
```
-f, --force Force removal of the SSH key
- -h, --help Help for delete
+ -h, --help help for delete
-i, --id string UUID of the SSH key
```
@@ -32,4 +32,4 @@ packet ssh-key delete [flags]
* [packet ssh-key](packet_ssh-key.md) - SSH key operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ssh-key_get.md b/docs/packet_ssh-key_get.md
index ff27648e..36d8b2f1 100644
--- a/docs/packet_ssh-key_get.md
+++ b/docs/packet_ssh-key_get.md
@@ -21,7 +21,7 @@ packet ssh-key get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-i, --id string UUID of the SSH key
-j, --json JSON output
-y, --yaml YAML output
@@ -37,4 +37,4 @@ packet ssh-key get [flags]
* [packet ssh-key](packet_ssh-key.md) - SSH key operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_ssh-key_update.md b/docs/packet_ssh-key_update.md
index 44f5992f..1a8b4a34 100644
--- a/docs/packet_ssh-key_update.md
+++ b/docs/packet_ssh-key_update.md
@@ -17,7 +17,7 @@ packet ssh-key update [flags]
### Options
```
- -h, --help Help for update
+ -h, --help help for update
-i, --id string UUID of the SSH key
-k, --key string Public SSH key string
-l, --label string Name of the SSH key
@@ -33,4 +33,4 @@ packet ssh-key update [flags]
* [packet ssh-key](packet_ssh-key.md) - SSH key operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_user.md b/docs/packet_user.md
index 6be06b29..b2a78415 100644
--- a/docs/packet_user.md
+++ b/docs/packet_user.md
@@ -9,7 +9,7 @@ User operations: get
### Options
```
- -h, --help Help for user
+ -h, --help help for user
```
### Options inherited from parent commands
@@ -23,4 +23,4 @@ User operations: get
* [packet](packet.md) - Command line interface for Packet Host
* [packet user get](packet_user_get.md) - Retrieves information about the current user or a specified user
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_user_get.md b/docs/packet_user_get.md
index b5102939..6cb3207b 100644
--- a/docs/packet_user_get.md
+++ b/docs/packet_user_get.md
@@ -21,7 +21,7 @@ packet user get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-i, --id string UUID of the user
-j, --json JSON output
-y, --yaml YAML output
@@ -37,4 +37,4 @@ packet user get [flags]
* [packet user](packet_user.md) - User operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_virtual-network.md b/docs/packet_virtual-network.md
index 9d7ea29b..4d5b6b07 100644
--- a/docs/packet_virtual-network.md
+++ b/docs/packet_virtual-network.md
@@ -9,7 +9,7 @@ Virtual network operations: create, delete and get
### Options
```
- -h, --help Help for virtual-network
+ -h, --help help for virtual-network
```
### Options inherited from parent commands
@@ -25,4 +25,4 @@ Virtual network operations: create, delete and get
* [packet virtual-network delete](packet_virtual-network_delete.md) - Deletes a Virtual Network
* [packet virtual-network get](packet_virtual-network_get.md) - Retrieves a list of virtual networks for a single project.
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_virtual-network_create.md b/docs/packet_virtual-network_create.md
index 4221fb72..5c834641 100644
--- a/docs/packet_virtual-network_create.md
+++ b/docs/packet_virtual-network_create.md
@@ -19,11 +19,9 @@ packet virtual-network create [flags]
```
-d, --description string Description of the virtual network
-f, --facility string Code of the facility
- -h, --help Help for create
+ -h, --help help for create
-j, --json JSON output
-p, --project-id string UUID of the project
- -l, --vlan int Virtual LAN ID
- -x, --vxlan int VXLAN ID
-y, --yaml YAML output
```
@@ -37,4 +35,4 @@ packet virtual-network create [flags]
* [packet virtual-network](packet_virtual-network.md) - Virtual network operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_virtual-network_delete.md b/docs/packet_virtual-network_delete.md
index ef19f0d6..b92202d9 100644
--- a/docs/packet_virtual-network_delete.md
+++ b/docs/packet_virtual-network_delete.md
@@ -18,7 +18,7 @@ packet virtual-network delete [flags]
```
-f, --force Force removal of the virtual network
- -h, --help Help for delete
+ -h, --help help for delete
-i, --id string UUID of the vlan
```
@@ -32,4 +32,4 @@ packet virtual-network delete [flags]
* [packet virtual-network](packet_virtual-network.md) - Virtual network operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_virtual-network_get.md b/docs/packet_virtual-network_get.md
index 65be219f..c5503d9b 100644
--- a/docs/packet_virtual-network_get.md
+++ b/docs/packet_virtual-network_get.md
@@ -17,7 +17,7 @@ packet virtual-network get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-j, --json JSON output
-p, --project-id string UUID of the project
-y, --yaml YAML output
@@ -33,4 +33,4 @@ packet virtual-network get [flags]
* [packet virtual-network](packet_virtual-network.md) - Virtual network operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_volume.md b/docs/packet_volume.md
index 3b4dde9d..3a03c939 100644
--- a/docs/packet_volume.md
+++ b/docs/packet_volume.md
@@ -9,7 +9,7 @@ Volume operations: create, delete, attach, detach and get
### Options
```
- -h, --help Help for volume
+ -h, --help help for volume
```
### Options inherited from parent commands
@@ -27,4 +27,4 @@ Volume operations: create, delete, attach, detach and get
* [packet volume detach](packet_volume_detach.md) - Detaches a volume from a device
* [packet volume get](packet_volume_get.md) - Retrieves a volume list or volume details.
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_volume_attach.md b/docs/packet_volume_attach.md
index 83996bbe..05fcd324 100644
--- a/docs/packet_volume_attach.md
+++ b/docs/packet_volume_attach.md
@@ -18,7 +18,7 @@ packet volume attach [flags]
```
-d, --device-id string UUID of the device
- -h, --help Help for attach
+ -h, --help help for attach
-i, --id string UUID of the volume
```
@@ -32,4 +32,4 @@ packet volume attach [flags]
* [packet volume](packet_volume.md) - Volume operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_volume_create.md b/docs/packet_volume_create.md
index ddf4fe35..7ae79884 100644
--- a/docs/packet_volume_create.md
+++ b/docs/packet_volume_create.md
@@ -20,7 +20,7 @@ packet volume create [flags]
-b, --billing-cycle string Billing cycle (default "hourly")
-d, --description string Description of the volume
-f, --facility string Code of the facility where the volume will be created
- -h, --help Help for create
+ -h, --help help for create
-j, --json JSON output
-l, --locked Set the volume to be locked
-P, --plan string Name of the plan
@@ -39,4 +39,4 @@ packet volume create [flags]
* [packet volume](packet_volume.md) - Volume operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_volume_delete.md b/docs/packet_volume_delete.md
index 45b79c21..b2e51387 100644
--- a/docs/packet_volume_delete.md
+++ b/docs/packet_volume_delete.md
@@ -18,7 +18,7 @@ packet volume delete [flags]
```
-f, --force Force removal of the volume
- -h, --help Help for delete
+ -h, --help help for delete
-i, --id string UUID of volume
```
@@ -32,4 +32,4 @@ packet volume delete [flags]
* [packet volume](packet_volume.md) - Volume operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_volume_detach.md b/docs/packet_volume_detach.md
index 7f79730b..7077b5e7 100644
--- a/docs/packet_volume_detach.md
+++ b/docs/packet_volume_detach.md
@@ -17,7 +17,7 @@ packet volume detach [flags]
### Options
```
- -h, --help Help for detach
+ -h, --help help for detach
-i, --id string UUID of the attached volume
```
@@ -31,4 +31,4 @@ packet volume detach [flags]
* [packet volume](packet_volume.md) - Volume operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_volume_get.md b/docs/packet_volume_get.md
index b38acd8d..649f76c7 100644
--- a/docs/packet_volume_get.md
+++ b/docs/packet_volume_get.md
@@ -21,7 +21,7 @@ packet volume get [flags]
### Options
```
- -h, --help Help for get
+ -h, --help help for get
-i, --id string UUID of the volume
-j, --json JSON output
-p, --project-id string UUID of the project
@@ -38,4 +38,4 @@ packet volume get [flags]
* [packet volume](packet_volume.md) - Volume operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_vpn.md b/docs/packet_vpn.md
index 018a70f3..8aedf8bd 100644
--- a/docs/packet_vpn.md
+++ b/docs/packet_vpn.md
@@ -9,7 +9,7 @@ VPN service operations: enable, disable, get
### Options
```
- -h, --help Help for vpn
+ -h, --help help for vpn
```
### Options inherited from parent commands
@@ -25,4 +25,4 @@ VPN service operations: enable, disable, get
* [packet vpn enable](packet_vpn_enable.md) - Enables VPN service
* [packet vpn get](packet_vpn_get.md) - Retrieves VPN service
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_vpn_disable.md b/docs/packet_vpn_disable.md
index a21e6f23..6c97a7c5 100644
--- a/docs/packet_vpn_disable.md
+++ b/docs/packet_vpn_disable.md
@@ -17,7 +17,7 @@ packet vpn disable [flags]
### Options
```
- -h, --help Help for disable
+ -h, --help help for disable
```
### Options inherited from parent commands
@@ -30,4 +30,4 @@ packet vpn disable [flags]
* [packet vpn](packet_vpn.md) - VPN service operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_vpn_enable.md b/docs/packet_vpn_enable.md
index 5d92ade5..78a3d976 100644
--- a/docs/packet_vpn_enable.md
+++ b/docs/packet_vpn_enable.md
@@ -17,7 +17,7 @@ packet vpn enable [flags]
### Options
```
- -h, --help Help for enable
+ -h, --help help for enable
```
### Options inherited from parent commands
@@ -30,4 +30,4 @@ packet vpn enable [flags]
* [packet vpn](packet_vpn.md) - VPN service operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/docs/packet_vpn_get.md b/docs/packet_vpn_get.md
index 89fc4d26..256f7af3 100644
--- a/docs/packet_vpn_get.md
+++ b/docs/packet_vpn_get.md
@@ -18,7 +18,7 @@ packet vpn get [flags]
```
-f, --facility string Code of the facility for which VPN config is to be retrieved
- -h, --help Help for get
+ -h, --help help for get
-j, --json JSON output
-y, --yaml YAML output
```
@@ -33,4 +33,4 @@ packet vpn get [flags]
* [packet vpn](packet_vpn.md) - VPN service operations
-###### Auto generated by spf13/cobra on 12-Aug-2019
+###### Auto generated by spf13/cobra on 25-Nov-2019
diff --git a/tests/facilities_test.go b/tests/facilities_test.go
index 7ed04577..98d230fb 100644
--- a/tests/facilities_test.go
+++ b/tests/facilities_test.go
@@ -30,7 +30,7 @@ func TestFacilitiesOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
diff --git a/tests/main_test.go b/tests/main_test.go
index a9f8bec9..d3b04918 100644
--- a/tests/main_test.go
+++ b/tests/main_test.go
@@ -99,7 +99,7 @@ func TestCliArgs(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
if len(tt.args) > 0 {
@@ -120,7 +120,7 @@ func TestCliArgs(t *testing.T) {
deviceID = (*device).ID
for {
- dev, _, err := client.Devices.Get(deviceID)
+ dev, _, err := client.Devices.Get(deviceID, nil)
if err != nil {
break
}
diff --git a/tests/organization_test.go b/tests/organization_test.go
index 65a27337..8144e451 100644
--- a/tests/organization_test.go
+++ b/tests/organization_test.go
@@ -54,7 +54,7 @@ func TestOrganizationOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
@@ -92,7 +92,7 @@ func TestOrganizationOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
})
@@ -119,7 +119,7 @@ func TestOrganizationOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
})
diff --git a/tests/plan_test.go b/tests/plan_test.go
index cb4a8c53..e4cecdea 100644
--- a/tests/plan_test.go
+++ b/tests/plan_test.go
@@ -30,7 +30,7 @@ func TestPlanOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
diff --git a/tests/project_test.go b/tests/project_test.go
index 1044b3ef..e2b62835 100644
--- a/tests/project_test.go
+++ b/tests/project_test.go
@@ -14,7 +14,7 @@ import (
func TestProjectOperations(t *testing.T) {
client, _ = packngo.NewClientWithBaseURL("Packet CLI", os.Getenv("PACKET_TOKEN"), nil, "https://api.packet.net/")
- orgs, _, _ := client.Organizations.List()
+ orgs, _, _ := client.Organizations.List(nil)
orgID := orgs[0].ID
tests := []Test{
@@ -53,7 +53,7 @@ func TestProjectOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
@@ -93,7 +93,7 @@ func TestProjectOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
})
diff --git a/tests/ssh_key_test.go b/tests/ssh_key_test.go
index 403afa48..ea7da830 100644
--- a/tests/ssh_key_test.go
+++ b/tests/ssh_key_test.go
@@ -1,8 +1,9 @@
package main
import (
+ "crypto/rand"
+ "crypto/rsa"
"fmt"
- "io/ioutil"
"os"
"os/exec"
"path"
@@ -10,6 +11,7 @@ import (
"testing"
"github.com/packethost/packngo"
+ "golang.org/x/crypto/ssh"
)
var sshKeyID string
@@ -17,28 +19,16 @@ var sshKeyID string
func TestSSHKeyOperations(t *testing.T) {
client, _ = packngo.NewClientWithBaseURL("Packet CLI", os.Getenv("PACKET_TOKEN"), nil, "https://api.packet.net/")
- data, err := ioutil.ReadFile(os.Getenv("HOME") + "/.ssh/id_rsa.pub")
+ publicKey, err := generatePublicKey()
if err != nil {
- fmt.Println("File reading error", err)
- return
+ fmt.Println("SSH Key generation error:", err)
}
- key := string(data)
tests := []Test{
- {"ssh-key create", []string{"ssh-key", "create", "-l", "test", "-k", key}},
+ {"ssh-key create", []string{"ssh-key", "create", "-l", "test", "-k", publicKey}},
{"ssh-key list", []string{"ssh-key", "get", "-j"}},
}
- sshKeys, _, _ := client.SSHKeys.List()
- for _, key := range sshKeys {
- if key.Label == "test" {
- sshKeyID = key.ID
- fmt.Println("sshkeyID", sshKeyID)
-
- break
- }
- }
-
cleanup := []Test{
{"ssh-key get", []string{"ssh-key", "get", "-i"}},
{"ssh-key delete", []string{"ssh-key", "delete", "-i"}},
@@ -60,12 +50,21 @@ func TestSSHKeyOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error") {
t.Fatal(actual)
}
})
}
+ sshKeys, _, _ := client.SSHKeys.List()
+ for _, key := range sshKeys {
+ if key.Label == "test" {
+ sshKeyID = key.ID
+ break
+ }
+ }
+ fmt.Println("outside", sshKeyID)
+
for _, tt := range cleanup {
t.Run(tt.name, func(t *testing.T) {
if tt.name == "ssh-key get" && sshKeyID != "" {
@@ -82,6 +81,7 @@ func TestSSHKeyOperations(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+
cmd := exec.Command(path.Join(dir, binaryName), tt.args...)
output, err := cmd.CombinedOutput()
@@ -90,9 +90,30 @@ func TestSSHKeyOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
})
}
}
+
+func generatePublicKey() (string, error) {
+ privateKey, err := rsa.GenerateKey(rand.Reader, 4096)
+ if err != nil {
+ return "", err
+ }
+
+ // Validate Private Key
+ err = privateKey.Validate()
+ if err != nil {
+ return "", err
+ }
+
+ publicRsaKey, err := ssh.NewPublicKey(&privateKey.PublicKey)
+ if err != nil {
+ return "", err
+ }
+
+ pubKeyBytes := ssh.MarshalAuthorizedKey(publicRsaKey)
+ return string(pubKeyBytes), nil
+}
diff --git a/tests/virtual_network_test.go b/tests/virtual_network_test.go
index 3550a554..e9e6881a 100644
--- a/tests/virtual_network_test.go
+++ b/tests/virtual_network_test.go
@@ -54,7 +54,7 @@ func TestVirtualNetworkOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
@@ -87,7 +87,7 @@ func TestVirtualNetworkOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
})
@@ -113,7 +113,7 @@ func TestVirtualNetworkOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
})
diff --git a/tests/volumes_test.go b/tests/volumes_test.go
index 44ebdfdb..b007512d 100644
--- a/tests/volumes_test.go
+++ b/tests/volumes_test.go
@@ -74,7 +74,7 @@ func TestVolumeOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
if len(tt.args) > 0 {
@@ -88,7 +88,7 @@ func TestVolumeOperations(t *testing.T) {
deviceID = (*device).ID
for {
- dev, _, err := client.Devices.Get(deviceID)
+ dev, _, err := client.Devices.Get(deviceID, nil)
if err != nil {
break
}
@@ -108,7 +108,7 @@ func TestVolumeOperations(t *testing.T) {
volumeID = (*volume).ID
for {
- vol, _, err := client.Volumes.Get(volumeID)
+ vol, _, err := client.Volumes.Get(volumeID, nil)
if err != nil {
break
}
@@ -151,13 +151,13 @@ func TestVolumeOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
if len(tt.args) > 0 {
if tt.args[0] == "volume" && (tt.args[1] == "attach" || tt.args[1] == "detach") {
for {
- vol, _, err := client.Volumes.Get(volumeID)
+ vol, _, err := client.Volumes.Get(volumeID, nil)
if err != nil {
break
}
@@ -195,7 +195,7 @@ func TestVolumeOperations(t *testing.T) {
}
actual := string(output)
- if strings.Contains(actual, "Error:") {
+ if strings.Contains(strings.ToLower(actual), "error:") {
t.Fatal(actual)
}
})
diff --git a/vendor/github.com/chzyer/readline/.gitignore b/vendor/github.com/chzyer/readline/.gitignore
deleted file mode 100644
index a3062bea..00000000
--- a/vendor/github.com/chzyer/readline/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-.vscode/*
diff --git a/vendor/github.com/chzyer/readline/.travis.yml b/vendor/github.com/chzyer/readline/.travis.yml
deleted file mode 100644
index 9c359554..00000000
--- a/vendor/github.com/chzyer/readline/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-go:
- - 1.x
-script:
- - GOOS=windows go install github.com/chzyer/readline/example/...
- - GOOS=linux go install github.com/chzyer/readline/example/...
- - GOOS=darwin go install github.com/chzyer/readline/example/...
- - go test -race -v
diff --git a/vendor/github.com/chzyer/readline/CHANGELOG.md b/vendor/github.com/chzyer/readline/CHANGELOG.md
deleted file mode 100644
index 14ff5be1..00000000
--- a/vendor/github.com/chzyer/readline/CHANGELOG.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# ChangeLog
-
-### 1.4 - 2016-07-25
-
-* [#60][60] Support dynamic autocompletion
-* Fix ANSI parser on Windows
-* Fix wrong column width in complete mode on Windows
-* Remove dependent package "golang.org/x/crypto/ssh/terminal"
-
-### 1.3 - 2016-05-09
-
-* [#38][38] add SetChildren for prefix completer interface
-* [#42][42] improve multiple lines compatibility
-* [#43][43] remove sub-package(runes) for gopkg compatibility
-* [#46][46] Auto complete with space prefixed line
-* [#48][48] support suspend process (ctrl+Z)
-* [#49][49] fix bug that check equals with previous command
-* [#53][53] Fix bug which causes integer divide by zero panicking when input buffer is empty
-
-### 1.2 - 2016-03-05
-
-* Add a demo for checking password strength [example/readline-pass-strength](https://github.com/chzyer/readline/blob/master/example/readline-pass-strength/readline-pass-strength.go), , written by [@sahib](https://github.com/sahib)
-* [#23][23], support stdin remapping
-* [#27][27], add a `UniqueEditLine` to `Config`, which will erase the editing line after user submited it, usually use in IM.
-* Add a demo for multiline [example/readline-multiline](https://github.com/chzyer/readline/blob/master/example/readline-multiline/readline-multiline.go) which can submit one SQL by multiple lines.
-* Supports performs even stdin/stdout is not a tty.
-* Add a new simple apis for single instance, check by [here](https://github.com/chzyer/readline/blob/master/std.go). It need to save history manually if using this api.
-* [#28][28], fixes the history is not working as expected.
-* [#33][33], vim mode now support `c`, `d`, `x (delete character)`, `r (replace character)`
-
-### 1.1 - 2015-11-20
-
-* [#12][12] Add support for key ``/``/``
-* Only enter raw mode as needed (calling `Readline()`), program will receive signal(e.g. Ctrl+C) if not interact with `readline`.
-* Bugs fixed for `PrefixCompleter`
-* Press `Ctrl+D` in empty line will cause `io.EOF` in error, Press `Ctrl+C` in anytime will cause `ErrInterrupt` instead of `io.EOF`, this will privodes a shell-like user experience.
-* Customable Interrupt/EOF prompt in `Config`
-* [#17][17] Change atomic package to use 32bit function to let it runnable on arm 32bit devices
-* Provides a new password user experience(`readline.ReadPasswordEx()`).
-
-### 1.0 - 2015-10-14
-
-* Initial public release.
-
-[12]: https://github.com/chzyer/readline/pull/12
-[17]: https://github.com/chzyer/readline/pull/17
-[23]: https://github.com/chzyer/readline/pull/23
-[27]: https://github.com/chzyer/readline/pull/27
-[28]: https://github.com/chzyer/readline/pull/28
-[33]: https://github.com/chzyer/readline/pull/33
-[38]: https://github.com/chzyer/readline/pull/38
-[42]: https://github.com/chzyer/readline/pull/42
-[43]: https://github.com/chzyer/readline/pull/43
-[46]: https://github.com/chzyer/readline/pull/46
-[48]: https://github.com/chzyer/readline/pull/48
-[49]: https://github.com/chzyer/readline/pull/49
-[53]: https://github.com/chzyer/readline/pull/53
-[60]: https://github.com/chzyer/readline/pull/60
diff --git a/vendor/github.com/chzyer/readline/LICENSE b/vendor/github.com/chzyer/readline/LICENSE
deleted file mode 100644
index c9afab3d..00000000
--- a/vendor/github.com/chzyer/readline/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 Chzyer
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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
-SOFTWARE.
-
diff --git a/vendor/github.com/chzyer/readline/README.md b/vendor/github.com/chzyer/readline/README.md
deleted file mode 100644
index fab974b7..00000000
--- a/vendor/github.com/chzyer/readline/README.md
+++ /dev/null
@@ -1,114 +0,0 @@
-[![Build Status](https://travis-ci.org/chzyer/readline.svg?branch=master)](https://travis-ci.org/chzyer/readline)
-[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
-[![Version](https://img.shields.io/github/tag/chzyer/readline.svg)](https://github.com/chzyer/readline/releases)
-[![GoDoc](https://godoc.org/github.com/chzyer/readline?status.svg)](https://godoc.org/github.com/chzyer/readline)
-[![OpenCollective](https://opencollective.com/readline/badge/backers.svg)](#backers)
-[![OpenCollective](https://opencollective.com/readline/badge/sponsors.svg)](#sponsors)
-
-
-
-
-
-
-
-A powerful readline library in `Linux` `macOS` `Windows` `Solaris`
-
-## Guide
-
-* [Demo](example/readline-demo/readline-demo.go)
-* [Shortcut](doc/shortcut.md)
-
-## Repos using readline
-
-[![cockroachdb](https://img.shields.io/github/stars/cockroachdb/cockroach.svg?label=cockroachdb/cockroach)](https://github.com/cockroachdb/cockroach)
-[![robertkrimen/otto](https://img.shields.io/github/stars/robertkrimen/otto.svg?label=robertkrimen/otto)](https://github.com/robertkrimen/otto)
-[![empire](https://img.shields.io/github/stars/remind101/empire.svg?label=remind101/empire)](https://github.com/remind101/empire)
-[![mehrdadrad/mylg](https://img.shields.io/github/stars/mehrdadrad/mylg.svg?label=mehrdadrad/mylg)](https://github.com/mehrdadrad/mylg)
-[![knq/usql](https://img.shields.io/github/stars/knq/usql.svg?label=knq/usql)](https://github.com/knq/usql)
-[![youtube/doorman](https://img.shields.io/github/stars/youtube/doorman.svg?label=youtube/doorman)](https://github.com/youtube/doorman)
-[![bom-d-van/harp](https://img.shields.io/github/stars/bom-d-van/harp.svg?label=bom-d-van/harp)](https://github.com/bom-d-van/harp)
-[![abiosoft/ishell](https://img.shields.io/github/stars/abiosoft/ishell.svg?label=abiosoft/ishell)](https://github.com/abiosoft/ishell)
-[![Netflix/hal-9001](https://img.shields.io/github/stars/Netflix/hal-9001.svg?label=Netflix/hal-9001)](https://github.com/Netflix/hal-9001)
-[![docker/go-p9p](https://img.shields.io/github/stars/docker/go-p9p.svg?label=docker/go-p9p)](https://github.com/docker/go-p9p)
-
-
-## Feedback
-
-If you have any questions, please submit a github issue and any pull requests is welcomed :)
-
-* [https://twitter.com/chzyer](https://twitter.com/chzyer)
-* [http://weibo.com/2145262190](http://weibo.com/2145262190)
-
-
-## Backers
-
-Love Readline? Help me keep it alive by donating funds to cover project expenses!
-[[Become a backer](https://opencollective.com/readline#backer)]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Sponsors
-
-Become a sponsor and get your logo here on our Github page. [[Become a sponsor](https://opencollective.com/readline#sponsor)]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/vendor/github.com/chzyer/readline/ansi_windows.go b/vendor/github.com/chzyer/readline/ansi_windows.go
deleted file mode 100644
index 63b908c1..00000000
--- a/vendor/github.com/chzyer/readline/ansi_windows.go
+++ /dev/null
@@ -1,249 +0,0 @@
-// +build windows
-
-package readline
-
-import (
- "bufio"
- "io"
- "strconv"
- "strings"
- "sync"
- "unicode/utf8"
- "unsafe"
-)
-
-const (
- _ = uint16(0)
- COLOR_FBLUE = 0x0001
- COLOR_FGREEN = 0x0002
- COLOR_FRED = 0x0004
- COLOR_FINTENSITY = 0x0008
-
- COLOR_BBLUE = 0x0010
- COLOR_BGREEN = 0x0020
- COLOR_BRED = 0x0040
- COLOR_BINTENSITY = 0x0080
-
- COMMON_LVB_UNDERSCORE = 0x8000
- COMMON_LVB_BOLD = 0x0007
-)
-
-var ColorTableFg = []word{
- 0, // 30: Black
- COLOR_FRED, // 31: Red
- COLOR_FGREEN, // 32: Green
- COLOR_FRED | COLOR_FGREEN, // 33: Yellow
- COLOR_FBLUE, // 34: Blue
- COLOR_FRED | COLOR_FBLUE, // 35: Magenta
- COLOR_FGREEN | COLOR_FBLUE, // 36: Cyan
- COLOR_FRED | COLOR_FBLUE | COLOR_FGREEN, // 37: White
-}
-
-var ColorTableBg = []word{
- 0, // 40: Black
- COLOR_BRED, // 41: Red
- COLOR_BGREEN, // 42: Green
- COLOR_BRED | COLOR_BGREEN, // 43: Yellow
- COLOR_BBLUE, // 44: Blue
- COLOR_BRED | COLOR_BBLUE, // 45: Magenta
- COLOR_BGREEN | COLOR_BBLUE, // 46: Cyan
- COLOR_BRED | COLOR_BBLUE | COLOR_BGREEN, // 47: White
-}
-
-type ANSIWriter struct {
- target io.Writer
- wg sync.WaitGroup
- ctx *ANSIWriterCtx
- sync.Mutex
-}
-
-func NewANSIWriter(w io.Writer) *ANSIWriter {
- a := &ANSIWriter{
- target: w,
- ctx: NewANSIWriterCtx(w),
- }
- return a
-}
-
-func (a *ANSIWriter) Close() error {
- a.wg.Wait()
- return nil
-}
-
-type ANSIWriterCtx struct {
- isEsc bool
- isEscSeq bool
- arg []string
- target *bufio.Writer
- wantFlush bool
-}
-
-func NewANSIWriterCtx(target io.Writer) *ANSIWriterCtx {
- return &ANSIWriterCtx{
- target: bufio.NewWriter(target),
- }
-}
-
-func (a *ANSIWriterCtx) Flush() {
- a.target.Flush()
-}
-
-func (a *ANSIWriterCtx) process(r rune) bool {
- if a.wantFlush {
- if r == 0 || r == CharEsc {
- a.wantFlush = false
- a.target.Flush()
- }
- }
- if a.isEscSeq {
- a.isEscSeq = a.ioloopEscSeq(a.target, r, &a.arg)
- return true
- }
-
- switch r {
- case CharEsc:
- a.isEsc = true
- case '[':
- if a.isEsc {
- a.arg = nil
- a.isEscSeq = true
- a.isEsc = false
- break
- }
- fallthrough
- default:
- a.target.WriteRune(r)
- a.wantFlush = true
- }
- return true
-}
-
-func (a *ANSIWriterCtx) ioloopEscSeq(w *bufio.Writer, r rune, argptr *[]string) bool {
- arg := *argptr
- var err error
-
- if r >= 'A' && r <= 'D' {
- count := short(GetInt(arg, 1))
- info, err := GetConsoleScreenBufferInfo()
- if err != nil {
- return false
- }
- switch r {
- case 'A': // up
- info.dwCursorPosition.y -= count
- case 'B': // down
- info.dwCursorPosition.y += count
- case 'C': // right
- info.dwCursorPosition.x += count
- case 'D': // left
- info.dwCursorPosition.x -= count
- }
- SetConsoleCursorPosition(&info.dwCursorPosition)
- return false
- }
-
- switch r {
- case 'J':
- killLines()
- case 'K':
- eraseLine()
- case 'm':
- color := word(0)
- for _, item := range arg {
- var c int
- c, err = strconv.Atoi(item)
- if err != nil {
- w.WriteString("[" + strings.Join(arg, ";") + "m")
- break
- }
- if c >= 30 && c < 40 {
- color ^= COLOR_FINTENSITY
- color |= ColorTableFg[c-30]
- } else if c >= 40 && c < 50 {
- color ^= COLOR_BINTENSITY
- color |= ColorTableBg[c-40]
- } else if c == 4 {
- color |= COMMON_LVB_UNDERSCORE | ColorTableFg[7]
- } else if c == 1 {
- color |= COMMON_LVB_BOLD | COLOR_FINTENSITY
- } else { // unknown code treat as reset
- color = ColorTableFg[7]
- }
- }
- if err != nil {
- break
- }
- kernel.SetConsoleTextAttribute(stdout, uintptr(color))
- case '\007': // set title
- case ';':
- if len(arg) == 0 || arg[len(arg)-1] != "" {
- arg = append(arg, "")
- *argptr = arg
- }
- return true
- default:
- if len(arg) == 0 {
- arg = append(arg, "")
- }
- arg[len(arg)-1] += string(r)
- *argptr = arg
- return true
- }
- *argptr = nil
- return false
-}
-
-func (a *ANSIWriter) Write(b []byte) (int, error) {
- a.Lock()
- defer a.Unlock()
-
- off := 0
- for len(b) > off {
- r, size := utf8.DecodeRune(b[off:])
- if size == 0 {
- return off, io.ErrShortWrite
- }
- off += size
- a.ctx.process(r)
- }
- a.ctx.Flush()
- return off, nil
-}
-
-func killLines() error {
- sbi, err := GetConsoleScreenBufferInfo()
- if err != nil {
- return err
- }
-
- size := (sbi.dwCursorPosition.y - sbi.dwSize.y) * sbi.dwSize.x
- size += sbi.dwCursorPosition.x
-
- var written int
- kernel.FillConsoleOutputAttribute(stdout, uintptr(ColorTableFg[7]),
- uintptr(size),
- sbi.dwCursorPosition.ptr(),
- uintptr(unsafe.Pointer(&written)),
- )
- return kernel.FillConsoleOutputCharacterW(stdout, uintptr(' '),
- uintptr(size),
- sbi.dwCursorPosition.ptr(),
- uintptr(unsafe.Pointer(&written)),
- )
-}
-
-func eraseLine() error {
- sbi, err := GetConsoleScreenBufferInfo()
- if err != nil {
- return err
- }
-
- size := sbi.dwSize.x
- sbi.dwCursorPosition.x = 0
- var written int
- return kernel.FillConsoleOutputCharacterW(stdout, uintptr(' '),
- uintptr(size),
- sbi.dwCursorPosition.ptr(),
- uintptr(unsafe.Pointer(&written)),
- )
-}
diff --git a/vendor/github.com/chzyer/readline/complete.go b/vendor/github.com/chzyer/readline/complete.go
deleted file mode 100644
index c08c9941..00000000
--- a/vendor/github.com/chzyer/readline/complete.go
+++ /dev/null
@@ -1,285 +0,0 @@
-package readline
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
-)
-
-type AutoCompleter interface {
- // Readline will pass the whole line and current offset to it
- // Completer need to pass all the candidates, and how long they shared the same characters in line
- // Example:
- // [go, git, git-shell, grep]
- // Do("g", 1) => ["o", "it", "it-shell", "rep"], 1
- // Do("gi", 2) => ["t", "t-shell"], 2
- // Do("git", 3) => ["", "-shell"], 3
- Do(line []rune, pos int) (newLine [][]rune, length int)
-}
-
-type TabCompleter struct{}
-
-func (t *TabCompleter) Do([]rune, int) ([][]rune, int) {
- return [][]rune{[]rune("\t")}, 0
-}
-
-type opCompleter struct {
- w io.Writer
- op *Operation
- width int
-
- inCompleteMode bool
- inSelectMode bool
- candidate [][]rune
- candidateSource []rune
- candidateOff int
- candidateChoise int
- candidateColNum int
-}
-
-func newOpCompleter(w io.Writer, op *Operation, width int) *opCompleter {
- return &opCompleter{
- w: w,
- op: op,
- width: width,
- }
-}
-
-func (o *opCompleter) doSelect() {
- if len(o.candidate) == 1 {
- o.op.buf.WriteRunes(o.candidate[0])
- o.ExitCompleteMode(false)
- return
- }
- o.nextCandidate(1)
- o.CompleteRefresh()
-}
-
-func (o *opCompleter) nextCandidate(i int) {
- o.candidateChoise += i
- o.candidateChoise = o.candidateChoise % len(o.candidate)
- if o.candidateChoise < 0 {
- o.candidateChoise = len(o.candidate) + o.candidateChoise
- }
-}
-
-func (o *opCompleter) OnComplete() bool {
- if o.width == 0 {
- return false
- }
- if o.IsInCompleteSelectMode() {
- o.doSelect()
- return true
- }
-
- buf := o.op.buf
- rs := buf.Runes()
-
- if o.IsInCompleteMode() && o.candidateSource != nil && runes.Equal(rs, o.candidateSource) {
- o.EnterCompleteSelectMode()
- o.doSelect()
- return true
- }
-
- o.ExitCompleteSelectMode()
- o.candidateSource = rs
- newLines, offset := o.op.cfg.AutoComplete.Do(rs, buf.idx)
- if len(newLines) == 0 {
- o.ExitCompleteMode(false)
- return true
- }
-
- // only Aggregate candidates in non-complete mode
- if !o.IsInCompleteMode() {
- if len(newLines) == 1 {
- buf.WriteRunes(newLines[0])
- o.ExitCompleteMode(false)
- return true
- }
-
- same, size := runes.Aggregate(newLines)
- if size > 0 {
- buf.WriteRunes(same)
- o.ExitCompleteMode(false)
- return true
- }
- }
-
- o.EnterCompleteMode(offset, newLines)
- return true
-}
-
-func (o *opCompleter) IsInCompleteSelectMode() bool {
- return o.inSelectMode
-}
-
-func (o *opCompleter) IsInCompleteMode() bool {
- return o.inCompleteMode
-}
-
-func (o *opCompleter) HandleCompleteSelect(r rune) bool {
- next := true
- switch r {
- case CharEnter, CharCtrlJ:
- next = false
- o.op.buf.WriteRunes(o.op.candidate[o.op.candidateChoise])
- o.ExitCompleteMode(false)
- case CharLineStart:
- num := o.candidateChoise % o.candidateColNum
- o.nextCandidate(-num)
- case CharLineEnd:
- num := o.candidateColNum - o.candidateChoise%o.candidateColNum - 1
- o.candidateChoise += num
- if o.candidateChoise >= len(o.candidate) {
- o.candidateChoise = len(o.candidate) - 1
- }
- case CharBackspace:
- o.ExitCompleteSelectMode()
- next = false
- case CharTab, CharForward:
- o.doSelect()
- case CharBell, CharInterrupt:
- o.ExitCompleteMode(true)
- next = false
- case CharNext:
- tmpChoise := o.candidateChoise + o.candidateColNum
- if tmpChoise >= o.getMatrixSize() {
- tmpChoise -= o.getMatrixSize()
- } else if tmpChoise >= len(o.candidate) {
- tmpChoise += o.candidateColNum
- tmpChoise -= o.getMatrixSize()
- }
- o.candidateChoise = tmpChoise
- case CharBackward:
- o.nextCandidate(-1)
- case CharPrev:
- tmpChoise := o.candidateChoise - o.candidateColNum
- if tmpChoise < 0 {
- tmpChoise += o.getMatrixSize()
- if tmpChoise >= len(o.candidate) {
- tmpChoise -= o.candidateColNum
- }
- }
- o.candidateChoise = tmpChoise
- default:
- next = false
- o.ExitCompleteSelectMode()
- }
- if next {
- o.CompleteRefresh()
- return true
- }
- return false
-}
-
-func (o *opCompleter) getMatrixSize() int {
- line := len(o.candidate) / o.candidateColNum
- if len(o.candidate)%o.candidateColNum != 0 {
- line++
- }
- return line * o.candidateColNum
-}
-
-func (o *opCompleter) OnWidthChange(newWidth int) {
- o.width = newWidth
-}
-
-func (o *opCompleter) CompleteRefresh() {
- if !o.inCompleteMode {
- return
- }
- lineCnt := o.op.buf.CursorLineCount()
- colWidth := 0
- for _, c := range o.candidate {
- w := runes.WidthAll(c)
- if w > colWidth {
- colWidth = w
- }
- }
- colWidth += o.candidateOff + 1
- same := o.op.buf.RuneSlice(-o.candidateOff)
-
- // -1 to avoid reach the end of line
- width := o.width - 1
- colNum := width / colWidth
- if colNum != 0 {
- colWidth += (width - (colWidth * colNum)) / colNum
- }
-
- o.candidateColNum = colNum
- buf := bufio.NewWriter(o.w)
- buf.Write(bytes.Repeat([]byte("\n"), lineCnt))
-
- colIdx := 0
- lines := 1
- buf.WriteString("\033[J")
- for idx, c := range o.candidate {
- inSelect := idx == o.candidateChoise && o.IsInCompleteSelectMode()
- if inSelect {
- buf.WriteString("\033[30;47m")
- }
- buf.WriteString(string(same))
- buf.WriteString(string(c))
- buf.Write(bytes.Repeat([]byte(" "), colWidth-runes.WidthAll(c)-runes.WidthAll(same)))
-
- if inSelect {
- buf.WriteString("\033[0m")
- }
-
- colIdx++
- if colIdx == colNum {
- buf.WriteString("\n")
- lines++
- colIdx = 0
- }
- }
-
- // move back
- fmt.Fprintf(buf, "\033[%dA\r", lineCnt-1+lines)
- fmt.Fprintf(buf, "\033[%dC", o.op.buf.idx+o.op.buf.PromptLen())
- buf.Flush()
-}
-
-func (o *opCompleter) aggCandidate(candidate [][]rune) int {
- offset := 0
- for i := 0; i < len(candidate[0]); i++ {
- for j := 0; j < len(candidate)-1; j++ {
- if i > len(candidate[j]) {
- goto aggregate
- }
- if candidate[j][i] != candidate[j+1][i] {
- goto aggregate
- }
- }
- offset = i
- }
-aggregate:
- return offset
-}
-
-func (o *opCompleter) EnterCompleteSelectMode() {
- o.inSelectMode = true
- o.candidateChoise = -1
- o.CompleteRefresh()
-}
-
-func (o *opCompleter) EnterCompleteMode(offset int, candidate [][]rune) {
- o.inCompleteMode = true
- o.candidate = candidate
- o.candidateOff = offset
- o.CompleteRefresh()
-}
-
-func (o *opCompleter) ExitCompleteSelectMode() {
- o.inSelectMode = false
- o.candidate = nil
- o.candidateChoise = -1
- o.candidateOff = -1
- o.candidateSource = nil
-}
-
-func (o *opCompleter) ExitCompleteMode(revent bool) {
- o.inCompleteMode = false
- o.ExitCompleteSelectMode()
-}
diff --git a/vendor/github.com/chzyer/readline/complete_helper.go b/vendor/github.com/chzyer/readline/complete_helper.go
deleted file mode 100644
index 58d72487..00000000
--- a/vendor/github.com/chzyer/readline/complete_helper.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package readline
-
-import (
- "bytes"
- "strings"
-)
-
-// Caller type for dynamic completion
-type DynamicCompleteFunc func(string) []string
-
-type PrefixCompleterInterface interface {
- Print(prefix string, level int, buf *bytes.Buffer)
- Do(line []rune, pos int) (newLine [][]rune, length int)
- GetName() []rune
- GetChildren() []PrefixCompleterInterface
- SetChildren(children []PrefixCompleterInterface)
-}
-
-type DynamicPrefixCompleterInterface interface {
- PrefixCompleterInterface
- IsDynamic() bool
- GetDynamicNames(line []rune) [][]rune
-}
-
-type PrefixCompleter struct {
- Name []rune
- Dynamic bool
- Callback DynamicCompleteFunc
- Children []PrefixCompleterInterface
-}
-
-func (p *PrefixCompleter) Tree(prefix string) string {
- buf := bytes.NewBuffer(nil)
- p.Print(prefix, 0, buf)
- return buf.String()
-}
-
-func Print(p PrefixCompleterInterface, prefix string, level int, buf *bytes.Buffer) {
- if strings.TrimSpace(string(p.GetName())) != "" {
- buf.WriteString(prefix)
- if level > 0 {
- buf.WriteString("├")
- buf.WriteString(strings.Repeat("─", (level*4)-2))
- buf.WriteString(" ")
- }
- buf.WriteString(string(p.GetName()) + "\n")
- level++
- }
- for _, ch := range p.GetChildren() {
- ch.Print(prefix, level, buf)
- }
-}
-
-func (p *PrefixCompleter) Print(prefix string, level int, buf *bytes.Buffer) {
- Print(p, prefix, level, buf)
-}
-
-func (p *PrefixCompleter) IsDynamic() bool {
- return p.Dynamic
-}
-
-func (p *PrefixCompleter) GetName() []rune {
- return p.Name
-}
-
-func (p *PrefixCompleter) GetDynamicNames(line []rune) [][]rune {
- var names = [][]rune{}
- for _, name := range p.Callback(string(line)) {
- names = append(names, []rune(name+" "))
- }
- return names
-}
-
-func (p *PrefixCompleter) GetChildren() []PrefixCompleterInterface {
- return p.Children
-}
-
-func (p *PrefixCompleter) SetChildren(children []PrefixCompleterInterface) {
- p.Children = children
-}
-
-func NewPrefixCompleter(pc ...PrefixCompleterInterface) *PrefixCompleter {
- return PcItem("", pc...)
-}
-
-func PcItem(name string, pc ...PrefixCompleterInterface) *PrefixCompleter {
- name += " "
- return &PrefixCompleter{
- Name: []rune(name),
- Dynamic: false,
- Children: pc,
- }
-}
-
-func PcItemDynamic(callback DynamicCompleteFunc, pc ...PrefixCompleterInterface) *PrefixCompleter {
- return &PrefixCompleter{
- Callback: callback,
- Dynamic: true,
- Children: pc,
- }
-}
-
-func (p *PrefixCompleter) Do(line []rune, pos int) (newLine [][]rune, offset int) {
- return doInternal(p, line, pos, line)
-}
-
-func Do(p PrefixCompleterInterface, line []rune, pos int) (newLine [][]rune, offset int) {
- return doInternal(p, line, pos, line)
-}
-
-func doInternal(p PrefixCompleterInterface, line []rune, pos int, origLine []rune) (newLine [][]rune, offset int) {
- line = runes.TrimSpaceLeft(line[:pos])
- goNext := false
- var lineCompleter PrefixCompleterInterface
- for _, child := range p.GetChildren() {
- childNames := make([][]rune, 1)
-
- childDynamic, ok := child.(DynamicPrefixCompleterInterface)
- if ok && childDynamic.IsDynamic() {
- childNames = childDynamic.GetDynamicNames(origLine)
- } else {
- childNames[0] = child.GetName()
- }
-
- for _, childName := range childNames {
- if len(line) >= len(childName) {
- if runes.HasPrefix(line, childName) {
- if len(line) == len(childName) {
- newLine = append(newLine, []rune{' '})
- } else {
- newLine = append(newLine, childName)
- }
- offset = len(childName)
- lineCompleter = child
- goNext = true
- }
- } else {
- if runes.HasPrefix(childName, line) {
- newLine = append(newLine, childName[len(line):])
- offset = len(line)
- lineCompleter = child
- }
- }
- }
- }
-
- if len(newLine) != 1 {
- return
- }
-
- tmpLine := make([]rune, 0, len(line))
- for i := offset; i < len(line); i++ {
- if line[i] == ' ' {
- continue
- }
-
- tmpLine = append(tmpLine, line[i:]...)
- return doInternal(lineCompleter, tmpLine, len(tmpLine), origLine)
- }
-
- if goNext {
- return doInternal(lineCompleter, nil, 0, origLine)
- }
- return
-}
diff --git a/vendor/github.com/chzyer/readline/complete_segment.go b/vendor/github.com/chzyer/readline/complete_segment.go
deleted file mode 100644
index 5ceadd80..00000000
--- a/vendor/github.com/chzyer/readline/complete_segment.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package readline
-
-type SegmentCompleter interface {
- // a
- // |- a1
- // |--- a11
- // |- a2
- // b
- // input:
- // DoTree([], 0) [a, b]
- // DoTree([a], 1) [a]
- // DoTree([a, ], 0) [a1, a2]
- // DoTree([a, a], 1) [a1, a2]
- // DoTree([a, a1], 2) [a1]
- // DoTree([a, a1, ], 0) [a11]
- // DoTree([a, a1, a], 1) [a11]
- DoSegment([][]rune, int) [][]rune
-}
-
-type dumpSegmentCompleter struct {
- f func([][]rune, int) [][]rune
-}
-
-func (d *dumpSegmentCompleter) DoSegment(segment [][]rune, n int) [][]rune {
- return d.f(segment, n)
-}
-
-func SegmentFunc(f func([][]rune, int) [][]rune) AutoCompleter {
- return &SegmentComplete{&dumpSegmentCompleter{f}}
-}
-
-func SegmentAutoComplete(completer SegmentCompleter) *SegmentComplete {
- return &SegmentComplete{
- SegmentCompleter: completer,
- }
-}
-
-type SegmentComplete struct {
- SegmentCompleter
-}
-
-func RetSegment(segments [][]rune, cands [][]rune, idx int) ([][]rune, int) {
- ret := make([][]rune, 0, len(cands))
- lastSegment := segments[len(segments)-1]
- for _, cand := range cands {
- if !runes.HasPrefix(cand, lastSegment) {
- continue
- }
- ret = append(ret, cand[len(lastSegment):])
- }
- return ret, idx
-}
-
-func SplitSegment(line []rune, pos int) ([][]rune, int) {
- segs := [][]rune{}
- lastIdx := -1
- line = line[:pos]
- pos = 0
- for idx, l := range line {
- if l == ' ' {
- pos = 0
- segs = append(segs, line[lastIdx+1:idx])
- lastIdx = idx
- } else {
- pos++
- }
- }
- segs = append(segs, line[lastIdx+1:])
- return segs, pos
-}
-
-func (c *SegmentComplete) Do(line []rune, pos int) (newLine [][]rune, offset int) {
-
- segment, idx := SplitSegment(line, pos)
-
- cands := c.DoSegment(segment, idx)
- newLine, offset = RetSegment(segment, cands, idx)
- for idx := range newLine {
- newLine[idx] = append(newLine[idx], ' ')
- }
- return newLine, offset
-}
diff --git a/vendor/github.com/chzyer/readline/complete_segment_test.go b/vendor/github.com/chzyer/readline/complete_segment_test.go
deleted file mode 100644
index 73a828ab..00000000
--- a/vendor/github.com/chzyer/readline/complete_segment_test.go
+++ /dev/null
@@ -1,167 +0,0 @@
-package readline
-
-import (
- "fmt"
- "testing"
-
- "github.com/chzyer/test"
-)
-
-func rs(s [][]rune) []string {
- ret := make([]string, len(s))
- for idx, ss := range s {
- ret[idx] = string(ss)
- }
- return ret
-}
-
-func sr(s ...string) [][]rune {
- ret := make([][]rune, len(s))
- for idx, ss := range s {
- ret[idx] = []rune(ss)
- }
- return ret
-}
-
-func TestRetSegment(t *testing.T) {
- defer test.New(t)
- // a
- // |- a1
- // |--- a11
- // |--- a12
- // |- a2
- // |--- a21
- // b
- // add
- // adddomain
- ret := []struct {
- Segments [][]rune
- Cands [][]rune
- idx int
- Ret [][]rune
- pos int
- }{
- {sr(""), sr("a", "b", "add", "adddomain"), 0, sr("a", "b", "add", "adddomain"), 0},
- {sr("a"), sr("a", "add", "adddomain"), 1, sr("", "dd", "dddomain"), 1},
- {sr("a", ""), sr("a1", "a2"), 0, sr("a1", "a2"), 0},
- {sr("a", "a"), sr("a1", "a2"), 1, sr("1", "2"), 1},
- {sr("a", "a1"), sr("a1"), 2, sr(""), 2},
- {sr("add"), sr("add", "adddomain"), 2, sr("", "domain"), 2},
- }
- for idx, r := range ret {
- ret, pos := RetSegment(r.Segments, r.Cands, r.idx)
- test.Equal(ret, r.Ret, fmt.Errorf("%v", idx))
- test.Equal(pos, r.pos, fmt.Errorf("%v", idx))
- }
-}
-
-func TestSplitSegment(t *testing.T) {
- defer test.New(t)
- // a
- // |- a1
- // |--- a11
- // |--- a12
- // |- a2
- // |--- a21
- // b
- ret := []struct {
- Line string
- Pos int
- Segments [][]rune
- Idx int
- }{
- {"", 0, sr(""), 0},
- {"a", 1, sr("a"), 1},
- {"a ", 2, sr("a", ""), 0},
- {"a a", 3, sr("a", "a"), 1},
- {"a a1", 4, sr("a", "a1"), 2},
- {"a a1 ", 5, sr("a", "a1", ""), 0},
- }
-
- for i, r := range ret {
- ret, idx := SplitSegment([]rune(r.Line), r.Pos)
- test.Equal(rs(ret), rs(r.Segments), fmt.Errorf("%v", i))
- test.Equal(idx, r.Idx, fmt.Errorf("%v", i))
- }
-}
-
-type Tree struct {
- Name string
- Children []Tree
-}
-
-func TestSegmentCompleter(t *testing.T) {
- defer test.New(t)
-
- tree := Tree{"", []Tree{
- {"a", []Tree{
- {"a1", []Tree{
- {"a11", nil},
- {"a12", nil},
- }},
- {"a2", []Tree{
- {"a21", nil},
- }},
- }},
- {"b", nil},
- {"route", []Tree{
- {"add", nil},
- {"adddomain", nil},
- }},
- }}
- s := SegmentFunc(func(ret [][]rune, n int) [][]rune {
- tree := tree
- main:
- for level := 0; level < len(ret)-1; {
- name := string(ret[level])
- for _, t := range tree.Children {
- if t.Name == name {
- tree = t
- level++
- continue main
- }
- }
- }
-
- ret = make([][]rune, len(tree.Children))
- for idx, r := range tree.Children {
- ret[idx] = []rune(r.Name)
- }
- return ret
- })
-
- // a
- // |- a1
- // |--- a11
- // |--- a12
- // |- a2
- // |--- a21
- // b
- ret := []struct {
- Line string
- Pos int
- Ret [][]rune
- Share int
- }{
- {"", 0, sr("a", "b", "route"), 0},
- {"a", 1, sr(""), 1},
- {"a ", 2, sr("a1", "a2"), 0},
- {"a a", 3, sr("1", "2"), 1},
- {"a a1", 4, sr(""), 2},
- {"a a1 ", 5, sr("a11", "a12"), 0},
- {"a a1 a", 6, sr("11", "12"), 1},
- {"a a1 a1", 7, sr("1", "2"), 2},
- {"a a1 a11", 8, sr(""), 3},
- {"route add", 9, sr("", "domain"), 3},
- }
- for _, r := range ret {
- for idx, rr := range r.Ret {
- r.Ret[idx] = append(rr, ' ')
- }
- }
- for i, r := range ret {
- newLine, length := s.Do([]rune(r.Line), r.Pos)
- test.Equal(rs(newLine), rs(r.Ret), fmt.Errorf("%v", i))
- test.Equal(length, r.Share, fmt.Errorf("%v", i))
- }
-}
diff --git a/vendor/github.com/chzyer/readline/doc/shortcut.md b/vendor/github.com/chzyer/readline/doc/shortcut.md
deleted file mode 100644
index 404f95d1..00000000
--- a/vendor/github.com/chzyer/readline/doc/shortcut.md
+++ /dev/null
@@ -1,62 +0,0 @@
-## Readline Shortcut
-
-`Meta`+`B` means press `Esc` and `n` separately.
-Users can change that in terminal simulator(i.e. iTerm2) to `Alt`+`B`
-Notice: `Meta`+`B` is equals with `Alt`+`B` in windows.
-
-* Shortcut in normal mode
-
-| Shortcut | Comment |
-| ------------------ | --------------------------------- |
-| `Ctrl`+`A` | Beginning of line |
-| `Ctrl`+`B` / `←` | Backward one character |
-| `Meta`+`B` | Backward one word |
-| `Ctrl`+`C` | Send io.EOF |
-| `Ctrl`+`D` | Delete one character |
-| `Meta`+`D` | Delete one word |
-| `Ctrl`+`E` | End of line |
-| `Ctrl`+`F` / `→` | Forward one character |
-| `Meta`+`F` | Forward one word |
-| `Ctrl`+`G` | Cancel |
-| `Ctrl`+`H` | Delete previous character |
-| `Ctrl`+`I` / `Tab` | Command line completion |
-| `Ctrl`+`J` | Line feed |
-| `Ctrl`+`K` | Cut text to the end of line |
-| `Ctrl`+`L` | Clear screen |
-| `Ctrl`+`M` | Same as Enter key |
-| `Ctrl`+`N` / `↓` | Next line (in history) |
-| `Ctrl`+`P` / `↑` | Prev line (in history) |
-| `Ctrl`+`R` | Search backwards in history |
-| `Ctrl`+`S` | Search forwards in history |
-| `Ctrl`+`T` | Transpose characters |
-| `Meta`+`T` | Transpose words (TODO) |
-| `Ctrl`+`U` | Cut text to the beginning of line |
-| `Ctrl`+`W` | Cut previous word |
-| `Backspace` | Delete previous character |
-| `Meta`+`Backspace` | Cut previous word |
-| `Enter` | Line feed |
-
-
-* Shortcut in Search Mode (`Ctrl`+`S` or `Ctrl`+`r` to enter this mode)
-
-| Shortcut | Comment |
-| ----------------------- | --------------------------------------- |
-| `Ctrl`+`S` | Search forwards in history |
-| `Ctrl`+`R` | Search backwards in history |
-| `Ctrl`+`C` / `Ctrl`+`G` | Exit Search Mode and revert the history |
-| `Backspace` | Delete previous character |
-| Other | Exit Search Mode |
-
-* Shortcut in Complete Select Mode (double `Tab` to enter this mode)
-
-| Shortcut | Comment |
-| ----------------------- | ---------------------------------------- |
-| `Ctrl`+`F` | Move Forward |
-| `Ctrl`+`B` | Move Backward |
-| `Ctrl`+`N` | Move to next line |
-| `Ctrl`+`P` | Move to previous line |
-| `Ctrl`+`A` | Move to the first candicate in current line |
-| `Ctrl`+`E` | Move to the last candicate in current line |
-| `Tab` / `Enter` | Use the word on cursor to complete |
-| `Ctrl`+`C` / `Ctrl`+`G` | Exit Complete Select Mode |
-| Other | Exit Complete Select Mode |
\ No newline at end of file
diff --git a/vendor/github.com/chzyer/readline/example/readline-demo/readline-demo.go b/vendor/github.com/chzyer/readline/example/readline-demo/readline-demo.go
deleted file mode 100644
index 2b1daf7d..00000000
--- a/vendor/github.com/chzyer/readline/example/readline-demo/readline-demo.go
+++ /dev/null
@@ -1,167 +0,0 @@
-package main
-
-import (
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "strconv"
- "strings"
- "time"
-
- "github.com/chzyer/readline"
-)
-
-func usage(w io.Writer) {
- io.WriteString(w, "commands:\n")
- io.WriteString(w, completer.Tree(" "))
-}
-
-// Function constructor - constructs new function for listing given directory
-func listFiles(path string) func(string) []string {
- return func(line string) []string {
- names := make([]string, 0)
- files, _ := ioutil.ReadDir(path)
- for _, f := range files {
- names = append(names, f.Name())
- }
- return names
- }
-}
-
-var completer = readline.NewPrefixCompleter(
- readline.PcItem("mode",
- readline.PcItem("vi"),
- readline.PcItem("emacs"),
- ),
- readline.PcItem("login"),
- readline.PcItem("say",
- readline.PcItemDynamic(listFiles("./"),
- readline.PcItem("with",
- readline.PcItem("following"),
- readline.PcItem("items"),
- ),
- ),
- readline.PcItem("hello"),
- readline.PcItem("bye"),
- ),
- readline.PcItem("setprompt"),
- readline.PcItem("setpassword"),
- readline.PcItem("bye"),
- readline.PcItem("help"),
- readline.PcItem("go",
- readline.PcItem("build", readline.PcItem("-o"), readline.PcItem("-v")),
- readline.PcItem("install",
- readline.PcItem("-v"),
- readline.PcItem("-vv"),
- readline.PcItem("-vvv"),
- ),
- readline.PcItem("test"),
- ),
- readline.PcItem("sleep"),
-)
-
-func filterInput(r rune) (rune, bool) {
- switch r {
- // block CtrlZ feature
- case readline.CharCtrlZ:
- return r, false
- }
- return r, true
-}
-
-func main() {
- l, err := readline.NewEx(&readline.Config{
- Prompt: "\033[31m»\033[0m ",
- HistoryFile: "/tmp/readline.tmp",
- AutoComplete: completer,
- InterruptPrompt: "^C",
- EOFPrompt: "exit",
-
- HistorySearchFold: true,
- FuncFilterInputRune: filterInput,
- })
- if err != nil {
- panic(err)
- }
- defer l.Close()
-
- setPasswordCfg := l.GenPasswordConfig()
- setPasswordCfg.SetListener(func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool) {
- l.SetPrompt(fmt.Sprintf("Enter password(%v): ", len(line)))
- l.Refresh()
- return nil, 0, false
- })
-
- log.SetOutput(l.Stderr())
- for {
- line, err := l.Readline()
- if err == readline.ErrInterrupt {
- if len(line) == 0 {
- break
- } else {
- continue
- }
- } else if err == io.EOF {
- break
- }
-
- line = strings.TrimSpace(line)
- switch {
- case strings.HasPrefix(line, "mode "):
- switch line[5:] {
- case "vi":
- l.SetVimMode(true)
- case "emacs":
- l.SetVimMode(false)
- default:
- println("invalid mode:", line[5:])
- }
- case line == "mode":
- if l.IsVimMode() {
- println("current mode: vim")
- } else {
- println("current mode: emacs")
- }
- case line == "login":
- pswd, err := l.ReadPassword("please enter your password: ")
- if err != nil {
- break
- }
- println("you enter:", strconv.Quote(string(pswd)))
- case line == "help":
- usage(l.Stderr())
- case line == "setpassword":
- pswd, err := l.ReadPasswordWithConfig(setPasswordCfg)
- if err == nil {
- println("you set:", strconv.Quote(string(pswd)))
- }
- case strings.HasPrefix(line, "setprompt"):
- if len(line) <= 10 {
- log.Println("setprompt ")
- break
- }
- l.SetPrompt(line[10:])
- case strings.HasPrefix(line, "say"):
- line := strings.TrimSpace(line[3:])
- if len(line) == 0 {
- log.Println("say what?")
- break
- }
- go func() {
- for range time.Tick(time.Second) {
- log.Println(line)
- }
- }()
- case line == "bye":
- goto exit
- case line == "sleep":
- log.Println("sleep 4 second")
- time.Sleep(4 * time.Second)
- case line == "":
- default:
- log.Println("you said:", strconv.Quote(line))
- }
- }
-exit:
-}
diff --git a/vendor/github.com/chzyer/readline/example/readline-im/README.md b/vendor/github.com/chzyer/readline/example/readline-im/README.md
deleted file mode 100644
index 2d292129..00000000
--- a/vendor/github.com/chzyer/readline/example/readline-im/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# readline-im
-
-![readline-im](https://dl.dropboxusercontent.com/s/52hc7bo92g3pgi5/03F93B8D-9B4B-4D35-BBAA-22FBDAC7F299-26173-000164AA33980001.gif?dl=0)
diff --git a/vendor/github.com/chzyer/readline/example/readline-im/readline-im.go b/vendor/github.com/chzyer/readline/example/readline-im/readline-im.go
deleted file mode 100644
index 16803bdf..00000000
--- a/vendor/github.com/chzyer/readline/example/readline-im/readline-im.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package main
-
-import (
- "fmt"
- "math/rand"
- "time"
-
- "github.com/chzyer/readline"
-)
-import "log"
-
-func main() {
- rl, err := readline.NewEx(&readline.Config{
- UniqueEditLine: true,
- })
- if err != nil {
- panic(err)
- }
- defer rl.Close()
-
- rl.SetPrompt("username: ")
- username, err := rl.Readline()
- if err != nil {
- return
- }
- rl.ResetHistory()
- log.SetOutput(rl.Stderr())
-
- fmt.Fprintln(rl, "Hi,", username+"! My name is Dave.")
- rl.SetPrompt(username + "> ")
-
- done := make(chan struct{})
- go func() {
- rand.Seed(time.Now().Unix())
- loop:
- for {
- select {
- case <-time.After(time.Duration(rand.Intn(20)) * 100 * time.Millisecond):
- case <-done:
- break loop
- }
- log.Println("Dave:", "hello")
- }
- log.Println("Dave:", "bye")
- done <- struct{}{}
- }()
-
- for {
- ln := rl.Line()
- if ln.CanContinue() {
- continue
- } else if ln.CanBreak() {
- break
- }
- log.Println(username+":", ln.Line)
- }
- rl.Clean()
- done <- struct{}{}
- <-done
-}
diff --git a/vendor/github.com/chzyer/readline/example/readline-multiline/readline-multiline.go b/vendor/github.com/chzyer/readline/example/readline-multiline/readline-multiline.go
deleted file mode 100644
index 2192cf6d..00000000
--- a/vendor/github.com/chzyer/readline/example/readline-multiline/readline-multiline.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package main
-
-import (
- "strings"
-
- "github.com/chzyer/readline"
-)
-
-func main() {
- rl, err := readline.NewEx(&readline.Config{
- Prompt: "> ",
- HistoryFile: "/tmp/readline-multiline",
- DisableAutoSaveHistory: true,
- })
- if err != nil {
- panic(err)
- }
- defer rl.Close()
-
- var cmds []string
- for {
- line, err := rl.Readline()
- if err != nil {
- break
- }
- line = strings.TrimSpace(line)
- if len(line) == 0 {
- continue
- }
- cmds = append(cmds, line)
- if !strings.HasSuffix(line, ";") {
- rl.SetPrompt(">>> ")
- continue
- }
- cmd := strings.Join(cmds, " ")
- cmds = cmds[:0]
- rl.SetPrompt("> ")
- rl.SaveHistory(cmd)
- println(cmd)
- }
-}
diff --git a/vendor/github.com/chzyer/readline/example/readline-pass-strength/readline-pass-strength.go b/vendor/github.com/chzyer/readline/example/readline-pass-strength/readline-pass-strength.go
deleted file mode 100644
index afcef45b..00000000
--- a/vendor/github.com/chzyer/readline/example/readline-pass-strength/readline-pass-strength.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// This is a small example using readline to read a password
-// and check it's strength while typing using the zxcvbn library.
-// Depending on the strength the prompt is colored nicely to indicate strength.
-//
-// This file is licensed under the WTFPL:
-//
-// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
-// Version 2, December 2004
-//
-// Copyright (C) 2004 Sam Hocevar
-//
-// 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.
-package main
-
-import (
- "fmt"
-
- "github.com/chzyer/readline"
- zxcvbn "github.com/nbutton23/zxcvbn-go"
-)
-
-const (
- Cyan = 36
- Green = 32
- Magenta = 35
- Red = 31
- Yellow = 33
- BackgroundRed = 41
-)
-
-// Reset sequence
-var ColorResetEscape = "\033[0m"
-
-// ColorResetEscape translates a ANSI color number to a color escape.
-func ColorEscape(color int) string {
- return fmt.Sprintf("\033[0;%dm", color)
-}
-
-// Colorize the msg using ANSI color escapes
-func Colorize(msg string, color int) string {
- return ColorEscape(color) + msg + ColorResetEscape
-}
-
-func createStrengthPrompt(password []rune) string {
- symbol, color := "", Red
- strength := zxcvbn.PasswordStrength(string(password), nil)
-
- switch {
- case strength.Score <= 1:
- symbol = "✗"
- color = Red
- case strength.Score <= 2:
- symbol = "⚡"
- color = Magenta
- case strength.Score <= 3:
- symbol = "⚠"
- color = Yellow
- case strength.Score <= 4:
- symbol = "✔"
- color = Green
- }
-
- prompt := Colorize(symbol, color)
- if strength.Entropy > 0 {
- entropy := fmt.Sprintf(" %3.0f", strength.Entropy)
- prompt += Colorize(entropy, Cyan)
- } else {
- prompt += Colorize(" ENT", Cyan)
- }
-
- prompt += Colorize(" New Password: ", color)
- return prompt
-}
-
-func main() {
- rl, err := readline.New("")
- if err != nil {
- return
- }
- defer rl.Close()
-
- setPasswordCfg := rl.GenPasswordConfig()
- setPasswordCfg.SetListener(func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool) {
- rl.SetPrompt(createStrengthPrompt(line))
- rl.Refresh()
- return nil, 0, false
- })
-
- pswd, err := rl.ReadPasswordWithConfig(setPasswordCfg)
- if err != nil {
- return
- }
-
- fmt.Println("Your password was:", string(pswd))
-}
diff --git a/vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-client/client.go b/vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-client/client.go
deleted file mode 100644
index 3b7ff312..00000000
--- a/vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-client/client.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package main
-
-import "github.com/chzyer/readline"
-
-func main() {
- if err := readline.DialRemote("tcp", ":12344"); err != nil {
- println(err.Error())
- }
-}
diff --git a/vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-server/server.go b/vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-server/server.go
deleted file mode 100644
index 38abc7dc..00000000
--- a/vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-server/server.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/chzyer/readline"
-)
-
-func main() {
- cfg := &readline.Config{
- Prompt: "readline-remote: ",
- }
- handleFunc := func(rl *readline.Instance) {
- for {
- line, err := rl.Readline()
- if err != nil {
- break
- }
- fmt.Fprintln(rl.Stdout(), "receive:"+line)
- }
- }
- err := readline.ListenRemote("tcp", ":12344", cfg, handleFunc)
- if err != nil {
- println(err.Error())
- }
-}
diff --git a/vendor/github.com/chzyer/readline/history.go b/vendor/github.com/chzyer/readline/history.go
deleted file mode 100644
index 6b17c464..00000000
--- a/vendor/github.com/chzyer/readline/history.go
+++ /dev/null
@@ -1,330 +0,0 @@
-package readline
-
-import (
- "bufio"
- "container/list"
- "fmt"
- "os"
- "strings"
- "sync"
-)
-
-type hisItem struct {
- Source []rune
- Version int64
- Tmp []rune
-}
-
-func (h *hisItem) Clean() {
- h.Source = nil
- h.Tmp = nil
-}
-
-type opHistory struct {
- cfg *Config
- history *list.List
- historyVer int64
- current *list.Element
- fd *os.File
- fdLock sync.Mutex
- enable bool
-}
-
-func newOpHistory(cfg *Config) (o *opHistory) {
- o = &opHistory{
- cfg: cfg,
- history: list.New(),
- enable: true,
- }
- return o
-}
-
-func (o *opHistory) Reset() {
- o.history = list.New()
- o.current = nil
-}
-
-func (o *opHistory) IsHistoryClosed() bool {
- o.fdLock.Lock()
- defer o.fdLock.Unlock()
- return o.fd.Fd() == ^(uintptr(0))
-}
-
-func (o *opHistory) Init() {
- if o.IsHistoryClosed() {
- o.initHistory()
- }
-}
-
-func (o *opHistory) initHistory() {
- if o.cfg.HistoryFile != "" {
- o.historyUpdatePath(o.cfg.HistoryFile)
- }
-}
-
-// only called by newOpHistory
-func (o *opHistory) historyUpdatePath(path string) {
- o.fdLock.Lock()
- defer o.fdLock.Unlock()
- f, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
- if err != nil {
- return
- }
- o.fd = f
- r := bufio.NewReader(o.fd)
- total := 0
- for ; ; total++ {
- line, err := r.ReadString('\n')
- if err != nil {
- break
- }
- // ignore the empty line
- line = strings.TrimSpace(line)
- if len(line) == 0 {
- continue
- }
- o.Push([]rune(line))
- o.Compact()
- }
- if total > o.cfg.HistoryLimit {
- o.rewriteLocked()
- }
- o.historyVer++
- o.Push(nil)
- return
-}
-
-func (o *opHistory) Compact() {
- for o.history.Len() > o.cfg.HistoryLimit && o.history.Len() > 0 {
- o.history.Remove(o.history.Front())
- }
-}
-
-func (o *opHistory) Rewrite() {
- o.fdLock.Lock()
- defer o.fdLock.Unlock()
- o.rewriteLocked()
-}
-
-func (o *opHistory) rewriteLocked() {
- if o.cfg.HistoryFile == "" {
- return
- }
-
- tmpFile := o.cfg.HistoryFile + ".tmp"
- fd, err := os.OpenFile(tmpFile, os.O_CREATE|os.O_WRONLY|os.O_TRUNC|os.O_APPEND, 0666)
- if err != nil {
- return
- }
-
- buf := bufio.NewWriter(fd)
- for elem := o.history.Front(); elem != nil; elem = elem.Next() {
- buf.WriteString(string(elem.Value.(*hisItem).Source) + "\n")
- }
- buf.Flush()
-
- // replace history file
- if err = os.Rename(tmpFile, o.cfg.HistoryFile); err != nil {
- fd.Close()
- return
- }
-
- if o.fd != nil {
- o.fd.Close()
- }
- // fd is write only, just satisfy what we need.
- o.fd = fd
-}
-
-func (o *opHistory) Close() {
- o.fdLock.Lock()
- defer o.fdLock.Unlock()
- if o.fd != nil {
- o.fd.Close()
- }
-}
-
-func (o *opHistory) FindBck(isNewSearch bool, rs []rune, start int) (int, *list.Element) {
- for elem := o.current; elem != nil; elem = elem.Prev() {
- item := o.showItem(elem.Value)
- if isNewSearch {
- start += len(rs)
- }
- if elem == o.current {
- if len(item) >= start {
- item = item[:start]
- }
- }
- idx := runes.IndexAllBckEx(item, rs, o.cfg.HistorySearchFold)
- if idx < 0 {
- continue
- }
- return idx, elem
- }
- return -1, nil
-}
-
-func (o *opHistory) FindFwd(isNewSearch bool, rs []rune, start int) (int, *list.Element) {
- for elem := o.current; elem != nil; elem = elem.Next() {
- item := o.showItem(elem.Value)
- if isNewSearch {
- start -= len(rs)
- if start < 0 {
- start = 0
- }
- }
- if elem == o.current {
- if len(item)-1 >= start {
- item = item[start:]
- } else {
- continue
- }
- }
- idx := runes.IndexAllEx(item, rs, o.cfg.HistorySearchFold)
- if idx < 0 {
- continue
- }
- if elem == o.current {
- idx += start
- }
- return idx, elem
- }
- return -1, nil
-}
-
-func (o *opHistory) showItem(obj interface{}) []rune {
- item := obj.(*hisItem)
- if item.Version == o.historyVer {
- return item.Tmp
- }
- return item.Source
-}
-
-func (o *opHistory) Prev() []rune {
- if o.current == nil {
- return nil
- }
- current := o.current.Prev()
- if current == nil {
- return nil
- }
- o.current = current
- return runes.Copy(o.showItem(current.Value))
-}
-
-func (o *opHistory) Next() ([]rune, bool) {
- if o.current == nil {
- return nil, false
- }
- current := o.current.Next()
- if current == nil {
- return nil, false
- }
-
- o.current = current
- return runes.Copy(o.showItem(current.Value)), true
-}
-
-// Disable the current history
-func (o *opHistory) Disable() {
- o.enable = false
-}
-
-// Enable the current history
-func (o *opHistory) Enable() {
- o.enable = true
-}
-
-func (o *opHistory) debug() {
- Debug("-------")
- for item := o.history.Front(); item != nil; item = item.Next() {
- Debug(fmt.Sprintf("%+v", item.Value))
- }
-}
-
-// save history
-func (o *opHistory) New(current []rune) (err error) {
-
- // history deactivated
- if !o.enable {
- return nil
- }
-
- current = runes.Copy(current)
-
- // if just use last command without modify
- // just clean lastest history
- if back := o.history.Back(); back != nil {
- prev := back.Prev()
- if prev != nil {
- if runes.Equal(current, prev.Value.(*hisItem).Source) {
- o.current = o.history.Back()
- o.current.Value.(*hisItem).Clean()
- o.historyVer++
- return nil
- }
- }
- }
-
- if len(current) == 0 {
- o.current = o.history.Back()
- if o.current != nil {
- o.current.Value.(*hisItem).Clean()
- o.historyVer++
- return nil
- }
- }
-
- if o.current != o.history.Back() {
- // move history item to current command
- currentItem := o.current.Value.(*hisItem)
- // set current to last item
- o.current = o.history.Back()
-
- current = runes.Copy(currentItem.Tmp)
- }
-
- // err only can be a IO error, just report
- err = o.Update(current, true)
-
- // push a new one to commit current command
- o.historyVer++
- o.Push(nil)
- return
-}
-
-func (o *opHistory) Revert() {
- o.historyVer++
- o.current = o.history.Back()
-}
-
-func (o *opHistory) Update(s []rune, commit bool) (err error) {
- o.fdLock.Lock()
- defer o.fdLock.Unlock()
- s = runes.Copy(s)
- if o.current == nil {
- o.Push(s)
- o.Compact()
- return
- }
- r := o.current.Value.(*hisItem)
- r.Version = o.historyVer
- if commit {
- r.Source = s
- if o.fd != nil {
- // just report the error
- _, err = o.fd.Write([]byte(string(r.Source) + "\n"))
- }
- } else {
- r.Tmp = append(r.Tmp[:0], s...)
- }
- o.current.Value = r
- o.Compact()
- return
-}
-
-func (o *opHistory) Push(s []rune) {
- s = runes.Copy(s)
- elem := o.history.PushBack(&hisItem{Source: s})
- o.current = elem
-}
diff --git a/vendor/github.com/chzyer/readline/operation.go b/vendor/github.com/chzyer/readline/operation.go
deleted file mode 100644
index 4c31624f..00000000
--- a/vendor/github.com/chzyer/readline/operation.go
+++ /dev/null
@@ -1,531 +0,0 @@
-package readline
-
-import (
- "errors"
- "io"
- "sync"
-)
-
-var (
- ErrInterrupt = errors.New("Interrupt")
-)
-
-type InterruptError struct {
- Line []rune
-}
-
-func (*InterruptError) Error() string {
- return "Interrupted"
-}
-
-type Operation struct {
- m sync.Mutex
- cfg *Config
- t *Terminal
- buf *RuneBuffer
- outchan chan []rune
- errchan chan error
- w io.Writer
-
- history *opHistory
- *opSearch
- *opCompleter
- *opPassword
- *opVim
-}
-
-func (o *Operation) SetBuffer(what string) {
- o.buf.Set([]rune(what))
-}
-
-type wrapWriter struct {
- r *Operation
- t *Terminal
- target io.Writer
-}
-
-func (w *wrapWriter) Write(b []byte) (int, error) {
- if !w.t.IsReading() {
- return w.target.Write(b)
- }
-
- var (
- n int
- err error
- )
- w.r.buf.Refresh(func() {
- n, err = w.target.Write(b)
- })
-
- if w.r.IsSearchMode() {
- w.r.SearchRefresh(-1)
- }
- if w.r.IsInCompleteMode() {
- w.r.CompleteRefresh()
- }
- return n, err
-}
-
-func NewOperation(t *Terminal, cfg *Config) *Operation {
- width := cfg.FuncGetWidth()
- op := &Operation{
- t: t,
- buf: NewRuneBuffer(t, cfg.Prompt, cfg, width),
- outchan: make(chan []rune),
- errchan: make(chan error, 1),
- }
- op.w = op.buf.w
- op.SetConfig(cfg)
- op.opVim = newVimMode(op)
- op.opCompleter = newOpCompleter(op.buf.w, op, width)
- op.opPassword = newOpPassword(op)
- op.cfg.FuncOnWidthChanged(func() {
- newWidth := cfg.FuncGetWidth()
- op.opCompleter.OnWidthChange(newWidth)
- op.opSearch.OnWidthChange(newWidth)
- op.buf.OnWidthChange(newWidth)
- })
- go op.ioloop()
- return op
-}
-
-func (o *Operation) SetPrompt(s string) {
- o.buf.SetPrompt(s)
-}
-
-func (o *Operation) SetMaskRune(r rune) {
- o.buf.SetMask(r)
-}
-
-func (o *Operation) GetConfig() *Config {
- o.m.Lock()
- cfg := *o.cfg
- o.m.Unlock()
- return &cfg
-}
-
-func (o *Operation) ioloop() {
- for {
- keepInSearchMode := false
- keepInCompleteMode := false
- r := o.t.ReadRune()
- if o.GetConfig().FuncFilterInputRune != nil {
- var process bool
- r, process = o.GetConfig().FuncFilterInputRune(r)
- if !process {
- o.buf.Refresh(nil) // to refresh the line
- continue // ignore this rune
- }
- }
-
- if r == 0 { // io.EOF
- if o.buf.Len() == 0 {
- o.buf.Clean()
- select {
- case o.errchan <- io.EOF:
- }
- break
- } else {
- // if stdin got io.EOF and there is something left in buffer,
- // let's flush them by sending CharEnter.
- // And we will got io.EOF int next loop.
- r = CharEnter
- }
- }
- isUpdateHistory := true
-
- if o.IsInCompleteSelectMode() {
- keepInCompleteMode = o.HandleCompleteSelect(r)
- if keepInCompleteMode {
- continue
- }
-
- o.buf.Refresh(nil)
- switch r {
- case CharEnter, CharCtrlJ:
- o.history.Update(o.buf.Runes(), false)
- fallthrough
- case CharInterrupt:
- o.t.KickRead()
- fallthrough
- case CharBell:
- continue
- }
- }
-
- if o.IsEnableVimMode() {
- r = o.HandleVim(r, o.t.ReadRune)
- if r == 0 {
- continue
- }
- }
-
- switch r {
- case CharBell:
- if o.IsSearchMode() {
- o.ExitSearchMode(true)
- o.buf.Refresh(nil)
- }
- if o.IsInCompleteMode() {
- o.ExitCompleteMode(true)
- o.buf.Refresh(nil)
- }
- case CharTab:
- if o.GetConfig().AutoComplete == nil {
- o.t.Bell()
- break
- }
- if o.OnComplete() {
- keepInCompleteMode = true
- } else {
- o.t.Bell()
- break
- }
-
- case CharBckSearch:
- if !o.SearchMode(S_DIR_BCK) {
- o.t.Bell()
- break
- }
- keepInSearchMode = true
- case CharCtrlU:
- o.buf.KillFront()
- case CharFwdSearch:
- if !o.SearchMode(S_DIR_FWD) {
- o.t.Bell()
- break
- }
- keepInSearchMode = true
- case CharKill:
- o.buf.Kill()
- keepInCompleteMode = true
- case MetaForward:
- o.buf.MoveToNextWord()
- case CharTranspose:
- o.buf.Transpose()
- case MetaBackward:
- o.buf.MoveToPrevWord()
- case MetaDelete:
- o.buf.DeleteWord()
- case CharLineStart:
- o.buf.MoveToLineStart()
- case CharLineEnd:
- o.buf.MoveToLineEnd()
- case CharBackspace, CharCtrlH:
- if o.IsSearchMode() {
- o.SearchBackspace()
- keepInSearchMode = true
- break
- }
-
- if o.buf.Len() == 0 {
- o.t.Bell()
- break
- }
- o.buf.Backspace()
- if o.IsInCompleteMode() {
- o.OnComplete()
- }
- case CharCtrlZ:
- o.buf.Clean()
- o.t.SleepToResume()
- o.Refresh()
- case CharCtrlL:
- ClearScreen(o.w)
- o.Refresh()
- case MetaBackspace, CharCtrlW:
- o.buf.BackEscapeWord()
- case CharCtrlY:
- o.buf.Yank()
- case CharEnter, CharCtrlJ:
- if o.IsSearchMode() {
- o.ExitSearchMode(false)
- }
- o.buf.MoveToLineEnd()
- var data []rune
- if !o.GetConfig().UniqueEditLine {
- o.buf.WriteRune('\n')
- data = o.buf.Reset()
- data = data[:len(data)-1] // trim \n
- } else {
- o.buf.Clean()
- data = o.buf.Reset()
- }
- o.outchan <- data
- if !o.GetConfig().DisableAutoSaveHistory {
- // ignore IO error
- _ = o.history.New(data)
- } else {
- isUpdateHistory = false
- }
- case CharBackward:
- o.buf.MoveBackward()
- case CharForward:
- o.buf.MoveForward()
- case CharPrev:
- buf := o.history.Prev()
- if buf != nil {
- o.buf.Set(buf)
- } else {
- o.t.Bell()
- }
- case CharNext:
- buf, ok := o.history.Next()
- if ok {
- o.buf.Set(buf)
- } else {
- o.t.Bell()
- }
- case CharDelete:
- if o.buf.Len() > 0 || !o.IsNormalMode() {
- o.t.KickRead()
- if !o.buf.Delete() {
- o.t.Bell()
- }
- break
- }
-
- // treat as EOF
- if !o.GetConfig().UniqueEditLine {
- o.buf.WriteString(o.GetConfig().EOFPrompt + "\n")
- }
- o.buf.Reset()
- isUpdateHistory = false
- o.history.Revert()
- o.errchan <- io.EOF
- if o.GetConfig().UniqueEditLine {
- o.buf.Clean()
- }
- case CharInterrupt:
- if o.IsSearchMode() {
- o.t.KickRead()
- o.ExitSearchMode(true)
- break
- }
- if o.IsInCompleteMode() {
- o.t.KickRead()
- o.ExitCompleteMode(true)
- o.buf.Refresh(nil)
- break
- }
- o.buf.MoveToLineEnd()
- o.buf.Refresh(nil)
- hint := o.GetConfig().InterruptPrompt + "\n"
- if !o.GetConfig().UniqueEditLine {
- o.buf.WriteString(hint)
- }
- remain := o.buf.Reset()
- if !o.GetConfig().UniqueEditLine {
- remain = remain[:len(remain)-len([]rune(hint))]
- }
- isUpdateHistory = false
- o.history.Revert()
- o.errchan <- &InterruptError{remain}
- default:
- if o.IsSearchMode() {
- o.SearchChar(r)
- keepInSearchMode = true
- break
- }
- o.buf.WriteRune(r)
- if o.IsInCompleteMode() {
- o.OnComplete()
- keepInCompleteMode = true
- }
- }
-
- listener := o.GetConfig().Listener
- if listener != nil {
- newLine, newPos, ok := listener.OnChange(o.buf.Runes(), o.buf.Pos(), r)
- if ok {
- o.buf.SetWithIdx(newPos, newLine)
- }
- }
-
- o.m.Lock()
- if !keepInSearchMode && o.IsSearchMode() {
- o.ExitSearchMode(false)
- o.buf.Refresh(nil)
- } else if o.IsInCompleteMode() {
- if !keepInCompleteMode {
- o.ExitCompleteMode(false)
- o.Refresh()
- } else {
- o.buf.Refresh(nil)
- o.CompleteRefresh()
- }
- }
- if isUpdateHistory && !o.IsSearchMode() {
- // it will cause null history
- o.history.Update(o.buf.Runes(), false)
- }
- o.m.Unlock()
- }
-}
-
-func (o *Operation) Stderr() io.Writer {
- return &wrapWriter{target: o.GetConfig().Stderr, r: o, t: o.t}
-}
-
-func (o *Operation) Stdout() io.Writer {
- return &wrapWriter{target: o.GetConfig().Stdout, r: o, t: o.t}
-}
-
-func (o *Operation) String() (string, error) {
- r, err := o.Runes()
- return string(r), err
-}
-
-func (o *Operation) Runes() ([]rune, error) {
- o.t.EnterRawMode()
- defer o.t.ExitRawMode()
-
- listener := o.GetConfig().Listener
- if listener != nil {
- listener.OnChange(nil, 0, 0)
- }
-
- o.buf.Refresh(nil) // print prompt
- o.t.KickRead()
- select {
- case r := <-o.outchan:
- return r, nil
- case err := <-o.errchan:
- if e, ok := err.(*InterruptError); ok {
- return e.Line, ErrInterrupt
- }
- return nil, err
- }
-}
-
-func (o *Operation) PasswordEx(prompt string, l Listener) ([]byte, error) {
- cfg := o.GenPasswordConfig()
- cfg.Prompt = prompt
- cfg.Listener = l
- return o.PasswordWithConfig(cfg)
-}
-
-func (o *Operation) GenPasswordConfig() *Config {
- return o.opPassword.PasswordConfig()
-}
-
-func (o *Operation) PasswordWithConfig(cfg *Config) ([]byte, error) {
- if err := o.opPassword.EnterPasswordMode(cfg); err != nil {
- return nil, err
- }
- defer o.opPassword.ExitPasswordMode()
- return o.Slice()
-}
-
-func (o *Operation) Password(prompt string) ([]byte, error) {
- return o.PasswordEx(prompt, nil)
-}
-
-func (o *Operation) SetTitle(t string) {
- o.w.Write([]byte("\033[2;" + t + "\007"))
-}
-
-func (o *Operation) Slice() ([]byte, error) {
- r, err := o.Runes()
- if err != nil {
- return nil, err
- }
- return []byte(string(r)), nil
-}
-
-func (o *Operation) Close() {
- o.history.Close()
-}
-
-func (o *Operation) SetHistoryPath(path string) {
- if o.history != nil {
- o.history.Close()
- }
- o.cfg.HistoryFile = path
- o.history = newOpHistory(o.cfg)
-}
-
-func (o *Operation) IsNormalMode() bool {
- return !o.IsInCompleteMode() && !o.IsSearchMode()
-}
-
-func (op *Operation) SetConfig(cfg *Config) (*Config, error) {
- op.m.Lock()
- defer op.m.Unlock()
- if op.cfg == cfg {
- return op.cfg, nil
- }
- if err := cfg.Init(); err != nil {
- return op.cfg, err
- }
- old := op.cfg
- op.cfg = cfg
- op.SetPrompt(cfg.Prompt)
- op.SetMaskRune(cfg.MaskRune)
- op.buf.SetConfig(cfg)
- width := op.cfg.FuncGetWidth()
-
- if cfg.opHistory == nil {
- op.SetHistoryPath(cfg.HistoryFile)
- cfg.opHistory = op.history
- cfg.opSearch = newOpSearch(op.buf.w, op.buf, op.history, cfg, width)
- }
- op.history = cfg.opHistory
-
- // SetHistoryPath will close opHistory which already exists
- // so if we use it next time, we need to reopen it by `InitHistory()`
- op.history.Init()
-
- if op.cfg.AutoComplete != nil {
- op.opCompleter = newOpCompleter(op.buf.w, op, width)
- }
-
- op.opSearch = cfg.opSearch
- return old, nil
-}
-
-func (o *Operation) ResetHistory() {
- o.history.Reset()
-}
-
-// if err is not nil, it just mean it fail to write to file
-// other things goes fine.
-func (o *Operation) SaveHistory(content string) error {
- return o.history.New([]rune(content))
-}
-
-func (o *Operation) Refresh() {
- if o.t.IsReading() {
- o.buf.Refresh(nil)
- }
-}
-
-func (o *Operation) Clean() {
- o.buf.Clean()
-}
-
-func FuncListener(f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)) Listener {
- return &DumpListener{f: f}
-}
-
-type DumpListener struct {
- f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)
-}
-
-func (d *DumpListener) OnChange(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool) {
- return d.f(line, pos, key)
-}
-
-type Listener interface {
- OnChange(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)
-}
-
-type Painter interface {
- Paint(line []rune, pos int) []rune
-}
-
-type defaultPainter struct{}
-
-func (p *defaultPainter) Paint(line []rune, _ int) []rune {
- return line
-}
diff --git a/vendor/github.com/chzyer/readline/password.go b/vendor/github.com/chzyer/readline/password.go
deleted file mode 100644
index 414288c2..00000000
--- a/vendor/github.com/chzyer/readline/password.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package readline
-
-type opPassword struct {
- o *Operation
- backupCfg *Config
-}
-
-func newOpPassword(o *Operation) *opPassword {
- return &opPassword{o: o}
-}
-
-func (o *opPassword) ExitPasswordMode() {
- o.o.SetConfig(o.backupCfg)
- o.backupCfg = nil
-}
-
-func (o *opPassword) EnterPasswordMode(cfg *Config) (err error) {
- o.backupCfg, err = o.o.SetConfig(cfg)
- return
-}
-
-func (o *opPassword) PasswordConfig() *Config {
- return &Config{
- EnableMask: true,
- InterruptPrompt: "\n",
- EOFPrompt: "\n",
- HistoryLimit: -1,
- Painter: &defaultPainter{},
-
- Stdout: o.o.cfg.Stdout,
- Stderr: o.o.cfg.Stderr,
- }
-}
diff --git a/vendor/github.com/chzyer/readline/rawreader_windows.go b/vendor/github.com/chzyer/readline/rawreader_windows.go
deleted file mode 100644
index 073ef150..00000000
--- a/vendor/github.com/chzyer/readline/rawreader_windows.go
+++ /dev/null
@@ -1,125 +0,0 @@
-// +build windows
-
-package readline
-
-import "unsafe"
-
-const (
- VK_CANCEL = 0x03
- VK_BACK = 0x08
- VK_TAB = 0x09
- VK_RETURN = 0x0D
- VK_SHIFT = 0x10
- VK_CONTROL = 0x11
- VK_MENU = 0x12
- VK_ESCAPE = 0x1B
- VK_LEFT = 0x25
- VK_UP = 0x26
- VK_RIGHT = 0x27
- VK_DOWN = 0x28
- VK_DELETE = 0x2E
- VK_LSHIFT = 0xA0
- VK_RSHIFT = 0xA1
- VK_LCONTROL = 0xA2
- VK_RCONTROL = 0xA3
-)
-
-// RawReader translate input record to ANSI escape sequence.
-// To provides same behavior as unix terminal.
-type RawReader struct {
- ctrlKey bool
- altKey bool
-}
-
-func NewRawReader() *RawReader {
- r := new(RawReader)
- return r
-}
-
-// only process one action in one read
-func (r *RawReader) Read(buf []byte) (int, error) {
- ir := new(_INPUT_RECORD)
- var read int
- var err error
-next:
- err = kernel.ReadConsoleInputW(stdin,
- uintptr(unsafe.Pointer(ir)),
- 1,
- uintptr(unsafe.Pointer(&read)),
- )
- if err != nil {
- return 0, err
- }
- if ir.EventType != EVENT_KEY {
- goto next
- }
- ker := (*_KEY_EVENT_RECORD)(unsafe.Pointer(&ir.Event[0]))
- if ker.bKeyDown == 0 { // keyup
- if r.ctrlKey || r.altKey {
- switch ker.wVirtualKeyCode {
- case VK_RCONTROL, VK_LCONTROL:
- r.ctrlKey = false
- case VK_MENU: //alt
- r.altKey = false
- }
- }
- goto next
- }
-
- if ker.unicodeChar == 0 {
- var target rune
- switch ker.wVirtualKeyCode {
- case VK_RCONTROL, VK_LCONTROL:
- r.ctrlKey = true
- case VK_MENU: //alt
- r.altKey = true
- case VK_LEFT:
- target = CharBackward
- case VK_RIGHT:
- target = CharForward
- case VK_UP:
- target = CharPrev
- case VK_DOWN:
- target = CharNext
- }
- if target != 0 {
- return r.write(buf, target)
- }
- goto next
- }
- char := rune(ker.unicodeChar)
- if r.ctrlKey {
- switch char {
- case 'A':
- char = CharLineStart
- case 'E':
- char = CharLineEnd
- case 'R':
- char = CharBckSearch
- case 'S':
- char = CharFwdSearch
- }
- } else if r.altKey {
- switch char {
- case VK_BACK:
- char = CharBackspace
- }
- return r.writeEsc(buf, char)
- }
- return r.write(buf, char)
-}
-
-func (r *RawReader) writeEsc(b []byte, char rune) (int, error) {
- b[0] = '\033'
- n := copy(b[1:], []byte(string(char)))
- return n + 1, nil
-}
-
-func (r *RawReader) write(b []byte, char rune) (int, error) {
- n := copy(b, []byte(string(char)))
- return n, nil
-}
-
-func (r *RawReader) Close() error {
- return nil
-}
diff --git a/vendor/github.com/chzyer/readline/readline.go b/vendor/github.com/chzyer/readline/readline.go
deleted file mode 100644
index 0e7aca06..00000000
--- a/vendor/github.com/chzyer/readline/readline.go
+++ /dev/null
@@ -1,326 +0,0 @@
-// Readline is a pure go implementation for GNU-Readline kind library.
-//
-// example:
-// rl, err := readline.New("> ")
-// if err != nil {
-// panic(err)
-// }
-// defer rl.Close()
-//
-// for {
-// line, err := rl.Readline()
-// if err != nil { // io.EOF
-// break
-// }
-// println(line)
-// }
-//
-package readline
-
-import "io"
-
-type Instance struct {
- Config *Config
- Terminal *Terminal
- Operation *Operation
-}
-
-type Config struct {
- // prompt supports ANSI escape sequence, so we can color some characters even in windows
- Prompt string
-
- // readline will persist historys to file where HistoryFile specified
- HistoryFile string
- // specify the max length of historys, it's 500 by default, set it to -1 to disable history
- HistoryLimit int
- DisableAutoSaveHistory bool
- // enable case-insensitive history searching
- HistorySearchFold bool
-
- // AutoCompleter will called once user press TAB
- AutoComplete AutoCompleter
-
- // Any key press will pass to Listener
- // NOTE: Listener will be triggered by (nil, 0, 0) immediately
- Listener Listener
-
- Painter Painter
-
- // If VimMode is true, readline will in vim.insert mode by default
- VimMode bool
-
- InterruptPrompt string
- EOFPrompt string
-
- FuncGetWidth func() int
-
- Stdin io.ReadCloser
- StdinWriter io.Writer
- Stdout io.Writer
- Stderr io.Writer
-
- EnableMask bool
- MaskRune rune
-
- // erase the editing line after user submited it
- // it use in IM usually.
- UniqueEditLine bool
-
- // filter input runes (may be used to disable CtrlZ or for translating some keys to different actions)
- // -> output = new (translated) rune and true/false if continue with processing this one
- FuncFilterInputRune func(rune) (rune, bool)
-
- // force use interactive even stdout is not a tty
- FuncIsTerminal func() bool
- FuncMakeRaw func() error
- FuncExitRaw func() error
- FuncOnWidthChanged func(func())
- ForceUseInteractive bool
-
- // private fields
- inited bool
- opHistory *opHistory
- opSearch *opSearch
-}
-
-func (c *Config) useInteractive() bool {
- if c.ForceUseInteractive {
- return true
- }
- return c.FuncIsTerminal()
-}
-
-func (c *Config) Init() error {
- if c.inited {
- return nil
- }
- c.inited = true
- if c.Stdin == nil {
- c.Stdin = NewCancelableStdin(Stdin)
- }
-
- c.Stdin, c.StdinWriter = NewFillableStdin(c.Stdin)
-
- if c.Stdout == nil {
- c.Stdout = Stdout
- }
- if c.Stderr == nil {
- c.Stderr = Stderr
- }
- if c.HistoryLimit == 0 {
- c.HistoryLimit = 500
- }
-
- if c.InterruptPrompt == "" {
- c.InterruptPrompt = "^C"
- } else if c.InterruptPrompt == "\n" {
- c.InterruptPrompt = ""
- }
- if c.EOFPrompt == "" {
- c.EOFPrompt = "^D"
- } else if c.EOFPrompt == "\n" {
- c.EOFPrompt = ""
- }
-
- if c.AutoComplete == nil {
- c.AutoComplete = &TabCompleter{}
- }
- if c.FuncGetWidth == nil {
- c.FuncGetWidth = GetScreenWidth
- }
- if c.FuncIsTerminal == nil {
- c.FuncIsTerminal = DefaultIsTerminal
- }
- rm := new(RawMode)
- if c.FuncMakeRaw == nil {
- c.FuncMakeRaw = rm.Enter
- }
- if c.FuncExitRaw == nil {
- c.FuncExitRaw = rm.Exit
- }
- if c.FuncOnWidthChanged == nil {
- c.FuncOnWidthChanged = DefaultOnWidthChanged
- }
-
- return nil
-}
-
-func (c Config) Clone() *Config {
- c.opHistory = nil
- c.opSearch = nil
- return &c
-}
-
-func (c *Config) SetListener(f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)) {
- c.Listener = FuncListener(f)
-}
-
-func (c *Config) SetPainter(p Painter) {
- c.Painter = p
-}
-
-func NewEx(cfg *Config) (*Instance, error) {
- t, err := NewTerminal(cfg)
- if err != nil {
- return nil, err
- }
- rl := t.Readline()
- if cfg.Painter == nil {
- cfg.Painter = &defaultPainter{}
- }
- return &Instance{
- Config: cfg,
- Terminal: t,
- Operation: rl,
- }, nil
-}
-
-func New(prompt string) (*Instance, error) {
- return NewEx(&Config{Prompt: prompt})
-}
-
-func (i *Instance) ResetHistory() {
- i.Operation.ResetHistory()
-}
-
-func (i *Instance) SetPrompt(s string) {
- i.Operation.SetPrompt(s)
-}
-
-func (i *Instance) SetMaskRune(r rune) {
- i.Operation.SetMaskRune(r)
-}
-
-// change history persistence in runtime
-func (i *Instance) SetHistoryPath(p string) {
- i.Operation.SetHistoryPath(p)
-}
-
-// readline will refresh automatic when write through Stdout()
-func (i *Instance) Stdout() io.Writer {
- return i.Operation.Stdout()
-}
-
-// readline will refresh automatic when write through Stdout()
-func (i *Instance) Stderr() io.Writer {
- return i.Operation.Stderr()
-}
-
-// switch VimMode in runtime
-func (i *Instance) SetVimMode(on bool) {
- i.Operation.SetVimMode(on)
-}
-
-func (i *Instance) IsVimMode() bool {
- return i.Operation.IsEnableVimMode()
-}
-
-func (i *Instance) GenPasswordConfig() *Config {
- return i.Operation.GenPasswordConfig()
-}
-
-// we can generate a config by `i.GenPasswordConfig()`
-func (i *Instance) ReadPasswordWithConfig(cfg *Config) ([]byte, error) {
- return i.Operation.PasswordWithConfig(cfg)
-}
-
-func (i *Instance) ReadPasswordEx(prompt string, l Listener) ([]byte, error) {
- return i.Operation.PasswordEx(prompt, l)
-}
-
-func (i *Instance) ReadPassword(prompt string) ([]byte, error) {
- return i.Operation.Password(prompt)
-}
-
-type Result struct {
- Line string
- Error error
-}
-
-func (l *Result) CanContinue() bool {
- return len(l.Line) != 0 && l.Error == ErrInterrupt
-}
-
-func (l *Result) CanBreak() bool {
- return !l.CanContinue() && l.Error != nil
-}
-
-func (i *Instance) Line() *Result {
- ret, err := i.Readline()
- return &Result{ret, err}
-}
-
-// err is one of (nil, io.EOF, readline.ErrInterrupt)
-func (i *Instance) Readline() (string, error) {
- return i.Operation.String()
-}
-
-func (i *Instance) ReadlineWithDefault(what string) (string, error) {
- i.Operation.SetBuffer(what)
- return i.Operation.String()
-}
-
-func (i *Instance) SaveHistory(content string) error {
- return i.Operation.SaveHistory(content)
-}
-
-// same as readline
-func (i *Instance) ReadSlice() ([]byte, error) {
- return i.Operation.Slice()
-}
-
-// we must make sure that call Close() before process exit.
-func (i *Instance) Close() error {
- if err := i.Terminal.Close(); err != nil {
- return err
- }
- i.Config.Stdin.Close()
- i.Operation.Close()
- return nil
-}
-func (i *Instance) Clean() {
- i.Operation.Clean()
-}
-
-func (i *Instance) Write(b []byte) (int, error) {
- return i.Stdout().Write(b)
-}
-
-// WriteStdin prefill the next Stdin fetch
-// Next time you call ReadLine() this value will be writen before the user input
-// ie :
-// i := readline.New()
-// i.WriteStdin([]byte("test"))
-// _, _= i.Readline()
-//
-// gives
-//
-// > test[cursor]
-func (i *Instance) WriteStdin(val []byte) (int, error) {
- return i.Terminal.WriteStdin(val)
-}
-
-func (i *Instance) SetConfig(cfg *Config) *Config {
- if i.Config == cfg {
- return cfg
- }
- old := i.Config
- i.Config = cfg
- i.Operation.SetConfig(cfg)
- i.Terminal.SetConfig(cfg)
- return old
-}
-
-func (i *Instance) Refresh() {
- i.Operation.Refresh()
-}
-
-// HistoryDisable the save of the commands into the history
-func (i *Instance) HistoryDisable() {
- i.Operation.history.Disable()
-}
-
-// HistoryEnable the save of the commands into the history (default on)
-func (i *Instance) HistoryEnable() {
- i.Operation.history.Enable()
-}
diff --git a/vendor/github.com/chzyer/readline/readline_test.go b/vendor/github.com/chzyer/readline/readline_test.go
deleted file mode 100644
index 34a5a3b5..00000000
--- a/vendor/github.com/chzyer/readline/readline_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package readline
-
-import (
- "testing"
- "time"
-)
-
-func TestRace(t *testing.T) {
- rl, err := NewEx(&Config{})
- if err != nil {
- t.Fatal(err)
- return
- }
-
- go func() {
- for range time.Tick(time.Millisecond) {
- rl.SetPrompt("hello")
- }
- }()
-
- go func() {
- time.Sleep(100 * time.Millisecond)
- rl.Close()
- }()
-
- rl.Readline()
-}
diff --git a/vendor/github.com/chzyer/readline/remote.go b/vendor/github.com/chzyer/readline/remote.go
deleted file mode 100644
index 74dbf569..00000000
--- a/vendor/github.com/chzyer/readline/remote.go
+++ /dev/null
@@ -1,475 +0,0 @@
-package readline
-
-import (
- "bufio"
- "bytes"
- "encoding/binary"
- "fmt"
- "io"
- "net"
- "os"
- "sync"
- "sync/atomic"
-)
-
-type MsgType int16
-
-const (
- T_DATA = MsgType(iota)
- T_WIDTH
- T_WIDTH_REPORT
- T_ISTTY_REPORT
- T_RAW
- T_ERAW // exit raw
- T_EOF
-)
-
-type RemoteSvr struct {
- eof int32
- closed int32
- width int32
- reciveChan chan struct{}
- writeChan chan *writeCtx
- conn net.Conn
- isTerminal bool
- funcWidthChan func()
- stopChan chan struct{}
-
- dataBufM sync.Mutex
- dataBuf bytes.Buffer
-}
-
-type writeReply struct {
- n int
- err error
-}
-
-type writeCtx struct {
- msg *Message
- reply chan *writeReply
-}
-
-func newWriteCtx(msg *Message) *writeCtx {
- return &writeCtx{
- msg: msg,
- reply: make(chan *writeReply),
- }
-}
-
-func NewRemoteSvr(conn net.Conn) (*RemoteSvr, error) {
- rs := &RemoteSvr{
- width: -1,
- conn: conn,
- writeChan: make(chan *writeCtx),
- reciveChan: make(chan struct{}),
- stopChan: make(chan struct{}),
- }
- buf := bufio.NewReader(rs.conn)
-
- if err := rs.init(buf); err != nil {
- return nil, err
- }
-
- go rs.readLoop(buf)
- go rs.writeLoop()
- return rs, nil
-}
-
-func (r *RemoteSvr) init(buf *bufio.Reader) error {
- m, err := ReadMessage(buf)
- if err != nil {
- return err
- }
- // receive isTerminal
- if m.Type != T_ISTTY_REPORT {
- return fmt.Errorf("unexpected init message")
- }
- r.GotIsTerminal(m.Data)
-
- // receive width
- m, err = ReadMessage(buf)
- if err != nil {
- return err
- }
- if m.Type != T_WIDTH_REPORT {
- return fmt.Errorf("unexpected init message")
- }
- r.GotReportWidth(m.Data)
-
- return nil
-}
-
-func (r *RemoteSvr) HandleConfig(cfg *Config) {
- cfg.Stderr = r
- cfg.Stdout = r
- cfg.Stdin = r
- cfg.FuncExitRaw = r.ExitRawMode
- cfg.FuncIsTerminal = r.IsTerminal
- cfg.FuncMakeRaw = r.EnterRawMode
- cfg.FuncExitRaw = r.ExitRawMode
- cfg.FuncGetWidth = r.GetWidth
- cfg.FuncOnWidthChanged = func(f func()) {
- r.funcWidthChan = f
- }
-}
-
-func (r *RemoteSvr) IsTerminal() bool {
- return r.isTerminal
-}
-
-func (r *RemoteSvr) checkEOF() error {
- if atomic.LoadInt32(&r.eof) == 1 {
- return io.EOF
- }
- return nil
-}
-
-func (r *RemoteSvr) Read(b []byte) (int, error) {
- r.dataBufM.Lock()
- n, err := r.dataBuf.Read(b)
- r.dataBufM.Unlock()
- if n == 0 {
- if err := r.checkEOF(); err != nil {
- return 0, err
- }
- }
-
- if n == 0 && err == io.EOF {
- <-r.reciveChan
- r.dataBufM.Lock()
- n, err = r.dataBuf.Read(b)
- r.dataBufM.Unlock()
- }
- if n == 0 {
- if err := r.checkEOF(); err != nil {
- return 0, err
- }
- }
-
- return n, err
-}
-
-func (r *RemoteSvr) writeMsg(m *Message) error {
- ctx := newWriteCtx(m)
- r.writeChan <- ctx
- reply := <-ctx.reply
- return reply.err
-}
-
-func (r *RemoteSvr) Write(b []byte) (int, error) {
- ctx := newWriteCtx(NewMessage(T_DATA, b))
- r.writeChan <- ctx
- reply := <-ctx.reply
- return reply.n, reply.err
-}
-
-func (r *RemoteSvr) EnterRawMode() error {
- return r.writeMsg(NewMessage(T_RAW, nil))
-}
-
-func (r *RemoteSvr) ExitRawMode() error {
- return r.writeMsg(NewMessage(T_ERAW, nil))
-}
-
-func (r *RemoteSvr) writeLoop() {
- defer r.Close()
-
-loop:
- for {
- select {
- case ctx, ok := <-r.writeChan:
- if !ok {
- break
- }
- n, err := ctx.msg.WriteTo(r.conn)
- ctx.reply <- &writeReply{n, err}
- case <-r.stopChan:
- break loop
- }
- }
-}
-
-func (r *RemoteSvr) Close() error {
- if atomic.CompareAndSwapInt32(&r.closed, 0, 1) {
- close(r.stopChan)
- r.conn.Close()
- }
- return nil
-}
-
-func (r *RemoteSvr) readLoop(buf *bufio.Reader) {
- defer r.Close()
- for {
- m, err := ReadMessage(buf)
- if err != nil {
- break
- }
- switch m.Type {
- case T_EOF:
- atomic.StoreInt32(&r.eof, 1)
- select {
- case r.reciveChan <- struct{}{}:
- default:
- }
- case T_DATA:
- r.dataBufM.Lock()
- r.dataBuf.Write(m.Data)
- r.dataBufM.Unlock()
- select {
- case r.reciveChan <- struct{}{}:
- default:
- }
- case T_WIDTH_REPORT:
- r.GotReportWidth(m.Data)
- case T_ISTTY_REPORT:
- r.GotIsTerminal(m.Data)
- }
- }
-}
-
-func (r *RemoteSvr) GotIsTerminal(data []byte) {
- if binary.BigEndian.Uint16(data) == 0 {
- r.isTerminal = false
- } else {
- r.isTerminal = true
- }
-}
-
-func (r *RemoteSvr) GotReportWidth(data []byte) {
- atomic.StoreInt32(&r.width, int32(binary.BigEndian.Uint16(data)))
- if r.funcWidthChan != nil {
- r.funcWidthChan()
- }
-}
-
-func (r *RemoteSvr) GetWidth() int {
- return int(atomic.LoadInt32(&r.width))
-}
-
-// -----------------------------------------------------------------------------
-
-type Message struct {
- Type MsgType
- Data []byte
-}
-
-func ReadMessage(r io.Reader) (*Message, error) {
- m := new(Message)
- var length int32
- if err := binary.Read(r, binary.BigEndian, &length); err != nil {
- return nil, err
- }
- if err := binary.Read(r, binary.BigEndian, &m.Type); err != nil {
- return nil, err
- }
- m.Data = make([]byte, int(length)-2)
- if _, err := io.ReadFull(r, m.Data); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-func NewMessage(t MsgType, data []byte) *Message {
- return &Message{t, data}
-}
-
-func (m *Message) WriteTo(w io.Writer) (int, error) {
- buf := bytes.NewBuffer(make([]byte, 0, len(m.Data)+2+4))
- binary.Write(buf, binary.BigEndian, int32(len(m.Data)+2))
- binary.Write(buf, binary.BigEndian, m.Type)
- buf.Write(m.Data)
- n, err := buf.WriteTo(w)
- return int(n), err
-}
-
-// -----------------------------------------------------------------------------
-
-type RemoteCli struct {
- conn net.Conn
- raw RawMode
- receiveChan chan struct{}
- inited int32
- isTerminal *bool
-
- data bytes.Buffer
- dataM sync.Mutex
-}
-
-func NewRemoteCli(conn net.Conn) (*RemoteCli, error) {
- r := &RemoteCli{
- conn: conn,
- receiveChan: make(chan struct{}),
- }
- return r, nil
-}
-
-func (r *RemoteCli) MarkIsTerminal(is bool) {
- r.isTerminal = &is
-}
-
-func (r *RemoteCli) init() error {
- if !atomic.CompareAndSwapInt32(&r.inited, 0, 1) {
- return nil
- }
-
- if err := r.reportIsTerminal(); err != nil {
- return err
- }
-
- if err := r.reportWidth(); err != nil {
- return err
- }
-
- // register sig for width changed
- DefaultOnWidthChanged(func() {
- r.reportWidth()
- })
- return nil
-}
-
-func (r *RemoteCli) writeMsg(m *Message) error {
- r.dataM.Lock()
- _, err := m.WriteTo(r.conn)
- r.dataM.Unlock()
- return err
-}
-
-func (r *RemoteCli) Write(b []byte) (int, error) {
- m := NewMessage(T_DATA, b)
- r.dataM.Lock()
- _, err := m.WriteTo(r.conn)
- r.dataM.Unlock()
- return len(b), err
-}
-
-func (r *RemoteCli) reportWidth() error {
- screenWidth := GetScreenWidth()
- data := make([]byte, 2)
- binary.BigEndian.PutUint16(data, uint16(screenWidth))
- msg := NewMessage(T_WIDTH_REPORT, data)
-
- if err := r.writeMsg(msg); err != nil {
- return err
- }
- return nil
-}
-
-func (r *RemoteCli) reportIsTerminal() error {
- var isTerminal bool
- if r.isTerminal != nil {
- isTerminal = *r.isTerminal
- } else {
- isTerminal = DefaultIsTerminal()
- }
- data := make([]byte, 2)
- if isTerminal {
- binary.BigEndian.PutUint16(data, 1)
- } else {
- binary.BigEndian.PutUint16(data, 0)
- }
- msg := NewMessage(T_ISTTY_REPORT, data)
- if err := r.writeMsg(msg); err != nil {
- return err
- }
- return nil
-}
-
-func (r *RemoteCli) readLoop() {
- buf := bufio.NewReader(r.conn)
- for {
- msg, err := ReadMessage(buf)
- if err != nil {
- break
- }
- switch msg.Type {
- case T_ERAW:
- r.raw.Exit()
- case T_RAW:
- r.raw.Enter()
- case T_DATA:
- os.Stdout.Write(msg.Data)
- }
- }
-}
-
-func (r *RemoteCli) ServeBy(source io.Reader) error {
- if err := r.init(); err != nil {
- return err
- }
-
- go func() {
- defer r.Close()
- for {
- n, _ := io.Copy(r, source)
- if n == 0 {
- break
- }
- }
- }()
- defer r.raw.Exit()
- r.readLoop()
- return nil
-}
-
-func (r *RemoteCli) Close() {
- r.writeMsg(NewMessage(T_EOF, nil))
-}
-
-func (r *RemoteCli) Serve() error {
- return r.ServeBy(os.Stdin)
-}
-
-func ListenRemote(n, addr string, cfg *Config, h func(*Instance), onListen ...func(net.Listener) error) error {
- ln, err := net.Listen(n, addr)
- if err != nil {
- return err
- }
- if len(onListen) > 0 {
- if err := onListen[0](ln); err != nil {
- return err
- }
- }
- for {
- conn, err := ln.Accept()
- if err != nil {
- break
- }
- go func() {
- defer conn.Close()
- rl, err := HandleConn(*cfg, conn)
- if err != nil {
- return
- }
- h(rl)
- }()
- }
- return nil
-}
-
-func HandleConn(cfg Config, conn net.Conn) (*Instance, error) {
- r, err := NewRemoteSvr(conn)
- if err != nil {
- return nil, err
- }
- r.HandleConfig(&cfg)
-
- rl, err := NewEx(&cfg)
- if err != nil {
- return nil, err
- }
- return rl, nil
-}
-
-func DialRemote(n, addr string) error {
- conn, err := net.Dial(n, addr)
- if err != nil {
- return err
- }
- defer conn.Close()
-
- cli, err := NewRemoteCli(conn)
- if err != nil {
- return err
- }
- return cli.Serve()
-}
diff --git a/vendor/github.com/chzyer/readline/runebuf.go b/vendor/github.com/chzyer/readline/runebuf.go
deleted file mode 100644
index 81d2da50..00000000
--- a/vendor/github.com/chzyer/readline/runebuf.go
+++ /dev/null
@@ -1,629 +0,0 @@
-package readline
-
-import (
- "bufio"
- "bytes"
- "io"
- "strconv"
- "strings"
- "sync"
-)
-
-type runeBufferBck struct {
- buf []rune
- idx int
-}
-
-type RuneBuffer struct {
- buf []rune
- idx int
- prompt []rune
- w io.Writer
-
- hadClean bool
- interactive bool
- cfg *Config
-
- width int
-
- bck *runeBufferBck
-
- offset string
-
- lastKill []rune
-
- sync.Mutex
-}
-
-func (r* RuneBuffer) pushKill(text []rune) {
- r.lastKill = append([]rune{}, text...)
-}
-
-func (r *RuneBuffer) OnWidthChange(newWidth int) {
- r.Lock()
- r.width = newWidth
- r.Unlock()
-}
-
-func (r *RuneBuffer) Backup() {
- r.Lock()
- r.bck = &runeBufferBck{r.buf, r.idx}
- r.Unlock()
-}
-
-func (r *RuneBuffer) Restore() {
- r.Refresh(func() {
- if r.bck == nil {
- return
- }
- r.buf = r.bck.buf
- r.idx = r.bck.idx
- })
-}
-
-func NewRuneBuffer(w io.Writer, prompt string, cfg *Config, width int) *RuneBuffer {
- rb := &RuneBuffer{
- w: w,
- interactive: cfg.useInteractive(),
- cfg: cfg,
- width: width,
- }
- rb.SetPrompt(prompt)
- return rb
-}
-
-func (r *RuneBuffer) SetConfig(cfg *Config) {
- r.Lock()
- r.cfg = cfg
- r.interactive = cfg.useInteractive()
- r.Unlock()
-}
-
-func (r *RuneBuffer) SetMask(m rune) {
- r.Lock()
- r.cfg.MaskRune = m
- r.Unlock()
-}
-
-func (r *RuneBuffer) CurrentWidth(x int) int {
- r.Lock()
- defer r.Unlock()
- return runes.WidthAll(r.buf[:x])
-}
-
-func (r *RuneBuffer) PromptLen() int {
- r.Lock()
- width := r.promptLen()
- r.Unlock()
- return width
-}
-
-func (r *RuneBuffer) promptLen() int {
- return runes.WidthAll(runes.ColorFilter(r.prompt))
-}
-
-func (r *RuneBuffer) RuneSlice(i int) []rune {
- r.Lock()
- defer r.Unlock()
-
- if i > 0 {
- rs := make([]rune, i)
- copy(rs, r.buf[r.idx:r.idx+i])
- return rs
- }
- rs := make([]rune, -i)
- copy(rs, r.buf[r.idx+i:r.idx])
- return rs
-}
-
-func (r *RuneBuffer) Runes() []rune {
- r.Lock()
- newr := make([]rune, len(r.buf))
- copy(newr, r.buf)
- r.Unlock()
- return newr
-}
-
-func (r *RuneBuffer) Pos() int {
- r.Lock()
- defer r.Unlock()
- return r.idx
-}
-
-func (r *RuneBuffer) Len() int {
- r.Lock()
- defer r.Unlock()
- return len(r.buf)
-}
-
-func (r *RuneBuffer) MoveToLineStart() {
- r.Refresh(func() {
- if r.idx == 0 {
- return
- }
- r.idx = 0
- })
-}
-
-func (r *RuneBuffer) MoveBackward() {
- r.Refresh(func() {
- if r.idx == 0 {
- return
- }
- r.idx--
- })
-}
-
-func (r *RuneBuffer) WriteString(s string) {
- r.WriteRunes([]rune(s))
-}
-
-func (r *RuneBuffer) WriteRune(s rune) {
- r.WriteRunes([]rune{s})
-}
-
-func (r *RuneBuffer) WriteRunes(s []rune) {
- r.Refresh(func() {
- tail := append(s, r.buf[r.idx:]...)
- r.buf = append(r.buf[:r.idx], tail...)
- r.idx += len(s)
- })
-}
-
-func (r *RuneBuffer) MoveForward() {
- r.Refresh(func() {
- if r.idx == len(r.buf) {
- return
- }
- r.idx++
- })
-}
-
-func (r *RuneBuffer) IsCursorInEnd() bool {
- r.Lock()
- defer r.Unlock()
- return r.idx == len(r.buf)
-}
-
-func (r *RuneBuffer) Replace(ch rune) {
- r.Refresh(func() {
- r.buf[r.idx] = ch
- })
-}
-
-func (r *RuneBuffer) Erase() {
- r.Refresh(func() {
- r.idx = 0
- r.pushKill(r.buf[:])
- r.buf = r.buf[:0]
- })
-}
-
-func (r *RuneBuffer) Delete() (success bool) {
- r.Refresh(func() {
- if r.idx == len(r.buf) {
- return
- }
- r.pushKill(r.buf[r.idx : r.idx+1])
- r.buf = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
- success = true
- })
- return
-}
-
-func (r *RuneBuffer) DeleteWord() {
- if r.idx == len(r.buf) {
- return
- }
- init := r.idx
- for init < len(r.buf) && IsWordBreak(r.buf[init]) {
- init++
- }
- for i := init + 1; i < len(r.buf); i++ {
- if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
- r.pushKill(r.buf[r.idx:i-1])
- r.Refresh(func() {
- r.buf = append(r.buf[:r.idx], r.buf[i-1:]...)
- })
- return
- }
- }
- r.Kill()
-}
-
-func (r *RuneBuffer) MoveToPrevWord() (success bool) {
- r.Refresh(func() {
- if r.idx == 0 {
- return
- }
-
- for i := r.idx - 1; i > 0; i-- {
- if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
- r.idx = i
- success = true
- return
- }
- }
- r.idx = 0
- success = true
- })
- return
-}
-
-func (r *RuneBuffer) KillFront() {
- r.Refresh(func() {
- if r.idx == 0 {
- return
- }
-
- length := len(r.buf) - r.idx
- r.pushKill(r.buf[:r.idx])
- copy(r.buf[:length], r.buf[r.idx:])
- r.idx = 0
- r.buf = r.buf[:length]
- })
-}
-
-func (r *RuneBuffer) Kill() {
- r.Refresh(func() {
- r.pushKill(r.buf[r.idx:])
- r.buf = r.buf[:r.idx]
- })
-}
-
-func (r *RuneBuffer) Transpose() {
- r.Refresh(func() {
- if len(r.buf) == 1 {
- r.idx++
- }
-
- if len(r.buf) < 2 {
- return
- }
-
- if r.idx == 0 {
- r.idx = 1
- } else if r.idx >= len(r.buf) {
- r.idx = len(r.buf) - 1
- }
- r.buf[r.idx], r.buf[r.idx-1] = r.buf[r.idx-1], r.buf[r.idx]
- r.idx++
- })
-}
-
-func (r *RuneBuffer) MoveToNextWord() {
- r.Refresh(func() {
- for i := r.idx + 1; i < len(r.buf); i++ {
- if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
- r.idx = i
- return
- }
- }
-
- r.idx = len(r.buf)
- })
-}
-
-func (r *RuneBuffer) MoveToEndWord() {
- r.Refresh(func() {
- // already at the end, so do nothing
- if r.idx == len(r.buf) {
- return
- }
- // if we are at the end of a word already, go to next
- if !IsWordBreak(r.buf[r.idx]) && IsWordBreak(r.buf[r.idx+1]) {
- r.idx++
- }
-
- // keep going until at the end of a word
- for i := r.idx + 1; i < len(r.buf); i++ {
- if IsWordBreak(r.buf[i]) && !IsWordBreak(r.buf[i-1]) {
- r.idx = i - 1
- return
- }
- }
- r.idx = len(r.buf)
- })
-}
-
-func (r *RuneBuffer) BackEscapeWord() {
- r.Refresh(func() {
- if r.idx == 0 {
- return
- }
- for i := r.idx - 1; i > 0; i-- {
- if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
- r.pushKill(r.buf[i:r.idx])
- r.buf = append(r.buf[:i], r.buf[r.idx:]...)
- r.idx = i
- return
- }
- }
-
- r.buf = r.buf[:0]
- r.idx = 0
- })
-}
-
-func (r *RuneBuffer) Yank() {
- if len(r.lastKill) == 0 {
- return
- }
- r.Refresh(func() {
- buf := make([]rune, 0, len(r.buf) + len(r.lastKill))
- buf = append(buf, r.buf[:r.idx]...)
- buf = append(buf, r.lastKill...)
- buf = append(buf, r.buf[r.idx:]...)
- r.buf = buf
- r.idx += len(r.lastKill)
- })
-}
-
-func (r *RuneBuffer) Backspace() {
- r.Refresh(func() {
- if r.idx == 0 {
- return
- }
-
- r.idx--
- r.buf = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
- })
-}
-
-func (r *RuneBuffer) MoveToLineEnd() {
- r.Refresh(func() {
- if r.idx == len(r.buf) {
- return
- }
-
- r.idx = len(r.buf)
- })
-}
-
-func (r *RuneBuffer) LineCount(width int) int {
- if width == -1 {
- width = r.width
- }
- return LineCount(width,
- runes.WidthAll(r.buf)+r.PromptLen())
-}
-
-func (r *RuneBuffer) MoveTo(ch rune, prevChar, reverse bool) (success bool) {
- r.Refresh(func() {
- if reverse {
- for i := r.idx - 1; i >= 0; i-- {
- if r.buf[i] == ch {
- r.idx = i
- if prevChar {
- r.idx++
- }
- success = true
- return
- }
- }
- return
- }
- for i := r.idx + 1; i < len(r.buf); i++ {
- if r.buf[i] == ch {
- r.idx = i
- if prevChar {
- r.idx--
- }
- success = true
- return
- }
- }
- })
- return
-}
-
-func (r *RuneBuffer) isInLineEdge() bool {
- if isWindows {
- return false
- }
- sp := r.getSplitByLine(r.buf)
- return len(sp[len(sp)-1]) == 0
-}
-
-func (r *RuneBuffer) getSplitByLine(rs []rune) []string {
- return SplitByLine(r.promptLen(), r.width, rs)
-}
-
-func (r *RuneBuffer) IdxLine(width int) int {
- r.Lock()
- defer r.Unlock()
- return r.idxLine(width)
-}
-
-func (r *RuneBuffer) idxLine(width int) int {
- if width == 0 {
- return 0
- }
- sp := r.getSplitByLine(r.buf[:r.idx])
- return len(sp) - 1
-}
-
-func (r *RuneBuffer) CursorLineCount() int {
- return r.LineCount(r.width) - r.IdxLine(r.width)
-}
-
-func (r *RuneBuffer) Refresh(f func()) {
- r.Lock()
- defer r.Unlock()
-
- if !r.interactive {
- if f != nil {
- f()
- }
- return
- }
-
- r.clean()
- if f != nil {
- f()
- }
- r.print()
-}
-
-func (r *RuneBuffer) SetOffset(offset string) {
- r.Lock()
- r.offset = offset
- r.Unlock()
-}
-
-func (r *RuneBuffer) print() {
- r.w.Write(r.output())
- r.hadClean = false
-}
-
-func (r *RuneBuffer) output() []byte {
- buf := bytes.NewBuffer(nil)
- buf.WriteString(string(r.prompt))
- if r.cfg.EnableMask && len(r.buf) > 0 {
- buf.Write([]byte(strings.Repeat(string(r.cfg.MaskRune), len(r.buf)-1)))
- if r.buf[len(r.buf)-1] == '\n' {
- buf.Write([]byte{'\n'})
- } else {
- buf.Write([]byte(string(r.cfg.MaskRune)))
- }
- if len(r.buf) > r.idx {
- buf.Write(r.getBackspaceSequence())
- }
-
- } else {
- for _, e := range r.cfg.Painter.Paint(r.buf, r.idx) {
- if e == '\t' {
- buf.WriteString(strings.Repeat(" ", TabWidth))
- } else {
- buf.WriteRune(e)
- }
- }
- if r.isInLineEdge() {
- buf.Write([]byte(" \b"))
- }
- }
- // cursor position
- if len(r.buf) > r.idx {
- buf.Write(r.getBackspaceSequence())
- }
- return buf.Bytes()
-}
-
-func (r *RuneBuffer) getBackspaceSequence() []byte {
- var sep = map[int]bool{}
-
- var i int
- for {
- if i >= runes.WidthAll(r.buf) {
- break
- }
-
- if i == 0 {
- i -= r.promptLen()
- }
- i += r.width
-
- sep[i] = true
- }
- var buf []byte
- for i := len(r.buf); i > r.idx; i-- {
- // move input to the left of one
- buf = append(buf, '\b')
- if sep[i] {
- // up one line, go to the start of the line and move cursor right to the end (r.width)
- buf = append(buf, "\033[A\r"+"\033["+strconv.Itoa(r.width)+"C"...)
- }
- }
-
- return buf
-
-}
-
-func (r *RuneBuffer) Reset() []rune {
- ret := runes.Copy(r.buf)
- r.buf = r.buf[:0]
- r.idx = 0
- return ret
-}
-
-func (r *RuneBuffer) calWidth(m int) int {
- if m > 0 {
- return runes.WidthAll(r.buf[r.idx : r.idx+m])
- }
- return runes.WidthAll(r.buf[r.idx+m : r.idx])
-}
-
-func (r *RuneBuffer) SetStyle(start, end int, style string) {
- if end < start {
- panic("end < start")
- }
-
- // goto start
- move := start - r.idx
- if move > 0 {
- r.w.Write([]byte(string(r.buf[r.idx : r.idx+move])))
- } else {
- r.w.Write(bytes.Repeat([]byte("\b"), r.calWidth(move)))
- }
- r.w.Write([]byte("\033[" + style + "m"))
- r.w.Write([]byte(string(r.buf[start:end])))
- r.w.Write([]byte("\033[0m"))
- // TODO: move back
-}
-
-func (r *RuneBuffer) SetWithIdx(idx int, buf []rune) {
- r.Refresh(func() {
- r.buf = buf
- r.idx = idx
- })
-}
-
-func (r *RuneBuffer) Set(buf []rune) {
- r.SetWithIdx(len(buf), buf)
-}
-
-func (r *RuneBuffer) SetPrompt(prompt string) {
- r.Lock()
- r.prompt = []rune(prompt)
- r.Unlock()
-}
-
-func (r *RuneBuffer) cleanOutput(w io.Writer, idxLine int) {
- buf := bufio.NewWriter(w)
-
- if r.width == 0 {
- buf.WriteString(strings.Repeat("\r\b", len(r.buf)+r.promptLen()))
- buf.Write([]byte("\033[J"))
- } else {
- buf.Write([]byte("\033[J")) // just like ^k :)
- if idxLine == 0 {
- buf.WriteString("\033[2K")
- buf.WriteString("\r")
- } else {
- for i := 0; i < idxLine; i++ {
- io.WriteString(buf, "\033[2K\r\033[A")
- }
- io.WriteString(buf, "\033[2K\r")
- }
- }
- buf.Flush()
- return
-}
-
-func (r *RuneBuffer) Clean() {
- r.Lock()
- r.clean()
- r.Unlock()
-}
-
-func (r *RuneBuffer) clean() {
- r.cleanWithIdxLine(r.idxLine(r.width))
-}
-
-func (r *RuneBuffer) cleanWithIdxLine(idxLine int) {
- if r.hadClean || !r.interactive {
- return
- }
- r.hadClean = true
- r.cleanOutput(r.w, idxLine)
-}
diff --git a/vendor/github.com/chzyer/readline/runes.go b/vendor/github.com/chzyer/readline/runes.go
deleted file mode 100644
index a669bc48..00000000
--- a/vendor/github.com/chzyer/readline/runes.go
+++ /dev/null
@@ -1,223 +0,0 @@
-package readline
-
-import (
- "bytes"
- "unicode"
- "unicode/utf8"
-)
-
-var runes = Runes{}
-var TabWidth = 4
-
-type Runes struct{}
-
-func (Runes) EqualRune(a, b rune, fold bool) bool {
- if a == b {
- return true
- }
- if !fold {
- return false
- }
- if a > b {
- a, b = b, a
- }
- if b < utf8.RuneSelf && 'A' <= a && a <= 'Z' {
- if b == a+'a'-'A' {
- return true
- }
- }
- return false
-}
-
-func (r Runes) EqualRuneFold(a, b rune) bool {
- return r.EqualRune(a, b, true)
-}
-
-func (r Runes) EqualFold(a, b []rune) bool {
- if len(a) != len(b) {
- return false
- }
- for i := 0; i < len(a); i++ {
- if r.EqualRuneFold(a[i], b[i]) {
- continue
- }
- return false
- }
-
- return true
-}
-
-func (Runes) Equal(a, b []rune) bool {
- if len(a) != len(b) {
- return false
- }
- for i := 0; i < len(a); i++ {
- if a[i] != b[i] {
- return false
- }
- }
- return true
-}
-
-func (rs Runes) IndexAllBckEx(r, sub []rune, fold bool) int {
- for i := len(r) - len(sub); i >= 0; i-- {
- found := true
- for j := 0; j < len(sub); j++ {
- if !rs.EqualRune(r[i+j], sub[j], fold) {
- found = false
- break
- }
- }
- if found {
- return i
- }
- }
- return -1
-}
-
-// Search in runes from end to front
-func (rs Runes) IndexAllBck(r, sub []rune) int {
- return rs.IndexAllBckEx(r, sub, false)
-}
-
-// Search in runes from front to end
-func (rs Runes) IndexAll(r, sub []rune) int {
- return rs.IndexAllEx(r, sub, false)
-}
-
-func (rs Runes) IndexAllEx(r, sub []rune, fold bool) int {
- for i := 0; i < len(r); i++ {
- found := true
- if len(r[i:]) < len(sub) {
- return -1
- }
- for j := 0; j < len(sub); j++ {
- if !rs.EqualRune(r[i+j], sub[j], fold) {
- found = false
- break
- }
- }
- if found {
- return i
- }
- }
- return -1
-}
-
-func (Runes) Index(r rune, rs []rune) int {
- for i := 0; i < len(rs); i++ {
- if rs[i] == r {
- return i
- }
- }
- return -1
-}
-
-func (Runes) ColorFilter(r []rune) []rune {
- newr := make([]rune, 0, len(r))
- for pos := 0; pos < len(r); pos++ {
- if r[pos] == '\033' && r[pos+1] == '[' {
- idx := runes.Index('m', r[pos+2:])
- if idx == -1 {
- continue
- }
- pos += idx + 2
- continue
- }
- newr = append(newr, r[pos])
- }
- return newr
-}
-
-var zeroWidth = []*unicode.RangeTable{
- unicode.Mn,
- unicode.Me,
- unicode.Cc,
- unicode.Cf,
-}
-
-var doubleWidth = []*unicode.RangeTable{
- unicode.Han,
- unicode.Hangul,
- unicode.Hiragana,
- unicode.Katakana,
-}
-
-func (Runes) Width(r rune) int {
- if r == '\t' {
- return TabWidth
- }
- if unicode.IsOneOf(zeroWidth, r) {
- return 0
- }
- if unicode.IsOneOf(doubleWidth, r) {
- return 2
- }
- return 1
-}
-
-func (Runes) WidthAll(r []rune) (length int) {
- for i := 0; i < len(r); i++ {
- length += runes.Width(r[i])
- }
- return
-}
-
-func (Runes) Backspace(r []rune) []byte {
- return bytes.Repeat([]byte{'\b'}, runes.WidthAll(r))
-}
-
-func (Runes) Copy(r []rune) []rune {
- n := make([]rune, len(r))
- copy(n, r)
- return n
-}
-
-func (Runes) HasPrefixFold(r, prefix []rune) bool {
- if len(r) < len(prefix) {
- return false
- }
- return runes.EqualFold(r[:len(prefix)], prefix)
-}
-
-func (Runes) HasPrefix(r, prefix []rune) bool {
- if len(r) < len(prefix) {
- return false
- }
- return runes.Equal(r[:len(prefix)], prefix)
-}
-
-func (Runes) Aggregate(candicate [][]rune) (same []rune, size int) {
- for i := 0; i < len(candicate[0]); i++ {
- for j := 0; j < len(candicate)-1; j++ {
- if i >= len(candicate[j]) || i >= len(candicate[j+1]) {
- goto aggregate
- }
- if candicate[j][i] != candicate[j+1][i] {
- goto aggregate
- }
- }
- size = i + 1
- }
-aggregate:
- if size > 0 {
- same = runes.Copy(candicate[0][:size])
- for i := 0; i < len(candicate); i++ {
- n := runes.Copy(candicate[i])
- copy(n, n[size:])
- candicate[i] = n[:len(n)-size]
- }
- }
- return
-}
-
-func (Runes) TrimSpaceLeft(in []rune) []rune {
- firstIndex := len(in)
- for i, r := range in {
- if unicode.IsSpace(r) == false {
- firstIndex = i
- break
- }
- }
- return in[firstIndex:]
-}
diff --git a/vendor/github.com/chzyer/readline/runes/runes.go b/vendor/github.com/chzyer/readline/runes/runes.go
deleted file mode 100644
index b069440a..00000000
--- a/vendor/github.com/chzyer/readline/runes/runes.go
+++ /dev/null
@@ -1,155 +0,0 @@
-// deprecated.
-// see https://github.com/chzyer/readline/issues/43
-// use github.com/chzyer/readline/runes.go
-package runes
-
-import (
- "bytes"
- "unicode"
-)
-
-func Equal(a, b []rune) bool {
- if len(a) != len(b) {
- return false
- }
- for i := 0; i < len(a); i++ {
- if a[i] != b[i] {
- return false
- }
- }
- return true
-}
-
-// Search in runes from end to front
-func IndexAllBck(r, sub []rune) int {
- for i := len(r) - len(sub); i >= 0; i-- {
- found := true
- for j := 0; j < len(sub); j++ {
- if r[i+j] != sub[j] {
- found = false
- break
- }
- }
- if found {
- return i
- }
- }
- return -1
-}
-
-// Search in runes from front to end
-func IndexAll(r, sub []rune) int {
- for i := 0; i < len(r); i++ {
- found := true
- if len(r[i:]) < len(sub) {
- return -1
- }
- for j := 0; j < len(sub); j++ {
- if r[i+j] != sub[j] {
- found = false
- break
- }
- }
- if found {
- return i
- }
- }
- return -1
-}
-
-func Index(r rune, rs []rune) int {
- for i := 0; i < len(rs); i++ {
- if rs[i] == r {
- return i
- }
- }
- return -1
-}
-
-func ColorFilter(r []rune) []rune {
- newr := make([]rune, 0, len(r))
- for pos := 0; pos < len(r); pos++ {
- if r[pos] == '\033' && r[pos+1] == '[' {
- idx := Index('m', r[pos+2:])
- if idx == -1 {
- continue
- }
- pos += idx + 2
- continue
- }
- newr = append(newr, r[pos])
- }
- return newr
-}
-
-var zeroWidth = []*unicode.RangeTable{
- unicode.Mn,
- unicode.Me,
- unicode.Cc,
- unicode.Cf,
-}
-
-var doubleWidth = []*unicode.RangeTable{
- unicode.Han,
- unicode.Hangul,
- unicode.Hiragana,
- unicode.Katakana,
-}
-
-func Width(r rune) int {
- if unicode.IsOneOf(zeroWidth, r) {
- return 0
- }
- if unicode.IsOneOf(doubleWidth, r) {
- return 2
- }
- return 1
-}
-
-func WidthAll(r []rune) (length int) {
- for i := 0; i < len(r); i++ {
- length += Width(r[i])
- }
- return
-}
-
-func Backspace(r []rune) []byte {
- return bytes.Repeat([]byte{'\b'}, WidthAll(r))
-}
-
-func Copy(r []rune) []rune {
- n := make([]rune, len(r))
- copy(n, r)
- return n
-}
-
-func HasPrefix(r, prefix []rune) bool {
- if len(r) < len(prefix) {
- return false
- }
- return Equal(r[:len(prefix)], prefix)
-}
-
-func Aggregate(candicate [][]rune) (same []rune, size int) {
- for i := 0; i < len(candicate[0]); i++ {
- for j := 0; j < len(candicate)-1; j++ {
- if i >= len(candicate[j]) || i >= len(candicate[j+1]) {
- goto aggregate
- }
- if candicate[j][i] != candicate[j+1][i] {
- goto aggregate
- }
- }
- size = i + 1
- }
-aggregate:
- if size > 0 {
- same = Copy(candicate[0][:size])
- for i := 0; i < len(candicate); i++ {
- n := Copy(candicate[i])
- copy(n, n[size:])
- candicate[i] = n[:len(n)-size]
- }
- }
- return
-}
diff --git a/vendor/github.com/chzyer/readline/runes/runes_test.go b/vendor/github.com/chzyer/readline/runes/runes_test.go
deleted file mode 100644
index b7a14128..00000000
--- a/vendor/github.com/chzyer/readline/runes/runes_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package runes
-
-import (
- "reflect"
- "testing"
-)
-
-type twidth struct {
- r []rune
- length int
-}
-
-func TestRuneWidth(t *testing.T) {
- runes := []twidth{
- {[]rune("☭"), 1},
- {[]rune("a"), 1},
- {[]rune("你"), 2},
- {ColorFilter([]rune("☭\033[13;1m你")), 3},
- }
- for _, r := range runes {
- if w := WidthAll(r.r); w != r.length {
- t.Fatal("result not expect", r.r, r.length, w)
- }
- }
-}
-
-type tagg struct {
- r [][]rune
- e [][]rune
- length int
-}
-
-func TestAggRunes(t *testing.T) {
- runes := []tagg{
- {
- [][]rune{[]rune("ab"), []rune("a"), []rune("abc")},
- [][]rune{[]rune("b"), []rune(""), []rune("bc")},
- 1,
- },
- {
- [][]rune{[]rune("addb"), []rune("ajkajsdf"), []rune("aasdfkc")},
- [][]rune{[]rune("ddb"), []rune("jkajsdf"), []rune("asdfkc")},
- 1,
- },
- {
- [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")},
- [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")},
- 0,
- },
- {
- [][]rune{[]rune("ddb"), []rune("ddajksdf"), []rune("ddaasdfkc")},
- [][]rune{[]rune("b"), []rune("ajksdf"), []rune("aasdfkc")},
- 2,
- },
- }
- for _, r := range runes {
- same, off := Aggregate(r.r)
- if off != r.length {
- t.Fatal("result not expect", off)
- }
- if len(same) != off {
- t.Fatal("result not expect", same)
- }
- if !reflect.DeepEqual(r.r, r.e) {
- t.Fatal("result not expect")
- }
- }
-}
diff --git a/vendor/github.com/chzyer/readline/runes_test.go b/vendor/github.com/chzyer/readline/runes_test.go
deleted file mode 100644
index 9c56d791..00000000
--- a/vendor/github.com/chzyer/readline/runes_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package readline
-
-import (
- "reflect"
- "testing"
-)
-
-type twidth struct {
- r []rune
- length int
-}
-
-func TestRuneWidth(t *testing.T) {
- rs := []twidth{
- {[]rune("☭"), 1},
- {[]rune("a"), 1},
- {[]rune("你"), 2},
- {runes.ColorFilter([]rune("☭\033[13;1m你")), 3},
- }
- for _, r := range rs {
- if w := runes.WidthAll(r.r); w != r.length {
- t.Fatal("result not expect", r.r, r.length, w)
- }
- }
-}
-
-type tagg struct {
- r [][]rune
- e [][]rune
- length int
-}
-
-func TestAggRunes(t *testing.T) {
- rs := []tagg{
- {
- [][]rune{[]rune("ab"), []rune("a"), []rune("abc")},
- [][]rune{[]rune("b"), []rune(""), []rune("bc")},
- 1,
- },
- {
- [][]rune{[]rune("addb"), []rune("ajkajsdf"), []rune("aasdfkc")},
- [][]rune{[]rune("ddb"), []rune("jkajsdf"), []rune("asdfkc")},
- 1,
- },
- {
- [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")},
- [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")},
- 0,
- },
- {
- [][]rune{[]rune("ddb"), []rune("ddajksdf"), []rune("ddaasdfkc")},
- [][]rune{[]rune("b"), []rune("ajksdf"), []rune("aasdfkc")},
- 2,
- },
- }
- for _, r := range rs {
- same, off := runes.Aggregate(r.r)
- if off != r.length {
- t.Fatal("result not expect", off)
- }
- if len(same) != off {
- t.Fatal("result not expect", same)
- }
- if !reflect.DeepEqual(r.r, r.e) {
- t.Fatal("result not expect")
- }
- }
-}
diff --git a/vendor/github.com/chzyer/readline/search.go b/vendor/github.com/chzyer/readline/search.go
deleted file mode 100644
index 52e8ff09..00000000
--- a/vendor/github.com/chzyer/readline/search.go
+++ /dev/null
@@ -1,164 +0,0 @@
-package readline
-
-import (
- "bytes"
- "container/list"
- "fmt"
- "io"
-)
-
-const (
- S_STATE_FOUND = iota
- S_STATE_FAILING
-)
-
-const (
- S_DIR_BCK = iota
- S_DIR_FWD
-)
-
-type opSearch struct {
- inMode bool
- state int
- dir int
- source *list.Element
- w io.Writer
- buf *RuneBuffer
- data []rune
- history *opHistory
- cfg *Config
- markStart int
- markEnd int
- width int
-}
-
-func newOpSearch(w io.Writer, buf *RuneBuffer, history *opHistory, cfg *Config, width int) *opSearch {
- return &opSearch{
- w: w,
- buf: buf,
- cfg: cfg,
- history: history,
- width: width,
- }
-}
-
-func (o *opSearch) OnWidthChange(newWidth int) {
- o.width = newWidth
-}
-
-func (o *opSearch) IsSearchMode() bool {
- return o.inMode
-}
-
-func (o *opSearch) SearchBackspace() {
- if len(o.data) > 0 {
- o.data = o.data[:len(o.data)-1]
- o.search(true)
- }
-}
-
-func (o *opSearch) findHistoryBy(isNewSearch bool) (int, *list.Element) {
- if o.dir == S_DIR_BCK {
- return o.history.FindBck(isNewSearch, o.data, o.buf.idx)
- }
- return o.history.FindFwd(isNewSearch, o.data, o.buf.idx)
-}
-
-func (o *opSearch) search(isChange bool) bool {
- if len(o.data) == 0 {
- o.state = S_STATE_FOUND
- o.SearchRefresh(-1)
- return true
- }
- idx, elem := o.findHistoryBy(isChange)
- if elem == nil {
- o.SearchRefresh(-2)
- return false
- }
- o.history.current = elem
-
- item := o.history.showItem(o.history.current.Value)
- start, end := 0, 0
- if o.dir == S_DIR_BCK {
- start, end = idx, idx+len(o.data)
- } else {
- start, end = idx, idx+len(o.data)
- idx += len(o.data)
- }
- o.buf.SetWithIdx(idx, item)
- o.markStart, o.markEnd = start, end
- o.SearchRefresh(idx)
- return true
-}
-
-func (o *opSearch) SearchChar(r rune) {
- o.data = append(o.data, r)
- o.search(true)
-}
-
-func (o *opSearch) SearchMode(dir int) bool {
- if o.width == 0 {
- return false
- }
- alreadyInMode := o.inMode
- o.inMode = true
- o.dir = dir
- o.source = o.history.current
- if alreadyInMode {
- o.search(false)
- } else {
- o.SearchRefresh(-1)
- }
- return true
-}
-
-func (o *opSearch) ExitSearchMode(revert bool) {
- if revert {
- o.history.current = o.source
- o.buf.Set(o.history.showItem(o.history.current.Value))
- }
- o.markStart, o.markEnd = 0, 0
- o.state = S_STATE_FOUND
- o.inMode = false
- o.source = nil
- o.data = nil
-}
-
-func (o *opSearch) SearchRefresh(x int) {
- if x == -2 {
- o.state = S_STATE_FAILING
- } else if x >= 0 {
- o.state = S_STATE_FOUND
- }
- if x < 0 {
- x = o.buf.idx
- }
- x = o.buf.CurrentWidth(x)
- x += o.buf.PromptLen()
- x = x % o.width
-
- if o.markStart > 0 {
- o.buf.SetStyle(o.markStart, o.markEnd, "4")
- }
-
- lineCnt := o.buf.CursorLineCount()
- buf := bytes.NewBuffer(nil)
- buf.Write(bytes.Repeat([]byte("\n"), lineCnt))
- buf.WriteString("\033[J")
- if o.state == S_STATE_FAILING {
- buf.WriteString("failing ")
- }
- if o.dir == S_DIR_BCK {
- buf.WriteString("bck")
- } else if o.dir == S_DIR_FWD {
- buf.WriteString("fwd")
- }
- buf.WriteString("-i-search: ")
- buf.WriteString(string(o.data)) // keyword
- buf.WriteString("\033[4m \033[0m") // _
- fmt.Fprintf(buf, "\r\033[%dA", lineCnt) // move prev
- if x > 0 {
- fmt.Fprintf(buf, "\033[%dC", x) // move forward
- }
- o.w.Write(buf.Bytes())
-}
diff --git a/vendor/github.com/chzyer/readline/std.go b/vendor/github.com/chzyer/readline/std.go
deleted file mode 100644
index 61d44b75..00000000
--- a/vendor/github.com/chzyer/readline/std.go
+++ /dev/null
@@ -1,197 +0,0 @@
-package readline
-
-import (
- "io"
- "os"
- "sync"
- "sync/atomic"
-)
-
-var (
- Stdin io.ReadCloser = os.Stdin
- Stdout io.WriteCloser = os.Stdout
- Stderr io.WriteCloser = os.Stderr
-)
-
-var (
- std *Instance
- stdOnce sync.Once
-)
-
-// global instance will not submit history automatic
-func getInstance() *Instance {
- stdOnce.Do(func() {
- std, _ = NewEx(&Config{
- DisableAutoSaveHistory: true,
- })
- })
- return std
-}
-
-// let readline load history from filepath
-// and try to persist history into disk
-// set fp to "" to prevent readline persisting history to disk
-// so the `AddHistory` will return nil error forever.
-func SetHistoryPath(fp string) {
- ins := getInstance()
- cfg := ins.Config.Clone()
- cfg.HistoryFile = fp
- ins.SetConfig(cfg)
-}
-
-// set auto completer to global instance
-func SetAutoComplete(completer AutoCompleter) {
- ins := getInstance()
- cfg := ins.Config.Clone()
- cfg.AutoComplete = completer
- ins.SetConfig(cfg)
-}
-
-// add history to global instance manually
-// raise error only if `SetHistoryPath` is set with a non-empty path
-func AddHistory(content string) error {
- ins := getInstance()
- return ins.SaveHistory(content)
-}
-
-func Password(prompt string) ([]byte, error) {
- ins := getInstance()
- return ins.ReadPassword(prompt)
-}
-
-// readline with global configs
-func Line(prompt string) (string, error) {
- ins := getInstance()
- ins.SetPrompt(prompt)
- return ins.Readline()
-}
-
-type CancelableStdin struct {
- r io.Reader
- mutex sync.Mutex
- stop chan struct{}
- closed int32
- notify chan struct{}
- data []byte
- read int
- err error
-}
-
-func NewCancelableStdin(r io.Reader) *CancelableStdin {
- c := &CancelableStdin{
- r: r,
- notify: make(chan struct{}),
- stop: make(chan struct{}),
- }
- go c.ioloop()
- return c
-}
-
-func (c *CancelableStdin) ioloop() {
-loop:
- for {
- select {
- case <-c.notify:
- c.read, c.err = c.r.Read(c.data)
- select {
- case c.notify <- struct{}{}:
- case <-c.stop:
- break loop
- }
- case <-c.stop:
- break loop
- }
- }
-}
-
-func (c *CancelableStdin) Read(b []byte) (n int, err error) {
- c.mutex.Lock()
- defer c.mutex.Unlock()
- if atomic.LoadInt32(&c.closed) == 1 {
- return 0, io.EOF
- }
-
- c.data = b
- select {
- case c.notify <- struct{}{}:
- case <-c.stop:
- return 0, io.EOF
- }
- select {
- case <-c.notify:
- return c.read, c.err
- case <-c.stop:
- return 0, io.EOF
- }
-}
-
-func (c *CancelableStdin) Close() error {
- if atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
- close(c.stop)
- }
- return nil
-}
-
-// FillableStdin is a stdin reader which can prepend some data before
-// reading into the real stdin
-type FillableStdin struct {
- sync.Mutex
- stdin io.Reader
- stdinBuffer io.ReadCloser
- buf []byte
- bufErr error
-}
-
-// NewFillableStdin gives you FillableStdin
-func NewFillableStdin(stdin io.Reader) (io.ReadCloser, io.Writer) {
- r, w := io.Pipe()
- s := &FillableStdin{
- stdinBuffer: r,
- stdin: stdin,
- }
- s.ioloop()
- return s, w
-}
-
-func (s *FillableStdin) ioloop() {
- go func() {
- for {
- bufR := make([]byte, 100)
- var n int
- n, s.bufErr = s.stdinBuffer.Read(bufR)
- if s.bufErr != nil {
- if s.bufErr == io.ErrClosedPipe {
- break
- }
- }
- s.Lock()
- s.buf = append(s.buf, bufR[:n]...)
- s.Unlock()
- }
- }()
-}
-
-// Read will read from the local buffer and if no data, read from stdin
-func (s *FillableStdin) Read(p []byte) (n int, err error) {
- s.Lock()
- i := len(s.buf)
- if len(p) < i {
- i = len(p)
- }
- if i > 0 {
- n := copy(p, s.buf)
- s.buf = s.buf[:0]
- cerr := s.bufErr
- s.bufErr = nil
- s.Unlock()
- return n, cerr
- }
- s.Unlock()
- n, err = s.stdin.Read(p)
- return n, err
-}
-
-func (s *FillableStdin) Close() error {
- s.stdinBuffer.Close()
- return nil
-}
diff --git a/vendor/github.com/chzyer/readline/std_windows.go b/vendor/github.com/chzyer/readline/std_windows.go
deleted file mode 100644
index b10f91bc..00000000
--- a/vendor/github.com/chzyer/readline/std_windows.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// +build windows
-
-package readline
-
-func init() {
- Stdin = NewRawReader()
- Stdout = NewANSIWriter(Stdout)
- Stderr = NewANSIWriter(Stderr)
-}
diff --git a/vendor/github.com/chzyer/readline/term.go b/vendor/github.com/chzyer/readline/term.go
deleted file mode 100644
index 133993ca..00000000
--- a/vendor/github.com/chzyer/readline/term.go
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd solaris
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := terminal.MakeRaw(0)
-// if err != nil {
-// panic(err)
-// }
-// defer terminal.Restore(0, oldState)
-package readline
-
-import (
- "io"
- "syscall"
-)
-
-// State contains the state of a terminal.
-type State struct {
- termios Termios
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- _, err := getTermios(fd)
- return err == nil
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- var oldState State
-
- if termios, err := getTermios(fd); err != nil {
- return nil, err
- } else {
- oldState.termios = *termios
- }
-
- newState := oldState.termios
- // This attempts to replicate the behaviour documented for cfmakeraw in
- // the termios(3) manpage.
- newState.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | syscall.ICRNL | syscall.IXON
- // newState.Oflag &^= syscall.OPOST
- newState.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.IEXTEN
- newState.Cflag &^= syscall.CSIZE | syscall.PARENB
- newState.Cflag |= syscall.CS8
-
- newState.Cc[syscall.VMIN] = 1
- newState.Cc[syscall.VTIME] = 0
-
- return &oldState, setTermios(fd, &newState)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- termios, err := getTermios(fd)
- if err != nil {
- return nil, err
- }
-
- return &State{termios: *termios}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func restoreTerm(fd int, state *State) error {
- return setTermios(fd, &state.termios)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- oldState, err := getTermios(fd)
- if err != nil {
- return nil, err
- }
-
- newState := oldState
- newState.Lflag &^= syscall.ECHO
- newState.Lflag |= syscall.ICANON | syscall.ISIG
- newState.Iflag |= syscall.ICRNL
- if err := setTermios(fd, newState); err != nil {
- return nil, err
- }
-
- defer func() {
- setTermios(fd, oldState)
- }()
-
- var buf [16]byte
- var ret []byte
- for {
- n, err := syscall.Read(fd, buf[:])
- if err != nil {
- return nil, err
- }
- if n == 0 {
- if len(ret) == 0 {
- return nil, io.EOF
- }
- break
- }
- if buf[n-1] == '\n' {
- n--
- }
- ret = append(ret, buf[:n]...)
- if n < len(buf) {
- break
- }
- }
-
- return ret, nil
-}
diff --git a/vendor/github.com/chzyer/readline/term_bsd.go b/vendor/github.com/chzyer/readline/term_bsd.go
deleted file mode 100644
index 68b56ea6..00000000
--- a/vendor/github.com/chzyer/readline/term_bsd.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd netbsd openbsd
-
-package readline
-
-import (
- "syscall"
- "unsafe"
-)
-
-func getTermios(fd int) (*Termios, error) {
- termios := new(Termios)
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TIOCGETA, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
- if err != 0 {
- return nil, err
- }
- return termios, nil
-}
-
-func setTermios(fd int, termios *Termios) error {
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TIOCSETA, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
- if err != 0 {
- return err
- }
- return nil
-}
diff --git a/vendor/github.com/chzyer/readline/term_linux.go b/vendor/github.com/chzyer/readline/term_linux.go
deleted file mode 100644
index e3392b4a..00000000
--- a/vendor/github.com/chzyer/readline/term_linux.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package readline
-
-import (
- "syscall"
- "unsafe"
-)
-
-// These constants are declared here, rather than importing
-// them from the syscall package as some syscall packages, even
-// on linux, for example gccgo, do not declare them.
-const ioctlReadTermios = 0x5401 // syscall.TCGETS
-const ioctlWriteTermios = 0x5402 // syscall.TCSETS
-
-func getTermios(fd int) (*Termios, error) {
- termios := new(Termios)
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
- if err != 0 {
- return nil, err
- }
- return termios, nil
-}
-
-func setTermios(fd int, termios *Termios) error {
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
- if err != 0 {
- return err
- }
- return nil
-}
diff --git a/vendor/github.com/chzyer/readline/term_solaris.go b/vendor/github.com/chzyer/readline/term_solaris.go
deleted file mode 100644
index 4c27273c..00000000
--- a/vendor/github.com/chzyer/readline/term_solaris.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build solaris
-
-package readline
-
-import "golang.org/x/sys/unix"
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (int, int, error) {
- ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
- if err != nil {
- return 0, 0, err
- }
- return int(ws.Col), int(ws.Row), nil
-}
-
-type Termios unix.Termios
-
-func getTermios(fd int) (*Termios, error) {
- termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
- if err != nil {
- return nil, err
- }
- return (*Termios)(termios), nil
-}
-
-func setTermios(fd int, termios *Termios) error {
- return unix.IoctlSetTermios(fd, unix.TCSETSF, (*unix.Termios)(termios))
-}
diff --git a/vendor/github.com/chzyer/readline/term_unix.go b/vendor/github.com/chzyer/readline/term_unix.go
deleted file mode 100644
index d3ea2424..00000000
--- a/vendor/github.com/chzyer/readline/term_unix.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd
-
-package readline
-
-import (
- "syscall"
- "unsafe"
-)
-
-type Termios syscall.Termios
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (int, int, error) {
- var dimensions [4]uint16
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&dimensions)), 0, 0, 0)
- if err != 0 {
- return 0, 0, err
- }
- return int(dimensions[1]), int(dimensions[0]), nil
-}
diff --git a/vendor/github.com/chzyer/readline/term_windows.go b/vendor/github.com/chzyer/readline/term_windows.go
deleted file mode 100644
index 1290e00b..00000000
--- a/vendor/github.com/chzyer/readline/term_windows.go
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := terminal.MakeRaw(0)
-// if err != nil {
-// panic(err)
-// }
-// defer terminal.Restore(0, oldState)
-package readline
-
-import (
- "io"
- "syscall"
- "unsafe"
-)
-
-const (
- enableLineInput = 2
- enableEchoInput = 4
- enableProcessedInput = 1
- enableWindowInput = 8
- enableMouseInput = 16
- enableInsertMode = 32
- enableQuickEditMode = 64
- enableExtendedFlags = 128
- enableAutoPosition = 256
- enableProcessedOutput = 1
- enableWrapAtEolOutput = 2
-)
-
-var kernel32 = syscall.NewLazyDLL("kernel32.dll")
-
-var (
- procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
- procSetConsoleMode = kernel32.NewProc("SetConsoleMode")
- procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
-)
-
-type (
- coord struct {
- x short
- y short
- }
- smallRect struct {
- left short
- top short
- right short
- bottom short
- }
- consoleScreenBufferInfo struct {
- size coord
- cursorPosition coord
- attributes word
- window smallRect
- maximumWindowSize coord
- }
-)
-
-type State struct {
- mode uint32
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- var st uint32
- r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- return r != 0 && e == 0
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- var st uint32
- _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- if e != 0 {
- return nil, error(e)
- }
- raw := st &^ (enableEchoInput | enableProcessedInput | enableLineInput | enableProcessedOutput)
- _, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(raw), 0)
- if e != 0 {
- return nil, error(e)
- }
- return &State{st}, nil
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- var st uint32
- _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- if e != 0 {
- return nil, error(e)
- }
- return &State{st}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func restoreTerm(fd int, state *State) error {
- _, _, err := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(state.mode), 0)
- return err
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- var info consoleScreenBufferInfo
- _, _, e := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&info)), 0)
- if e != 0 {
- return 0, 0, error(e)
- }
- return int(info.size.x), int(info.size.y), nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- var st uint32
- _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- if e != 0 {
- return nil, error(e)
- }
- old := st
-
- st &^= (enableEchoInput)
- st |= (enableProcessedInput | enableLineInput | enableProcessedOutput)
- _, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(st), 0)
- if e != 0 {
- return nil, error(e)
- }
-
- defer func() {
- syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(old), 0)
- }()
-
- var buf [16]byte
- var ret []byte
- for {
- n, err := syscall.Read(syscall.Handle(fd), buf[:])
- if err != nil {
- return nil, err
- }
- if n == 0 {
- if len(ret) == 0 {
- return nil, io.EOF
- }
- break
- }
- if buf[n-1] == '\n' {
- n--
- }
- if n > 0 && buf[n-1] == '\r' {
- n--
- }
- ret = append(ret, buf[:n]...)
- if n < len(buf) {
- break
- }
- }
-
- return ret, nil
-}
diff --git a/vendor/github.com/chzyer/readline/terminal.go b/vendor/github.com/chzyer/readline/terminal.go
deleted file mode 100644
index 1078631c..00000000
--- a/vendor/github.com/chzyer/readline/terminal.go
+++ /dev/null
@@ -1,238 +0,0 @@
-package readline
-
-import (
- "bufio"
- "fmt"
- "io"
- "strings"
- "sync"
- "sync/atomic"
-)
-
-type Terminal struct {
- m sync.Mutex
- cfg *Config
- outchan chan rune
- closed int32
- stopChan chan struct{}
- kickChan chan struct{}
- wg sync.WaitGroup
- isReading int32
- sleeping int32
-
- sizeChan chan string
-}
-
-func NewTerminal(cfg *Config) (*Terminal, error) {
- if err := cfg.Init(); err != nil {
- return nil, err
- }
- t := &Terminal{
- cfg: cfg,
- kickChan: make(chan struct{}, 1),
- outchan: make(chan rune),
- stopChan: make(chan struct{}, 1),
- sizeChan: make(chan string, 1),
- }
-
- go t.ioloop()
- return t, nil
-}
-
-// SleepToResume will sleep myself, and return only if I'm resumed.
-func (t *Terminal) SleepToResume() {
- if !atomic.CompareAndSwapInt32(&t.sleeping, 0, 1) {
- return
- }
- defer atomic.StoreInt32(&t.sleeping, 0)
-
- t.ExitRawMode()
- ch := WaitForResume()
- SuspendMe()
- <-ch
- t.EnterRawMode()
-}
-
-func (t *Terminal) EnterRawMode() (err error) {
- return t.cfg.FuncMakeRaw()
-}
-
-func (t *Terminal) ExitRawMode() (err error) {
- return t.cfg.FuncExitRaw()
-}
-
-func (t *Terminal) Write(b []byte) (int, error) {
- return t.cfg.Stdout.Write(b)
-}
-
-// WriteStdin prefill the next Stdin fetch
-// Next time you call ReadLine() this value will be writen before the user input
-func (t *Terminal) WriteStdin(b []byte) (int, error) {
- return t.cfg.StdinWriter.Write(b)
-}
-
-type termSize struct {
- left int
- top int
-}
-
-func (t *Terminal) GetOffset(f func(offset string)) {
- go func() {
- f(<-t.sizeChan)
- }()
- t.Write([]byte("\033[6n"))
-}
-
-func (t *Terminal) Print(s string) {
- fmt.Fprintf(t.cfg.Stdout, "%s", s)
-}
-
-func (t *Terminal) PrintRune(r rune) {
- fmt.Fprintf(t.cfg.Stdout, "%c", r)
-}
-
-func (t *Terminal) Readline() *Operation {
- return NewOperation(t, t.cfg)
-}
-
-// return rune(0) if meet EOF
-func (t *Terminal) ReadRune() rune {
- ch, ok := <-t.outchan
- if !ok {
- return rune(0)
- }
- return ch
-}
-
-func (t *Terminal) IsReading() bool {
- return atomic.LoadInt32(&t.isReading) == 1
-}
-
-func (t *Terminal) KickRead() {
- select {
- case t.kickChan <- struct{}{}:
- default:
- }
-}
-
-func (t *Terminal) ioloop() {
- t.wg.Add(1)
- defer func() {
- t.wg.Done()
- close(t.outchan)
- }()
-
- var (
- isEscape bool
- isEscapeEx bool
- expectNextChar bool
- )
-
- buf := bufio.NewReader(t.getStdin())
- for {
- if !expectNextChar {
- atomic.StoreInt32(&t.isReading, 0)
- select {
- case <-t.kickChan:
- atomic.StoreInt32(&t.isReading, 1)
- case <-t.stopChan:
- return
- }
- }
- expectNextChar = false
- r, _, err := buf.ReadRune()
- if err != nil {
- if strings.Contains(err.Error(), "interrupted system call") {
- expectNextChar = true
- continue
- }
- break
- }
-
- if isEscape {
- isEscape = false
- if r == CharEscapeEx {
- expectNextChar = true
- isEscapeEx = true
- continue
- }
- r = escapeKey(r, buf)
- } else if isEscapeEx {
- isEscapeEx = false
- if key := readEscKey(r, buf); key != nil {
- r = escapeExKey(key)
- // offset
- if key.typ == 'R' {
- if _, _, ok := key.Get2(); ok {
- select {
- case t.sizeChan <- key.attr:
- default:
- }
- }
- expectNextChar = true
- continue
- }
- }
- if r == 0 {
- expectNextChar = true
- continue
- }
- }
-
- expectNextChar = true
- switch r {
- case CharEsc:
- if t.cfg.VimMode {
- t.outchan <- r
- break
- }
- isEscape = true
- case CharInterrupt, CharEnter, CharCtrlJ, CharDelete:
- expectNextChar = false
- fallthrough
- default:
- t.outchan <- r
- }
- }
-
-}
-
-func (t *Terminal) Bell() {
- fmt.Fprintf(t, "%c", CharBell)
-}
-
-func (t *Terminal) Close() error {
- if atomic.SwapInt32(&t.closed, 1) != 0 {
- return nil
- }
- if closer, ok := t.cfg.Stdin.(io.Closer); ok {
- closer.Close()
- }
- close(t.stopChan)
- t.wg.Wait()
- return t.ExitRawMode()
-}
-
-func (t *Terminal) GetConfig() *Config {
- t.m.Lock()
- cfg := *t.cfg
- t.m.Unlock()
- return &cfg
-}
-
-func (t *Terminal) getStdin() io.Reader {
- t.m.Lock()
- r := t.cfg.Stdin
- t.m.Unlock()
- return r
-}
-
-func (t *Terminal) SetConfig(c *Config) error {
- if err := c.Init(); err != nil {
- return err
- }
- t.m.Lock()
- t.cfg = c
- t.m.Unlock()
- return nil
-}
diff --git a/vendor/github.com/chzyer/readline/utils.go b/vendor/github.com/chzyer/readline/utils.go
deleted file mode 100644
index af4e0052..00000000
--- a/vendor/github.com/chzyer/readline/utils.go
+++ /dev/null
@@ -1,277 +0,0 @@
-package readline
-
-import (
- "bufio"
- "bytes"
- "container/list"
- "fmt"
- "os"
- "strconv"
- "strings"
- "sync"
- "time"
- "unicode"
-)
-
-var (
- isWindows = false
-)
-
-const (
- CharLineStart = 1
- CharBackward = 2
- CharInterrupt = 3
- CharDelete = 4
- CharLineEnd = 5
- CharForward = 6
- CharBell = 7
- CharCtrlH = 8
- CharTab = 9
- CharCtrlJ = 10
- CharKill = 11
- CharCtrlL = 12
- CharEnter = 13
- CharNext = 14
- CharPrev = 16
- CharBckSearch = 18
- CharFwdSearch = 19
- CharTranspose = 20
- CharCtrlU = 21
- CharCtrlW = 23
- CharCtrlY = 25
- CharCtrlZ = 26
- CharEsc = 27
- CharEscapeEx = 91
- CharBackspace = 127
-)
-
-const (
- MetaBackward rune = -iota - 1
- MetaForward
- MetaDelete
- MetaBackspace
- MetaTranspose
-)
-
-// WaitForResume need to call before current process got suspend.
-// It will run a ticker until a long duration is occurs,
-// which means this process is resumed.
-func WaitForResume() chan struct{} {
- ch := make(chan struct{})
- var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- ticker := time.NewTicker(10 * time.Millisecond)
- t := time.Now()
- wg.Done()
- for {
- now := <-ticker.C
- if now.Sub(t) > 100*time.Millisecond {
- break
- }
- t = now
- }
- ticker.Stop()
- ch <- struct{}{}
- }()
- wg.Wait()
- return ch
-}
-
-func Restore(fd int, state *State) error {
- err := restoreTerm(fd, state)
- if err != nil {
- // errno 0 means everything is ok :)
- if err.Error() == "errno 0" {
- return nil
- } else {
- return err
- }
- }
- return nil
-}
-
-func IsPrintable(key rune) bool {
- isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
- return key >= 32 && !isInSurrogateArea
-}
-
-// translate Esc[X
-func escapeExKey(key *escapeKeyPair) rune {
- var r rune
- switch key.typ {
- case 'D':
- r = CharBackward
- case 'C':
- r = CharForward
- case 'A':
- r = CharPrev
- case 'B':
- r = CharNext
- case 'H':
- r = CharLineStart
- case 'F':
- r = CharLineEnd
- case '~':
- if key.attr == "3" {
- r = CharDelete
- }
- default:
- }
- return r
-}
-
-type escapeKeyPair struct {
- attr string
- typ rune
-}
-
-func (e *escapeKeyPair) Get2() (int, int, bool) {
- sp := strings.Split(e.attr, ";")
- if len(sp) < 2 {
- return -1, -1, false
- }
- s1, err := strconv.Atoi(sp[0])
- if err != nil {
- return -1, -1, false
- }
- s2, err := strconv.Atoi(sp[1])
- if err != nil {
- return -1, -1, false
- }
- return s1, s2, true
-}
-
-func readEscKey(r rune, reader *bufio.Reader) *escapeKeyPair {
- p := escapeKeyPair{}
- buf := bytes.NewBuffer(nil)
- for {
- if r == ';' {
- } else if unicode.IsNumber(r) {
- } else {
- p.typ = r
- break
- }
- buf.WriteRune(r)
- r, _, _ = reader.ReadRune()
- }
- p.attr = buf.String()
- return &p
-}
-
-// translate EscX to Meta+X
-func escapeKey(r rune, reader *bufio.Reader) rune {
- switch r {
- case 'b':
- r = MetaBackward
- case 'f':
- r = MetaForward
- case 'd':
- r = MetaDelete
- case CharTranspose:
- r = MetaTranspose
- case CharBackspace:
- r = MetaBackspace
- case 'O':
- d, _, _ := reader.ReadRune()
- switch d {
- case 'H':
- r = CharLineStart
- case 'F':
- r = CharLineEnd
- default:
- reader.UnreadRune()
- }
- case CharEsc:
-
- }
- return r
-}
-
-func SplitByLine(start, screenWidth int, rs []rune) []string {
- var ret []string
- buf := bytes.NewBuffer(nil)
- currentWidth := start
- for _, r := range rs {
- w := runes.Width(r)
- currentWidth += w
- buf.WriteRune(r)
- if currentWidth >= screenWidth {
- ret = append(ret, buf.String())
- buf.Reset()
- currentWidth = 0
- }
- }
- ret = append(ret, buf.String())
- return ret
-}
-
-// calculate how many lines for N character
-func LineCount(screenWidth, w int) int {
- r := w / screenWidth
- if w%screenWidth != 0 {
- r++
- }
- return r
-}
-
-func IsWordBreak(i rune) bool {
- switch {
- case i >= 'a' && i <= 'z':
- case i >= 'A' && i <= 'Z':
- case i >= '0' && i <= '9':
- default:
- return true
- }
- return false
-}
-
-func GetInt(s []string, def int) int {
- if len(s) == 0 {
- return def
- }
- c, err := strconv.Atoi(s[0])
- if err != nil {
- return def
- }
- return c
-}
-
-type RawMode struct {
- state *State
-}
-
-func (r *RawMode) Enter() (err error) {
- r.state, err = MakeRaw(GetStdin())
- return err
-}
-
-func (r *RawMode) Exit() error {
- if r.state == nil {
- return nil
- }
- return Restore(GetStdin(), r.state)
-}
-
-// -----------------------------------------------------------------------------
-
-func sleep(n int) {
- Debug(n)
- time.Sleep(2000 * time.Millisecond)
-}
-
-// print a linked list to Debug()
-func debugList(l *list.List) {
- idx := 0
- for e := l.Front(); e != nil; e = e.Next() {
- Debug(idx, fmt.Sprintf("%+v", e.Value))
- idx++
- }
-}
-
-// append log info to another file
-func Debug(o ...interface{}) {
- f, _ := os.OpenFile("debug.tmp", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
- fmt.Fprintln(f, o...)
- f.Close()
-}
diff --git a/vendor/github.com/chzyer/readline/utils_test.go b/vendor/github.com/chzyer/readline/utils_test.go
deleted file mode 100644
index 96037df6..00000000
--- a/vendor/github.com/chzyer/readline/utils_test.go
+++ /dev/null
@@ -1 +0,0 @@
-package readline
diff --git a/vendor/github.com/chzyer/readline/utils_unix.go b/vendor/github.com/chzyer/readline/utils_unix.go
deleted file mode 100644
index f88dac97..00000000
--- a/vendor/github.com/chzyer/readline/utils_unix.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd solaris
-
-package readline
-
-import (
- "io"
- "os"
- "os/signal"
- "sync"
- "syscall"
-)
-
-type winsize struct {
- Row uint16
- Col uint16
- Xpixel uint16
- Ypixel uint16
-}
-
-// SuspendMe use to send suspend signal to myself, when we in the raw mode.
-// For OSX it need to send to parent's pid
-// For Linux it need to send to myself
-func SuspendMe() {
- p, _ := os.FindProcess(os.Getppid())
- p.Signal(syscall.SIGTSTP)
- p, _ = os.FindProcess(os.Getpid())
- p.Signal(syscall.SIGTSTP)
-}
-
-// get width of the terminal
-func getWidth(stdoutFd int) int {
- cols, _, err := GetSize(stdoutFd)
- if err != nil {
- return -1
- }
- return cols
-}
-
-func GetScreenWidth() int {
- w := getWidth(syscall.Stdout)
- if w < 0 {
- w = getWidth(syscall.Stderr)
- }
- return w
-}
-
-// ClearScreen clears the console screen
-func ClearScreen(w io.Writer) (int, error) {
- return w.Write([]byte("\033[H"))
-}
-
-func DefaultIsTerminal() bool {
- return IsTerminal(syscall.Stdin) && (IsTerminal(syscall.Stdout) || IsTerminal(syscall.Stderr))
-}
-
-func GetStdin() int {
- return syscall.Stdin
-}
-
-// -----------------------------------------------------------------------------
-
-var (
- widthChange sync.Once
- widthChangeCallback func()
-)
-
-func DefaultOnWidthChanged(f func()) {
- widthChangeCallback = f
- widthChange.Do(func() {
- ch := make(chan os.Signal, 1)
- signal.Notify(ch, syscall.SIGWINCH)
-
- go func() {
- for {
- _, ok := <-ch
- if !ok {
- break
- }
- widthChangeCallback()
- }
- }()
- })
-}
diff --git a/vendor/github.com/chzyer/readline/utils_windows.go b/vendor/github.com/chzyer/readline/utils_windows.go
deleted file mode 100644
index 5bfa55dc..00000000
--- a/vendor/github.com/chzyer/readline/utils_windows.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build windows
-
-package readline
-
-import (
- "io"
- "syscall"
-)
-
-func SuspendMe() {
-}
-
-func GetStdin() int {
- return int(syscall.Stdin)
-}
-
-func init() {
- isWindows = true
-}
-
-// get width of the terminal
-func GetScreenWidth() int {
- info, _ := GetConsoleScreenBufferInfo()
- if info == nil {
- return -1
- }
- return int(info.dwSize.x)
-}
-
-// ClearScreen clears the console screen
-func ClearScreen(_ io.Writer) error {
- return SetConsoleCursorPosition(&_COORD{0, 0})
-}
-
-func DefaultIsTerminal() bool {
- return true
-}
-
-func DefaultOnWidthChanged(func()) {
-
-}
diff --git a/vendor/github.com/chzyer/readline/vim.go b/vendor/github.com/chzyer/readline/vim.go
deleted file mode 100644
index bedf2c1a..00000000
--- a/vendor/github.com/chzyer/readline/vim.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package readline
-
-const (
- VIM_NORMAL = iota
- VIM_INSERT
- VIM_VISUAL
-)
-
-type opVim struct {
- cfg *Config
- op *Operation
- vimMode int
-}
-
-func newVimMode(op *Operation) *opVim {
- ov := &opVim{
- cfg: op.cfg,
- op: op,
- }
- ov.SetVimMode(ov.cfg.VimMode)
- return ov
-}
-
-func (o *opVim) SetVimMode(on bool) {
- if o.cfg.VimMode && !on { // turn off
- o.ExitVimMode()
- }
- o.cfg.VimMode = on
- o.vimMode = VIM_INSERT
-}
-
-func (o *opVim) ExitVimMode() {
- o.vimMode = VIM_INSERT
-}
-
-func (o *opVim) IsEnableVimMode() bool {
- return o.cfg.VimMode
-}
-
-func (o *opVim) handleVimNormalMovement(r rune, readNext func() rune) (t rune, handled bool) {
- rb := o.op.buf
- handled = true
- switch r {
- case 'h':
- t = CharBackward
- case 'j':
- t = CharNext
- case 'k':
- t = CharPrev
- case 'l':
- t = CharForward
- case '0', '^':
- rb.MoveToLineStart()
- case '$':
- rb.MoveToLineEnd()
- case 'x':
- rb.Delete()
- if rb.IsCursorInEnd() {
- rb.MoveBackward()
- }
- case 'r':
- rb.Replace(readNext())
- case 'd':
- next := readNext()
- switch next {
- case 'd':
- rb.Erase()
- case 'w':
- rb.DeleteWord()
- case 'h':
- rb.Backspace()
- case 'l':
- rb.Delete()
- }
- case 'p':
- rb.Yank()
- case 'b', 'B':
- rb.MoveToPrevWord()
- case 'w', 'W':
- rb.MoveToNextWord()
- case 'e', 'E':
- rb.MoveToEndWord()
- case 'f', 'F', 't', 'T':
- next := readNext()
- prevChar := r == 't' || r == 'T'
- reverse := r == 'F' || r == 'T'
- switch next {
- case CharEsc:
- default:
- rb.MoveTo(next, prevChar, reverse)
- }
- default:
- return r, false
- }
- return t, true
-}
-
-func (o *opVim) handleVimNormalEnterInsert(r rune, readNext func() rune) (t rune, handled bool) {
- rb := o.op.buf
- handled = true
- switch r {
- case 'i':
- case 'I':
- rb.MoveToLineStart()
- case 'a':
- rb.MoveForward()
- case 'A':
- rb.MoveToLineEnd()
- case 's':
- rb.Delete()
- case 'S':
- rb.Erase()
- case 'c':
- next := readNext()
- switch next {
- case 'c':
- rb.Erase()
- case 'w':
- rb.DeleteWord()
- case 'h':
- rb.Backspace()
- case 'l':
- rb.Delete()
- }
- default:
- return r, false
- }
-
- o.EnterVimInsertMode()
- return
-}
-
-func (o *opVim) HandleVimNormal(r rune, readNext func() rune) (t rune) {
- switch r {
- case CharEnter, CharInterrupt:
- o.ExitVimMode()
- return r
- }
-
- if r, handled := o.handleVimNormalMovement(r, readNext); handled {
- return r
- }
-
- if r, handled := o.handleVimNormalEnterInsert(r, readNext); handled {
- return r
- }
-
- // invalid operation
- o.op.t.Bell()
- return 0
-}
-
-func (o *opVim) EnterVimInsertMode() {
- o.vimMode = VIM_INSERT
-}
-
-func (o *opVim) ExitVimInsertMode() {
- o.vimMode = VIM_NORMAL
-}
-
-func (o *opVim) HandleVim(r rune, readNext func() rune) rune {
- if o.vimMode == VIM_NORMAL {
- return o.HandleVimNormal(r, readNext)
- }
- if r == CharEsc {
- o.ExitVimInsertMode()
- return 0
- }
-
- switch o.vimMode {
- case VIM_INSERT:
- return r
- case VIM_VISUAL:
- }
- return r
-}
diff --git a/vendor/github.com/chzyer/readline/windows_api.go b/vendor/github.com/chzyer/readline/windows_api.go
deleted file mode 100644
index 63f4f7b7..00000000
--- a/vendor/github.com/chzyer/readline/windows_api.go
+++ /dev/null
@@ -1,152 +0,0 @@
-// +build windows
-
-package readline
-
-import (
- "reflect"
- "syscall"
- "unsafe"
-)
-
-var (
- kernel = NewKernel()
- stdout = uintptr(syscall.Stdout)
- stdin = uintptr(syscall.Stdin)
-)
-
-type Kernel struct {
- SetConsoleCursorPosition,
- SetConsoleTextAttribute,
- FillConsoleOutputCharacterW,
- FillConsoleOutputAttribute,
- ReadConsoleInputW,
- GetConsoleScreenBufferInfo,
- GetConsoleCursorInfo,
- GetStdHandle CallFunc
-}
-
-type short int16
-type word uint16
-type dword uint32
-type wchar uint16
-
-type _COORD struct {
- x short
- y short
-}
-
-func (c *_COORD) ptr() uintptr {
- return uintptr(*(*int32)(unsafe.Pointer(c)))
-}
-
-const (
- EVENT_KEY = 0x0001
- EVENT_MOUSE = 0x0002
- EVENT_WINDOW_BUFFER_SIZE = 0x0004
- EVENT_MENU = 0x0008
- EVENT_FOCUS = 0x0010
-)
-
-type _KEY_EVENT_RECORD struct {
- bKeyDown int32
- wRepeatCount word
- wVirtualKeyCode word
- wVirtualScanCode word
- unicodeChar wchar
- dwControlKeyState dword
-}
-
-// KEY_EVENT_RECORD KeyEvent;
-// MOUSE_EVENT_RECORD MouseEvent;
-// WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
-// MENU_EVENT_RECORD MenuEvent;
-// FOCUS_EVENT_RECORD FocusEvent;
-type _INPUT_RECORD struct {
- EventType word
- Padding uint16
- Event [16]byte
-}
-
-type _CONSOLE_SCREEN_BUFFER_INFO struct {
- dwSize _COORD
- dwCursorPosition _COORD
- wAttributes word
- srWindow _SMALL_RECT
- dwMaximumWindowSize _COORD
-}
-
-type _SMALL_RECT struct {
- left short
- top short
- right short
- bottom short
-}
-
-type _CONSOLE_CURSOR_INFO struct {
- dwSize dword
- bVisible bool
-}
-
-type CallFunc func(u ...uintptr) error
-
-func NewKernel() *Kernel {
- k := &Kernel{}
- kernel32 := syscall.NewLazyDLL("kernel32.dll")
- v := reflect.ValueOf(k).Elem()
- t := v.Type()
- for i := 0; i < t.NumField(); i++ {
- name := t.Field(i).Name
- f := kernel32.NewProc(name)
- v.Field(i).Set(reflect.ValueOf(k.Wrap(f)))
- }
- return k
-}
-
-func (k *Kernel) Wrap(p *syscall.LazyProc) CallFunc {
- return func(args ...uintptr) error {
- var r0 uintptr
- var e1 syscall.Errno
- size := uintptr(len(args))
- if len(args) <= 3 {
- buf := make([]uintptr, 3)
- copy(buf, args)
- r0, _, e1 = syscall.Syscall(p.Addr(), size,
- buf[0], buf[1], buf[2])
- } else {
- buf := make([]uintptr, 6)
- copy(buf, args)
- r0, _, e1 = syscall.Syscall6(p.Addr(), size,
- buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
- )
- }
-
- if int(r0) == 0 {
- if e1 != 0 {
- return error(e1)
- } else {
- return syscall.EINVAL
- }
- }
- return nil
- }
-
-}
-
-func GetConsoleScreenBufferInfo() (*_CONSOLE_SCREEN_BUFFER_INFO, error) {
- t := new(_CONSOLE_SCREEN_BUFFER_INFO)
- err := kernel.GetConsoleScreenBufferInfo(
- stdout,
- uintptr(unsafe.Pointer(t)),
- )
- return t, err
-}
-
-func GetConsoleCursorInfo() (*_CONSOLE_CURSOR_INFO, error) {
- t := new(_CONSOLE_CURSOR_INFO)
- err := kernel.GetConsoleCursorInfo(stdout, uintptr(unsafe.Pointer(t)))
- return t, err
-}
-
-func SetConsoleCursorPosition(c *_COORD) error {
- return kernel.SetConsoleCursorPosition(stdout, c.ptr())
-}
diff --git a/vendor/github.com/cpuguy83/go-md2man/.gitignore b/vendor/github.com/cpuguy83/go-md2man/.gitignore
deleted file mode 100644
index b651fbfb..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-go-md2man
diff --git a/vendor/github.com/cpuguy83/go-md2man/.gometalinter.json b/vendor/github.com/cpuguy83/go-md2man/.gometalinter.json
deleted file mode 100644
index a5f83163..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/.gometalinter.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "Vendor": true,
- "Deadline": "2m",
- "Sort": ["linter", "severity", "path", "line"],
- "Enable": [
- "deadcode",
- "errcheck",
- "structcheck",
- "unused",
- "varcheck",
- "unconvert",
- "gofmt",
- "goimports",
- "golint",
- "ineffassign",
- "vet",
- "goconst",
- "megacheck"
- ]
-}
diff --git a/vendor/github.com/cpuguy83/go-md2man/.travis.yml b/vendor/github.com/cpuguy83/go-md2man/.travis.yml
deleted file mode 100644
index e1891f1f..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: go
-go:
- - 1.x
- - 1.8.x
- - 1.9.x
- - tip
-script:
- - script/setup/dev-tools
- - script/validate/vendor
- - go build -i .
- - make check
- - go build
- - go test -v ./...
diff --git a/vendor/github.com/cpuguy83/go-md2man/Dockerfile b/vendor/github.com/cpuguy83/go-md2man/Dockerfile
deleted file mode 100644
index 97bec828..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/Dockerfile
+++ /dev/null
@@ -1,8 +0,0 @@
-FROM golang:1.8 AS build
-COPY . /go/src/github.com/cpuguy83/go-md2man
-WORKDIR /go/src/github.com/cpuguy83/go-md2man
-RUN CGO_ENABLED=0 go build
-
-FROM scratch
-COPY --from=build /go/src/github.com/cpuguy83/go-md2man/go-md2man /go-md2man
-ENTRYPOINT ["/go-md2man"]
diff --git a/vendor/github.com/cpuguy83/go-md2man/Gopkg.lock b/vendor/github.com/cpuguy83/go-md2man/Gopkg.lock
deleted file mode 100644
index 03f34f68..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/Gopkg.lock
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- name = "github.com/russross/blackfriday"
- packages = ["."]
- revision = "4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c"
- version = "v1.5"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- inputs-digest = "d4fdd599038b13752bbcaf722cac55d8e6d81b6fd60bb325df3e31d71aaf358c"
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/vendor/github.com/cpuguy83/go-md2man/Gopkg.toml b/vendor/github.com/cpuguy83/go-md2man/Gopkg.toml
deleted file mode 100644
index 9372f8c8..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/Gopkg.toml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-# Gopkg.toml example
-#
-# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-# name = "github.com/user/project"
-# version = "1.0.0"
-#
-# [[constraint]]
-# name = "github.com/user/project2"
-# branch = "dev"
-# source = "github.com/myfork/project2"
-#
-# [[override]]
-# name = "github.com/x/y"
-# version = "2.4.0"
-
-
-[[constraint]]
- name = "github.com/russross/blackfriday"
- version = "1.4"
diff --git a/vendor/github.com/cpuguy83/go-md2man/LICENSE.md b/vendor/github.com/cpuguy83/go-md2man/LICENSE.md
deleted file mode 100644
index 1cade6ce..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/LICENSE.md
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Brian Goff
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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
-SOFTWARE.
diff --git a/vendor/github.com/cpuguy83/go-md2man/Makefile b/vendor/github.com/cpuguy83/go-md2man/Makefile
deleted file mode 100644
index 6e30faf8..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-check:
- gometalinter --config .gometalinter.json ./...
diff --git a/vendor/github.com/cpuguy83/go-md2man/README.md b/vendor/github.com/cpuguy83/go-md2man/README.md
deleted file mode 100644
index 29ed7c9e..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-go-md2man
-=========
-
-** Work in Progress **
-This still needs a lot of help to be complete, or even usable!
-
-Uses blackfriday to process markdown into man pages.
-
-### Usage
-
-./md2man -in /path/to/markdownfile.md -out /manfile/output/path
-
-### How to contribute
-
-We use [dep](https://github.com/golang/dep/) for vendoring Go packages.
-See dep documentation for how to update.
-
-### TODO
-
-- Needs oh so much testing love
-- Look into blackfriday's 2.0 API
diff --git a/vendor/github.com/cpuguy83/go-md2man/go-md2man.1.md b/vendor/github.com/cpuguy83/go-md2man/go-md2man.1.md
deleted file mode 100644
index e1ae104e..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/go-md2man.1.md
+++ /dev/null
@@ -1,23 +0,0 @@
-go-md2man 1 "January 2015" go-md2man "User Manual"
-==================================================
-
-# NAME
- go-md2man - Convert mardown files into manpages
-
-# SYNOPSIS
- go-md2man -in=[/path/to/md/file] -out=[/path/to/output]
-
-# Description
- go-md2man converts standard markdown formatted documents into manpages. It is
- written purely in Go so as to reduce dependencies on 3rd party libs.
-
- By default, the input is stdin and the output is stdout.
-
-# Example
- Convert the markdown file "go-md2man.1.md" into a manpage.
-
- go-md2man -in=README.md -out=go-md2man.1.out
-
-# HISTORY
- January 2015, Originally compiled by Brian Goff( cpuguy83@gmail.com )
-
diff --git a/vendor/github.com/cpuguy83/go-md2man/md2man.go b/vendor/github.com/cpuguy83/go-md2man/md2man.go
deleted file mode 100644
index c35dd335..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/md2man.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "io/ioutil"
- "os"
-
- "github.com/cpuguy83/go-md2man/md2man"
-)
-
-var inFilePath = flag.String("in", "", "Path to file to be processed (default: stdin)")
-var outFilePath = flag.String("out", "", "Path to output processed file (default: stdout)")
-
-func main() {
- var err error
- flag.Parse()
-
- inFile := os.Stdin
- if *inFilePath != "" {
- inFile, err = os.Open(*inFilePath)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- }
- defer inFile.Close() // nolint: errcheck
-
- doc, err := ioutil.ReadAll(inFile)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-
- out := md2man.Render(doc)
-
- outFile := os.Stdout
- if *outFilePath != "" {
- outFile, err = os.Create(*outFilePath)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
- defer outFile.Close() // nolint: errcheck
- }
- _, err = outFile.Write(out)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-}
diff --git a/vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go b/vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go
deleted file mode 100644
index af62279a..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package md2man
-
-import (
- "github.com/russross/blackfriday"
-)
-
-// Render converts a markdown document into a roff formatted document.
-func Render(doc []byte) []byte {
- renderer := RoffRenderer(0)
- extensions := 0
- extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
- extensions |= blackfriday.EXTENSION_TABLES
- extensions |= blackfriday.EXTENSION_FENCED_CODE
- extensions |= blackfriday.EXTENSION_AUTOLINK
- extensions |= blackfriday.EXTENSION_SPACE_HEADERS
- extensions |= blackfriday.EXTENSION_FOOTNOTES
- extensions |= blackfriday.EXTENSION_TITLEBLOCK
-
- return blackfriday.Markdown(doc, renderer, extensions)
-}
diff --git a/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go b/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go
deleted file mode 100644
index 8c29ec68..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go
+++ /dev/null
@@ -1,285 +0,0 @@
-package md2man
-
-import (
- "bytes"
- "fmt"
- "html"
- "strings"
-
- "github.com/russross/blackfriday"
-)
-
-type roffRenderer struct {
- ListCounters []int
-}
-
-// RoffRenderer creates a new blackfriday Renderer for generating roff documents
-// from markdown
-func RoffRenderer(flags int) blackfriday.Renderer {
- return &roffRenderer{}
-}
-
-func (r *roffRenderer) GetFlags() int {
- return 0
-}
-
-func (r *roffRenderer) TitleBlock(out *bytes.Buffer, text []byte) {
- out.WriteString(".TH ")
-
- splitText := bytes.Split(text, []byte("\n"))
- for i, line := range splitText {
- line = bytes.TrimPrefix(line, []byte("% "))
- if i == 0 {
- line = bytes.Replace(line, []byte("("), []byte("\" \""), 1)
- line = bytes.Replace(line, []byte(")"), []byte("\" \""), 1)
- }
- line = append([]byte("\""), line...)
- line = append(line, []byte("\" ")...)
- out.Write(line)
- }
- out.WriteString("\n")
-
- // disable hyphenation
- out.WriteString(".nh\n")
- // disable justification (adjust text to left margin only)
- out.WriteString(".ad l\n")
-}
-
-func (r *roffRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {
- out.WriteString("\n.PP\n.RS\n\n.nf\n")
- escapeSpecialChars(out, text)
- out.WriteString("\n.fi\n.RE\n")
-}
-
-func (r *roffRenderer) BlockQuote(out *bytes.Buffer, text []byte) {
- out.WriteString("\n.PP\n.RS\n")
- out.Write(text)
- out.WriteString("\n.RE\n")
-}
-
-func (r *roffRenderer) BlockHtml(out *bytes.Buffer, text []byte) { // nolint: golint
- out.Write(text)
-}
-
-func (r *roffRenderer) Header(out *bytes.Buffer, text func() bool, level int, id string) {
- marker := out.Len()
-
- switch {
- case marker == 0:
- // This is the doc header
- out.WriteString(".TH ")
- case level == 1:
- out.WriteString("\n\n.SH ")
- case level == 2:
- out.WriteString("\n.SH ")
- default:
- out.WriteString("\n.SS ")
- }
-
- if !text() {
- out.Truncate(marker)
- return
- }
-}
-
-func (r *roffRenderer) HRule(out *bytes.Buffer) {
- out.WriteString("\n.ti 0\n\\l'\\n(.lu'\n")
-}
-
-func (r *roffRenderer) List(out *bytes.Buffer, text func() bool, flags int) {
- marker := out.Len()
- r.ListCounters = append(r.ListCounters, 1)
- out.WriteString("\n.RS\n")
- if !text() {
- out.Truncate(marker)
- return
- }
- r.ListCounters = r.ListCounters[:len(r.ListCounters)-1]
- out.WriteString("\n.RE\n")
-}
-
-func (r *roffRenderer) ListItem(out *bytes.Buffer, text []byte, flags int) {
- if flags&blackfriday.LIST_TYPE_ORDERED != 0 {
- out.WriteString(fmt.Sprintf(".IP \"%3d.\" 5\n", r.ListCounters[len(r.ListCounters)-1]))
- r.ListCounters[len(r.ListCounters)-1]++
- } else {
- out.WriteString(".IP \\(bu 2\n")
- }
- out.Write(text)
- out.WriteString("\n")
-}
-
-func (r *roffRenderer) Paragraph(out *bytes.Buffer, text func() bool) {
- marker := out.Len()
- out.WriteString("\n.PP\n")
- if !text() {
- out.Truncate(marker)
- return
- }
- if marker != 0 {
- out.WriteString("\n")
- }
-}
-
-func (r *roffRenderer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {
- out.WriteString("\n.TS\nallbox;\n")
-
- maxDelims := 0
- lines := strings.Split(strings.TrimRight(string(header), "\n")+"\n"+strings.TrimRight(string(body), "\n"), "\n")
- for _, w := range lines {
- curDelims := strings.Count(w, "\t")
- if curDelims > maxDelims {
- maxDelims = curDelims
- }
- }
- out.Write([]byte(strings.Repeat("l ", maxDelims+1) + "\n"))
- out.Write([]byte(strings.Repeat("l ", maxDelims+1) + ".\n"))
- out.Write(header)
- if len(header) > 0 {
- out.Write([]byte("\n"))
- }
-
- out.Write(body)
- out.WriteString("\n.TE\n")
-}
-
-func (r *roffRenderer) TableRow(out *bytes.Buffer, text []byte) {
- if out.Len() > 0 {
- out.WriteString("\n")
- }
- out.Write(text)
-}
-
-func (r *roffRenderer) TableHeaderCell(out *bytes.Buffer, text []byte, align int) {
- if out.Len() > 0 {
- out.WriteString("\t")
- }
- if len(text) == 0 {
- text = []byte{' '}
- }
- out.Write([]byte("\\fB\\fC" + string(text) + "\\fR"))
-}
-
-func (r *roffRenderer) TableCell(out *bytes.Buffer, text []byte, align int) {
- if out.Len() > 0 {
- out.WriteString("\t")
- }
- if len(text) > 30 {
- text = append([]byte("T{\n"), text...)
- text = append(text, []byte("\nT}")...)
- }
- if len(text) == 0 {
- text = []byte{' '}
- }
- out.Write(text)
-}
-
-func (r *roffRenderer) Footnotes(out *bytes.Buffer, text func() bool) {
-
-}
-
-func (r *roffRenderer) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) {
-
-}
-
-func (r *roffRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
- out.WriteString("\n\\[la]")
- out.Write(link)
- out.WriteString("\\[ra]")
-}
-
-func (r *roffRenderer) CodeSpan(out *bytes.Buffer, text []byte) {
- out.WriteString("\\fB\\fC")
- escapeSpecialChars(out, text)
- out.WriteString("\\fR")
-}
-
-func (r *roffRenderer) DoubleEmphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\fB")
- out.Write(text)
- out.WriteString("\\fP")
-}
-
-func (r *roffRenderer) Emphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\fI")
- out.Write(text)
- out.WriteString("\\fP")
-}
-
-func (r *roffRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
-}
-
-func (r *roffRenderer) LineBreak(out *bytes.Buffer) {
- out.WriteString("\n.br\n")
-}
-
-func (r *roffRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
- out.Write(content)
- r.AutoLink(out, link, 0)
-}
-
-func (r *roffRenderer) RawHtmlTag(out *bytes.Buffer, tag []byte) { // nolint: golint
- out.Write(tag)
-}
-
-func (r *roffRenderer) TripleEmphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\s+2")
- out.Write(text)
- out.WriteString("\\s-2")
-}
-
-func (r *roffRenderer) StrikeThrough(out *bytes.Buffer, text []byte) {
-}
-
-func (r *roffRenderer) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
-
-}
-
-func (r *roffRenderer) Entity(out *bytes.Buffer, entity []byte) {
- out.WriteString(html.UnescapeString(string(entity)))
-}
-
-func (r *roffRenderer) NormalText(out *bytes.Buffer, text []byte) {
- escapeSpecialChars(out, text)
-}
-
-func (r *roffRenderer) DocumentHeader(out *bytes.Buffer) {
-}
-
-func (r *roffRenderer) DocumentFooter(out *bytes.Buffer) {
-}
-
-func needsBackslash(c byte) bool {
- for _, r := range []byte("-_&\\~") {
- if c == r {
- return true
- }
- }
- return false
-}
-
-func escapeSpecialChars(out *bytes.Buffer, text []byte) {
- for i := 0; i < len(text); i++ {
- // escape initial apostrophe or period
- if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') {
- out.WriteString("\\&")
- }
-
- // directly copy normal characters
- org := i
-
- for i < len(text) && !needsBackslash(text[i]) {
- i++
- }
- if i > org {
- out.Write(text[org:i])
- }
-
- // escape a character
- if i >= len(text) {
- break
- }
- out.WriteByte('\\')
- out.WriteByte(text[i])
- }
-}
diff --git a/vendor/github.com/cpuguy83/go-md2man/md2man/roff_test.go b/vendor/github.com/cpuguy83/go-md2man/md2man/roff_test.go
deleted file mode 100644
index eb5fab63..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/md2man/roff_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package md2man
-
-import (
- "bytes"
- "testing"
-)
-
-func TestTitleBlock(t *testing.T) {
- r := &roffRenderer{}
- buf := bytes.NewBuffer(nil)
-
- title := []byte("% stuff\n% more stuff\n% even more stuff")
-
- r.TitleBlock(buf, title)
- expected := ".TH \"stuff\" \"more stuff\" \"even more stuff\" \n.nh\n.ad l\n"
- actual := buf.String()
- if expected != actual {
- t.Fatalf("expected:\n%s\nactual:\n%s", expected, actual)
- }
-}
-
-func TestBlockCode(t *testing.T) {
- r := &roffRenderer{}
- buf := bytes.NewBuffer(nil)
-
- code := []byte("$ echo hello world\nhello world\n")
- r.BlockCode(buf, code, "")
-
- expected := `
-.PP
-.RS
-
-.nf
-$ echo hello world
-hello world
-
-.fi
-.RE
-`
- result := buf.String()
- if expected != result {
- t.Fatalf("got incorrect output:\nexpected:\n%v\n\ngot:\n%v", expected, result)
- }
-}
-
-func TestTableCell(t *testing.T) {
- r := &roffRenderer{}
- buf := bytes.NewBuffer(nil)
- cell := []byte{}
-
- r.TableCell(buf, cell, 0)
- expected := " "
- if buf.String() != expected {
- t.Fatalf("expected %q, got %q", expected, buf.String())
- }
-
- r.TableCell(buf, cell, 0)
- expected += "\t "
- if buf.String() != expected {
- t.Fatalf("expected %q, got %q", expected, buf.String())
- }
-
- cell = []byte("*")
- r.TableCell(buf, cell, 0)
- expected += "\t*"
- if buf.String() != expected {
- t.Fatalf("expected %q, got %q", expected, buf.String())
- }
-
- cell = []byte("this is a test with some really long string")
- r.TableCell(buf, cell, 0)
- expected += "\tT{\nthis is a test with some really long string\nT}"
- if buf.String() != expected {
- t.Fatalf("expected %q, got %q", expected, buf.String())
- }
-
- cell = []byte("some short string")
- r.TableCell(buf, cell, 0)
- expected += "\tsome short string"
- if buf.String() != expected {
- t.Fatalf("expected %q, got %q", expected, buf.String())
- }
-
- cell = []byte{}
- r.TableCell(buf, cell, 0)
- expected += "\t "
- if buf.String() != expected {
- t.Fatalf("expected %q, got %q", expected, buf.String())
- }
-
- cell = []byte("*")
- r.TableCell(buf, cell, 0)
- expected += "\t*"
- if buf.String() != expected {
- t.Fatalf("expected %q, got %q", expected, buf.String())
- }
-}
diff --git a/vendor/github.com/cpuguy83/go-md2man/script/setup/dev-tools b/vendor/github.com/cpuguy83/go-md2man/script/setup/dev-tools
deleted file mode 100755
index 8efe701e..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/script/setup/dev-tools
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env bash
-
-set -eu -o pipefail
-
-go get -u github.com/alecthomas/gometalinter
-gometalinter --install >/dev/null
-go get -u github.com/golang/dep/cmd/dep
diff --git a/vendor/github.com/cpuguy83/go-md2man/script/validate/vendor b/vendor/github.com/cpuguy83/go-md2man/script/validate/vendor
deleted file mode 100755
index ef29b4cd..00000000
--- a/vendor/github.com/cpuguy83/go-md2man/script/validate/vendor
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-set -eu -o pipefail
-
-dep ensure
-
-DIFF_PATH="vendor/"
-DIFF=$(git status --porcelain -- "$DIFF_PATH")
-
-if [ "$DIFF" ]; then
- echo
- echo "These files were modified:"
- echo
- echo "$DIFF"
- echo
- exit 1
-else
- echo "$DIFF_PATH is correct"
-fi
diff --git a/vendor/github.com/fsnotify/fsnotify/.editorconfig b/vendor/github.com/fsnotify/fsnotify/.editorconfig
deleted file mode 100644
index ba49e3c2..00000000
--- a/vendor/github.com/fsnotify/fsnotify/.editorconfig
+++ /dev/null
@@ -1,5 +0,0 @@
-root = true
-
-[*]
-indent_style = tab
-indent_size = 4
diff --git a/vendor/github.com/fsnotify/fsnotify/.github/ISSUE_TEMPLATE.md b/vendor/github.com/fsnotify/fsnotify/.github/ISSUE_TEMPLATE.md
deleted file mode 100644
index 4ad1aed8..00000000
--- a/vendor/github.com/fsnotify/fsnotify/.github/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,11 +0,0 @@
-Before reporting an issue, please ensure you are using the latest release of fsnotify.
-
-### Which operating system (GOOS) and version are you using?
-
-Linux: lsb_release -a
-macOS: sw_vers
-Windows: systeminfo | findstr /B /C:OS
-
-### Please describe the issue that occurred.
-
-### Are you able to reproduce the issue? Please provide steps to reproduce and a code sample if possible.
diff --git a/vendor/github.com/fsnotify/fsnotify/.github/PULL_REQUEST_TEMPLATE.md b/vendor/github.com/fsnotify/fsnotify/.github/PULL_REQUEST_TEMPLATE.md
deleted file mode 100644
index 64ddf7ce..00000000
--- a/vendor/github.com/fsnotify/fsnotify/.github/PULL_REQUEST_TEMPLATE.md
+++ /dev/null
@@ -1,8 +0,0 @@
-#### What does this pull request do?
-
-
-#### Where should the reviewer start?
-
-
-#### How should this be manually tested?
-
diff --git a/vendor/github.com/fsnotify/fsnotify/.gitignore b/vendor/github.com/fsnotify/fsnotify/.gitignore
deleted file mode 100644
index 4cd0cbaf..00000000
--- a/vendor/github.com/fsnotify/fsnotify/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-# Setup a Global .gitignore for OS and editor generated files:
-# https://help.github.com/articles/ignoring-files
-# git config --global core.excludesfile ~/.gitignore_global
-
-.vagrant
-*.sublime-project
diff --git a/vendor/github.com/fsnotify/fsnotify/.travis.yml b/vendor/github.com/fsnotify/fsnotify/.travis.yml
deleted file mode 100644
index 981d1bb8..00000000
--- a/vendor/github.com/fsnotify/fsnotify/.travis.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-sudo: false
-language: go
-
-go:
- - 1.8.x
- - 1.9.x
- - tip
-
-matrix:
- allow_failures:
- - go: tip
- fast_finish: true
-
-before_script:
- - go get -u github.com/golang/lint/golint
-
-script:
- - go test -v --race ./...
-
-after_script:
- - test -z "$(gofmt -s -l -w . | tee /dev/stderr)"
- - test -z "$(golint ./... | tee /dev/stderr)"
- - go vet ./...
-
-os:
- - linux
- - osx
-
-notifications:
- email: false
diff --git a/vendor/github.com/fsnotify/fsnotify/AUTHORS b/vendor/github.com/fsnotify/fsnotify/AUTHORS
deleted file mode 100644
index 5ab5d41c..00000000
--- a/vendor/github.com/fsnotify/fsnotify/AUTHORS
+++ /dev/null
@@ -1,52 +0,0 @@
-# Names should be added to this file as
-# Name or Organization
-# The email address is not required for organizations.
-
-# You can update this list using the following command:
-#
-# $ git shortlog -se | awk '{print $2 " " $3 " " $4}'
-
-# Please keep the list sorted.
-
-Aaron L
-Adrien Bustany
-Amit Krishnan
-Anmol Sethi
-Bjørn Erik Pedersen
-Bruno Bigras
-Caleb Spare
-Case Nelson
-Chris Howey
-Christoffer Buchholz
-Daniel Wagner-Hall
-Dave Cheney
-Evan Phoenix
-Francisco Souza
-Hari haran
-John C Barstow
-Kelvin Fo
-Ken-ichirou MATSUZAWA
-Matt Layher
-Nathan Youngman
-Nickolai Zeldovich
-Patrick
-Paul Hammond
-Pawel Knap
-Pieter Droogendijk
-Pursuit92
-Riku Voipio
-Rob Figueiredo
-Rodrigo Chiossi
-Slawek Ligus
-Soge Zhang
-Tiffany Jernigan
-Tilak Sharma
-Tom Payne
-Travis Cline
-Tudor Golubenco
-Vahe Khachikyan
-Yukang
-bronze1man
-debrando
-henrikedwards
-铁哥
diff --git a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md b/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md
deleted file mode 100644
index be4d7ea2..00000000
--- a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md
+++ /dev/null
@@ -1,317 +0,0 @@
-# Changelog
-
-## v1.4.7 / 2018-01-09
-
-* BSD/macOS: Fix possible deadlock on closing the watcher on kqueue (thanks @nhooyr and @glycerine)
-* Tests: Fix missing verb on format string (thanks @rchiossi)
-* Linux: Fix deadlock in Remove (thanks @aarondl)
-* Linux: Watch.Add improvements (avoid race, fix consistency, reduce garbage) (thanks @twpayne)
-* Docs: Moved FAQ into the README (thanks @vahe)
-* Linux: Properly handle inotify's IN_Q_OVERFLOW event (thanks @zeldovich)
-* Docs: replace references to OS X with macOS
-
-## v1.4.2 / 2016-10-10
-
-* Linux: use InotifyInit1 with IN_CLOEXEC to stop leaking a file descriptor to a child process when using fork/exec [#178](https://github.com/fsnotify/fsnotify/pull/178) (thanks @pattyshack)
-
-## v1.4.1 / 2016-10-04
-
-* Fix flaky inotify stress test on Linux [#177](https://github.com/fsnotify/fsnotify/pull/177) (thanks @pattyshack)
-
-## v1.4.0 / 2016-10-01
-
-* add a String() method to Event.Op [#165](https://github.com/fsnotify/fsnotify/pull/165) (thanks @oozie)
-
-## v1.3.1 / 2016-06-28
-
-* Windows: fix for double backslash when watching the root of a drive [#151](https://github.com/fsnotify/fsnotify/issues/151) (thanks @brunoqc)
-
-## v1.3.0 / 2016-04-19
-
-* Support linux/arm64 by [patching](https://go-review.googlesource.com/#/c/21971/) x/sys/unix and switching to to it from syscall (thanks @suihkulokki) [#135](https://github.com/fsnotify/fsnotify/pull/135)
-
-## v1.2.10 / 2016-03-02
-
-* Fix golint errors in windows.go [#121](https://github.com/fsnotify/fsnotify/pull/121) (thanks @tiffanyfj)
-
-## v1.2.9 / 2016-01-13
-
-kqueue: Fix logic for CREATE after REMOVE [#111](https://github.com/fsnotify/fsnotify/pull/111) (thanks @bep)
-
-## v1.2.8 / 2015-12-17
-
-* kqueue: fix race condition in Close [#105](https://github.com/fsnotify/fsnotify/pull/105) (thanks @djui for reporting the issue and @ppknap for writing a failing test)
-* inotify: fix race in test
-* enable race detection for continuous integration (Linux, Mac, Windows)
-
-## v1.2.5 / 2015-10-17
-
-* inotify: use epoll_create1 for arm64 support (requires Linux 2.6.27 or later) [#100](https://github.com/fsnotify/fsnotify/pull/100) (thanks @suihkulokki)
-* inotify: fix path leaks [#73](https://github.com/fsnotify/fsnotify/pull/73) (thanks @chamaken)
-* kqueue: watch for rename events on subdirectories [#83](https://github.com/fsnotify/fsnotify/pull/83) (thanks @guotie)
-* kqueue: avoid infinite loops from symlinks cycles [#101](https://github.com/fsnotify/fsnotify/pull/101) (thanks @illicitonion)
-
-## v1.2.1 / 2015-10-14
-
-* kqueue: don't watch named pipes [#98](https://github.com/fsnotify/fsnotify/pull/98) (thanks @evanphx)
-
-## v1.2.0 / 2015-02-08
-
-* inotify: use epoll to wake up readEvents [#66](https://github.com/fsnotify/fsnotify/pull/66) (thanks @PieterD)
-* inotify: closing watcher should now always shut down goroutine [#63](https://github.com/fsnotify/fsnotify/pull/63) (thanks @PieterD)
-* kqueue: close kqueue after removing watches, fixes [#59](https://github.com/fsnotify/fsnotify/issues/59)
-
-## v1.1.1 / 2015-02-05
-
-* inotify: Retry read on EINTR [#61](https://github.com/fsnotify/fsnotify/issues/61) (thanks @PieterD)
-
-## v1.1.0 / 2014-12-12
-
-* kqueue: rework internals [#43](https://github.com/fsnotify/fsnotify/pull/43)
- * add low-level functions
- * only need to store flags on directories
- * less mutexes [#13](https://github.com/fsnotify/fsnotify/issues/13)
- * done can be an unbuffered channel
- * remove calls to os.NewSyscallError
-* More efficient string concatenation for Event.String() [#52](https://github.com/fsnotify/fsnotify/pull/52) (thanks @mdlayher)
-* kqueue: fix regression in rework causing subdirectories to be watched [#48](https://github.com/fsnotify/fsnotify/issues/48)
-* kqueue: cleanup internal watch before sending remove event [#51](https://github.com/fsnotify/fsnotify/issues/51)
-
-## v1.0.4 / 2014-09-07
-
-* kqueue: add dragonfly to the build tags.
-* Rename source code files, rearrange code so exported APIs are at the top.
-* Add done channel to example code. [#37](https://github.com/fsnotify/fsnotify/pull/37) (thanks @chenyukang)
-
-## v1.0.3 / 2014-08-19
-
-* [Fix] Windows MOVED_TO now translates to Create like on BSD and Linux. [#36](https://github.com/fsnotify/fsnotify/issues/36)
-
-## v1.0.2 / 2014-08-17
-
-* [Fix] Missing create events on macOS. [#14](https://github.com/fsnotify/fsnotify/issues/14) (thanks @zhsso)
-* [Fix] Make ./path and path equivalent. (thanks @zhsso)
-
-## v1.0.0 / 2014-08-15
-
-* [API] Remove AddWatch on Windows, use Add.
-* Improve documentation for exported identifiers. [#30](https://github.com/fsnotify/fsnotify/issues/30)
-* Minor updates based on feedback from golint.
-
-## dev / 2014-07-09
-
-* Moved to [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify).
-* Use os.NewSyscallError instead of returning errno (thanks @hariharan-uno)
-
-## dev / 2014-07-04
-
-* kqueue: fix incorrect mutex used in Close()
-* Update example to demonstrate usage of Op.
-
-## dev / 2014-06-28
-
-* [API] Don't set the Write Op for attribute notifications [#4](https://github.com/fsnotify/fsnotify/issues/4)
-* Fix for String() method on Event (thanks Alex Brainman)
-* Don't build on Plan 9 or Solaris (thanks @4ad)
-
-## dev / 2014-06-21
-
-* Events channel of type Event rather than *Event.
-* [internal] use syscall constants directly for inotify and kqueue.
-* [internal] kqueue: rename events to kevents and fileEvent to event.
-
-## dev / 2014-06-19
-
-* Go 1.3+ required on Windows (uses syscall.ERROR_MORE_DATA internally).
-* [internal] remove cookie from Event struct (unused).
-* [internal] Event struct has the same definition across every OS.
-* [internal] remove internal watch and removeWatch methods.
-
-## dev / 2014-06-12
-
-* [API] Renamed Watch() to Add() and RemoveWatch() to Remove().
-* [API] Pluralized channel names: Events and Errors.
-* [API] Renamed FileEvent struct to Event.
-* [API] Op constants replace methods like IsCreate().
-
-## dev / 2014-06-12
-
-* Fix data race on kevent buffer (thanks @tilaks) [#98](https://github.com/howeyc/fsnotify/pull/98)
-
-## dev / 2014-05-23
-
-* [API] Remove current implementation of WatchFlags.
- * current implementation doesn't take advantage of OS for efficiency
- * provides little benefit over filtering events as they are received, but has extra bookkeeping and mutexes
- * no tests for the current implementation
- * not fully implemented on Windows [#93](https://github.com/howeyc/fsnotify/issues/93#issuecomment-39285195)
-
-## v0.9.3 / 2014-12-31
-
-* kqueue: cleanup internal watch before sending remove event [#51](https://github.com/fsnotify/fsnotify/issues/51)
-
-## v0.9.2 / 2014-08-17
-
-* [Backport] Fix missing create events on macOS. [#14](https://github.com/fsnotify/fsnotify/issues/14) (thanks @zhsso)
-
-## v0.9.1 / 2014-06-12
-
-* Fix data race on kevent buffer (thanks @tilaks) [#98](https://github.com/howeyc/fsnotify/pull/98)
-
-## v0.9.0 / 2014-01-17
-
-* IsAttrib() for events that only concern a file's metadata [#79][] (thanks @abustany)
-* [Fix] kqueue: fix deadlock [#77][] (thanks @cespare)
-* [NOTICE] Development has moved to `code.google.com/p/go.exp/fsnotify` in preparation for inclusion in the Go standard library.
-
-## v0.8.12 / 2013-11-13
-
-* [API] Remove FD_SET and friends from Linux adapter
-
-## v0.8.11 / 2013-11-02
-
-* [Doc] Add Changelog [#72][] (thanks @nathany)
-* [Doc] Spotlight and double modify events on macOS [#62][] (reported by @paulhammond)
-
-## v0.8.10 / 2013-10-19
-
-* [Fix] kqueue: remove file watches when parent directory is removed [#71][] (reported by @mdwhatcott)
-* [Fix] kqueue: race between Close and readEvents [#70][] (reported by @bernerdschaefer)
-* [Doc] specify OS-specific limits in README (thanks @debrando)
-
-## v0.8.9 / 2013-09-08
-
-* [Doc] Contributing (thanks @nathany)
-* [Doc] update package path in example code [#63][] (thanks @paulhammond)
-* [Doc] GoCI badge in README (Linux only) [#60][]
-* [Doc] Cross-platform testing with Vagrant [#59][] (thanks @nathany)
-
-## v0.8.8 / 2013-06-17
-
-* [Fix] Windows: handle `ERROR_MORE_DATA` on Windows [#49][] (thanks @jbowtie)
-
-## v0.8.7 / 2013-06-03
-
-* [API] Make syscall flags internal
-* [Fix] inotify: ignore event changes
-* [Fix] race in symlink test [#45][] (reported by @srid)
-* [Fix] tests on Windows
-* lower case error messages
-
-## v0.8.6 / 2013-05-23
-
-* kqueue: Use EVT_ONLY flag on Darwin
-* [Doc] Update README with full example
-
-## v0.8.5 / 2013-05-09
-
-* [Fix] inotify: allow monitoring of "broken" symlinks (thanks @tsg)
-
-## v0.8.4 / 2013-04-07
-
-* [Fix] kqueue: watch all file events [#40][] (thanks @ChrisBuchholz)
-
-## v0.8.3 / 2013-03-13
-
-* [Fix] inoitfy/kqueue memory leak [#36][] (reported by @nbkolchin)
-* [Fix] kqueue: use fsnFlags for watching a directory [#33][] (reported by @nbkolchin)
-
-## v0.8.2 / 2013-02-07
-
-* [Doc] add Authors
-* [Fix] fix data races for map access [#29][] (thanks @fsouza)
-
-## v0.8.1 / 2013-01-09
-
-* [Fix] Windows path separators
-* [Doc] BSD License
-
-## v0.8.0 / 2012-11-09
-
-* kqueue: directory watching improvements (thanks @vmirage)
-* inotify: add `IN_MOVED_TO` [#25][] (requested by @cpisto)
-* [Fix] kqueue: deleting watched directory [#24][] (reported by @jakerr)
-
-## v0.7.4 / 2012-10-09
-
-* [Fix] inotify: fixes from https://codereview.appspot.com/5418045/ (ugorji)
-* [Fix] kqueue: preserve watch flags when watching for delete [#21][] (reported by @robfig)
-* [Fix] kqueue: watch the directory even if it isn't a new watch (thanks @robfig)
-* [Fix] kqueue: modify after recreation of file
-
-## v0.7.3 / 2012-09-27
-
-* [Fix] kqueue: watch with an existing folder inside the watched folder (thanks @vmirage)
-* [Fix] kqueue: no longer get duplicate CREATE events
-
-## v0.7.2 / 2012-09-01
-
-* kqueue: events for created directories
-
-## v0.7.1 / 2012-07-14
-
-* [Fix] for renaming files
-
-## v0.7.0 / 2012-07-02
-
-* [Feature] FSNotify flags
-* [Fix] inotify: Added file name back to event path
-
-## v0.6.0 / 2012-06-06
-
-* kqueue: watch files after directory created (thanks @tmc)
-
-## v0.5.1 / 2012-05-22
-
-* [Fix] inotify: remove all watches before Close()
-
-## v0.5.0 / 2012-05-03
-
-* [API] kqueue: return errors during watch instead of sending over channel
-* kqueue: match symlink behavior on Linux
-* inotify: add `DELETE_SELF` (requested by @taralx)
-* [Fix] kqueue: handle EINTR (reported by @robfig)
-* [Doc] Godoc example [#1][] (thanks @davecheney)
-
-## v0.4.0 / 2012-03-30
-
-* Go 1 released: build with go tool
-* [Feature] Windows support using winfsnotify
-* Windows does not have attribute change notifications
-* Roll attribute notifications into IsModify
-
-## v0.3.0 / 2012-02-19
-
-* kqueue: add files when watch directory
-
-## v0.2.0 / 2011-12-30
-
-* update to latest Go weekly code
-
-## v0.1.0 / 2011-10-19
-
-* kqueue: add watch on file creation to match inotify
-* kqueue: create file event
-* inotify: ignore `IN_IGNORED` events
-* event String()
-* linux: common FileEvent functions
-* initial commit
-
-[#79]: https://github.com/howeyc/fsnotify/pull/79
-[#77]: https://github.com/howeyc/fsnotify/pull/77
-[#72]: https://github.com/howeyc/fsnotify/issues/72
-[#71]: https://github.com/howeyc/fsnotify/issues/71
-[#70]: https://github.com/howeyc/fsnotify/issues/70
-[#63]: https://github.com/howeyc/fsnotify/issues/63
-[#62]: https://github.com/howeyc/fsnotify/issues/62
-[#60]: https://github.com/howeyc/fsnotify/issues/60
-[#59]: https://github.com/howeyc/fsnotify/issues/59
-[#49]: https://github.com/howeyc/fsnotify/issues/49
-[#45]: https://github.com/howeyc/fsnotify/issues/45
-[#40]: https://github.com/howeyc/fsnotify/issues/40
-[#36]: https://github.com/howeyc/fsnotify/issues/36
-[#33]: https://github.com/howeyc/fsnotify/issues/33
-[#29]: https://github.com/howeyc/fsnotify/issues/29
-[#25]: https://github.com/howeyc/fsnotify/issues/25
-[#24]: https://github.com/howeyc/fsnotify/issues/24
-[#21]: https://github.com/howeyc/fsnotify/issues/21
diff --git a/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md b/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md
deleted file mode 100644
index 828a60b2..00000000
--- a/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# Contributing
-
-## Issues
-
-* Request features and report bugs using the [GitHub Issue Tracker](https://github.com/fsnotify/fsnotify/issues).
-* Please indicate the platform you are using fsnotify on.
-* A code example to reproduce the problem is appreciated.
-
-## Pull Requests
-
-### Contributor License Agreement
-
-fsnotify is derived from code in the [golang.org/x/exp](https://godoc.org/golang.org/x/exp) package and it may be included [in the standard library](https://github.com/fsnotify/fsnotify/issues/1) in the future. Therefore fsnotify carries the same [LICENSE](https://github.com/fsnotify/fsnotify/blob/master/LICENSE) as Go. Contributors retain their copyright, so you need to fill out a short form before we can accept your contribution: [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual).
-
-Please indicate that you have signed the CLA in your pull request.
-
-### How fsnotify is Developed
-
-* Development is done on feature branches.
-* Tests are run on BSD, Linux, macOS and Windows.
-* Pull requests are reviewed and [applied to master][am] using [hub][].
- * Maintainers may modify or squash commits rather than asking contributors to.
-* To issue a new release, the maintainers will:
- * Update the CHANGELOG
- * Tag a version, which will become available through gopkg.in.
-
-### How to Fork
-
-For smooth sailing, always use the original import path. Installing with `go get` makes this easy.
-
-1. Install from GitHub (`go get -u github.com/fsnotify/fsnotify`)
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Ensure everything works and the tests pass (see below)
-4. Commit your changes (`git commit -am 'Add some feature'`)
-
-Contribute upstream:
-
-1. Fork fsnotify on GitHub
-2. Add your remote (`git remote add fork git@github.com:mycompany/repo.git`)
-3. Push to the branch (`git push fork my-new-feature`)
-4. Create a new Pull Request on GitHub
-
-This workflow is [thoroughly explained by Katrina Owen](https://splice.com/blog/contributing-open-source-git-repositories-go/).
-
-### Testing
-
-fsnotify uses build tags to compile different code on Linux, BSD, macOS, and Windows.
-
-Before doing a pull request, please do your best to test your changes on multiple platforms, and list which platforms you were able/unable to test on.
-
-To aid in cross-platform testing there is a Vagrantfile for Linux and BSD.
-
-* Install [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/)
-* Setup [Vagrant Gopher](https://github.com/nathany/vagrant-gopher) in your `src` folder.
-* Run `vagrant up` from the project folder. You can also setup just one box with `vagrant up linux` or `vagrant up bsd` (note: the BSD box doesn't support Windows hosts at this time, and NFS may prompt for your host OS password)
-* Once setup, you can run the test suite on a given OS with a single command `vagrant ssh linux -c 'cd fsnotify/fsnotify; go test'`.
-* When you're done, you will want to halt or destroy the Vagrant boxes.
-
-Notice: fsnotify file system events won't trigger in shared folders. The tests get around this limitation by using the /tmp directory.
-
-Right now there is no equivalent solution for Windows and macOS, but there are Windows VMs [freely available from Microsoft](http://www.modern.ie/en-us/virtualization-tools#downloads).
-
-### Maintainers
-
-Help maintaining fsnotify is welcome. To be a maintainer:
-
-* Submit a pull request and sign the CLA as above.
-* You must be able to run the test suite on Mac, Windows, Linux and BSD.
-
-To keep master clean, the fsnotify project uses the "apply mail" workflow outlined in Nathaniel Talbott's post ["Merge pull request" Considered Harmful][am]. This requires installing [hub][].
-
-All code changes should be internal pull requests.
-
-Releases are tagged using [Semantic Versioning](http://semver.org/).
-
-[hub]: https://github.com/github/hub
-[am]: http://blog.spreedly.com/2014/06/24/merge-pull-request-considered-harmful/#.VGa5yZPF_Zs
diff --git a/vendor/github.com/fsnotify/fsnotify/LICENSE b/vendor/github.com/fsnotify/fsnotify/LICENSE
deleted file mode 100644
index f21e5408..00000000
--- a/vendor/github.com/fsnotify/fsnotify/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-Copyright (c) 2012 fsnotify Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/fsnotify/fsnotify/README.md b/vendor/github.com/fsnotify/fsnotify/README.md
deleted file mode 100644
index 39932074..00000000
--- a/vendor/github.com/fsnotify/fsnotify/README.md
+++ /dev/null
@@ -1,79 +0,0 @@
-# File system notifications for Go
-
-[![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify)
-
-fsnotify utilizes [golang.org/x/sys](https://godoc.org/golang.org/x/sys) rather than `syscall` from the standard library. Ensure you have the latest version installed by running:
-
-```console
-go get -u golang.org/x/sys/...
-```
-
-Cross platform: Windows, Linux, BSD and macOS.
-
-|Adapter |OS |Status |
-|----------|----------|----------|
-|inotify |Linux 2.6.27 or later, Android\*|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)|
-|kqueue |BSD, macOS, iOS\*|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)|
-|ReadDirectoryChangesW|Windows|Supported [![Build status](https://ci.appveyor.com/api/projects/status/ivwjubaih4r0udeh/branch/master?svg=true)](https://ci.appveyor.com/project/NathanYoungman/fsnotify/branch/master)|
-|FSEvents |macOS |[Planned](https://github.com/fsnotify/fsnotify/issues/11)|
-|FEN |Solaris 11 |[In Progress](https://github.com/fsnotify/fsnotify/issues/12)|
-|fanotify |Linux 2.6.37+ | |
-|USN Journals |Windows |[Maybe](https://github.com/fsnotify/fsnotify/issues/53)|
-|Polling |*All* |[Maybe](https://github.com/fsnotify/fsnotify/issues/9)|
-
-\* Android and iOS are untested.
-
-Please see [the documentation](https://godoc.org/github.com/fsnotify/fsnotify) and consult the [FAQ](#faq) for usage information.
-
-## API stability
-
-fsnotify is a fork of [howeyc/fsnotify](https://godoc.org/github.com/howeyc/fsnotify) with a new API as of v1.0. The API is based on [this design document](http://goo.gl/MrYxyA).
-
-All [releases](https://github.com/fsnotify/fsnotify/releases) are tagged based on [Semantic Versioning](http://semver.org/). Further API changes are [planned](https://github.com/fsnotify/fsnotify/milestones), and will be tagged with a new major revision number.
-
-Go 1.6 supports dependencies located in the `vendor/` folder. Unless you are creating a library, it is recommended that you copy fsnotify into `vendor/github.com/fsnotify/fsnotify` within your project, and likewise for `golang.org/x/sys`.
-
-## Contributing
-
-Please refer to [CONTRIBUTING][] before opening an issue or pull request.
-
-## Example
-
-See [example_test.go](https://github.com/fsnotify/fsnotify/blob/master/example_test.go).
-
-## FAQ
-
-**When a file is moved to another directory is it still being watched?**
-
-No (it shouldn't be, unless you are watching where it was moved to).
-
-**When I watch a directory, are all subdirectories watched as well?**
-
-No, you must add watches for any directory you want to watch (a recursive watcher is on the roadmap [#18][]).
-
-**Do I have to watch the Error and Event channels in a separate goroutine?**
-
-As of now, yes. Looking into making this single-thread friendly (see [howeyc #7][#7])
-
-**Why am I receiving multiple events for the same file on OS X?**
-
-Spotlight indexing on OS X can result in multiple events (see [howeyc #62][#62]). A temporary workaround is to add your folder(s) to the *Spotlight Privacy settings* until we have a native FSEvents implementation (see [#11][]).
-
-**How many files can be watched at once?**
-
-There are OS-specific limits as to how many watches can be created:
-* Linux: /proc/sys/fs/inotify/max_user_watches contains the limit, reaching this limit results in a "no space left on device" error.
-* BSD / OSX: sysctl variables "kern.maxfiles" and "kern.maxfilesperproc", reaching these limits results in a "too many open files" error.
-
-[#62]: https://github.com/howeyc/fsnotify/issues/62
-[#18]: https://github.com/fsnotify/fsnotify/issues/18
-[#11]: https://github.com/fsnotify/fsnotify/issues/11
-[#7]: https://github.com/howeyc/fsnotify/issues/7
-
-[contributing]: https://github.com/fsnotify/fsnotify/blob/master/CONTRIBUTING.md
-
-## Related Projects
-
-* [notify](https://github.com/rjeczalik/notify)
-* [fsevents](https://github.com/fsnotify/fsevents)
-
diff --git a/vendor/github.com/fsnotify/fsnotify/example_test.go b/vendor/github.com/fsnotify/fsnotify/example_test.go
deleted file mode 100644
index 700502cb..00000000
--- a/vendor/github.com/fsnotify/fsnotify/example_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !plan9
-
-package fsnotify_test
-
-import (
- "log"
-
- "github.com/fsnotify/fsnotify"
-)
-
-func ExampleNewWatcher() {
- watcher, err := fsnotify.NewWatcher()
- if err != nil {
- log.Fatal(err)
- }
- defer watcher.Close()
-
- done := make(chan bool)
- go func() {
- for {
- select {
- case event := <-watcher.Events:
- log.Println("event:", event)
- if event.Op&fsnotify.Write == fsnotify.Write {
- log.Println("modified file:", event.Name)
- }
- case err := <-watcher.Errors:
- log.Println("error:", err)
- }
- }
- }()
-
- err = watcher.Add("/tmp/foo")
- if err != nil {
- log.Fatal(err)
- }
- <-done
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/fen.go b/vendor/github.com/fsnotify/fsnotify/fen.go
deleted file mode 100644
index ced39cb8..00000000
--- a/vendor/github.com/fsnotify/fsnotify/fen.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build solaris
-
-package fsnotify
-
-import (
- "errors"
-)
-
-// Watcher watches a set of files, delivering events to a channel.
-type Watcher struct {
- Events chan Event
- Errors chan error
-}
-
-// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
-func NewWatcher() (*Watcher, error) {
- return nil, errors.New("FEN based watcher not yet supported for fsnotify\n")
-}
-
-// Close removes all watches and closes the events channel.
-func (w *Watcher) Close() error {
- return nil
-}
-
-// Add starts watching the named file or directory (non-recursively).
-func (w *Watcher) Add(name string) error {
- return nil
-}
-
-// Remove stops watching the the named file or directory (non-recursively).
-func (w *Watcher) Remove(name string) error {
- return nil
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/fsnotify.go b/vendor/github.com/fsnotify/fsnotify/fsnotify.go
deleted file mode 100644
index 190bf0de..00000000
--- a/vendor/github.com/fsnotify/fsnotify/fsnotify.go
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !plan9
-
-// Package fsnotify provides a platform-independent interface for file system notifications.
-package fsnotify
-
-import (
- "bytes"
- "errors"
- "fmt"
-)
-
-// Event represents a single file system notification.
-type Event struct {
- Name string // Relative path to the file or directory.
- Op Op // File operation that triggered the event.
-}
-
-// Op describes a set of file operations.
-type Op uint32
-
-// These are the generalized file operations that can trigger a notification.
-const (
- Create Op = 1 << iota
- Write
- Remove
- Rename
- Chmod
-)
-
-func (op Op) String() string {
- // Use a buffer for efficient string concatenation
- var buffer bytes.Buffer
-
- if op&Create == Create {
- buffer.WriteString("|CREATE")
- }
- if op&Remove == Remove {
- buffer.WriteString("|REMOVE")
- }
- if op&Write == Write {
- buffer.WriteString("|WRITE")
- }
- if op&Rename == Rename {
- buffer.WriteString("|RENAME")
- }
- if op&Chmod == Chmod {
- buffer.WriteString("|CHMOD")
- }
- if buffer.Len() == 0 {
- return ""
- }
- return buffer.String()[1:] // Strip leading pipe
-}
-
-// String returns a string representation of the event in the form
-// "file: REMOVE|WRITE|..."
-func (e Event) String() string {
- return fmt.Sprintf("%q: %s", e.Name, e.Op.String())
-}
-
-// Common errors that can be reported by a watcher
-var ErrEventOverflow = errors.New("fsnotify queue overflow")
diff --git a/vendor/github.com/fsnotify/fsnotify/fsnotify_test.go b/vendor/github.com/fsnotify/fsnotify/fsnotify_test.go
deleted file mode 100644
index f9771d9d..00000000
--- a/vendor/github.com/fsnotify/fsnotify/fsnotify_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !plan9
-
-package fsnotify
-
-import (
- "os"
- "testing"
- "time"
-)
-
-func TestEventStringWithValue(t *testing.T) {
- for opMask, expectedString := range map[Op]string{
- Chmod | Create: `"/usr/someFile": CREATE|CHMOD`,
- Rename: `"/usr/someFile": RENAME`,
- Remove: `"/usr/someFile": REMOVE`,
- Write | Chmod: `"/usr/someFile": WRITE|CHMOD`,
- } {
- event := Event{Name: "/usr/someFile", Op: opMask}
- if event.String() != expectedString {
- t.Fatalf("Expected %s, got: %v", expectedString, event.String())
- }
-
- }
-}
-
-func TestEventOpStringWithValue(t *testing.T) {
- expectedOpString := "WRITE|CHMOD"
- event := Event{Name: "someFile", Op: Write | Chmod}
- if event.Op.String() != expectedOpString {
- t.Fatalf("Expected %s, got: %v", expectedOpString, event.Op.String())
- }
-}
-
-func TestEventOpStringWithNoValue(t *testing.T) {
- expectedOpString := ""
- event := Event{Name: "testFile", Op: 0}
- if event.Op.String() != expectedOpString {
- t.Fatalf("Expected %s, got: %v", expectedOpString, event.Op.String())
- }
-}
-
-// TestWatcherClose tests that the goroutine started by creating the watcher can be
-// signalled to return at any time, even if there is no goroutine listening on the events
-// or errors channels.
-func TestWatcherClose(t *testing.T) {
- t.Parallel()
-
- name := tempMkFile(t, "")
- w := newWatcher(t)
- err := w.Add(name)
- if err != nil {
- t.Fatal(err)
- }
-
- err = os.Remove(name)
- if err != nil {
- t.Fatal(err)
- }
- // Allow the watcher to receive the event.
- time.Sleep(time.Millisecond * 100)
-
- err = w.Close()
- if err != nil {
- t.Fatal(err)
- }
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/inotify.go b/vendor/github.com/fsnotify/fsnotify/inotify.go
deleted file mode 100644
index d9fd1b88..00000000
--- a/vendor/github.com/fsnotify/fsnotify/inotify.go
+++ /dev/null
@@ -1,337 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-
-package fsnotify
-
-import (
- "errors"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "strings"
- "sync"
- "unsafe"
-
- "golang.org/x/sys/unix"
-)
-
-// Watcher watches a set of files, delivering events to a channel.
-type Watcher struct {
- Events chan Event
- Errors chan error
- mu sync.Mutex // Map access
- fd int
- poller *fdPoller
- watches map[string]*watch // Map of inotify watches (key: path)
- paths map[int]string // Map of watched paths (key: watch descriptor)
- done chan struct{} // Channel for sending a "quit message" to the reader goroutine
- doneResp chan struct{} // Channel to respond to Close
-}
-
-// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
-func NewWatcher() (*Watcher, error) {
- // Create inotify fd
- fd, errno := unix.InotifyInit1(unix.IN_CLOEXEC)
- if fd == -1 {
- return nil, errno
- }
- // Create epoll
- poller, err := newFdPoller(fd)
- if err != nil {
- unix.Close(fd)
- return nil, err
- }
- w := &Watcher{
- fd: fd,
- poller: poller,
- watches: make(map[string]*watch),
- paths: make(map[int]string),
- Events: make(chan Event),
- Errors: make(chan error),
- done: make(chan struct{}),
- doneResp: make(chan struct{}),
- }
-
- go w.readEvents()
- return w, nil
-}
-
-func (w *Watcher) isClosed() bool {
- select {
- case <-w.done:
- return true
- default:
- return false
- }
-}
-
-// Close removes all watches and closes the events channel.
-func (w *Watcher) Close() error {
- if w.isClosed() {
- return nil
- }
-
- // Send 'close' signal to goroutine, and set the Watcher to closed.
- close(w.done)
-
- // Wake up goroutine
- w.poller.wake()
-
- // Wait for goroutine to close
- <-w.doneResp
-
- return nil
-}
-
-// Add starts watching the named file or directory (non-recursively).
-func (w *Watcher) Add(name string) error {
- name = filepath.Clean(name)
- if w.isClosed() {
- return errors.New("inotify instance already closed")
- }
-
- const agnosticEvents = unix.IN_MOVED_TO | unix.IN_MOVED_FROM |
- unix.IN_CREATE | unix.IN_ATTRIB | unix.IN_MODIFY |
- unix.IN_MOVE_SELF | unix.IN_DELETE | unix.IN_DELETE_SELF
-
- var flags uint32 = agnosticEvents
-
- w.mu.Lock()
- defer w.mu.Unlock()
- watchEntry := w.watches[name]
- if watchEntry != nil {
- flags |= watchEntry.flags | unix.IN_MASK_ADD
- }
- wd, errno := unix.InotifyAddWatch(w.fd, name, flags)
- if wd == -1 {
- return errno
- }
-
- if watchEntry == nil {
- w.watches[name] = &watch{wd: uint32(wd), flags: flags}
- w.paths[wd] = name
- } else {
- watchEntry.wd = uint32(wd)
- watchEntry.flags = flags
- }
-
- return nil
-}
-
-// Remove stops watching the named file or directory (non-recursively).
-func (w *Watcher) Remove(name string) error {
- name = filepath.Clean(name)
-
- // Fetch the watch.
- w.mu.Lock()
- defer w.mu.Unlock()
- watch, ok := w.watches[name]
-
- // Remove it from inotify.
- if !ok {
- return fmt.Errorf("can't remove non-existent inotify watch for: %s", name)
- }
-
- // We successfully removed the watch if InotifyRmWatch doesn't return an
- // error, we need to clean up our internal state to ensure it matches
- // inotify's kernel state.
- delete(w.paths, int(watch.wd))
- delete(w.watches, name)
-
- // inotify_rm_watch will return EINVAL if the file has been deleted;
- // the inotify will already have been removed.
- // watches and pathes are deleted in ignoreLinux() implicitly and asynchronously
- // by calling inotify_rm_watch() below. e.g. readEvents() goroutine receives IN_IGNORE
- // so that EINVAL means that the wd is being rm_watch()ed or its file removed
- // by another thread and we have not received IN_IGNORE event.
- success, errno := unix.InotifyRmWatch(w.fd, watch.wd)
- if success == -1 {
- // TODO: Perhaps it's not helpful to return an error here in every case.
- // the only two possible errors are:
- // EBADF, which happens when w.fd is not a valid file descriptor of any kind.
- // EINVAL, which is when fd is not an inotify descriptor or wd is not a valid watch descriptor.
- // Watch descriptors are invalidated when they are removed explicitly or implicitly;
- // explicitly by inotify_rm_watch, implicitly when the file they are watching is deleted.
- return errno
- }
-
- return nil
-}
-
-type watch struct {
- wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall)
- flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags)
-}
-
-// readEvents reads from the inotify file descriptor, converts the
-// received events into Event objects and sends them via the Events channel
-func (w *Watcher) readEvents() {
- var (
- buf [unix.SizeofInotifyEvent * 4096]byte // Buffer for a maximum of 4096 raw events
- n int // Number of bytes read with read()
- errno error // Syscall errno
- ok bool // For poller.wait
- )
-
- defer close(w.doneResp)
- defer close(w.Errors)
- defer close(w.Events)
- defer unix.Close(w.fd)
- defer w.poller.close()
-
- for {
- // See if we have been closed.
- if w.isClosed() {
- return
- }
-
- ok, errno = w.poller.wait()
- if errno != nil {
- select {
- case w.Errors <- errno:
- case <-w.done:
- return
- }
- continue
- }
-
- if !ok {
- continue
- }
-
- n, errno = unix.Read(w.fd, buf[:])
- // If a signal interrupted execution, see if we've been asked to close, and try again.
- // http://man7.org/linux/man-pages/man7/signal.7.html :
- // "Before Linux 3.8, reads from an inotify(7) file descriptor were not restartable"
- if errno == unix.EINTR {
- continue
- }
-
- // unix.Read might have been woken up by Close. If so, we're done.
- if w.isClosed() {
- return
- }
-
- if n < unix.SizeofInotifyEvent {
- var err error
- if n == 0 {
- // If EOF is received. This should really never happen.
- err = io.EOF
- } else if n < 0 {
- // If an error occurred while reading.
- err = errno
- } else {
- // Read was too short.
- err = errors.New("notify: short read in readEvents()")
- }
- select {
- case w.Errors <- err:
- case <-w.done:
- return
- }
- continue
- }
-
- var offset uint32
- // We don't know how many events we just read into the buffer
- // While the offset points to at least one whole event...
- for offset <= uint32(n-unix.SizeofInotifyEvent) {
- // Point "raw" to the event in the buffer
- raw := (*unix.InotifyEvent)(unsafe.Pointer(&buf[offset]))
-
- mask := uint32(raw.Mask)
- nameLen := uint32(raw.Len)
-
- if mask&unix.IN_Q_OVERFLOW != 0 {
- select {
- case w.Errors <- ErrEventOverflow:
- case <-w.done:
- return
- }
- }
-
- // If the event happened to the watched directory or the watched file, the kernel
- // doesn't append the filename to the event, but we would like to always fill the
- // the "Name" field with a valid filename. We retrieve the path of the watch from
- // the "paths" map.
- w.mu.Lock()
- name, ok := w.paths[int(raw.Wd)]
- // IN_DELETE_SELF occurs when the file/directory being watched is removed.
- // This is a sign to clean up the maps, otherwise we are no longer in sync
- // with the inotify kernel state which has already deleted the watch
- // automatically.
- if ok && mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF {
- delete(w.paths, int(raw.Wd))
- delete(w.watches, name)
- }
- w.mu.Unlock()
-
- if nameLen > 0 {
- // Point "bytes" at the first byte of the filename
- bytes := (*[unix.PathMax]byte)(unsafe.Pointer(&buf[offset+unix.SizeofInotifyEvent]))
- // The filename is padded with NULL bytes. TrimRight() gets rid of those.
- name += "/" + strings.TrimRight(string(bytes[0:nameLen]), "\000")
- }
-
- event := newEvent(name, mask)
-
- // Send the events that are not ignored on the events channel
- if !event.ignoreLinux(mask) {
- select {
- case w.Events <- event:
- case <-w.done:
- return
- }
- }
-
- // Move to the next event in the buffer
- offset += unix.SizeofInotifyEvent + nameLen
- }
- }
-}
-
-// Certain types of events can be "ignored" and not sent over the Events
-// channel. Such as events marked ignore by the kernel, or MODIFY events
-// against files that do not exist.
-func (e *Event) ignoreLinux(mask uint32) bool {
- // Ignore anything the inotify API says to ignore
- if mask&unix.IN_IGNORED == unix.IN_IGNORED {
- return true
- }
-
- // If the event is not a DELETE or RENAME, the file must exist.
- // Otherwise the event is ignored.
- // *Note*: this was put in place because it was seen that a MODIFY
- // event was sent after the DELETE. This ignores that MODIFY and
- // assumes a DELETE will come or has come if the file doesn't exist.
- if !(e.Op&Remove == Remove || e.Op&Rename == Rename) {
- _, statErr := os.Lstat(e.Name)
- return os.IsNotExist(statErr)
- }
- return false
-}
-
-// newEvent returns an platform-independent Event based on an inotify mask.
-func newEvent(name string, mask uint32) Event {
- e := Event{Name: name}
- if mask&unix.IN_CREATE == unix.IN_CREATE || mask&unix.IN_MOVED_TO == unix.IN_MOVED_TO {
- e.Op |= Create
- }
- if mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF || mask&unix.IN_DELETE == unix.IN_DELETE {
- e.Op |= Remove
- }
- if mask&unix.IN_MODIFY == unix.IN_MODIFY {
- e.Op |= Write
- }
- if mask&unix.IN_MOVE_SELF == unix.IN_MOVE_SELF || mask&unix.IN_MOVED_FROM == unix.IN_MOVED_FROM {
- e.Op |= Rename
- }
- if mask&unix.IN_ATTRIB == unix.IN_ATTRIB {
- e.Op |= Chmod
- }
- return e
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/inotify_poller.go b/vendor/github.com/fsnotify/fsnotify/inotify_poller.go
deleted file mode 100644
index cc7db4b2..00000000
--- a/vendor/github.com/fsnotify/fsnotify/inotify_poller.go
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-
-package fsnotify
-
-import (
- "errors"
-
- "golang.org/x/sys/unix"
-)
-
-type fdPoller struct {
- fd int // File descriptor (as returned by the inotify_init() syscall)
- epfd int // Epoll file descriptor
- pipe [2]int // Pipe for waking up
-}
-
-func emptyPoller(fd int) *fdPoller {
- poller := new(fdPoller)
- poller.fd = fd
- poller.epfd = -1
- poller.pipe[0] = -1
- poller.pipe[1] = -1
- return poller
-}
-
-// Create a new inotify poller.
-// This creates an inotify handler, and an epoll handler.
-func newFdPoller(fd int) (*fdPoller, error) {
- var errno error
- poller := emptyPoller(fd)
- defer func() {
- if errno != nil {
- poller.close()
- }
- }()
- poller.fd = fd
-
- // Create epoll fd
- poller.epfd, errno = unix.EpollCreate1(0)
- if poller.epfd == -1 {
- return nil, errno
- }
- // Create pipe; pipe[0] is the read end, pipe[1] the write end.
- errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK)
- if errno != nil {
- return nil, errno
- }
-
- // Register inotify fd with epoll
- event := unix.EpollEvent{
- Fd: int32(poller.fd),
- Events: unix.EPOLLIN,
- }
- errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.fd, &event)
- if errno != nil {
- return nil, errno
- }
-
- // Register pipe fd with epoll
- event = unix.EpollEvent{
- Fd: int32(poller.pipe[0]),
- Events: unix.EPOLLIN,
- }
- errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.pipe[0], &event)
- if errno != nil {
- return nil, errno
- }
-
- return poller, nil
-}
-
-// Wait using epoll.
-// Returns true if something is ready to be read,
-// false if there is not.
-func (poller *fdPoller) wait() (bool, error) {
- // 3 possible events per fd, and 2 fds, makes a maximum of 6 events.
- // I don't know whether epoll_wait returns the number of events returned,
- // or the total number of events ready.
- // I decided to catch both by making the buffer one larger than the maximum.
- events := make([]unix.EpollEvent, 7)
- for {
- n, errno := unix.EpollWait(poller.epfd, events, -1)
- if n == -1 {
- if errno == unix.EINTR {
- continue
- }
- return false, errno
- }
- if n == 0 {
- // If there are no events, try again.
- continue
- }
- if n > 6 {
- // This should never happen. More events were returned than should be possible.
- return false, errors.New("epoll_wait returned more events than I know what to do with")
- }
- ready := events[:n]
- epollhup := false
- epollerr := false
- epollin := false
- for _, event := range ready {
- if event.Fd == int32(poller.fd) {
- if event.Events&unix.EPOLLHUP != 0 {
- // This should not happen, but if it does, treat it as a wakeup.
- epollhup = true
- }
- if event.Events&unix.EPOLLERR != 0 {
- // If an error is waiting on the file descriptor, we should pretend
- // something is ready to read, and let unix.Read pick up the error.
- epollerr = true
- }
- if event.Events&unix.EPOLLIN != 0 {
- // There is data to read.
- epollin = true
- }
- }
- if event.Fd == int32(poller.pipe[0]) {
- if event.Events&unix.EPOLLHUP != 0 {
- // Write pipe descriptor was closed, by us. This means we're closing down the
- // watcher, and we should wake up.
- }
- if event.Events&unix.EPOLLERR != 0 {
- // If an error is waiting on the pipe file descriptor.
- // This is an absolute mystery, and should never ever happen.
- return false, errors.New("Error on the pipe descriptor.")
- }
- if event.Events&unix.EPOLLIN != 0 {
- // This is a regular wakeup, so we have to clear the buffer.
- err := poller.clearWake()
- if err != nil {
- return false, err
- }
- }
- }
- }
-
- if epollhup || epollerr || epollin {
- return true, nil
- }
- return false, nil
- }
-}
-
-// Close the write end of the poller.
-func (poller *fdPoller) wake() error {
- buf := make([]byte, 1)
- n, errno := unix.Write(poller.pipe[1], buf)
- if n == -1 {
- if errno == unix.EAGAIN {
- // Buffer is full, poller will wake.
- return nil
- }
- return errno
- }
- return nil
-}
-
-func (poller *fdPoller) clearWake() error {
- // You have to be woken up a LOT in order to get to 100!
- buf := make([]byte, 100)
- n, errno := unix.Read(poller.pipe[0], buf)
- if n == -1 {
- if errno == unix.EAGAIN {
- // Buffer is empty, someone else cleared our wake.
- return nil
- }
- return errno
- }
- return nil
-}
-
-// Close all poller file descriptors, but not the one passed to it.
-func (poller *fdPoller) close() {
- if poller.pipe[1] != -1 {
- unix.Close(poller.pipe[1])
- }
- if poller.pipe[0] != -1 {
- unix.Close(poller.pipe[0])
- }
- if poller.epfd != -1 {
- unix.Close(poller.epfd)
- }
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/inotify_poller_test.go b/vendor/github.com/fsnotify/fsnotify/inotify_poller_test.go
deleted file mode 100644
index 26623efe..00000000
--- a/vendor/github.com/fsnotify/fsnotify/inotify_poller_test.go
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-
-package fsnotify
-
-import (
- "testing"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-type testFd [2]int
-
-func makeTestFd(t *testing.T) testFd {
- var tfd testFd
- errno := unix.Pipe(tfd[:])
- if errno != nil {
- t.Fatalf("Failed to create pipe: %v", errno)
- }
- return tfd
-}
-
-func (tfd testFd) fd() int {
- return tfd[0]
-}
-
-func (tfd testFd) closeWrite(t *testing.T) {
- errno := unix.Close(tfd[1])
- if errno != nil {
- t.Fatalf("Failed to close write end of pipe: %v", errno)
- }
-}
-
-func (tfd testFd) put(t *testing.T) {
- buf := make([]byte, 10)
- _, errno := unix.Write(tfd[1], buf)
- if errno != nil {
- t.Fatalf("Failed to write to pipe: %v", errno)
- }
-}
-
-func (tfd testFd) get(t *testing.T) {
- buf := make([]byte, 10)
- _, errno := unix.Read(tfd[0], buf)
- if errno != nil {
- t.Fatalf("Failed to read from pipe: %v", errno)
- }
-}
-
-func (tfd testFd) close() {
- unix.Close(tfd[1])
- unix.Close(tfd[0])
-}
-
-func makePoller(t *testing.T) (testFd, *fdPoller) {
- tfd := makeTestFd(t)
- poller, err := newFdPoller(tfd.fd())
- if err != nil {
- t.Fatalf("Failed to create poller: %v", err)
- }
- return tfd, poller
-}
-
-func TestPollerWithBadFd(t *testing.T) {
- _, err := newFdPoller(-1)
- if err != unix.EBADF {
- t.Fatalf("Expected EBADF, got: %v", err)
- }
-}
-
-func TestPollerWithData(t *testing.T) {
- tfd, poller := makePoller(t)
- defer tfd.close()
- defer poller.close()
-
- tfd.put(t)
- ok, err := poller.wait()
- if err != nil {
- t.Fatalf("poller failed: %v", err)
- }
- if !ok {
- t.Fatalf("expected poller to return true")
- }
- tfd.get(t)
-}
-
-func TestPollerWithWakeup(t *testing.T) {
- tfd, poller := makePoller(t)
- defer tfd.close()
- defer poller.close()
-
- err := poller.wake()
- if err != nil {
- t.Fatalf("wake failed: %v", err)
- }
- ok, err := poller.wait()
- if err != nil {
- t.Fatalf("poller failed: %v", err)
- }
- if ok {
- t.Fatalf("expected poller to return false")
- }
-}
-
-func TestPollerWithClose(t *testing.T) {
- tfd, poller := makePoller(t)
- defer tfd.close()
- defer poller.close()
-
- tfd.closeWrite(t)
- ok, err := poller.wait()
- if err != nil {
- t.Fatalf("poller failed: %v", err)
- }
- if !ok {
- t.Fatalf("expected poller to return true")
- }
-}
-
-func TestPollerWithWakeupAndData(t *testing.T) {
- tfd, poller := makePoller(t)
- defer tfd.close()
- defer poller.close()
-
- tfd.put(t)
- err := poller.wake()
- if err != nil {
- t.Fatalf("wake failed: %v", err)
- }
-
- // both data and wakeup
- ok, err := poller.wait()
- if err != nil {
- t.Fatalf("poller failed: %v", err)
- }
- if !ok {
- t.Fatalf("expected poller to return true")
- }
-
- // data is still in the buffer, wakeup is cleared
- ok, err = poller.wait()
- if err != nil {
- t.Fatalf("poller failed: %v", err)
- }
- if !ok {
- t.Fatalf("expected poller to return true")
- }
-
- tfd.get(t)
- // data is gone, only wakeup now
- err = poller.wake()
- if err != nil {
- t.Fatalf("wake failed: %v", err)
- }
- ok, err = poller.wait()
- if err != nil {
- t.Fatalf("poller failed: %v", err)
- }
- if ok {
- t.Fatalf("expected poller to return false")
- }
-}
-
-func TestPollerConcurrent(t *testing.T) {
- tfd, poller := makePoller(t)
- defer tfd.close()
- defer poller.close()
-
- oks := make(chan bool)
- live := make(chan bool)
- defer close(live)
- go func() {
- defer close(oks)
- for {
- ok, err := poller.wait()
- if err != nil {
- t.Fatalf("poller failed: %v", err)
- }
- oks <- ok
- if !<-live {
- return
- }
- }
- }()
-
- // Try a write
- select {
- case <-time.After(50 * time.Millisecond):
- case <-oks:
- t.Fatalf("poller did not wait")
- }
- tfd.put(t)
- if !<-oks {
- t.Fatalf("expected true")
- }
- tfd.get(t)
- live <- true
-
- // Try a wakeup
- select {
- case <-time.After(50 * time.Millisecond):
- case <-oks:
- t.Fatalf("poller did not wait")
- }
- err := poller.wake()
- if err != nil {
- t.Fatalf("wake failed: %v", err)
- }
- if <-oks {
- t.Fatalf("expected false")
- }
- live <- true
-
- // Try a close
- select {
- case <-time.After(50 * time.Millisecond):
- case <-oks:
- t.Fatalf("poller did not wait")
- }
- tfd.closeWrite(t)
- if !<-oks {
- t.Fatalf("expected true")
- }
- tfd.get(t)
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/inotify_test.go b/vendor/github.com/fsnotify/fsnotify/inotify_test.go
deleted file mode 100644
index 54f3f00e..00000000
--- a/vendor/github.com/fsnotify/fsnotify/inotify_test.go
+++ /dev/null
@@ -1,449 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-
-package fsnotify
-
-import (
- "fmt"
- "os"
- "path/filepath"
- "strings"
- "testing"
- "time"
-)
-
-func TestInotifyCloseRightAway(t *testing.T) {
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher")
- }
-
- // Close immediately; it won't even reach the first unix.Read.
- w.Close()
-
- // Wait for the close to complete.
- <-time.After(50 * time.Millisecond)
- isWatcherReallyClosed(t, w)
-}
-
-func TestInotifyCloseSlightlyLater(t *testing.T) {
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher")
- }
-
- // Wait until readEvents has reached unix.Read, and Close.
- <-time.After(50 * time.Millisecond)
- w.Close()
-
- // Wait for the close to complete.
- <-time.After(50 * time.Millisecond)
- isWatcherReallyClosed(t, w)
-}
-
-func TestInotifyCloseSlightlyLaterWithWatch(t *testing.T) {
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher")
- }
- w.Add(testDir)
-
- // Wait until readEvents has reached unix.Read, and Close.
- <-time.After(50 * time.Millisecond)
- w.Close()
-
- // Wait for the close to complete.
- <-time.After(50 * time.Millisecond)
- isWatcherReallyClosed(t, w)
-}
-
-func TestInotifyCloseAfterRead(t *testing.T) {
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher")
- }
-
- err = w.Add(testDir)
- if err != nil {
- t.Fatalf("Failed to add .")
- }
-
- // Generate an event.
- os.Create(filepath.Join(testDir, "somethingSOMETHINGsomethingSOMETHING"))
-
- // Wait for readEvents to read the event, then close the watcher.
- <-time.After(50 * time.Millisecond)
- w.Close()
-
- // Wait for the close to complete.
- <-time.After(50 * time.Millisecond)
- isWatcherReallyClosed(t, w)
-}
-
-func isWatcherReallyClosed(t *testing.T, w *Watcher) {
- select {
- case err, ok := <-w.Errors:
- if ok {
- t.Fatalf("w.Errors is not closed; readEvents is still alive after closing (error: %v)", err)
- }
- default:
- t.Fatalf("w.Errors would have blocked; readEvents is still alive!")
- }
-
- select {
- case _, ok := <-w.Events:
- if ok {
- t.Fatalf("w.Events is not closed; readEvents is still alive after closing")
- }
- default:
- t.Fatalf("w.Events would have blocked; readEvents is still alive!")
- }
-}
-
-func TestInotifyCloseCreate(t *testing.T) {
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher: %v", err)
- }
- defer w.Close()
-
- err = w.Add(testDir)
- if err != nil {
- t.Fatalf("Failed to add testDir: %v", err)
- }
- h, err := os.Create(filepath.Join(testDir, "testfile"))
- if err != nil {
- t.Fatalf("Failed to create file in testdir: %v", err)
- }
- h.Close()
- select {
- case _ = <-w.Events:
- case err := <-w.Errors:
- t.Fatalf("Error from watcher: %v", err)
- case <-time.After(50 * time.Millisecond):
- t.Fatalf("Took too long to wait for event")
- }
-
- // At this point, we've received one event, so the goroutine is ready.
- // It's also blocking on unix.Read.
- // Now we try to swap the file descriptor under its nose.
- w.Close()
- w, err = NewWatcher()
- defer w.Close()
- if err != nil {
- t.Fatalf("Failed to create second watcher: %v", err)
- }
-
- <-time.After(50 * time.Millisecond)
- err = w.Add(testDir)
- if err != nil {
- t.Fatalf("Error adding testDir again: %v", err)
- }
-}
-
-// This test verifies the watcher can keep up with file creations/deletions
-// when under load.
-func TestInotifyStress(t *testing.T) {
- maxNumToCreate := 1000
-
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
- testFilePrefix := filepath.Join(testDir, "testfile")
-
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher: %v", err)
- }
- defer w.Close()
-
- err = w.Add(testDir)
- if err != nil {
- t.Fatalf("Failed to add testDir: %v", err)
- }
-
- doneChan := make(chan struct{})
- // The buffer ensures that the file generation goroutine is never blocked.
- errChan := make(chan error, 2*maxNumToCreate)
-
- go func() {
- for i := 0; i < maxNumToCreate; i++ {
- testFile := fmt.Sprintf("%s%d", testFilePrefix, i)
-
- handle, err := os.Create(testFile)
- if err != nil {
- errChan <- fmt.Errorf("Create failed: %v", err)
- continue
- }
-
- err = handle.Close()
- if err != nil {
- errChan <- fmt.Errorf("Close failed: %v", err)
- continue
- }
- }
-
- // If we delete a newly created file too quickly, inotify will skip the
- // create event and only send the delete event.
- time.Sleep(100 * time.Millisecond)
-
- for i := 0; i < maxNumToCreate; i++ {
- testFile := fmt.Sprintf("%s%d", testFilePrefix, i)
- err = os.Remove(testFile)
- if err != nil {
- errChan <- fmt.Errorf("Remove failed: %v", err)
- }
- }
-
- close(doneChan)
- }()
-
- creates := 0
- removes := 0
-
- finished := false
- after := time.After(10 * time.Second)
- for !finished {
- select {
- case <-after:
- t.Fatalf("Not done")
- case <-doneChan:
- finished = true
- case err := <-errChan:
- t.Fatalf("Got an error from file creator goroutine: %v", err)
- case err := <-w.Errors:
- t.Fatalf("Got an error from watcher: %v", err)
- case evt := <-w.Events:
- if !strings.HasPrefix(evt.Name, testFilePrefix) {
- t.Fatalf("Got an event for an unknown file: %s", evt.Name)
- }
- if evt.Op == Create {
- creates++
- }
- if evt.Op == Remove {
- removes++
- }
- }
- }
-
- // Drain remaining events from channels
- count := 0
- for count < 10 {
- select {
- case err := <-errChan:
- t.Fatalf("Got an error from file creator goroutine: %v", err)
- case err := <-w.Errors:
- t.Fatalf("Got an error from watcher: %v", err)
- case evt := <-w.Events:
- if !strings.HasPrefix(evt.Name, testFilePrefix) {
- t.Fatalf("Got an event for an unknown file: %s", evt.Name)
- }
- if evt.Op == Create {
- creates++
- }
- if evt.Op == Remove {
- removes++
- }
- count = 0
- default:
- count++
- // Give the watcher chances to fill the channels.
- time.Sleep(time.Millisecond)
- }
- }
-
- if creates-removes > 1 || creates-removes < -1 {
- t.Fatalf("Creates and removes should not be off by more than one: %d creates, %d removes", creates, removes)
- }
- if creates < 50 {
- t.Fatalf("Expected at least 50 creates, got %d", creates)
- }
-}
-
-func TestInotifyRemoveTwice(t *testing.T) {
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
- testFile := filepath.Join(testDir, "testfile")
-
- handle, err := os.Create(testFile)
- if err != nil {
- t.Fatalf("Create failed: %v", err)
- }
- handle.Close()
-
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher: %v", err)
- }
- defer w.Close()
-
- err = w.Add(testFile)
- if err != nil {
- t.Fatalf("Failed to add testFile: %v", err)
- }
-
- err = w.Remove(testFile)
- if err != nil {
- t.Fatalf("wanted successful remove but got: %v", err)
- }
-
- err = w.Remove(testFile)
- if err == nil {
- t.Fatalf("no error on removing invalid file")
- }
-
- w.mu.Lock()
- defer w.mu.Unlock()
- if len(w.watches) != 0 {
- t.Fatalf("Expected watches len is 0, but got: %d, %v", len(w.watches), w.watches)
- }
- if len(w.paths) != 0 {
- t.Fatalf("Expected paths len is 0, but got: %d, %v", len(w.paths), w.paths)
- }
-}
-
-func TestInotifyInnerMapLength(t *testing.T) {
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
- testFile := filepath.Join(testDir, "testfile")
-
- handle, err := os.Create(testFile)
- if err != nil {
- t.Fatalf("Create failed: %v", err)
- }
- handle.Close()
-
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher: %v", err)
- }
- defer w.Close()
-
- err = w.Add(testFile)
- if err != nil {
- t.Fatalf("Failed to add testFile: %v", err)
- }
- go func() {
- for err := range w.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- err = os.Remove(testFile)
- if err != nil {
- t.Fatalf("Failed to remove testFile: %v", err)
- }
- _ = <-w.Events // consume Remove event
- <-time.After(50 * time.Millisecond) // wait IN_IGNORE propagated
-
- w.mu.Lock()
- defer w.mu.Unlock()
- if len(w.watches) != 0 {
- t.Fatalf("Expected watches len is 0, but got: %d, %v", len(w.watches), w.watches)
- }
- if len(w.paths) != 0 {
- t.Fatalf("Expected paths len is 0, but got: %d, %v", len(w.paths), w.paths)
- }
-}
-
-func TestInotifyOverflow(t *testing.T) {
- // We need to generate many more events than the
- // fs.inotify.max_queued_events sysctl setting.
- // We use multiple goroutines (one per directory)
- // to speed up file creation.
- numDirs := 128
- numFiles := 1024
-
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- w, err := NewWatcher()
- if err != nil {
- t.Fatalf("Failed to create watcher: %v", err)
- }
- defer w.Close()
-
- for dn := 0; dn < numDirs; dn++ {
- testSubdir := fmt.Sprintf("%s/%d", testDir, dn)
-
- err := os.Mkdir(testSubdir, 0777)
- if err != nil {
- t.Fatalf("Cannot create subdir: %v", err)
- }
-
- err = w.Add(testSubdir)
- if err != nil {
- t.Fatalf("Failed to add subdir: %v", err)
- }
- }
-
- errChan := make(chan error, numDirs*numFiles)
-
- for dn := 0; dn < numDirs; dn++ {
- testSubdir := fmt.Sprintf("%s/%d", testDir, dn)
-
- go func() {
- for fn := 0; fn < numFiles; fn++ {
- testFile := fmt.Sprintf("%s/%d", testSubdir, fn)
-
- handle, err := os.Create(testFile)
- if err != nil {
- errChan <- fmt.Errorf("Create failed: %v", err)
- continue
- }
-
- err = handle.Close()
- if err != nil {
- errChan <- fmt.Errorf("Close failed: %v", err)
- continue
- }
- }
- }()
- }
-
- creates := 0
- overflows := 0
-
- after := time.After(10 * time.Second)
- for overflows == 0 && creates < numDirs*numFiles {
- select {
- case <-after:
- t.Fatalf("Not done")
- case err := <-errChan:
- t.Fatalf("Got an error from file creator goroutine: %v", err)
- case err := <-w.Errors:
- if err == ErrEventOverflow {
- overflows++
- } else {
- t.Fatalf("Got an error from watcher: %v", err)
- }
- case evt := <-w.Events:
- if !strings.HasPrefix(evt.Name, testDir) {
- t.Fatalf("Got an event for an unknown file: %s", evt.Name)
- }
- if evt.Op == Create {
- creates++
- }
- }
- }
-
- if creates == numDirs*numFiles {
- t.Fatalf("Could not trigger overflow")
- }
-
- if overflows == 0 {
- t.Fatalf("No overflow and not enough creates (expected %d, got %d)",
- numDirs*numFiles, creates)
- }
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/integration_darwin_test.go b/vendor/github.com/fsnotify/fsnotify/integration_darwin_test.go
deleted file mode 100644
index cd6adc27..00000000
--- a/vendor/github.com/fsnotify/fsnotify/integration_darwin_test.go
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package fsnotify
-
-import (
- "os"
- "path/filepath"
- "testing"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-// testExchangedataForWatcher tests the watcher with the exchangedata operation on macOS.
-//
-// This is widely used for atomic saves on macOS, e.g. TextMate and in Apple's NSDocument.
-//
-// See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/exchangedata.2.html
-// Also see: https://github.com/textmate/textmate/blob/cd016be29489eba5f3c09b7b70b06da134dda550/Frameworks/io/src/swap_file_data.cc#L20
-func testExchangedataForWatcher(t *testing.T, watchDir bool) {
- // Create directory to watch
- testDir1 := tempMkdir(t)
-
- // For the intermediate file
- testDir2 := tempMkdir(t)
-
- defer os.RemoveAll(testDir1)
- defer os.RemoveAll(testDir2)
-
- resolvedFilename := "TestFsnotifyEvents.file"
-
- // TextMate does:
- //
- // 1. exchangedata (intermediate, resolved)
- // 2. unlink intermediate
- //
- // Let's try to simulate that:
- resolved := filepath.Join(testDir1, resolvedFilename)
- intermediate := filepath.Join(testDir2, resolvedFilename+"~")
-
- // Make sure we create the file before we start watching
- createAndSyncFile(t, resolved)
-
- watcher := newWatcher(t)
-
- // Test both variants in isolation
- if watchDir {
- addWatch(t, watcher, testDir1)
- } else {
- addWatch(t, watcher, resolved)
- }
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var removeReceived counter
- var createReceived counter
-
- done := make(chan bool)
-
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(resolved) {
- if event.Op&Remove == Remove {
- removeReceived.increment()
- }
- if event.Op&Create == Create {
- createReceived.increment()
- }
- }
- t.Logf("event received: %s", event)
- }
- done <- true
- }()
-
- // Repeat to make sure the watched file/directory "survives" the REMOVE/CREATE loop.
- for i := 1; i <= 3; i++ {
- // The intermediate file is created in a folder outside the watcher
- createAndSyncFile(t, intermediate)
-
- // 1. Swap
- if err := unix.Exchangedata(intermediate, resolved, 0); err != nil {
- t.Fatalf("[%d] exchangedata failed: %s", i, err)
- }
-
- time.Sleep(50 * time.Millisecond)
-
- // 2. Delete the intermediate file
- err := os.Remove(intermediate)
-
- if err != nil {
- t.Fatalf("[%d] remove %s failed: %s", i, intermediate, err)
- }
-
- time.Sleep(50 * time.Millisecond)
-
- }
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
-
- // The events will be (CHMOD + REMOVE + CREATE) X 2. Let's focus on the last two:
- if removeReceived.value() < 3 {
- t.Fatal("fsnotify remove events have not been received after 500 ms")
- }
-
- if createReceived.value() < 3 {
- t.Fatal("fsnotify create events have not been received after 500 ms")
- }
-
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(2 * time.Second):
- t.Fatal("event stream was not closed after 2 seconds")
- }
-}
-
-// TestExchangedataInWatchedDir test exchangedata operation on file in watched dir.
-func TestExchangedataInWatchedDir(t *testing.T) {
- testExchangedataForWatcher(t, true)
-}
-
-// TestExchangedataInWatchedDir test exchangedata operation on watched file.
-func TestExchangedataInWatchedFile(t *testing.T) {
- testExchangedataForWatcher(t, false)
-}
-
-func createAndSyncFile(t *testing.T, filepath string) {
- f1, err := os.OpenFile(filepath, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating %s failed: %s", filepath, err)
- }
- f1.Sync()
- f1.Close()
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/integration_test.go b/vendor/github.com/fsnotify/fsnotify/integration_test.go
deleted file mode 100644
index 8b7e9d3e..00000000
--- a/vendor/github.com/fsnotify/fsnotify/integration_test.go
+++ /dev/null
@@ -1,1237 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !plan9,!solaris
-
-package fsnotify
-
-import (
- "io/ioutil"
- "os"
- "os/exec"
- "path"
- "path/filepath"
- "runtime"
- "sync/atomic"
- "testing"
- "time"
-)
-
-// An atomic counter
-type counter struct {
- val int32
-}
-
-func (c *counter) increment() {
- atomic.AddInt32(&c.val, 1)
-}
-
-func (c *counter) value() int32 {
- return atomic.LoadInt32(&c.val)
-}
-
-func (c *counter) reset() {
- atomic.StoreInt32(&c.val, 0)
-}
-
-// tempMkdir makes a temporary directory
-func tempMkdir(t *testing.T) string {
- dir, err := ioutil.TempDir("", "fsnotify")
- if err != nil {
- t.Fatalf("failed to create test directory: %s", err)
- }
- return dir
-}
-
-// tempMkFile makes a temporary file.
-func tempMkFile(t *testing.T, dir string) string {
- f, err := ioutil.TempFile(dir, "fsnotify")
- if err != nil {
- t.Fatalf("failed to create test file: %v", err)
- }
- defer f.Close()
- return f.Name()
-}
-
-// newWatcher initializes an fsnotify Watcher instance.
-func newWatcher(t *testing.T) *Watcher {
- watcher, err := NewWatcher()
- if err != nil {
- t.Fatalf("NewWatcher() failed: %s", err)
- }
- return watcher
-}
-
-// addWatch adds a watch for a directory
-func addWatch(t *testing.T, watcher *Watcher, dir string) {
- if err := watcher.Add(dir); err != nil {
- t.Fatalf("watcher.Add(%q) failed: %s", dir, err)
- }
-}
-
-func TestFsnotifyMultipleOperations(t *testing.T) {
- watcher := newWatcher(t)
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- // Create directory that's not watched
- testDirToMoveFiles := tempMkdir(t)
- defer os.RemoveAll(testDirToMoveFiles)
-
- testFile := filepath.Join(testDir, "TestFsnotifySeq.testfile")
- testFileRenamed := filepath.Join(testDirToMoveFiles, "TestFsnotifySeqRename.testfile")
-
- addWatch(t, watcher, testDir)
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var createReceived, modifyReceived, deleteReceived, renameReceived counter
- done := make(chan bool)
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testDir) || event.Name == filepath.Clean(testFile) {
- t.Logf("event received: %s", event)
- if event.Op&Remove == Remove {
- deleteReceived.increment()
- }
- if event.Op&Write == Write {
- modifyReceived.increment()
- }
- if event.Op&Create == Create {
- createReceived.increment()
- }
- if event.Op&Rename == Rename {
- renameReceived.increment()
- }
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- done <- true
- }()
-
- // Create a file
- // This should add at least one event to the fsnotify event queue
- var f *os.File
- f, err := os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
-
- time.Sleep(time.Millisecond)
- f.WriteString("data")
- f.Sync()
- f.Close()
-
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- if err := testRename(testFile, testFileRenamed); err != nil {
- t.Fatalf("rename failed: %s", err)
- }
-
- // Modify the file outside of the watched dir
- f, err = os.Open(testFileRenamed)
- if err != nil {
- t.Fatalf("open test renamed file failed: %s", err)
- }
- f.WriteString("data")
- f.Sync()
- f.Close()
-
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- // Recreate the file that was moved
- f, err = os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Close()
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
- cReceived := createReceived.value()
- if cReceived != 2 {
- t.Fatalf("incorrect number of create events received after 500 ms (%d vs %d)", cReceived, 2)
- }
- mReceived := modifyReceived.value()
- if mReceived != 1 {
- t.Fatalf("incorrect number of modify events received after 500 ms (%d vs %d)", mReceived, 1)
- }
- dReceived := deleteReceived.value()
- rReceived := renameReceived.value()
- if dReceived+rReceived != 1 {
- t.Fatalf("incorrect number of rename+delete events received after 500 ms (%d vs %d)", rReceived+dReceived, 1)
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(2 * time.Second):
- t.Fatal("event stream was not closed after 2 seconds")
- }
-}
-
-func TestFsnotifyMultipleCreates(t *testing.T) {
- watcher := newWatcher(t)
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- testFile := filepath.Join(testDir, "TestFsnotifySeq.testfile")
-
- addWatch(t, watcher, testDir)
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var createReceived, modifyReceived, deleteReceived counter
- done := make(chan bool)
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testDir) || event.Name == filepath.Clean(testFile) {
- t.Logf("event received: %s", event)
- if event.Op&Remove == Remove {
- deleteReceived.increment()
- }
- if event.Op&Create == Create {
- createReceived.increment()
- }
- if event.Op&Write == Write {
- modifyReceived.increment()
- }
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- done <- true
- }()
-
- // Create a file
- // This should add at least one event to the fsnotify event queue
- var f *os.File
- f, err := os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
-
- time.Sleep(time.Millisecond)
- f.WriteString("data")
- f.Sync()
- f.Close()
-
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- os.Remove(testFile)
-
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- // Recreate the file
- f, err = os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Close()
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- // Modify
- f, err = os.OpenFile(testFile, os.O_WRONLY, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
-
- time.Sleep(time.Millisecond)
- f.WriteString("data")
- f.Sync()
- f.Close()
-
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- // Modify
- f, err = os.OpenFile(testFile, os.O_WRONLY, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
-
- time.Sleep(time.Millisecond)
- f.WriteString("data")
- f.Sync()
- f.Close()
-
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
- cReceived := createReceived.value()
- if cReceived != 2 {
- t.Fatalf("incorrect number of create events received after 500 ms (%d vs %d)", cReceived, 2)
- }
- mReceived := modifyReceived.value()
- if mReceived < 3 {
- t.Fatalf("incorrect number of modify events received after 500 ms (%d vs atleast %d)", mReceived, 3)
- }
- dReceived := deleteReceived.value()
- if dReceived != 1 {
- t.Fatalf("incorrect number of rename+delete events received after 500 ms (%d vs %d)", dReceived, 1)
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(2 * time.Second):
- t.Fatal("event stream was not closed after 2 seconds")
- }
-}
-
-func TestFsnotifyDirOnly(t *testing.T) {
- watcher := newWatcher(t)
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- // Create a file before watching directory
- // This should NOT add any events to the fsnotify event queue
- testFileAlreadyExists := filepath.Join(testDir, "TestFsnotifyEventsExisting.testfile")
- {
- var f *os.File
- f, err := os.OpenFile(testFileAlreadyExists, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
- f.Close()
- }
-
- addWatch(t, watcher, testDir)
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- testFile := filepath.Join(testDir, "TestFsnotifyDirOnly.testfile")
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var createReceived, modifyReceived, deleteReceived counter
- done := make(chan bool)
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testDir) || event.Name == filepath.Clean(testFile) || event.Name == filepath.Clean(testFileAlreadyExists) {
- t.Logf("event received: %s", event)
- if event.Op&Remove == Remove {
- deleteReceived.increment()
- }
- if event.Op&Write == Write {
- modifyReceived.increment()
- }
- if event.Op&Create == Create {
- createReceived.increment()
- }
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- done <- true
- }()
-
- // Create a file
- // This should add at least one event to the fsnotify event queue
- var f *os.File
- f, err := os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
-
- time.Sleep(time.Millisecond)
- f.WriteString("data")
- f.Sync()
- f.Close()
-
- time.Sleep(50 * time.Millisecond) // give system time to sync write change before delete
-
- os.Remove(testFile)
- os.Remove(testFileAlreadyExists)
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
- cReceived := createReceived.value()
- if cReceived != 1 {
- t.Fatalf("incorrect number of create events received after 500 ms (%d vs %d)", cReceived, 1)
- }
- mReceived := modifyReceived.value()
- if mReceived != 1 {
- t.Fatalf("incorrect number of modify events received after 500 ms (%d vs %d)", mReceived, 1)
- }
- dReceived := deleteReceived.value()
- if dReceived != 2 {
- t.Fatalf("incorrect number of delete events received after 500 ms (%d vs %d)", dReceived, 2)
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(2 * time.Second):
- t.Fatal("event stream was not closed after 2 seconds")
- }
-}
-
-func TestFsnotifyDeleteWatchedDir(t *testing.T) {
- watcher := newWatcher(t)
- defer watcher.Close()
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- // Create a file before watching directory
- testFileAlreadyExists := filepath.Join(testDir, "TestFsnotifyEventsExisting.testfile")
- {
- var f *os.File
- f, err := os.OpenFile(testFileAlreadyExists, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
- f.Close()
- }
-
- addWatch(t, watcher, testDir)
-
- // Add a watch for testFile
- addWatch(t, watcher, testFileAlreadyExists)
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var deleteReceived counter
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testDir) || event.Name == filepath.Clean(testFileAlreadyExists) {
- t.Logf("event received: %s", event)
- if event.Op&Remove == Remove {
- deleteReceived.increment()
- }
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- }()
-
- os.RemoveAll(testDir)
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
- dReceived := deleteReceived.value()
- if dReceived < 2 {
- t.Fatalf("did not receive at least %d delete events, received %d after 500 ms", 2, dReceived)
- }
-}
-
-func TestFsnotifySubDir(t *testing.T) {
- watcher := newWatcher(t)
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- testFile1 := filepath.Join(testDir, "TestFsnotifyFile1.testfile")
- testSubDir := filepath.Join(testDir, "sub")
- testSubDirFile := filepath.Join(testDir, "sub/TestFsnotifyFile1.testfile")
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var createReceived, deleteReceived counter
- done := make(chan bool)
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testDir) || event.Name == filepath.Clean(testSubDir) || event.Name == filepath.Clean(testFile1) {
- t.Logf("event received: %s", event)
- if event.Op&Create == Create {
- createReceived.increment()
- }
- if event.Op&Remove == Remove {
- deleteReceived.increment()
- }
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- done <- true
- }()
-
- addWatch(t, watcher, testDir)
-
- // Create sub-directory
- if err := os.Mkdir(testSubDir, 0777); err != nil {
- t.Fatalf("failed to create test sub-directory: %s", err)
- }
-
- // Create a file
- var f *os.File
- f, err := os.OpenFile(testFile1, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
- f.Close()
-
- // Create a file (Should not see this! we are not watching subdir)
- var fs *os.File
- fs, err = os.OpenFile(testSubDirFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- fs.Sync()
- fs.Close()
-
- time.Sleep(200 * time.Millisecond)
-
- // Make sure receive deletes for both file and sub-directory
- os.RemoveAll(testSubDir)
- os.Remove(testFile1)
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
- cReceived := createReceived.value()
- if cReceived != 2 {
- t.Fatalf("incorrect number of create events received after 500 ms (%d vs %d)", cReceived, 2)
- }
- dReceived := deleteReceived.value()
- if dReceived != 2 {
- t.Fatalf("incorrect number of delete events received after 500 ms (%d vs %d)", dReceived, 2)
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(2 * time.Second):
- t.Fatal("event stream was not closed after 2 seconds")
- }
-}
-
-func TestFsnotifyRename(t *testing.T) {
- watcher := newWatcher(t)
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- addWatch(t, watcher, testDir)
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- testFile := filepath.Join(testDir, "TestFsnotifyEvents.testfile")
- testFileRenamed := filepath.Join(testDir, "TestFsnotifyEvents.testfileRenamed")
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var renameReceived counter
- done := make(chan bool)
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testDir) || event.Name == filepath.Clean(testFile) || event.Name == filepath.Clean(testFileRenamed) {
- if event.Op&Rename == Rename {
- renameReceived.increment()
- }
- t.Logf("event received: %s", event)
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- done <- true
- }()
-
- // Create a file
- // This should add at least one event to the fsnotify event queue
- var f *os.File
- f, err := os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
-
- f.WriteString("data")
- f.Sync()
- f.Close()
-
- // Add a watch for testFile
- addWatch(t, watcher, testFile)
-
- if err := testRename(testFile, testFileRenamed); err != nil {
- t.Fatalf("rename failed: %s", err)
- }
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
- if renameReceived.value() == 0 {
- t.Fatal("fsnotify rename events have not been received after 500 ms")
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(2 * time.Second):
- t.Fatal("event stream was not closed after 2 seconds")
- }
-
- os.Remove(testFileRenamed)
-}
-
-func TestFsnotifyRenameToCreate(t *testing.T) {
- watcher := newWatcher(t)
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- // Create directory to get file
- testDirFrom := tempMkdir(t)
- defer os.RemoveAll(testDirFrom)
-
- addWatch(t, watcher, testDir)
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- testFile := filepath.Join(testDirFrom, "TestFsnotifyEvents.testfile")
- testFileRenamed := filepath.Join(testDir, "TestFsnotifyEvents.testfileRenamed")
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var createReceived counter
- done := make(chan bool)
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testDir) || event.Name == filepath.Clean(testFile) || event.Name == filepath.Clean(testFileRenamed) {
- if event.Op&Create == Create {
- createReceived.increment()
- }
- t.Logf("event received: %s", event)
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- done <- true
- }()
-
- // Create a file
- // This should add at least one event to the fsnotify event queue
- var f *os.File
- f, err := os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
- f.Close()
-
- if err := testRename(testFile, testFileRenamed); err != nil {
- t.Fatalf("rename failed: %s", err)
- }
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
- if createReceived.value() == 0 {
- t.Fatal("fsnotify create events have not been received after 500 ms")
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(2 * time.Second):
- t.Fatal("event stream was not closed after 2 seconds")
- }
-
- os.Remove(testFileRenamed)
-}
-
-func TestFsnotifyRenameToOverwrite(t *testing.T) {
- switch runtime.GOOS {
- case "plan9", "windows":
- t.Skipf("skipping test on %q (os.Rename over existing file does not create event).", runtime.GOOS)
- }
-
- watcher := newWatcher(t)
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- // Create directory to get file
- testDirFrom := tempMkdir(t)
- defer os.RemoveAll(testDirFrom)
-
- testFile := filepath.Join(testDirFrom, "TestFsnotifyEvents.testfile")
- testFileRenamed := filepath.Join(testDir, "TestFsnotifyEvents.testfileRenamed")
-
- // Create a file
- var fr *os.File
- fr, err := os.OpenFile(testFileRenamed, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- fr.Sync()
- fr.Close()
-
- addWatch(t, watcher, testDir)
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- var eventReceived counter
- done := make(chan bool)
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testFileRenamed) {
- eventReceived.increment()
- t.Logf("event received: %s", event)
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- done <- true
- }()
-
- // Create a file
- // This should add at least one event to the fsnotify event queue
- var f *os.File
- f, err = os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
- f.Close()
-
- if err := testRename(testFile, testFileRenamed); err != nil {
- t.Fatalf("rename failed: %s", err)
- }
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
- if eventReceived.value() == 0 {
- t.Fatal("fsnotify events have not been received after 500 ms")
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(2 * time.Second):
- t.Fatal("event stream was not closed after 2 seconds")
- }
-
- os.Remove(testFileRenamed)
-}
-
-func TestRemovalOfWatch(t *testing.T) {
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- // Create a file before watching directory
- testFileAlreadyExists := filepath.Join(testDir, "TestFsnotifyEventsExisting.testfile")
- {
- var f *os.File
- f, err := os.OpenFile(testFileAlreadyExists, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
- f.Close()
- }
-
- watcher := newWatcher(t)
- defer watcher.Close()
-
- addWatch(t, watcher, testDir)
- if err := watcher.Remove(testDir); err != nil {
- t.Fatalf("Could not remove the watch: %v\n", err)
- }
-
- go func() {
- select {
- case ev := <-watcher.Events:
- t.Fatalf("We received event: %v\n", ev)
- case <-time.After(500 * time.Millisecond):
- t.Log("No event received, as expected.")
- }
- }()
-
- time.Sleep(200 * time.Millisecond)
- // Modify the file outside of the watched dir
- f, err := os.Open(testFileAlreadyExists)
- if err != nil {
- t.Fatalf("Open test file failed: %s", err)
- }
- f.WriteString("data")
- f.Sync()
- f.Close()
- if err := os.Chmod(testFileAlreadyExists, 0700); err != nil {
- t.Fatalf("chmod failed: %s", err)
- }
- time.Sleep(400 * time.Millisecond)
-}
-
-func TestFsnotifyAttrib(t *testing.T) {
- if runtime.GOOS == "windows" {
- t.Skip("attributes don't work on Windows.")
- }
-
- watcher := newWatcher(t)
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for err := range watcher.Errors {
- t.Fatalf("error received: %s", err)
- }
- }()
-
- testFile := filepath.Join(testDir, "TestFsnotifyAttrib.testfile")
-
- // Receive events on the event channel on a separate goroutine
- eventstream := watcher.Events
- // The modifyReceived counter counts IsModify events that are not IsAttrib,
- // and the attribReceived counts IsAttrib events (which are also IsModify as
- // a consequence).
- var modifyReceived counter
- var attribReceived counter
- done := make(chan bool)
- go func() {
- for event := range eventstream {
- // Only count relevant events
- if event.Name == filepath.Clean(testDir) || event.Name == filepath.Clean(testFile) {
- if event.Op&Write == Write {
- modifyReceived.increment()
- }
- if event.Op&Chmod == Chmod {
- attribReceived.increment()
- }
- t.Logf("event received: %s", event)
- } else {
- t.Logf("unexpected event received: %s", event)
- }
- }
- done <- true
- }()
-
- // Create a file
- // This should add at least one event to the fsnotify event queue
- var f *os.File
- f, err := os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
-
- f.WriteString("data")
- f.Sync()
- f.Close()
-
- // Add a watch for testFile
- addWatch(t, watcher, testFile)
-
- if err := os.Chmod(testFile, 0700); err != nil {
- t.Fatalf("chmod failed: %s", err)
- }
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- // Creating/writing a file changes also the mtime, so IsAttrib should be set to true here
- time.Sleep(500 * time.Millisecond)
- if modifyReceived.value() != 0 {
- t.Fatal("received an unexpected modify event when creating a test file")
- }
- if attribReceived.value() == 0 {
- t.Fatal("fsnotify attribute events have not received after 500 ms")
- }
-
- // Modifying the contents of the file does not set the attrib flag (although eg. the mtime
- // might have been modified).
- modifyReceived.reset()
- attribReceived.reset()
-
- f, err = os.OpenFile(testFile, os.O_WRONLY, 0)
- if err != nil {
- t.Fatalf("reopening test file failed: %s", err)
- }
-
- f.WriteString("more data")
- f.Sync()
- f.Close()
-
- time.Sleep(500 * time.Millisecond)
-
- if modifyReceived.value() != 1 {
- t.Fatal("didn't receive a modify event after changing test file contents")
- }
-
- if attribReceived.value() != 0 {
- t.Fatal("did receive an unexpected attrib event after changing test file contents")
- }
-
- modifyReceived.reset()
- attribReceived.reset()
-
- // Doing a chmod on the file should trigger an event with the "attrib" flag set (the contents
- // of the file are not changed though)
- if err := os.Chmod(testFile, 0600); err != nil {
- t.Fatalf("chmod failed: %s", err)
- }
-
- time.Sleep(500 * time.Millisecond)
-
- if attribReceived.value() != 1 {
- t.Fatal("didn't receive an attribute change after 500ms")
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
- t.Log("waiting for the event channel to become closed...")
- select {
- case <-done:
- t.Log("event channel closed")
- case <-time.After(1e9):
- t.Fatal("event stream was not closed after 1 second")
- }
-
- os.Remove(testFile)
-}
-
-func TestFsnotifyClose(t *testing.T) {
- watcher := newWatcher(t)
- watcher.Close()
-
- var done int32
- go func() {
- watcher.Close()
- atomic.StoreInt32(&done, 1)
- }()
-
- time.Sleep(50e6) // 50 ms
- if atomic.LoadInt32(&done) == 0 {
- t.Fatal("double Close() test failed: second Close() call didn't return")
- }
-
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- if err := watcher.Add(testDir); err == nil {
- t.Fatal("expected error on Watch() after Close(), got nil")
- }
-}
-
-func TestFsnotifyFakeSymlink(t *testing.T) {
- if runtime.GOOS == "windows" {
- t.Skip("symlinks don't work on Windows.")
- }
-
- watcher := newWatcher(t)
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- var errorsReceived counter
- // Receive errors on the error channel on a separate goroutine
- go func() {
- for errors := range watcher.Errors {
- t.Logf("Received error: %s", errors)
- errorsReceived.increment()
- }
- }()
-
- // Count the CREATE events received
- var createEventsReceived, otherEventsReceived counter
- go func() {
- for ev := range watcher.Events {
- t.Logf("event received: %s", ev)
- if ev.Op&Create == Create {
- createEventsReceived.increment()
- } else {
- otherEventsReceived.increment()
- }
- }
- }()
-
- addWatch(t, watcher, testDir)
-
- if err := os.Symlink(filepath.Join(testDir, "zzz"), filepath.Join(testDir, "zzznew")); err != nil {
- t.Fatalf("Failed to create bogus symlink: %s", err)
- }
- t.Logf("Created bogus symlink")
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
-
- // Should not be error, just no events for broken links (watching nothing)
- if errorsReceived.value() > 0 {
- t.Fatal("fsnotify errors have been received.")
- }
- if otherEventsReceived.value() > 0 {
- t.Fatal("fsnotify other events received on the broken link")
- }
-
- // Except for 1 create event (for the link itself)
- if createEventsReceived.value() == 0 {
- t.Fatal("fsnotify create events were not received after 500 ms")
- }
- if createEventsReceived.value() > 1 {
- t.Fatal("fsnotify more create events received than expected")
- }
-
- // Try closing the fsnotify instance
- t.Log("calling Close()")
- watcher.Close()
-}
-
-func TestCyclicSymlink(t *testing.T) {
- if runtime.GOOS == "windows" {
- t.Skip("symlinks don't work on Windows.")
- }
-
- watcher := newWatcher(t)
-
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- link := path.Join(testDir, "link")
- if err := os.Symlink(".", link); err != nil {
- t.Fatalf("could not make symlink: %v", err)
- }
- addWatch(t, watcher, testDir)
-
- var createEventsReceived counter
- go func() {
- for ev := range watcher.Events {
- if ev.Op&Create == Create {
- createEventsReceived.increment()
- }
- }
- }()
-
- if err := os.Remove(link); err != nil {
- t.Fatalf("Error removing link: %v", err)
- }
-
- // It would be nice to be able to expect a delete event here, but kqueue has
- // no way for us to get events on symlinks themselves, because opening them
- // opens an fd to the file to which they point.
-
- if err := ioutil.WriteFile(link, []byte("foo"), 0700); err != nil {
- t.Fatalf("could not make symlink: %v", err)
- }
-
- // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
- time.Sleep(500 * time.Millisecond)
-
- if got := createEventsReceived.value(); got == 0 {
- t.Errorf("want at least 1 create event got %v", got)
- }
-
- watcher.Close()
-}
-
-// TestConcurrentRemovalOfWatch tests that concurrent calls to RemoveWatch do not race.
-// See https://codereview.appspot.com/103300045/
-// go test -test.run=TestConcurrentRemovalOfWatch -test.cpu=1,1,1,1,1 -race
-func TestConcurrentRemovalOfWatch(t *testing.T) {
- if runtime.GOOS != "darwin" {
- t.Skip("regression test for race only present on darwin")
- }
-
- // Create directory to watch
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- // Create a file before watching directory
- testFileAlreadyExists := filepath.Join(testDir, "TestFsnotifyEventsExisting.testfile")
- {
- var f *os.File
- f, err := os.OpenFile(testFileAlreadyExists, os.O_WRONLY|os.O_CREATE, 0666)
- if err != nil {
- t.Fatalf("creating test file failed: %s", err)
- }
- f.Sync()
- f.Close()
- }
-
- watcher := newWatcher(t)
- defer watcher.Close()
-
- addWatch(t, watcher, testDir)
-
- // Test that RemoveWatch can be invoked concurrently, with no data races.
- removed1 := make(chan struct{})
- go func() {
- defer close(removed1)
- watcher.Remove(testDir)
- }()
- removed2 := make(chan struct{})
- go func() {
- close(removed2)
- watcher.Remove(testDir)
- }()
- <-removed1
- <-removed2
-}
-
-func TestClose(t *testing.T) {
- // Regression test for #59 bad file descriptor from Close
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- watcher := newWatcher(t)
- if err := watcher.Add(testDir); err != nil {
- t.Fatalf("Expected no error on Add, got %v", err)
- }
- err := watcher.Close()
- if err != nil {
- t.Fatalf("Expected no error on Close, got %v.", err)
- }
-}
-
-// TestRemoveWithClose tests if one can handle Remove events and, at the same
-// time, close Watcher object without any data races.
-func TestRemoveWithClose(t *testing.T) {
- testDir := tempMkdir(t)
- defer os.RemoveAll(testDir)
-
- const fileN = 200
- tempFiles := make([]string, 0, fileN)
- for i := 0; i < fileN; i++ {
- tempFiles = append(tempFiles, tempMkFile(t, testDir))
- }
- watcher := newWatcher(t)
- if err := watcher.Add(testDir); err != nil {
- t.Fatalf("Expected no error on Add, got %v", err)
- }
- startC, stopC := make(chan struct{}), make(chan struct{})
- errC := make(chan error)
- go func() {
- for {
- select {
- case <-watcher.Errors:
- case <-watcher.Events:
- case <-stopC:
- return
- }
- }
- }()
- go func() {
- <-startC
- for _, fileName := range tempFiles {
- os.Remove(fileName)
- }
- }()
- go func() {
- <-startC
- errC <- watcher.Close()
- }()
- close(startC)
- defer close(stopC)
- if err := <-errC; err != nil {
- t.Fatalf("Expected no error on Close, got %v.", err)
- }
-}
-
-func testRename(file1, file2 string) error {
- switch runtime.GOOS {
- case "windows", "plan9":
- return os.Rename(file1, file2)
- default:
- cmd := exec.Command("mv", file1, file2)
- return cmd.Run()
- }
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/kqueue.go b/vendor/github.com/fsnotify/fsnotify/kqueue.go
deleted file mode 100644
index 86e76a3d..00000000
--- a/vendor/github.com/fsnotify/fsnotify/kqueue.go
+++ /dev/null
@@ -1,521 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build freebsd openbsd netbsd dragonfly darwin
-
-package fsnotify
-
-import (
- "errors"
- "fmt"
- "io/ioutil"
- "os"
- "path/filepath"
- "sync"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-// Watcher watches a set of files, delivering events to a channel.
-type Watcher struct {
- Events chan Event
- Errors chan error
- done chan struct{} // Channel for sending a "quit message" to the reader goroutine
-
- kq int // File descriptor (as returned by the kqueue() syscall).
-
- mu sync.Mutex // Protects access to watcher data
- watches map[string]int // Map of watched file descriptors (key: path).
- externalWatches map[string]bool // Map of watches added by user of the library.
- dirFlags map[string]uint32 // Map of watched directories to fflags used in kqueue.
- paths map[int]pathInfo // Map file descriptors to path names for processing kqueue events.
- fileExists map[string]bool // Keep track of if we know this file exists (to stop duplicate create events).
- isClosed bool // Set to true when Close() is first called
-}
-
-type pathInfo struct {
- name string
- isDir bool
-}
-
-// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
-func NewWatcher() (*Watcher, error) {
- kq, err := kqueue()
- if err != nil {
- return nil, err
- }
-
- w := &Watcher{
- kq: kq,
- watches: make(map[string]int),
- dirFlags: make(map[string]uint32),
- paths: make(map[int]pathInfo),
- fileExists: make(map[string]bool),
- externalWatches: make(map[string]bool),
- Events: make(chan Event),
- Errors: make(chan error),
- done: make(chan struct{}),
- }
-
- go w.readEvents()
- return w, nil
-}
-
-// Close removes all watches and closes the events channel.
-func (w *Watcher) Close() error {
- w.mu.Lock()
- if w.isClosed {
- w.mu.Unlock()
- return nil
- }
- w.isClosed = true
-
- // copy paths to remove while locked
- var pathsToRemove = make([]string, 0, len(w.watches))
- for name := range w.watches {
- pathsToRemove = append(pathsToRemove, name)
- }
- w.mu.Unlock()
- // unlock before calling Remove, which also locks
-
- for _, name := range pathsToRemove {
- w.Remove(name)
- }
-
- // send a "quit" message to the reader goroutine
- close(w.done)
-
- return nil
-}
-
-// Add starts watching the named file or directory (non-recursively).
-func (w *Watcher) Add(name string) error {
- w.mu.Lock()
- w.externalWatches[name] = true
- w.mu.Unlock()
- _, err := w.addWatch(name, noteAllEvents)
- return err
-}
-
-// Remove stops watching the the named file or directory (non-recursively).
-func (w *Watcher) Remove(name string) error {
- name = filepath.Clean(name)
- w.mu.Lock()
- watchfd, ok := w.watches[name]
- w.mu.Unlock()
- if !ok {
- return fmt.Errorf("can't remove non-existent kevent watch for: %s", name)
- }
-
- const registerRemove = unix.EV_DELETE
- if err := register(w.kq, []int{watchfd}, registerRemove, 0); err != nil {
- return err
- }
-
- unix.Close(watchfd)
-
- w.mu.Lock()
- isDir := w.paths[watchfd].isDir
- delete(w.watches, name)
- delete(w.paths, watchfd)
- delete(w.dirFlags, name)
- w.mu.Unlock()
-
- // Find all watched paths that are in this directory that are not external.
- if isDir {
- var pathsToRemove []string
- w.mu.Lock()
- for _, path := range w.paths {
- wdir, _ := filepath.Split(path.name)
- if filepath.Clean(wdir) == name {
- if !w.externalWatches[path.name] {
- pathsToRemove = append(pathsToRemove, path.name)
- }
- }
- }
- w.mu.Unlock()
- for _, name := range pathsToRemove {
- // Since these are internal, not much sense in propagating error
- // to the user, as that will just confuse them with an error about
- // a path they did not explicitly watch themselves.
- w.Remove(name)
- }
- }
-
- return nil
-}
-
-// Watch all events (except NOTE_EXTEND, NOTE_LINK, NOTE_REVOKE)
-const noteAllEvents = unix.NOTE_DELETE | unix.NOTE_WRITE | unix.NOTE_ATTRIB | unix.NOTE_RENAME
-
-// keventWaitTime to block on each read from kevent
-var keventWaitTime = durationToTimespec(100 * time.Millisecond)
-
-// addWatch adds name to the watched file set.
-// The flags are interpreted as described in kevent(2).
-// Returns the real path to the file which was added, if any, which may be different from the one passed in the case of symlinks.
-func (w *Watcher) addWatch(name string, flags uint32) (string, error) {
- var isDir bool
- // Make ./name and name equivalent
- name = filepath.Clean(name)
-
- w.mu.Lock()
- if w.isClosed {
- w.mu.Unlock()
- return "", errors.New("kevent instance already closed")
- }
- watchfd, alreadyWatching := w.watches[name]
- // We already have a watch, but we can still override flags.
- if alreadyWatching {
- isDir = w.paths[watchfd].isDir
- }
- w.mu.Unlock()
-
- if !alreadyWatching {
- fi, err := os.Lstat(name)
- if err != nil {
- return "", err
- }
-
- // Don't watch sockets.
- if fi.Mode()&os.ModeSocket == os.ModeSocket {
- return "", nil
- }
-
- // Don't watch named pipes.
- if fi.Mode()&os.ModeNamedPipe == os.ModeNamedPipe {
- return "", nil
- }
-
- // Follow Symlinks
- // Unfortunately, Linux can add bogus symlinks to watch list without
- // issue, and Windows can't do symlinks period (AFAIK). To maintain
- // consistency, we will act like everything is fine. There will simply
- // be no file events for broken symlinks.
- // Hence the returns of nil on errors.
- if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
- name, err = filepath.EvalSymlinks(name)
- if err != nil {
- return "", nil
- }
-
- w.mu.Lock()
- _, alreadyWatching = w.watches[name]
- w.mu.Unlock()
-
- if alreadyWatching {
- return name, nil
- }
-
- fi, err = os.Lstat(name)
- if err != nil {
- return "", nil
- }
- }
-
- watchfd, err = unix.Open(name, openMode, 0700)
- if watchfd == -1 {
- return "", err
- }
-
- isDir = fi.IsDir()
- }
-
- const registerAdd = unix.EV_ADD | unix.EV_CLEAR | unix.EV_ENABLE
- if err := register(w.kq, []int{watchfd}, registerAdd, flags); err != nil {
- unix.Close(watchfd)
- return "", err
- }
-
- if !alreadyWatching {
- w.mu.Lock()
- w.watches[name] = watchfd
- w.paths[watchfd] = pathInfo{name: name, isDir: isDir}
- w.mu.Unlock()
- }
-
- if isDir {
- // Watch the directory if it has not been watched before,
- // or if it was watched before, but perhaps only a NOTE_DELETE (watchDirectoryFiles)
- w.mu.Lock()
-
- watchDir := (flags&unix.NOTE_WRITE) == unix.NOTE_WRITE &&
- (!alreadyWatching || (w.dirFlags[name]&unix.NOTE_WRITE) != unix.NOTE_WRITE)
- // Store flags so this watch can be updated later
- w.dirFlags[name] = flags
- w.mu.Unlock()
-
- if watchDir {
- if err := w.watchDirectoryFiles(name); err != nil {
- return "", err
- }
- }
- }
- return name, nil
-}
-
-// readEvents reads from kqueue and converts the received kevents into
-// Event values that it sends down the Events channel.
-func (w *Watcher) readEvents() {
- eventBuffer := make([]unix.Kevent_t, 10)
-
-loop:
- for {
- // See if there is a message on the "done" channel
- select {
- case <-w.done:
- break loop
- default:
- }
-
- // Get new events
- kevents, err := read(w.kq, eventBuffer, &keventWaitTime)
- // EINTR is okay, the syscall was interrupted before timeout expired.
- if err != nil && err != unix.EINTR {
- select {
- case w.Errors <- err:
- case <-w.done:
- break loop
- }
- continue
- }
-
- // Flush the events we received to the Events channel
- for len(kevents) > 0 {
- kevent := &kevents[0]
- watchfd := int(kevent.Ident)
- mask := uint32(kevent.Fflags)
- w.mu.Lock()
- path := w.paths[watchfd]
- w.mu.Unlock()
- event := newEvent(path.name, mask)
-
- if path.isDir && !(event.Op&Remove == Remove) {
- // Double check to make sure the directory exists. This can happen when
- // we do a rm -fr on a recursively watched folders and we receive a
- // modification event first but the folder has been deleted and later
- // receive the delete event
- if _, err := os.Lstat(event.Name); os.IsNotExist(err) {
- // mark is as delete event
- event.Op |= Remove
- }
- }
-
- if event.Op&Rename == Rename || event.Op&Remove == Remove {
- w.Remove(event.Name)
- w.mu.Lock()
- delete(w.fileExists, event.Name)
- w.mu.Unlock()
- }
-
- if path.isDir && event.Op&Write == Write && !(event.Op&Remove == Remove) {
- w.sendDirectoryChangeEvents(event.Name)
- } else {
- // Send the event on the Events channel.
- select {
- case w.Events <- event:
- case <-w.done:
- break loop
- }
- }
-
- if event.Op&Remove == Remove {
- // Look for a file that may have overwritten this.
- // For example, mv f1 f2 will delete f2, then create f2.
- if path.isDir {
- fileDir := filepath.Clean(event.Name)
- w.mu.Lock()
- _, found := w.watches[fileDir]
- w.mu.Unlock()
- if found {
- // make sure the directory exists before we watch for changes. When we
- // do a recursive watch and perform rm -fr, the parent directory might
- // have gone missing, ignore the missing directory and let the
- // upcoming delete event remove the watch from the parent directory.
- if _, err := os.Lstat(fileDir); err == nil {
- w.sendDirectoryChangeEvents(fileDir)
- }
- }
- } else {
- filePath := filepath.Clean(event.Name)
- if fileInfo, err := os.Lstat(filePath); err == nil {
- w.sendFileCreatedEventIfNew(filePath, fileInfo)
- }
- }
- }
-
- // Move to next event
- kevents = kevents[1:]
- }
- }
-
- // cleanup
- err := unix.Close(w.kq)
- if err != nil {
- // only way the previous loop breaks is if w.done was closed so we need to async send to w.Errors.
- select {
- case w.Errors <- err:
- default:
- }
- }
- close(w.Events)
- close(w.Errors)
-}
-
-// newEvent returns an platform-independent Event based on kqueue Fflags.
-func newEvent(name string, mask uint32) Event {
- e := Event{Name: name}
- if mask&unix.NOTE_DELETE == unix.NOTE_DELETE {
- e.Op |= Remove
- }
- if mask&unix.NOTE_WRITE == unix.NOTE_WRITE {
- e.Op |= Write
- }
- if mask&unix.NOTE_RENAME == unix.NOTE_RENAME {
- e.Op |= Rename
- }
- if mask&unix.NOTE_ATTRIB == unix.NOTE_ATTRIB {
- e.Op |= Chmod
- }
- return e
-}
-
-func newCreateEvent(name string) Event {
- return Event{Name: name, Op: Create}
-}
-
-// watchDirectoryFiles to mimic inotify when adding a watch on a directory
-func (w *Watcher) watchDirectoryFiles(dirPath string) error {
- // Get all files
- files, err := ioutil.ReadDir(dirPath)
- if err != nil {
- return err
- }
-
- for _, fileInfo := range files {
- filePath := filepath.Join(dirPath, fileInfo.Name())
- filePath, err = w.internalWatch(filePath, fileInfo)
- if err != nil {
- return err
- }
-
- w.mu.Lock()
- w.fileExists[filePath] = true
- w.mu.Unlock()
- }
-
- return nil
-}
-
-// sendDirectoryEvents searches the directory for newly created files
-// and sends them over the event channel. This functionality is to have
-// the BSD version of fsnotify match Linux inotify which provides a
-// create event for files created in a watched directory.
-func (w *Watcher) sendDirectoryChangeEvents(dirPath string) {
- // Get all files
- files, err := ioutil.ReadDir(dirPath)
- if err != nil {
- select {
- case w.Errors <- err:
- case <-w.done:
- return
- }
- }
-
- // Search for new files
- for _, fileInfo := range files {
- filePath := filepath.Join(dirPath, fileInfo.Name())
- err := w.sendFileCreatedEventIfNew(filePath, fileInfo)
-
- if err != nil {
- return
- }
- }
-}
-
-// sendFileCreatedEvent sends a create event if the file isn't already being tracked.
-func (w *Watcher) sendFileCreatedEventIfNew(filePath string, fileInfo os.FileInfo) (err error) {
- w.mu.Lock()
- _, doesExist := w.fileExists[filePath]
- w.mu.Unlock()
- if !doesExist {
- // Send create event
- select {
- case w.Events <- newCreateEvent(filePath):
- case <-w.done:
- return
- }
- }
-
- // like watchDirectoryFiles (but without doing another ReadDir)
- filePath, err = w.internalWatch(filePath, fileInfo)
- if err != nil {
- return err
- }
-
- w.mu.Lock()
- w.fileExists[filePath] = true
- w.mu.Unlock()
-
- return nil
-}
-
-func (w *Watcher) internalWatch(name string, fileInfo os.FileInfo) (string, error) {
- if fileInfo.IsDir() {
- // mimic Linux providing delete events for subdirectories
- // but preserve the flags used if currently watching subdirectory
- w.mu.Lock()
- flags := w.dirFlags[name]
- w.mu.Unlock()
-
- flags |= unix.NOTE_DELETE | unix.NOTE_RENAME
- return w.addWatch(name, flags)
- }
-
- // watch file to mimic Linux inotify
- return w.addWatch(name, noteAllEvents)
-}
-
-// kqueue creates a new kernel event queue and returns a descriptor.
-func kqueue() (kq int, err error) {
- kq, err = unix.Kqueue()
- if kq == -1 {
- return kq, err
- }
- return kq, nil
-}
-
-// register events with the queue
-func register(kq int, fds []int, flags int, fflags uint32) error {
- changes := make([]unix.Kevent_t, len(fds))
-
- for i, fd := range fds {
- // SetKevent converts int to the platform-specific types:
- unix.SetKevent(&changes[i], fd, unix.EVFILT_VNODE, flags)
- changes[i].Fflags = fflags
- }
-
- // register the events
- success, err := unix.Kevent(kq, changes, nil, nil)
- if success == -1 {
- return err
- }
- return nil
-}
-
-// read retrieves pending events, or waits until an event occurs.
-// A timeout of nil blocks indefinitely, while 0 polls the queue.
-func read(kq int, events []unix.Kevent_t, timeout *unix.Timespec) ([]unix.Kevent_t, error) {
- n, err := unix.Kevent(kq, nil, events, timeout)
- if err != nil {
- return nil, err
- }
- return events[0:n], nil
-}
-
-// durationToTimespec prepares a timeout value
-func durationToTimespec(d time.Duration) unix.Timespec {
- return unix.NsecToTimespec(d.Nanoseconds())
-}
diff --git a/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go b/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go
deleted file mode 100644
index 7d8de145..00000000
--- a/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build freebsd openbsd netbsd dragonfly
-
-package fsnotify
-
-import "golang.org/x/sys/unix"
-
-const openMode = unix.O_NONBLOCK | unix.O_RDONLY
diff --git a/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go b/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go
deleted file mode 100644
index 9139e171..00000000
--- a/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin
-
-package fsnotify
-
-import "golang.org/x/sys/unix"
-
-// note: this constant is not defined on BSD
-const openMode = unix.O_EVTONLY
diff --git a/vendor/github.com/fsnotify/fsnotify/windows.go b/vendor/github.com/fsnotify/fsnotify/windows.go
deleted file mode 100644
index 09436f31..00000000
--- a/vendor/github.com/fsnotify/fsnotify/windows.go
+++ /dev/null
@@ -1,561 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package fsnotify
-
-import (
- "errors"
- "fmt"
- "os"
- "path/filepath"
- "runtime"
- "sync"
- "syscall"
- "unsafe"
-)
-
-// Watcher watches a set of files, delivering events to a channel.
-type Watcher struct {
- Events chan Event
- Errors chan error
- isClosed bool // Set to true when Close() is first called
- mu sync.Mutex // Map access
- port syscall.Handle // Handle to completion port
- watches watchMap // Map of watches (key: i-number)
- input chan *input // Inputs to the reader are sent on this channel
- quit chan chan<- error
-}
-
-// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
-func NewWatcher() (*Watcher, error) {
- port, e := syscall.CreateIoCompletionPort(syscall.InvalidHandle, 0, 0, 0)
- if e != nil {
- return nil, os.NewSyscallError("CreateIoCompletionPort", e)
- }
- w := &Watcher{
- port: port,
- watches: make(watchMap),
- input: make(chan *input, 1),
- Events: make(chan Event, 50),
- Errors: make(chan error),
- quit: make(chan chan<- error, 1),
- }
- go w.readEvents()
- return w, nil
-}
-
-// Close removes all watches and closes the events channel.
-func (w *Watcher) Close() error {
- if w.isClosed {
- return nil
- }
- w.isClosed = true
-
- // Send "quit" message to the reader goroutine
- ch := make(chan error)
- w.quit <- ch
- if err := w.wakeupReader(); err != nil {
- return err
- }
- return <-ch
-}
-
-// Add starts watching the named file or directory (non-recursively).
-func (w *Watcher) Add(name string) error {
- if w.isClosed {
- return errors.New("watcher already closed")
- }
- in := &input{
- op: opAddWatch,
- path: filepath.Clean(name),
- flags: sysFSALLEVENTS,
- reply: make(chan error),
- }
- w.input <- in
- if err := w.wakeupReader(); err != nil {
- return err
- }
- return <-in.reply
-}
-
-// Remove stops watching the the named file or directory (non-recursively).
-func (w *Watcher) Remove(name string) error {
- in := &input{
- op: opRemoveWatch,
- path: filepath.Clean(name),
- reply: make(chan error),
- }
- w.input <- in
- if err := w.wakeupReader(); err != nil {
- return err
- }
- return <-in.reply
-}
-
-const (
- // Options for AddWatch
- sysFSONESHOT = 0x80000000
- sysFSONLYDIR = 0x1000000
-
- // Events
- sysFSACCESS = 0x1
- sysFSALLEVENTS = 0xfff
- sysFSATTRIB = 0x4
- sysFSCLOSE = 0x18
- sysFSCREATE = 0x100
- sysFSDELETE = 0x200
- sysFSDELETESELF = 0x400
- sysFSMODIFY = 0x2
- sysFSMOVE = 0xc0
- sysFSMOVEDFROM = 0x40
- sysFSMOVEDTO = 0x80
- sysFSMOVESELF = 0x800
-
- // Special events
- sysFSIGNORED = 0x8000
- sysFSQOVERFLOW = 0x4000
-)
-
-func newEvent(name string, mask uint32) Event {
- e := Event{Name: name}
- if mask&sysFSCREATE == sysFSCREATE || mask&sysFSMOVEDTO == sysFSMOVEDTO {
- e.Op |= Create
- }
- if mask&sysFSDELETE == sysFSDELETE || mask&sysFSDELETESELF == sysFSDELETESELF {
- e.Op |= Remove
- }
- if mask&sysFSMODIFY == sysFSMODIFY {
- e.Op |= Write
- }
- if mask&sysFSMOVE == sysFSMOVE || mask&sysFSMOVESELF == sysFSMOVESELF || mask&sysFSMOVEDFROM == sysFSMOVEDFROM {
- e.Op |= Rename
- }
- if mask&sysFSATTRIB == sysFSATTRIB {
- e.Op |= Chmod
- }
- return e
-}
-
-const (
- opAddWatch = iota
- opRemoveWatch
-)
-
-const (
- provisional uint64 = 1 << (32 + iota)
-)
-
-type input struct {
- op int
- path string
- flags uint32
- reply chan error
-}
-
-type inode struct {
- handle syscall.Handle
- volume uint32
- index uint64
-}
-
-type watch struct {
- ov syscall.Overlapped
- ino *inode // i-number
- path string // Directory path
- mask uint64 // Directory itself is being watched with these notify flags
- names map[string]uint64 // Map of names being watched and their notify flags
- rename string // Remembers the old name while renaming a file
- buf [4096]byte
-}
-
-type indexMap map[uint64]*watch
-type watchMap map[uint32]indexMap
-
-func (w *Watcher) wakeupReader() error {
- e := syscall.PostQueuedCompletionStatus(w.port, 0, 0, nil)
- if e != nil {
- return os.NewSyscallError("PostQueuedCompletionStatus", e)
- }
- return nil
-}
-
-func getDir(pathname string) (dir string, err error) {
- attr, e := syscall.GetFileAttributes(syscall.StringToUTF16Ptr(pathname))
- if e != nil {
- return "", os.NewSyscallError("GetFileAttributes", e)
- }
- if attr&syscall.FILE_ATTRIBUTE_DIRECTORY != 0 {
- dir = pathname
- } else {
- dir, _ = filepath.Split(pathname)
- dir = filepath.Clean(dir)
- }
- return
-}
-
-func getIno(path string) (ino *inode, err error) {
- h, e := syscall.CreateFile(syscall.StringToUTF16Ptr(path),
- syscall.FILE_LIST_DIRECTORY,
- syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
- nil, syscall.OPEN_EXISTING,
- syscall.FILE_FLAG_BACKUP_SEMANTICS|syscall.FILE_FLAG_OVERLAPPED, 0)
- if e != nil {
- return nil, os.NewSyscallError("CreateFile", e)
- }
- var fi syscall.ByHandleFileInformation
- if e = syscall.GetFileInformationByHandle(h, &fi); e != nil {
- syscall.CloseHandle(h)
- return nil, os.NewSyscallError("GetFileInformationByHandle", e)
- }
- ino = &inode{
- handle: h,
- volume: fi.VolumeSerialNumber,
- index: uint64(fi.FileIndexHigh)<<32 | uint64(fi.FileIndexLow),
- }
- return ino, nil
-}
-
-// Must run within the I/O thread.
-func (m watchMap) get(ino *inode) *watch {
- if i := m[ino.volume]; i != nil {
- return i[ino.index]
- }
- return nil
-}
-
-// Must run within the I/O thread.
-func (m watchMap) set(ino *inode, watch *watch) {
- i := m[ino.volume]
- if i == nil {
- i = make(indexMap)
- m[ino.volume] = i
- }
- i[ino.index] = watch
-}
-
-// Must run within the I/O thread.
-func (w *Watcher) addWatch(pathname string, flags uint64) error {
- dir, err := getDir(pathname)
- if err != nil {
- return err
- }
- if flags&sysFSONLYDIR != 0 && pathname != dir {
- return nil
- }
- ino, err := getIno(dir)
- if err != nil {
- return err
- }
- w.mu.Lock()
- watchEntry := w.watches.get(ino)
- w.mu.Unlock()
- if watchEntry == nil {
- if _, e := syscall.CreateIoCompletionPort(ino.handle, w.port, 0, 0); e != nil {
- syscall.CloseHandle(ino.handle)
- return os.NewSyscallError("CreateIoCompletionPort", e)
- }
- watchEntry = &watch{
- ino: ino,
- path: dir,
- names: make(map[string]uint64),
- }
- w.mu.Lock()
- w.watches.set(ino, watchEntry)
- w.mu.Unlock()
- flags |= provisional
- } else {
- syscall.CloseHandle(ino.handle)
- }
- if pathname == dir {
- watchEntry.mask |= flags
- } else {
- watchEntry.names[filepath.Base(pathname)] |= flags
- }
- if err = w.startRead(watchEntry); err != nil {
- return err
- }
- if pathname == dir {
- watchEntry.mask &= ^provisional
- } else {
- watchEntry.names[filepath.Base(pathname)] &= ^provisional
- }
- return nil
-}
-
-// Must run within the I/O thread.
-func (w *Watcher) remWatch(pathname string) error {
- dir, err := getDir(pathname)
- if err != nil {
- return err
- }
- ino, err := getIno(dir)
- if err != nil {
- return err
- }
- w.mu.Lock()
- watch := w.watches.get(ino)
- w.mu.Unlock()
- if watch == nil {
- return fmt.Errorf("can't remove non-existent watch for: %s", pathname)
- }
- if pathname == dir {
- w.sendEvent(watch.path, watch.mask&sysFSIGNORED)
- watch.mask = 0
- } else {
- name := filepath.Base(pathname)
- w.sendEvent(filepath.Join(watch.path, name), watch.names[name]&sysFSIGNORED)
- delete(watch.names, name)
- }
- return w.startRead(watch)
-}
-
-// Must run within the I/O thread.
-func (w *Watcher) deleteWatch(watch *watch) {
- for name, mask := range watch.names {
- if mask&provisional == 0 {
- w.sendEvent(filepath.Join(watch.path, name), mask&sysFSIGNORED)
- }
- delete(watch.names, name)
- }
- if watch.mask != 0 {
- if watch.mask&provisional == 0 {
- w.sendEvent(watch.path, watch.mask&sysFSIGNORED)
- }
- watch.mask = 0
- }
-}
-
-// Must run within the I/O thread.
-func (w *Watcher) startRead(watch *watch) error {
- if e := syscall.CancelIo(watch.ino.handle); e != nil {
- w.Errors <- os.NewSyscallError("CancelIo", e)
- w.deleteWatch(watch)
- }
- mask := toWindowsFlags(watch.mask)
- for _, m := range watch.names {
- mask |= toWindowsFlags(m)
- }
- if mask == 0 {
- if e := syscall.CloseHandle(watch.ino.handle); e != nil {
- w.Errors <- os.NewSyscallError("CloseHandle", e)
- }
- w.mu.Lock()
- delete(w.watches[watch.ino.volume], watch.ino.index)
- w.mu.Unlock()
- return nil
- }
- e := syscall.ReadDirectoryChanges(watch.ino.handle, &watch.buf[0],
- uint32(unsafe.Sizeof(watch.buf)), false, mask, nil, &watch.ov, 0)
- if e != nil {
- err := os.NewSyscallError("ReadDirectoryChanges", e)
- if e == syscall.ERROR_ACCESS_DENIED && watch.mask&provisional == 0 {
- // Watched directory was probably removed
- if w.sendEvent(watch.path, watch.mask&sysFSDELETESELF) {
- if watch.mask&sysFSONESHOT != 0 {
- watch.mask = 0
- }
- }
- err = nil
- }
- w.deleteWatch(watch)
- w.startRead(watch)
- return err
- }
- return nil
-}
-
-// readEvents reads from the I/O completion port, converts the
-// received events into Event objects and sends them via the Events channel.
-// Entry point to the I/O thread.
-func (w *Watcher) readEvents() {
- var (
- n, key uint32
- ov *syscall.Overlapped
- )
- runtime.LockOSThread()
-
- for {
- e := syscall.GetQueuedCompletionStatus(w.port, &n, &key, &ov, syscall.INFINITE)
- watch := (*watch)(unsafe.Pointer(ov))
-
- if watch == nil {
- select {
- case ch := <-w.quit:
- w.mu.Lock()
- var indexes []indexMap
- for _, index := range w.watches {
- indexes = append(indexes, index)
- }
- w.mu.Unlock()
- for _, index := range indexes {
- for _, watch := range index {
- w.deleteWatch(watch)
- w.startRead(watch)
- }
- }
- var err error
- if e := syscall.CloseHandle(w.port); e != nil {
- err = os.NewSyscallError("CloseHandle", e)
- }
- close(w.Events)
- close(w.Errors)
- ch <- err
- return
- case in := <-w.input:
- switch in.op {
- case opAddWatch:
- in.reply <- w.addWatch(in.path, uint64(in.flags))
- case opRemoveWatch:
- in.reply <- w.remWatch(in.path)
- }
- default:
- }
- continue
- }
-
- switch e {
- case syscall.ERROR_MORE_DATA:
- if watch == nil {
- w.Errors <- errors.New("ERROR_MORE_DATA has unexpectedly null lpOverlapped buffer")
- } else {
- // The i/o succeeded but the buffer is full.
- // In theory we should be building up a full packet.
- // In practice we can get away with just carrying on.
- n = uint32(unsafe.Sizeof(watch.buf))
- }
- case syscall.ERROR_ACCESS_DENIED:
- // Watched directory was probably removed
- w.sendEvent(watch.path, watch.mask&sysFSDELETESELF)
- w.deleteWatch(watch)
- w.startRead(watch)
- continue
- case syscall.ERROR_OPERATION_ABORTED:
- // CancelIo was called on this handle
- continue
- default:
- w.Errors <- os.NewSyscallError("GetQueuedCompletionPort", e)
- continue
- case nil:
- }
-
- var offset uint32
- for {
- if n == 0 {
- w.Events <- newEvent("", sysFSQOVERFLOW)
- w.Errors <- errors.New("short read in readEvents()")
- break
- }
-
- // Point "raw" to the event in the buffer
- raw := (*syscall.FileNotifyInformation)(unsafe.Pointer(&watch.buf[offset]))
- buf := (*[syscall.MAX_PATH]uint16)(unsafe.Pointer(&raw.FileName))
- name := syscall.UTF16ToString(buf[:raw.FileNameLength/2])
- fullname := filepath.Join(watch.path, name)
-
- var mask uint64
- switch raw.Action {
- case syscall.FILE_ACTION_REMOVED:
- mask = sysFSDELETESELF
- case syscall.FILE_ACTION_MODIFIED:
- mask = sysFSMODIFY
- case syscall.FILE_ACTION_RENAMED_OLD_NAME:
- watch.rename = name
- case syscall.FILE_ACTION_RENAMED_NEW_NAME:
- if watch.names[watch.rename] != 0 {
- watch.names[name] |= watch.names[watch.rename]
- delete(watch.names, watch.rename)
- mask = sysFSMOVESELF
- }
- }
-
- sendNameEvent := func() {
- if w.sendEvent(fullname, watch.names[name]&mask) {
- if watch.names[name]&sysFSONESHOT != 0 {
- delete(watch.names, name)
- }
- }
- }
- if raw.Action != syscall.FILE_ACTION_RENAMED_NEW_NAME {
- sendNameEvent()
- }
- if raw.Action == syscall.FILE_ACTION_REMOVED {
- w.sendEvent(fullname, watch.names[name]&sysFSIGNORED)
- delete(watch.names, name)
- }
- if w.sendEvent(fullname, watch.mask&toFSnotifyFlags(raw.Action)) {
- if watch.mask&sysFSONESHOT != 0 {
- watch.mask = 0
- }
- }
- if raw.Action == syscall.FILE_ACTION_RENAMED_NEW_NAME {
- fullname = filepath.Join(watch.path, watch.rename)
- sendNameEvent()
- }
-
- // Move to the next event in the buffer
- if raw.NextEntryOffset == 0 {
- break
- }
- offset += raw.NextEntryOffset
-
- // Error!
- if offset >= n {
- w.Errors <- errors.New("Windows system assumed buffer larger than it is, events have likely been missed.")
- break
- }
- }
-
- if err := w.startRead(watch); err != nil {
- w.Errors <- err
- }
- }
-}
-
-func (w *Watcher) sendEvent(name string, mask uint64) bool {
- if mask == 0 {
- return false
- }
- event := newEvent(name, uint32(mask))
- select {
- case ch := <-w.quit:
- w.quit <- ch
- case w.Events <- event:
- }
- return true
-}
-
-func toWindowsFlags(mask uint64) uint32 {
- var m uint32
- if mask&sysFSACCESS != 0 {
- m |= syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS
- }
- if mask&sysFSMODIFY != 0 {
- m |= syscall.FILE_NOTIFY_CHANGE_LAST_WRITE
- }
- if mask&sysFSATTRIB != 0 {
- m |= syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES
- }
- if mask&(sysFSMOVE|sysFSCREATE|sysFSDELETE) != 0 {
- m |= syscall.FILE_NOTIFY_CHANGE_FILE_NAME | syscall.FILE_NOTIFY_CHANGE_DIR_NAME
- }
- return m
-}
-
-func toFSnotifyFlags(action uint32) uint64 {
- switch action {
- case syscall.FILE_ACTION_ADDED:
- return sysFSCREATE
- case syscall.FILE_ACTION_REMOVED:
- return sysFSDELETE
- case syscall.FILE_ACTION_MODIFIED:
- return sysFSMODIFY
- case syscall.FILE_ACTION_RENAMED_OLD_NAME:
- return sysFSMOVEDFROM
- case syscall.FILE_ACTION_RENAMED_NEW_NAME:
- return sysFSMOVEDTO
- }
- return 0
-}
diff --git a/vendor/github.com/ghodss/yaml/.gitignore b/vendor/github.com/ghodss/yaml/.gitignore
deleted file mode 100644
index e256a31e..00000000
--- a/vendor/github.com/ghodss/yaml/.gitignore
+++ /dev/null
@@ -1,20 +0,0 @@
-# OSX leaves these everywhere on SMB shares
-._*
-
-# Eclipse files
-.classpath
-.project
-.settings/**
-
-# Emacs save files
-*~
-
-# Vim-related files
-[._]*.s[a-w][a-z]
-[._]s[a-w][a-z]
-*.un~
-Session.vim
-.netrwhist
-
-# Go test binaries
-*.test
diff --git a/vendor/github.com/ghodss/yaml/.travis.yml b/vendor/github.com/ghodss/yaml/.travis.yml
deleted file mode 100644
index 0e9d6edc..00000000
--- a/vendor/github.com/ghodss/yaml/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-go:
- - 1.3
- - 1.4
-script:
- - go test
- - go build
diff --git a/vendor/github.com/ghodss/yaml/LICENSE b/vendor/github.com/ghodss/yaml/LICENSE
deleted file mode 100644
index 7805d36d..00000000
--- a/vendor/github.com/ghodss/yaml/LICENSE
+++ /dev/null
@@ -1,50 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Sam Ghods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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
-SOFTWARE.
-
-
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/ghodss/yaml/README.md b/vendor/github.com/ghodss/yaml/README.md
deleted file mode 100644
index 0200f75b..00000000
--- a/vendor/github.com/ghodss/yaml/README.md
+++ /dev/null
@@ -1,121 +0,0 @@
-# YAML marshaling and unmarshaling support for Go
-
-[![Build Status](https://travis-ci.org/ghodss/yaml.svg)](https://travis-ci.org/ghodss/yaml)
-
-## Introduction
-
-A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs.
-
-In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/).
-
-## Compatibility
-
-This package uses [go-yaml](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility).
-
-## Caveats
-
-**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example:
-
-```
-BAD:
- exampleKey: !!binary gIGC
-
-GOOD:
- exampleKey: gIGC
-... and decode the base64 data in your code.
-```
-
-**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys.
-
-## Installation and usage
-
-To install, run:
-
-```
-$ go get github.com/ghodss/yaml
-```
-
-And import using:
-
-```
-import "github.com/ghodss/yaml"
-```
-
-Usage is very similar to the JSON library:
-
-```go
-package main
-
-import (
- "fmt"
-
- "github.com/ghodss/yaml"
-)
-
-type Person struct {
- Name string `json:"name"` // Affects YAML field names too.
- Age int `json:"age"`
-}
-
-func main() {
- // Marshal a Person struct to YAML.
- p := Person{"John", 30}
- y, err := yaml.Marshal(p)
- if err != nil {
- fmt.Printf("err: %v\n", err)
- return
- }
- fmt.Println(string(y))
- /* Output:
- age: 30
- name: John
- */
-
- // Unmarshal the YAML back into a Person struct.
- var p2 Person
- err = yaml.Unmarshal(y, &p2)
- if err != nil {
- fmt.Printf("err: %v\n", err)
- return
- }
- fmt.Println(p2)
- /* Output:
- {John 30}
- */
-}
-```
-
-`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available:
-
-```go
-package main
-
-import (
- "fmt"
-
- "github.com/ghodss/yaml"
-)
-
-func main() {
- j := []byte(`{"name": "John", "age": 30}`)
- y, err := yaml.JSONToYAML(j)
- if err != nil {
- fmt.Printf("err: %v\n", err)
- return
- }
- fmt.Println(string(y))
- /* Output:
- name: John
- age: 30
- */
- j2, err := yaml.YAMLToJSON(y)
- if err != nil {
- fmt.Printf("err: %v\n", err)
- return
- }
- fmt.Println(string(j2))
- /* Output:
- {"age":30,"name":"John"}
- */
-}
-```
diff --git a/vendor/github.com/ghodss/yaml/fields.go b/vendor/github.com/ghodss/yaml/fields.go
deleted file mode 100644
index 58600740..00000000
--- a/vendor/github.com/ghodss/yaml/fields.go
+++ /dev/null
@@ -1,501 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-package yaml
-
-import (
- "bytes"
- "encoding"
- "encoding/json"
- "reflect"
- "sort"
- "strings"
- "sync"
- "unicode"
- "unicode/utf8"
-)
-
-// indirect walks down v allocating pointers as needed,
-// until it gets to a non-pointer.
-// if it encounters an Unmarshaler, indirect stops and returns that.
-// if decodingNull is true, indirect stops at the last pointer so it can be set to nil.
-func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) {
- // If v is a named type and is addressable,
- // start with its address, so that if the type has pointer methods,
- // we find them.
- if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
- v = v.Addr()
- }
- for {
- // Load value from interface, but only if the result will be
- // usefully addressable.
- if v.Kind() == reflect.Interface && !v.IsNil() {
- e := v.Elem()
- if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) {
- v = e
- continue
- }
- }
-
- if v.Kind() != reflect.Ptr {
- break
- }
-
- if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() {
- break
- }
- if v.IsNil() {
- if v.CanSet() {
- v.Set(reflect.New(v.Type().Elem()))
- } else {
- v = reflect.New(v.Type().Elem())
- }
- }
- if v.Type().NumMethod() > 0 {
- if u, ok := v.Interface().(json.Unmarshaler); ok {
- return u, nil, reflect.Value{}
- }
- if u, ok := v.Interface().(encoding.TextUnmarshaler); ok {
- return nil, u, reflect.Value{}
- }
- }
- v = v.Elem()
- }
- return nil, nil, v
-}
-
-// A field represents a single field found in a struct.
-type field struct {
- name string
- nameBytes []byte // []byte(name)
- equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent
-
- tag bool
- index []int
- typ reflect.Type
- omitEmpty bool
- quoted bool
-}
-
-func fillField(f field) field {
- f.nameBytes = []byte(f.name)
- f.equalFold = foldFunc(f.nameBytes)
- return f
-}
-
-// byName sorts field by name, breaking ties with depth,
-// then breaking ties with "name came from json tag", then
-// breaking ties with index sequence.
-type byName []field
-
-func (x byName) Len() int { return len(x) }
-
-func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-func (x byName) Less(i, j int) bool {
- if x[i].name != x[j].name {
- return x[i].name < x[j].name
- }
- if len(x[i].index) != len(x[j].index) {
- return len(x[i].index) < len(x[j].index)
- }
- if x[i].tag != x[j].tag {
- return x[i].tag
- }
- return byIndex(x).Less(i, j)
-}
-
-// byIndex sorts field by index sequence.
-type byIndex []field
-
-func (x byIndex) Len() int { return len(x) }
-
-func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-func (x byIndex) Less(i, j int) bool {
- for k, xik := range x[i].index {
- if k >= len(x[j].index) {
- return false
- }
- if xik != x[j].index[k] {
- return xik < x[j].index[k]
- }
- }
- return len(x[i].index) < len(x[j].index)
-}
-
-// typeFields returns a list of fields that JSON should recognize for the given type.
-// The algorithm is breadth-first search over the set of structs to include - the top struct
-// and then any reachable anonymous structs.
-func typeFields(t reflect.Type) []field {
- // Anonymous fields to explore at the current level and the next.
- current := []field{}
- next := []field{{typ: t}}
-
- // Count of queued names for current level and the next.
- count := map[reflect.Type]int{}
- nextCount := map[reflect.Type]int{}
-
- // Types already visited at an earlier level.
- visited := map[reflect.Type]bool{}
-
- // Fields found.
- var fields []field
-
- for len(next) > 0 {
- current, next = next, current[:0]
- count, nextCount = nextCount, map[reflect.Type]int{}
-
- for _, f := range current {
- if visited[f.typ] {
- continue
- }
- visited[f.typ] = true
-
- // Scan f.typ for fields to include.
- for i := 0; i < f.typ.NumField(); i++ {
- sf := f.typ.Field(i)
- if sf.PkgPath != "" { // unexported
- continue
- }
- tag := sf.Tag.Get("json")
- if tag == "-" {
- continue
- }
- name, opts := parseTag(tag)
- if !isValidTag(name) {
- name = ""
- }
- index := make([]int, len(f.index)+1)
- copy(index, f.index)
- index[len(f.index)] = i
-
- ft := sf.Type
- if ft.Name() == "" && ft.Kind() == reflect.Ptr {
- // Follow pointer.
- ft = ft.Elem()
- }
-
- // Record found field and index sequence.
- if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct {
- tagged := name != ""
- if name == "" {
- name = sf.Name
- }
- fields = append(fields, fillField(field{
- name: name,
- tag: tagged,
- index: index,
- typ: ft,
- omitEmpty: opts.Contains("omitempty"),
- quoted: opts.Contains("string"),
- }))
- if count[f.typ] > 1 {
- // If there were multiple instances, add a second,
- // so that the annihilation code will see a duplicate.
- // It only cares about the distinction between 1 or 2,
- // so don't bother generating any more copies.
- fields = append(fields, fields[len(fields)-1])
- }
- continue
- }
-
- // Record new anonymous struct to explore in next round.
- nextCount[ft]++
- if nextCount[ft] == 1 {
- next = append(next, fillField(field{name: ft.Name(), index: index, typ: ft}))
- }
- }
- }
- }
-
- sort.Sort(byName(fields))
-
- // Delete all fields that are hidden by the Go rules for embedded fields,
- // except that fields with JSON tags are promoted.
-
- // The fields are sorted in primary order of name, secondary order
- // of field index length. Loop over names; for each name, delete
- // hidden fields by choosing the one dominant field that survives.
- out := fields[:0]
- for advance, i := 0, 0; i < len(fields); i += advance {
- // One iteration per name.
- // Find the sequence of fields with the name of this first field.
- fi := fields[i]
- name := fi.name
- for advance = 1; i+advance < len(fields); advance++ {
- fj := fields[i+advance]
- if fj.name != name {
- break
- }
- }
- if advance == 1 { // Only one field with this name
- out = append(out, fi)
- continue
- }
- dominant, ok := dominantField(fields[i : i+advance])
- if ok {
- out = append(out, dominant)
- }
- }
-
- fields = out
- sort.Sort(byIndex(fields))
-
- return fields
-}
-
-// dominantField looks through the fields, all of which are known to
-// have the same name, to find the single field that dominates the
-// others using Go's embedding rules, modified by the presence of
-// JSON tags. If there are multiple top-level fields, the boolean
-// will be false: This condition is an error in Go and we skip all
-// the fields.
-func dominantField(fields []field) (field, bool) {
- // The fields are sorted in increasing index-length order. The winner
- // must therefore be one with the shortest index length. Drop all
- // longer entries, which is easy: just truncate the slice.
- length := len(fields[0].index)
- tagged := -1 // Index of first tagged field.
- for i, f := range fields {
- if len(f.index) > length {
- fields = fields[:i]
- break
- }
- if f.tag {
- if tagged >= 0 {
- // Multiple tagged fields at the same level: conflict.
- // Return no field.
- return field{}, false
- }
- tagged = i
- }
- }
- if tagged >= 0 {
- return fields[tagged], true
- }
- // All remaining fields have the same length. If there's more than one,
- // we have a conflict (two fields named "X" at the same level) and we
- // return no field.
- if len(fields) > 1 {
- return field{}, false
- }
- return fields[0], true
-}
-
-var fieldCache struct {
- sync.RWMutex
- m map[reflect.Type][]field
-}
-
-// cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
-func cachedTypeFields(t reflect.Type) []field {
- fieldCache.RLock()
- f := fieldCache.m[t]
- fieldCache.RUnlock()
- if f != nil {
- return f
- }
-
- // Compute fields without lock.
- // Might duplicate effort but won't hold other computations back.
- f = typeFields(t)
- if f == nil {
- f = []field{}
- }
-
- fieldCache.Lock()
- if fieldCache.m == nil {
- fieldCache.m = map[reflect.Type][]field{}
- }
- fieldCache.m[t] = f
- fieldCache.Unlock()
- return f
-}
-
-func isValidTag(s string) bool {
- if s == "" {
- return false
- }
- for _, c := range s {
- switch {
- case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c):
- // Backslash and quote chars are reserved, but
- // otherwise any punctuation chars are allowed
- // in a tag name.
- default:
- if !unicode.IsLetter(c) && !unicode.IsDigit(c) {
- return false
- }
- }
- }
- return true
-}
-
-const (
- caseMask = ^byte(0x20) // Mask to ignore case in ASCII.
- kelvin = '\u212a'
- smallLongEss = '\u017f'
-)
-
-// foldFunc returns one of four different case folding equivalence
-// functions, from most general (and slow) to fastest:
-//
-// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8
-// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S')
-// 3) asciiEqualFold, no special, but includes non-letters (including _)
-// 4) simpleLetterEqualFold, no specials, no non-letters.
-//
-// The letters S and K are special because they map to 3 runes, not just 2:
-// * S maps to s and to U+017F 'ſ' Latin small letter long s
-// * k maps to K and to U+212A 'K' Kelvin sign
-// See http://play.golang.org/p/tTxjOc0OGo
-//
-// The returned function is specialized for matching against s and
-// should only be given s. It's not curried for performance reasons.
-func foldFunc(s []byte) func(s, t []byte) bool {
- nonLetter := false
- special := false // special letter
- for _, b := range s {
- if b >= utf8.RuneSelf {
- return bytes.EqualFold
- }
- upper := b & caseMask
- if upper < 'A' || upper > 'Z' {
- nonLetter = true
- } else if upper == 'K' || upper == 'S' {
- // See above for why these letters are special.
- special = true
- }
- }
- if special {
- return equalFoldRight
- }
- if nonLetter {
- return asciiEqualFold
- }
- return simpleLetterEqualFold
-}
-
-// equalFoldRight is a specialization of bytes.EqualFold when s is
-// known to be all ASCII (including punctuation), but contains an 's',
-// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t.
-// See comments on foldFunc.
-func equalFoldRight(s, t []byte) bool {
- for _, sb := range s {
- if len(t) == 0 {
- return false
- }
- tb := t[0]
- if tb < utf8.RuneSelf {
- if sb != tb {
- sbUpper := sb & caseMask
- if 'A' <= sbUpper && sbUpper <= 'Z' {
- if sbUpper != tb&caseMask {
- return false
- }
- } else {
- return false
- }
- }
- t = t[1:]
- continue
- }
- // sb is ASCII and t is not. t must be either kelvin
- // sign or long s; sb must be s, S, k, or K.
- tr, size := utf8.DecodeRune(t)
- switch sb {
- case 's', 'S':
- if tr != smallLongEss {
- return false
- }
- case 'k', 'K':
- if tr != kelvin {
- return false
- }
- default:
- return false
- }
- t = t[size:]
-
- }
- if len(t) > 0 {
- return false
- }
- return true
-}
-
-// asciiEqualFold is a specialization of bytes.EqualFold for use when
-// s is all ASCII (but may contain non-letters) and contains no
-// special-folding letters.
-// See comments on foldFunc.
-func asciiEqualFold(s, t []byte) bool {
- if len(s) != len(t) {
- return false
- }
- for i, sb := range s {
- tb := t[i]
- if sb == tb {
- continue
- }
- if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') {
- if sb&caseMask != tb&caseMask {
- return false
- }
- } else {
- return false
- }
- }
- return true
-}
-
-// simpleLetterEqualFold is a specialization of bytes.EqualFold for
-// use when s is all ASCII letters (no underscores, etc) and also
-// doesn't contain 'k', 'K', 's', or 'S'.
-// See comments on foldFunc.
-func simpleLetterEqualFold(s, t []byte) bool {
- if len(s) != len(t) {
- return false
- }
- for i, b := range s {
- if b&caseMask != t[i]&caseMask {
- return false
- }
- }
- return true
-}
-
-// tagOptions is the string following a comma in a struct field's "json"
-// tag, or the empty string. It does not include the leading comma.
-type tagOptions string
-
-// parseTag splits a struct field's json tag into its name and
-// comma-separated options.
-func parseTag(tag string) (string, tagOptions) {
- if idx := strings.Index(tag, ","); idx != -1 {
- return tag[:idx], tagOptions(tag[idx+1:])
- }
- return tag, tagOptions("")
-}
-
-// Contains reports whether a comma-separated list of options
-// contains a particular substr flag. substr must be surrounded by a
-// string boundary or commas.
-func (o tagOptions) Contains(optionName string) bool {
- if len(o) == 0 {
- return false
- }
- s := string(o)
- for s != "" {
- var next string
- i := strings.Index(s, ",")
- if i >= 0 {
- s, next = s[:i], s[i+1:]
- }
- if s == optionName {
- return true
- }
- s = next
- }
- return false
-}
diff --git a/vendor/github.com/ghodss/yaml/yaml.go b/vendor/github.com/ghodss/yaml/yaml.go
deleted file mode 100644
index 4fb4054a..00000000
--- a/vendor/github.com/ghodss/yaml/yaml.go
+++ /dev/null
@@ -1,277 +0,0 @@
-package yaml
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "reflect"
- "strconv"
-
- "gopkg.in/yaml.v2"
-)
-
-// Marshals the object into JSON then converts JSON to YAML and returns the
-// YAML.
-func Marshal(o interface{}) ([]byte, error) {
- j, err := json.Marshal(o)
- if err != nil {
- return nil, fmt.Errorf("error marshaling into JSON: %v", err)
- }
-
- y, err := JSONToYAML(j)
- if err != nil {
- return nil, fmt.Errorf("error converting JSON to YAML: %v", err)
- }
-
- return y, nil
-}
-
-// Converts YAML to JSON then uses JSON to unmarshal into an object.
-func Unmarshal(y []byte, o interface{}) error {
- vo := reflect.ValueOf(o)
- j, err := yamlToJSON(y, &vo)
- if err != nil {
- return fmt.Errorf("error converting YAML to JSON: %v", err)
- }
-
- err = json.Unmarshal(j, o)
- if err != nil {
- return fmt.Errorf("error unmarshaling JSON: %v", err)
- }
-
- return nil
-}
-
-// Convert JSON to YAML.
-func JSONToYAML(j []byte) ([]byte, error) {
- // Convert the JSON to an object.
- var jsonObj interface{}
- // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the
- // Go JSON library doesn't try to pick the right number type (int, float,
- // etc.) when unmarshalling to interface{}, it just picks float64
- // universally. go-yaml does go through the effort of picking the right
- // number type, so we can preserve number type throughout this process.
- err := yaml.Unmarshal(j, &jsonObj)
- if err != nil {
- return nil, err
- }
-
- // Marshal this object into YAML.
- return yaml.Marshal(jsonObj)
-}
-
-// Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through
-// this method should be a no-op.
-//
-// Things YAML can do that are not supported by JSON:
-// * In YAML you can have binary and null keys in your maps. These are invalid
-// in JSON. (int and float keys are converted to strings.)
-// * Binary data in YAML with the !!binary tag is not supported. If you want to
-// use binary data with this library, encode the data as base64 as usual but do
-// not use the !!binary tag in your YAML. This will ensure the original base64
-// encoded data makes it all the way through to the JSON.
-func YAMLToJSON(y []byte) ([]byte, error) {
- return yamlToJSON(y, nil)
-}
-
-func yamlToJSON(y []byte, jsonTarget *reflect.Value) ([]byte, error) {
- // Convert the YAML to an object.
- var yamlObj interface{}
- err := yaml.Unmarshal(y, &yamlObj)
- if err != nil {
- return nil, err
- }
-
- // YAML objects are not completely compatible with JSON objects (e.g. you
- // can have non-string keys in YAML). So, convert the YAML-compatible object
- // to a JSON-compatible object, failing with an error if irrecoverable
- // incompatibilties happen along the way.
- jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget)
- if err != nil {
- return nil, err
- }
-
- // Convert this object to JSON and return the data.
- return json.Marshal(jsonObj)
-}
-
-func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) {
- var err error
-
- // Resolve jsonTarget to a concrete value (i.e. not a pointer or an
- // interface). We pass decodingNull as false because we're not actually
- // decoding into the value, we're just checking if the ultimate target is a
- // string.
- if jsonTarget != nil {
- ju, tu, pv := indirect(*jsonTarget, false)
- // We have a JSON or Text Umarshaler at this level, so we can't be trying
- // to decode into a string.
- if ju != nil || tu != nil {
- jsonTarget = nil
- } else {
- jsonTarget = &pv
- }
- }
-
- // If yamlObj is a number or a boolean, check if jsonTarget is a string -
- // if so, coerce. Else return normal.
- // If yamlObj is a map or array, find the field that each key is
- // unmarshaling to, and when you recurse pass the reflect.Value for that
- // field back into this function.
- switch typedYAMLObj := yamlObj.(type) {
- case map[interface{}]interface{}:
- // JSON does not support arbitrary keys in a map, so we must convert
- // these keys to strings.
- //
- // From my reading of go-yaml v2 (specifically the resolve function),
- // keys can only have the types string, int, int64, float64, binary
- // (unsupported), or null (unsupported).
- strMap := make(map[string]interface{})
- for k, v := range typedYAMLObj {
- // Resolve the key to a string first.
- var keyString string
- switch typedKey := k.(type) {
- case string:
- keyString = typedKey
- case int:
- keyString = strconv.Itoa(typedKey)
- case int64:
- // go-yaml will only return an int64 as a key if the system
- // architecture is 32-bit and the key's value is between 32-bit
- // and 64-bit. Otherwise the key type will simply be int.
- keyString = strconv.FormatInt(typedKey, 10)
- case float64:
- // Stolen from go-yaml to use the same conversion to string as
- // the go-yaml library uses to convert float to string when
- // Marshaling.
- s := strconv.FormatFloat(typedKey, 'g', -1, 32)
- switch s {
- case "+Inf":
- s = ".inf"
- case "-Inf":
- s = "-.inf"
- case "NaN":
- s = ".nan"
- }
- keyString = s
- case bool:
- if typedKey {
- keyString = "true"
- } else {
- keyString = "false"
- }
- default:
- return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v",
- reflect.TypeOf(k), k, v)
- }
-
- // jsonTarget should be a struct or a map. If it's a struct, find
- // the field it's going to map to and pass its reflect.Value. If
- // it's a map, find the element type of the map and pass the
- // reflect.Value created from that type. If it's neither, just pass
- // nil - JSON conversion will error for us if it's a real issue.
- if jsonTarget != nil {
- t := *jsonTarget
- if t.Kind() == reflect.Struct {
- keyBytes := []byte(keyString)
- // Find the field that the JSON library would use.
- var f *field
- fields := cachedTypeFields(t.Type())
- for i := range fields {
- ff := &fields[i]
- if bytes.Equal(ff.nameBytes, keyBytes) {
- f = ff
- break
- }
- // Do case-insensitive comparison.
- if f == nil && ff.equalFold(ff.nameBytes, keyBytes) {
- f = ff
- }
- }
- if f != nil {
- // Find the reflect.Value of the most preferential
- // struct field.
- jtf := t.Field(f.index[0])
- strMap[keyString], err = convertToJSONableObject(v, &jtf)
- if err != nil {
- return nil, err
- }
- continue
- }
- } else if t.Kind() == reflect.Map {
- // Create a zero value of the map's element type to use as
- // the JSON target.
- jtv := reflect.Zero(t.Type().Elem())
- strMap[keyString], err = convertToJSONableObject(v, &jtv)
- if err != nil {
- return nil, err
- }
- continue
- }
- }
- strMap[keyString], err = convertToJSONableObject(v, nil)
- if err != nil {
- return nil, err
- }
- }
- return strMap, nil
- case []interface{}:
- // We need to recurse into arrays in case there are any
- // map[interface{}]interface{}'s inside and to convert any
- // numbers to strings.
-
- // If jsonTarget is a slice (which it really should be), find the
- // thing it's going to map to. If it's not a slice, just pass nil
- // - JSON conversion will error for us if it's a real issue.
- var jsonSliceElemValue *reflect.Value
- if jsonTarget != nil {
- t := *jsonTarget
- if t.Kind() == reflect.Slice {
- // By default slices point to nil, but we need a reflect.Value
- // pointing to a value of the slice type, so we create one here.
- ev := reflect.Indirect(reflect.New(t.Type().Elem()))
- jsonSliceElemValue = &ev
- }
- }
-
- // Make and use a new array.
- arr := make([]interface{}, len(typedYAMLObj))
- for i, v := range typedYAMLObj {
- arr[i], err = convertToJSONableObject(v, jsonSliceElemValue)
- if err != nil {
- return nil, err
- }
- }
- return arr, nil
- default:
- // If the target type is a string and the YAML type is a number,
- // convert the YAML type to a string.
- if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String {
- // Based on my reading of go-yaml, it may return int, int64,
- // float64, or uint64.
- var s string
- switch typedVal := typedYAMLObj.(type) {
- case int:
- s = strconv.FormatInt(int64(typedVal), 10)
- case int64:
- s = strconv.FormatInt(typedVal, 10)
- case float64:
- s = strconv.FormatFloat(typedVal, 'g', -1, 32)
- case uint64:
- s = strconv.FormatUint(typedVal, 10)
- case bool:
- if typedVal {
- s = "true"
- } else {
- s = "false"
- }
- }
- if len(s) > 0 {
- yamlObj = interface{}(s)
- }
- }
- return yamlObj, nil
- }
-
- return nil, nil
-}
diff --git a/vendor/github.com/ghodss/yaml/yaml_test.go b/vendor/github.com/ghodss/yaml/yaml_test.go
deleted file mode 100644
index 505af453..00000000
--- a/vendor/github.com/ghodss/yaml/yaml_test.go
+++ /dev/null
@@ -1,287 +0,0 @@
-package yaml
-
-import (
- "fmt"
- "math"
- "reflect"
- "strconv"
- "testing"
-)
-
-type MarshalTest struct {
- A string
- B int64
- // Would like to test float64, but it's not supported in go-yaml.
- // (See https://github.com/go-yaml/yaml/issues/83.)
- C float32
-}
-
-func TestMarshal(t *testing.T) {
- f32String := strconv.FormatFloat(math.MaxFloat32, 'g', -1, 32)
- s := MarshalTest{"a", math.MaxInt64, math.MaxFloat32}
- e := []byte(fmt.Sprintf("A: a\nB: %d\nC: %s\n", math.MaxInt64, f32String))
-
- y, err := Marshal(s)
- if err != nil {
- t.Errorf("error marshaling YAML: %v", err)
- }
-
- if !reflect.DeepEqual(y, e) {
- t.Errorf("marshal YAML was unsuccessful, expected: %#v, got: %#v",
- string(e), string(y))
- }
-}
-
-type UnmarshalString struct {
- A string
- True string
-}
-
-type UnmarshalStringMap struct {
- A map[string]string
-}
-
-type UnmarshalNestedString struct {
- A NestedString
-}
-
-type NestedString struct {
- A string
-}
-
-type UnmarshalSlice struct {
- A []NestedSlice
-}
-
-type NestedSlice struct {
- B string
- C *string
-}
-
-func TestUnmarshal(t *testing.T) {
- y := []byte("a: 1")
- s1 := UnmarshalString{}
- e1 := UnmarshalString{A: "1"}
- unmarshal(t, y, &s1, &e1)
-
- y = []byte("a: true")
- s1 = UnmarshalString{}
- e1 = UnmarshalString{A: "true"}
- unmarshal(t, y, &s1, &e1)
-
- y = []byte("true: 1")
- s1 = UnmarshalString{}
- e1 = UnmarshalString{True: "1"}
- unmarshal(t, y, &s1, &e1)
-
- y = []byte("a:\n a: 1")
- s2 := UnmarshalNestedString{}
- e2 := UnmarshalNestedString{NestedString{"1"}}
- unmarshal(t, y, &s2, &e2)
-
- y = []byte("a:\n - b: abc\n c: def\n - b: 123\n c: 456\n")
- s3 := UnmarshalSlice{}
- e3 := UnmarshalSlice{[]NestedSlice{NestedSlice{"abc", strPtr("def")}, NestedSlice{"123", strPtr("456")}}}
- unmarshal(t, y, &s3, &e3)
-
- y = []byte("a:\n b: 1")
- s4 := UnmarshalStringMap{}
- e4 := UnmarshalStringMap{map[string]string{"b": "1"}}
- unmarshal(t, y, &s4, &e4)
-
- y = []byte(`
-a:
- name: TestA
-b:
- name: TestB
-`)
- type NamedThing struct {
- Name string `json:"name"`
- }
- s5 := map[string]*NamedThing{}
- e5 := map[string]*NamedThing{
- "a": &NamedThing{Name: "TestA"},
- "b": &NamedThing{Name: "TestB"},
- }
- unmarshal(t, y, &s5, &e5)
-}
-
-func unmarshal(t *testing.T, y []byte, s, e interface{}) {
- err := Unmarshal(y, s)
- if err != nil {
- t.Errorf("error unmarshaling YAML: %v", err)
- }
-
- if !reflect.DeepEqual(s, e) {
- t.Errorf("unmarshal YAML was unsuccessful, expected: %+#v, got: %+#v",
- e, s)
- }
-}
-
-type Case struct {
- input string
- output string
- // By default we test that reversing the output == input. But if there is a
- // difference in the reversed output, you can optionally specify it here.
- reverse *string
-}
-
-type RunType int
-
-const (
- RunTypeJSONToYAML RunType = iota
- RunTypeYAMLToJSON
-)
-
-func TestJSONToYAML(t *testing.T) {
- cases := []Case{
- {
- `{"t":"a"}`,
- "t: a\n",
- nil,
- }, {
- `{"t":null}`,
- "t: null\n",
- nil,
- },
- }
-
- runCases(t, RunTypeJSONToYAML, cases)
-}
-
-func TestYAMLToJSON(t *testing.T) {
- cases := []Case{
- {
- "t: a\n",
- `{"t":"a"}`,
- nil,
- }, {
- "t: \n",
- `{"t":null}`,
- strPtr("t: null\n"),
- }, {
- "t: null\n",
- `{"t":null}`,
- nil,
- }, {
- "1: a\n",
- `{"1":"a"}`,
- strPtr("\"1\": a\n"),
- }, {
- "1000000000000000000000000000000000000: a\n",
- `{"1e+36":"a"}`,
- strPtr("\"1e+36\": a\n"),
- }, {
- "1e+36: a\n",
- `{"1e+36":"a"}`,
- strPtr("\"1e+36\": a\n"),
- }, {
- "\"1e+36\": a\n",
- `{"1e+36":"a"}`,
- nil,
- }, {
- "\"1.2\": a\n",
- `{"1.2":"a"}`,
- nil,
- }, {
- "- t: a\n",
- `[{"t":"a"}]`,
- nil,
- }, {
- "- t: a\n" +
- "- t:\n" +
- " b: 1\n" +
- " c: 2\n",
- `[{"t":"a"},{"t":{"b":1,"c":2}}]`,
- nil,
- }, {
- `[{t: a}, {t: {b: 1, c: 2}}]`,
- `[{"t":"a"},{"t":{"b":1,"c":2}}]`,
- strPtr("- t: a\n" +
- "- t:\n" +
- " b: 1\n" +
- " c: 2\n"),
- }, {
- "- t: \n",
- `[{"t":null}]`,
- strPtr("- t: null\n"),
- }, {
- "- t: null\n",
- `[{"t":null}]`,
- nil,
- },
- }
-
- // Cases that should produce errors.
- _ = []Case{
- {
- "~: a",
- `{"null":"a"}`,
- nil,
- }, {
- "a: !!binary gIGC\n",
- "{\"a\":\"\x80\x81\x82\"}",
- nil,
- },
- }
-
- runCases(t, RunTypeYAMLToJSON, cases)
-}
-
-func runCases(t *testing.T, runType RunType, cases []Case) {
- var f func([]byte) ([]byte, error)
- var invF func([]byte) ([]byte, error)
- var msg string
- var invMsg string
- if runType == RunTypeJSONToYAML {
- f = JSONToYAML
- invF = YAMLToJSON
- msg = "JSON to YAML"
- invMsg = "YAML back to JSON"
- } else {
- f = YAMLToJSON
- invF = JSONToYAML
- msg = "YAML to JSON"
- invMsg = "JSON back to YAML"
- }
-
- for _, c := range cases {
- // Convert the string.
- t.Logf("converting %s\n", c.input)
- output, err := f([]byte(c.input))
- if err != nil {
- t.Errorf("Failed to convert %s, input: `%s`, err: %v", msg, c.input, err)
- }
-
- // Check it against the expected output.
- if string(output) != c.output {
- t.Errorf("Failed to convert %s, input: `%s`, expected `%s`, got `%s`",
- msg, c.input, c.output, string(output))
- }
-
- // Set the string that we will compare the reversed output to.
- reverse := c.input
- // If a special reverse string was specified, use that instead.
- if c.reverse != nil {
- reverse = *c.reverse
- }
-
- // Reverse the output.
- input, err := invF(output)
- if err != nil {
- t.Errorf("Failed to convert %s, input: `%s`, err: %v", invMsg, string(output), err)
- }
-
- // Check the reverse is equal to the input (or to *c.reverse).
- if string(input) != reverse {
- t.Errorf("Failed to convert %s, input: `%s`, expected `%s`, got `%s`",
- invMsg, string(output), reverse, string(input))
- }
- }
-
-}
-
-// To be able to easily fill in the *Case.reverse string above.
-func strPtr(s string) *string {
- return &s
-}
diff --git a/vendor/github.com/hashicorp/hcl/.github/ISSUE_TEMPLATE.md b/vendor/github.com/hashicorp/hcl/.github/ISSUE_TEMPLATE.md
deleted file mode 100644
index 2d7fc4bf..00000000
--- a/vendor/github.com/hashicorp/hcl/.github/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,21 +0,0 @@
-### HCL Template
-```hcl
-# Place your HCL configuration file here
-```
-
-### Expected behavior
-What should have happened?
-
-### Actual behavior
-What actually happened?
-
-### Steps to reproduce
-1.
-2.
-3.
-
-### References
-Are there any other GitHub issues (open or closed) that should
-be linked here? For example:
-- GH-1234
-- ...
diff --git a/vendor/github.com/hashicorp/hcl/.gitignore b/vendor/github.com/hashicorp/hcl/.gitignore
deleted file mode 100644
index 822fa09f..00000000
--- a/vendor/github.com/hashicorp/hcl/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-y.output
-
-# ignore intellij files
-.idea
-*.iml
-*.ipr
-*.iws
-
-*.test
diff --git a/vendor/github.com/hashicorp/hcl/.travis.yml b/vendor/github.com/hashicorp/hcl/.travis.yml
deleted file mode 100644
index cb63a321..00000000
--- a/vendor/github.com/hashicorp/hcl/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-sudo: false
-
-language: go
-
-go:
- - 1.x
- - tip
-
-branches:
- only:
- - master
-
-script: make test
diff --git a/vendor/github.com/hashicorp/hcl/LICENSE b/vendor/github.com/hashicorp/hcl/LICENSE
deleted file mode 100644
index c33dcc7c..00000000
--- a/vendor/github.com/hashicorp/hcl/LICENSE
+++ /dev/null
@@ -1,354 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. “Contributor”
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. “Contributor Version”
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor’s Contribution.
-
-1.3. “Contribution”
-
- means Covered Software of a particular Contributor.
-
-1.4. “Covered Software”
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. “Incompatible With Secondary Licenses”
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of version
- 1.1 or earlier of the License, but not also under the terms of a
- Secondary License.
-
-1.6. “Executable Form”
-
- means any form of the work other than Source Code Form.
-
-1.7. “Larger Work”
-
- means a work that combines Covered Software with other material, in a separate
- file or files, that is not Covered Software.
-
-1.8. “License”
-
- means this document.
-
-1.9. “Licensable”
-
- means having the right to grant, to the maximum extent possible, whether at the
- time of the initial grant or subsequently, any and all of the rights conveyed by
- this License.
-
-1.10. “Modifications”
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to, deletion
- from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. “Patent Claims” of a Contributor
-
- means any patent claim(s), including without limitation, method, process,
- and apparatus claims, in any patent Licensable by such Contributor that
- would be infringed, but for the grant of the License, by the making,
- using, selling, offering for sale, having made, import, or transfer of
- either its Contributions or its Contributor Version.
-
-1.12. “Secondary License”
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. “Source Code Form”
-
- means the form of the work preferred for making modifications.
-
-1.14. “You” (or “Your”)
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, “You” includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, “control” means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or as
- part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its Contributions
- or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution become
- effective for each Contribution on the date the Contributor first distributes
- such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under this
- License. No additional rights or licenses will be implied from the distribution
- or licensing of Covered Software under this License. Notwithstanding Section
- 2.1(b) above, no patent license is granted by a Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party’s
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of its
- Contributions.
-
- This License does not grant any rights in the trademarks, service marks, or
- logos of any Contributor (except as may be necessary to comply with the
- notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this License
- (see Section 10.2) or under the terms of a Secondary License (if permitted
- under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its Contributions
- are its original creation(s) or it has sufficient rights to grant the
- rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under applicable
- copyright doctrines of fair use, fair dealing, or other equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under the
- terms of this License. You must inform recipients that the Source Code Form
- of the Covered Software is governed by the terms of this License, and how
- they can obtain a copy of this License. You may not attempt to alter or
- restrict the recipients’ rights in the Source Code Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this License,
- or sublicense it under different terms, provided that the license for
- the Executable Form does not attempt to limit or alter the recipients’
- rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for the
- Covered Software. If the Larger Work is a combination of Covered Software
- with a work governed by one or more Secondary Licenses, and the Covered
- Software is not Incompatible With Secondary Licenses, this License permits
- You to additionally distribute such Covered Software under the terms of
- such Secondary License(s), so that the recipient of the Larger Work may, at
- their option, further distribute the Covered Software under the terms of
- either this License or such Secondary License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices (including
- copyright notices, patent notices, disclaimers of warranty, or limitations
- of liability) contained within the Source Code Form of the Covered
- Software, except that You may alter any license notices to the extent
- required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on behalf
- of any Contributor. You must make it absolutely clear that any such
- warranty, support, indemnity, or liability obligation is offered by You
- alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute, judicial
- order, or regulation then You must: (a) comply with the terms of this License
- to the maximum extent possible; and (b) describe the limitations and the code
- they affect. Such description must be placed in a text file included with all
- distributions of the Covered Software under this License. Except to the
- extent prohibited by statute or regulation, such description must be
- sufficiently detailed for a recipient of ordinary skill to be able to
- understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing basis,
- if such Contributor fails to notify You of the non-compliance by some
- reasonable means prior to 60 days after You have come back into compliance.
- Moreover, Your grants from a particular Contributor are reinstated on an
- ongoing basis if such Contributor notifies You of the non-compliance by
- some reasonable means, this is the first time You have received notice of
- non-compliance with this License from such Contributor, and You become
- compliant prior to 30 days after Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions, counter-claims,
- and cross-claims) alleging that a Contributor Version directly or
- indirectly infringes any patent, then the rights granted to You by any and
- all Contributors for the Covered Software under Section 2.1 of this License
- shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an “as is” basis, without
- warranty of any kind, either expressed, implied, or statutory, including,
- without limitation, warranties that the Covered Software is free of defects,
- merchantable, fit for a particular purpose or non-infringing. The entire
- risk as to the quality and performance of the Covered Software is with You.
- Should any Covered Software prove defective in any respect, You (not any
- Contributor) assume the cost of any necessary servicing, repair, or
- correction. This disclaimer of warranty constitutes an essential part of this
- License. No use of any Covered Software is authorized under this License
- except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from such
- party’s negligence to the extent applicable law prohibits such limitation.
- Some jurisdictions do not allow the exclusion or limitation of incidental or
- consequential damages, so this exclusion and limitation may not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts of
- a jurisdiction where the defendant maintains its principal place of business
- and such litigation shall be governed by laws of that jurisdiction, without
- reference to its conflict-of-law provisions. Nothing in this Section shall
- prevent a party’s ability to bring cross-claims or counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject matter
- hereof. If any provision of this License is held to be unenforceable, such
- provision shall be reformed only to the extent necessary to make it
- enforceable. Any law or regulation which provides that the language of a
- contract shall be construed against the drafter shall not be used to construe
- this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version of
- the License under which You originally received the Covered Software, or
- under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a modified
- version of this License if you rename the license and remove any
- references to the name of the license steward (except to note that such
- modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
- If You choose to distribute Source Code Form that is Incompatible With
- Secondary Licenses under the terms of this version of the License, the
- notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file, then
-You may include the notice in a location (such as a LICENSE file in a relevant
-directory) where a recipient would be likely to look for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - “Incompatible With Secondary Licenses” Notice
-
- This Source Code Form is “Incompatible
- With Secondary Licenses”, as defined by
- the Mozilla Public License, v. 2.0.
-
diff --git a/vendor/github.com/hashicorp/hcl/Makefile b/vendor/github.com/hashicorp/hcl/Makefile
deleted file mode 100644
index 9fafd501..00000000
--- a/vendor/github.com/hashicorp/hcl/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-TEST?=./...
-
-default: test
-
-fmt: generate
- go fmt ./...
-
-test: generate
- go get -t ./...
- go test $(TEST) $(TESTARGS)
-
-generate:
- go generate ./...
-
-updatedeps:
- go get -u golang.org/x/tools/cmd/stringer
-
-.PHONY: default generate test updatedeps
diff --git a/vendor/github.com/hashicorp/hcl/README.md b/vendor/github.com/hashicorp/hcl/README.md
deleted file mode 100644
index c8223326..00000000
--- a/vendor/github.com/hashicorp/hcl/README.md
+++ /dev/null
@@ -1,125 +0,0 @@
-# HCL
-
-[![GoDoc](https://godoc.org/github.com/hashicorp/hcl?status.png)](https://godoc.org/github.com/hashicorp/hcl) [![Build Status](https://travis-ci.org/hashicorp/hcl.svg?branch=master)](https://travis-ci.org/hashicorp/hcl)
-
-HCL (HashiCorp Configuration Language) is a configuration language built
-by HashiCorp. The goal of HCL is to build a structured configuration language
-that is both human and machine friendly for use with command-line tools, but
-specifically targeted towards DevOps tools, servers, etc.
-
-HCL is also fully JSON compatible. That is, JSON can be used as completely
-valid input to a system expecting HCL. This helps makes systems
-interoperable with other systems.
-
-HCL is heavily inspired by
-[libucl](https://github.com/vstakhov/libucl),
-nginx configuration, and others similar.
-
-## Why?
-
-A common question when viewing HCL is to ask the question: why not
-JSON, YAML, etc.?
-
-Prior to HCL, the tools we built at [HashiCorp](http://www.hashicorp.com)
-used a variety of configuration languages from full programming languages
-such as Ruby to complete data structure languages such as JSON. What we
-learned is that some people wanted human-friendly configuration languages
-and some people wanted machine-friendly languages.
-
-JSON fits a nice balance in this, but is fairly verbose and most
-importantly doesn't support comments. With YAML, we found that beginners
-had a really hard time determining what the actual structure was, and
-ended up guessing more often than not whether to use a hyphen, colon, etc.
-in order to represent some configuration key.
-
-Full programming languages such as Ruby enable complex behavior
-a configuration language shouldn't usually allow, and also forces
-people to learn some set of Ruby.
-
-Because of this, we decided to create our own configuration language
-that is JSON-compatible. Our configuration language (HCL) is designed
-to be written and modified by humans. The API for HCL allows JSON
-as an input so that it is also machine-friendly (machines can generate
-JSON instead of trying to generate HCL).
-
-Our goal with HCL is not to alienate other configuration languages.
-It is instead to provide HCL as a specialized language for our tools,
-and JSON as the interoperability layer.
-
-## Syntax
-
-For a complete grammar, please see the parser itself. A high-level overview
-of the syntax and grammar is listed here.
-
- * Single line comments start with `#` or `//`
-
- * Multi-line comments are wrapped in `/*` and `*/`. Nested block comments
- are not allowed. A multi-line comment (also known as a block comment)
- terminates at the first `*/` found.
-
- * Values are assigned with the syntax `key = value` (whitespace doesn't
- matter). The value can be any primitive: a string, number, boolean,
- object, or list.
-
- * Strings are double-quoted and can contain any UTF-8 characters.
- Example: `"Hello, World"`
-
- * Multi-line strings start with `<-
- echo %Path%
-
- go version
-
- go env
-
- go get -t ./...
-
-build_script:
-- cmd: go test -v ./...
diff --git a/vendor/github.com/hashicorp/hcl/decoder.go b/vendor/github.com/hashicorp/hcl/decoder.go
deleted file mode 100644
index bed9ebbe..00000000
--- a/vendor/github.com/hashicorp/hcl/decoder.go
+++ /dev/null
@@ -1,729 +0,0 @@
-package hcl
-
-import (
- "errors"
- "fmt"
- "reflect"
- "sort"
- "strconv"
- "strings"
-
- "github.com/hashicorp/hcl/hcl/ast"
- "github.com/hashicorp/hcl/hcl/parser"
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-// This is the tag to use with structures to have settings for HCL
-const tagName = "hcl"
-
-var (
- // nodeType holds a reference to the type of ast.Node
- nodeType reflect.Type = findNodeType()
-)
-
-// Unmarshal accepts a byte slice as input and writes the
-// data to the value pointed to by v.
-func Unmarshal(bs []byte, v interface{}) error {
- root, err := parse(bs)
- if err != nil {
- return err
- }
-
- return DecodeObject(v, root)
-}
-
-// Decode reads the given input and decodes it into the structure
-// given by `out`.
-func Decode(out interface{}, in string) error {
- obj, err := Parse(in)
- if err != nil {
- return err
- }
-
- return DecodeObject(out, obj)
-}
-
-// DecodeObject is a lower-level version of Decode. It decodes a
-// raw Object into the given output.
-func DecodeObject(out interface{}, n ast.Node) error {
- val := reflect.ValueOf(out)
- if val.Kind() != reflect.Ptr {
- return errors.New("result must be a pointer")
- }
-
- // If we have the file, we really decode the root node
- if f, ok := n.(*ast.File); ok {
- n = f.Node
- }
-
- var d decoder
- return d.decode("root", n, val.Elem())
-}
-
-type decoder struct {
- stack []reflect.Kind
-}
-
-func (d *decoder) decode(name string, node ast.Node, result reflect.Value) error {
- k := result
-
- // If we have an interface with a valid value, we use that
- // for the check.
- if result.Kind() == reflect.Interface {
- elem := result.Elem()
- if elem.IsValid() {
- k = elem
- }
- }
-
- // Push current onto stack unless it is an interface.
- if k.Kind() != reflect.Interface {
- d.stack = append(d.stack, k.Kind())
-
- // Schedule a pop
- defer func() {
- d.stack = d.stack[:len(d.stack)-1]
- }()
- }
-
- switch k.Kind() {
- case reflect.Bool:
- return d.decodeBool(name, node, result)
- case reflect.Float32, reflect.Float64:
- return d.decodeFloat(name, node, result)
- case reflect.Int, reflect.Int32, reflect.Int64:
- return d.decodeInt(name, node, result)
- case reflect.Interface:
- // When we see an interface, we make our own thing
- return d.decodeInterface(name, node, result)
- case reflect.Map:
- return d.decodeMap(name, node, result)
- case reflect.Ptr:
- return d.decodePtr(name, node, result)
- case reflect.Slice:
- return d.decodeSlice(name, node, result)
- case reflect.String:
- return d.decodeString(name, node, result)
- case reflect.Struct:
- return d.decodeStruct(name, node, result)
- default:
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: unknown kind to decode into: %s", name, k.Kind()),
- }
- }
-}
-
-func (d *decoder) decodeBool(name string, node ast.Node, result reflect.Value) error {
- switch n := node.(type) {
- case *ast.LiteralType:
- if n.Token.Type == token.BOOL {
- v, err := strconv.ParseBool(n.Token.Text)
- if err != nil {
- return err
- }
-
- result.Set(reflect.ValueOf(v))
- return nil
- }
- }
-
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: unknown type %T", name, node),
- }
-}
-
-func (d *decoder) decodeFloat(name string, node ast.Node, result reflect.Value) error {
- switch n := node.(type) {
- case *ast.LiteralType:
- if n.Token.Type == token.FLOAT || n.Token.Type == token.NUMBER {
- v, err := strconv.ParseFloat(n.Token.Text, 64)
- if err != nil {
- return err
- }
-
- result.Set(reflect.ValueOf(v).Convert(result.Type()))
- return nil
- }
- }
-
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: unknown type %T", name, node),
- }
-}
-
-func (d *decoder) decodeInt(name string, node ast.Node, result reflect.Value) error {
- switch n := node.(type) {
- case *ast.LiteralType:
- switch n.Token.Type {
- case token.NUMBER:
- v, err := strconv.ParseInt(n.Token.Text, 0, 0)
- if err != nil {
- return err
- }
-
- if result.Kind() == reflect.Interface {
- result.Set(reflect.ValueOf(int(v)))
- } else {
- result.SetInt(v)
- }
- return nil
- case token.STRING:
- v, err := strconv.ParseInt(n.Token.Value().(string), 0, 0)
- if err != nil {
- return err
- }
-
- if result.Kind() == reflect.Interface {
- result.Set(reflect.ValueOf(int(v)))
- } else {
- result.SetInt(v)
- }
- return nil
- }
- }
-
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: unknown type %T", name, node),
- }
-}
-
-func (d *decoder) decodeInterface(name string, node ast.Node, result reflect.Value) error {
- // When we see an ast.Node, we retain the value to enable deferred decoding.
- // Very useful in situations where we want to preserve ast.Node information
- // like Pos
- if result.Type() == nodeType && result.CanSet() {
- result.Set(reflect.ValueOf(node))
- return nil
- }
-
- var set reflect.Value
- redecode := true
-
- // For testing types, ObjectType should just be treated as a list. We
- // set this to a temporary var because we want to pass in the real node.
- testNode := node
- if ot, ok := node.(*ast.ObjectType); ok {
- testNode = ot.List
- }
-
- switch n := testNode.(type) {
- case *ast.ObjectList:
- // If we're at the root or we're directly within a slice, then we
- // decode objects into map[string]interface{}, otherwise we decode
- // them into lists.
- if len(d.stack) == 0 || d.stack[len(d.stack)-1] == reflect.Slice {
- var temp map[string]interface{}
- tempVal := reflect.ValueOf(temp)
- result := reflect.MakeMap(
- reflect.MapOf(
- reflect.TypeOf(""),
- tempVal.Type().Elem()))
-
- set = result
- } else {
- var temp []map[string]interface{}
- tempVal := reflect.ValueOf(temp)
- result := reflect.MakeSlice(
- reflect.SliceOf(tempVal.Type().Elem()), 0, len(n.Items))
- set = result
- }
- case *ast.ObjectType:
- // If we're at the root or we're directly within a slice, then we
- // decode objects into map[string]interface{}, otherwise we decode
- // them into lists.
- if len(d.stack) == 0 || d.stack[len(d.stack)-1] == reflect.Slice {
- var temp map[string]interface{}
- tempVal := reflect.ValueOf(temp)
- result := reflect.MakeMap(
- reflect.MapOf(
- reflect.TypeOf(""),
- tempVal.Type().Elem()))
-
- set = result
- } else {
- var temp []map[string]interface{}
- tempVal := reflect.ValueOf(temp)
- result := reflect.MakeSlice(
- reflect.SliceOf(tempVal.Type().Elem()), 0, 1)
- set = result
- }
- case *ast.ListType:
- var temp []interface{}
- tempVal := reflect.ValueOf(temp)
- result := reflect.MakeSlice(
- reflect.SliceOf(tempVal.Type().Elem()), 0, 0)
- set = result
- case *ast.LiteralType:
- switch n.Token.Type {
- case token.BOOL:
- var result bool
- set = reflect.Indirect(reflect.New(reflect.TypeOf(result)))
- case token.FLOAT:
- var result float64
- set = reflect.Indirect(reflect.New(reflect.TypeOf(result)))
- case token.NUMBER:
- var result int
- set = reflect.Indirect(reflect.New(reflect.TypeOf(result)))
- case token.STRING, token.HEREDOC:
- set = reflect.Indirect(reflect.New(reflect.TypeOf("")))
- default:
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: cannot decode into interface: %T", name, node),
- }
- }
- default:
- return fmt.Errorf(
- "%s: cannot decode into interface: %T",
- name, node)
- }
-
- // Set the result to what its supposed to be, then reset
- // result so we don't reflect into this method anymore.
- result.Set(set)
-
- if redecode {
- // Revisit the node so that we can use the newly instantiated
- // thing and populate it.
- if err := d.decode(name, node, result); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (d *decoder) decodeMap(name string, node ast.Node, result reflect.Value) error {
- if item, ok := node.(*ast.ObjectItem); ok {
- node = &ast.ObjectList{Items: []*ast.ObjectItem{item}}
- }
-
- if ot, ok := node.(*ast.ObjectType); ok {
- node = ot.List
- }
-
- n, ok := node.(*ast.ObjectList)
- if !ok {
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: not an object type for map (%T)", name, node),
- }
- }
-
- // If we have an interface, then we can address the interface,
- // but not the slice itself, so get the element but set the interface
- set := result
- if result.Kind() == reflect.Interface {
- result = result.Elem()
- }
-
- resultType := result.Type()
- resultElemType := resultType.Elem()
- resultKeyType := resultType.Key()
- if resultKeyType.Kind() != reflect.String {
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: map must have string keys", name),
- }
- }
-
- // Make a map if it is nil
- resultMap := result
- if result.IsNil() {
- resultMap = reflect.MakeMap(
- reflect.MapOf(resultKeyType, resultElemType))
- }
-
- // Go through each element and decode it.
- done := make(map[string]struct{})
- for _, item := range n.Items {
- if item.Val == nil {
- continue
- }
-
- // github.com/hashicorp/terraform/issue/5740
- if len(item.Keys) == 0 {
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: map must have string keys", name),
- }
- }
-
- // Get the key we're dealing with, which is the first item
- keyStr := item.Keys[0].Token.Value().(string)
-
- // If we've already processed this key, then ignore it
- if _, ok := done[keyStr]; ok {
- continue
- }
-
- // Determine the value. If we have more than one key, then we
- // get the objectlist of only these keys.
- itemVal := item.Val
- if len(item.Keys) > 1 {
- itemVal = n.Filter(keyStr)
- done[keyStr] = struct{}{}
- }
-
- // Make the field name
- fieldName := fmt.Sprintf("%s.%s", name, keyStr)
-
- // Get the key/value as reflection values
- key := reflect.ValueOf(keyStr)
- val := reflect.Indirect(reflect.New(resultElemType))
-
- // If we have a pre-existing value in the map, use that
- oldVal := resultMap.MapIndex(key)
- if oldVal.IsValid() {
- val.Set(oldVal)
- }
-
- // Decode!
- if err := d.decode(fieldName, itemVal, val); err != nil {
- return err
- }
-
- // Set the value on the map
- resultMap.SetMapIndex(key, val)
- }
-
- // Set the final map if we can
- set.Set(resultMap)
- return nil
-}
-
-func (d *decoder) decodePtr(name string, node ast.Node, result reflect.Value) error {
- // Create an element of the concrete (non pointer) type and decode
- // into that. Then set the value of the pointer to this type.
- resultType := result.Type()
- resultElemType := resultType.Elem()
- val := reflect.New(resultElemType)
- if err := d.decode(name, node, reflect.Indirect(val)); err != nil {
- return err
- }
-
- result.Set(val)
- return nil
-}
-
-func (d *decoder) decodeSlice(name string, node ast.Node, result reflect.Value) error {
- // If we have an interface, then we can address the interface,
- // but not the slice itself, so get the element but set the interface
- set := result
- if result.Kind() == reflect.Interface {
- result = result.Elem()
- }
- // Create the slice if it isn't nil
- resultType := result.Type()
- resultElemType := resultType.Elem()
- if result.IsNil() {
- resultSliceType := reflect.SliceOf(resultElemType)
- result = reflect.MakeSlice(
- resultSliceType, 0, 0)
- }
-
- // Figure out the items we'll be copying into the slice
- var items []ast.Node
- switch n := node.(type) {
- case *ast.ObjectList:
- items = make([]ast.Node, len(n.Items))
- for i, item := range n.Items {
- items[i] = item
- }
- case *ast.ObjectType:
- items = []ast.Node{n}
- case *ast.ListType:
- items = n.List
- default:
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("unknown slice type: %T", node),
- }
- }
-
- for i, item := range items {
- fieldName := fmt.Sprintf("%s[%d]", name, i)
-
- // Decode
- val := reflect.Indirect(reflect.New(resultElemType))
-
- // if item is an object that was decoded from ambiguous JSON and
- // flattened, make sure it's expanded if it needs to decode into a
- // defined structure.
- item := expandObject(item, val)
-
- if err := d.decode(fieldName, item, val); err != nil {
- return err
- }
-
- // Append it onto the slice
- result = reflect.Append(result, val)
- }
-
- set.Set(result)
- return nil
-}
-
-// expandObject detects if an ambiguous JSON object was flattened to a List which
-// should be decoded into a struct, and expands the ast to properly deocode.
-func expandObject(node ast.Node, result reflect.Value) ast.Node {
- item, ok := node.(*ast.ObjectItem)
- if !ok {
- return node
- }
-
- elemType := result.Type()
-
- // our target type must be a struct
- switch elemType.Kind() {
- case reflect.Ptr:
- switch elemType.Elem().Kind() {
- case reflect.Struct:
- //OK
- default:
- return node
- }
- case reflect.Struct:
- //OK
- default:
- return node
- }
-
- // A list value will have a key and field name. If it had more fields,
- // it wouldn't have been flattened.
- if len(item.Keys) != 2 {
- return node
- }
-
- keyToken := item.Keys[0].Token
- item.Keys = item.Keys[1:]
-
- // we need to un-flatten the ast enough to decode
- newNode := &ast.ObjectItem{
- Keys: []*ast.ObjectKey{
- &ast.ObjectKey{
- Token: keyToken,
- },
- },
- Val: &ast.ObjectType{
- List: &ast.ObjectList{
- Items: []*ast.ObjectItem{item},
- },
- },
- }
-
- return newNode
-}
-
-func (d *decoder) decodeString(name string, node ast.Node, result reflect.Value) error {
- switch n := node.(type) {
- case *ast.LiteralType:
- switch n.Token.Type {
- case token.NUMBER:
- result.Set(reflect.ValueOf(n.Token.Text).Convert(result.Type()))
- return nil
- case token.STRING, token.HEREDOC:
- result.Set(reflect.ValueOf(n.Token.Value()).Convert(result.Type()))
- return nil
- }
- }
-
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: unknown type for string %T", name, node),
- }
-}
-
-func (d *decoder) decodeStruct(name string, node ast.Node, result reflect.Value) error {
- var item *ast.ObjectItem
- if it, ok := node.(*ast.ObjectItem); ok {
- item = it
- node = it.Val
- }
-
- if ot, ok := node.(*ast.ObjectType); ok {
- node = ot.List
- }
-
- // Handle the special case where the object itself is a literal. Previously
- // the yacc parser would always ensure top-level elements were arrays. The new
- // parser does not make the same guarantees, thus we need to convert any
- // top-level literal elements into a list.
- if _, ok := node.(*ast.LiteralType); ok && item != nil {
- node = &ast.ObjectList{Items: []*ast.ObjectItem{item}}
- }
-
- list, ok := node.(*ast.ObjectList)
- if !ok {
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: not an object type for struct (%T)", name, node),
- }
- }
-
- // This slice will keep track of all the structs we'll be decoding.
- // There can be more than one struct if there are embedded structs
- // that are squashed.
- structs := make([]reflect.Value, 1, 5)
- structs[0] = result
-
- // Compile the list of all the fields that we're going to be decoding
- // from all the structs.
- type field struct {
- field reflect.StructField
- val reflect.Value
- }
- fields := []field{}
- for len(structs) > 0 {
- structVal := structs[0]
- structs = structs[1:]
-
- structType := structVal.Type()
- for i := 0; i < structType.NumField(); i++ {
- fieldType := structType.Field(i)
- tagParts := strings.Split(fieldType.Tag.Get(tagName), ",")
-
- // Ignore fields with tag name "-"
- if tagParts[0] == "-" {
- continue
- }
-
- if fieldType.Anonymous {
- fieldKind := fieldType.Type.Kind()
- if fieldKind != reflect.Struct {
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: unsupported type to struct: %s",
- fieldType.Name, fieldKind),
- }
- }
-
- // We have an embedded field. We "squash" the fields down
- // if specified in the tag.
- squash := false
- for _, tag := range tagParts[1:] {
- if tag == "squash" {
- squash = true
- break
- }
- }
-
- if squash {
- structs = append(
- structs, result.FieldByName(fieldType.Name))
- continue
- }
- }
-
- // Normal struct field, store it away
- fields = append(fields, field{fieldType, structVal.Field(i)})
- }
- }
-
- usedKeys := make(map[string]struct{})
- decodedFields := make([]string, 0, len(fields))
- decodedFieldsVal := make([]reflect.Value, 0)
- unusedKeysVal := make([]reflect.Value, 0)
- for _, f := range fields {
- field, fieldValue := f.field, f.val
- if !fieldValue.IsValid() {
- // This should never happen
- panic("field is not valid")
- }
-
- // If we can't set the field, then it is unexported or something,
- // and we just continue onwards.
- if !fieldValue.CanSet() {
- continue
- }
-
- fieldName := field.Name
-
- tagValue := field.Tag.Get(tagName)
- tagParts := strings.SplitN(tagValue, ",", 2)
- if len(tagParts) >= 2 {
- switch tagParts[1] {
- case "decodedFields":
- decodedFieldsVal = append(decodedFieldsVal, fieldValue)
- continue
- case "key":
- if item == nil {
- return &parser.PosError{
- Pos: node.Pos(),
- Err: fmt.Errorf("%s: %s asked for 'key', impossible",
- name, fieldName),
- }
- }
-
- fieldValue.SetString(item.Keys[0].Token.Value().(string))
- continue
- case "unusedKeys":
- unusedKeysVal = append(unusedKeysVal, fieldValue)
- continue
- }
- }
-
- if tagParts[0] != "" {
- fieldName = tagParts[0]
- }
-
- // Determine the element we'll use to decode. If it is a single
- // match (only object with the field), then we decode it exactly.
- // If it is a prefix match, then we decode the matches.
- filter := list.Filter(fieldName)
-
- prefixMatches := filter.Children()
- matches := filter.Elem()
- if len(matches.Items) == 0 && len(prefixMatches.Items) == 0 {
- continue
- }
-
- // Track the used key
- usedKeys[fieldName] = struct{}{}
-
- // Create the field name and decode. We range over the elements
- // because we actually want the value.
- fieldName = fmt.Sprintf("%s.%s", name, fieldName)
- if len(prefixMatches.Items) > 0 {
- if err := d.decode(fieldName, prefixMatches, fieldValue); err != nil {
- return err
- }
- }
- for _, match := range matches.Items {
- var decodeNode ast.Node = match.Val
- if ot, ok := decodeNode.(*ast.ObjectType); ok {
- decodeNode = &ast.ObjectList{Items: ot.List.Items}
- }
-
- if err := d.decode(fieldName, decodeNode, fieldValue); err != nil {
- return err
- }
- }
-
- decodedFields = append(decodedFields, field.Name)
- }
-
- if len(decodedFieldsVal) > 0 {
- // Sort it so that it is deterministic
- sort.Strings(decodedFields)
-
- for _, v := range decodedFieldsVal {
- v.Set(reflect.ValueOf(decodedFields))
- }
- }
-
- return nil
-}
-
-// findNodeType returns the type of ast.Node
-func findNodeType() reflect.Type {
- var nodeContainer struct {
- Node ast.Node
- }
- value := reflect.ValueOf(nodeContainer).FieldByName("Node")
- return value.Type()
-}
diff --git a/vendor/github.com/hashicorp/hcl/decoder_test.go b/vendor/github.com/hashicorp/hcl/decoder_test.go
deleted file mode 100644
index 8682f470..00000000
--- a/vendor/github.com/hashicorp/hcl/decoder_test.go
+++ /dev/null
@@ -1,1203 +0,0 @@
-package hcl
-
-import (
- "io/ioutil"
- "path/filepath"
- "reflect"
- "testing"
- "time"
-
- "github.com/davecgh/go-spew/spew"
- "github.com/hashicorp/hcl/hcl/ast"
-)
-
-func TestDecode_interface(t *testing.T) {
- cases := []struct {
- File string
- Err bool
- Out interface{}
- }{
- {
- "basic.hcl",
- false,
- map[string]interface{}{
- "foo": "bar",
- "bar": "${file(\"bing/bong.txt\")}",
- },
- },
- {
- "basic_squish.hcl",
- false,
- map[string]interface{}{
- "foo": "bar",
- "bar": "${file(\"bing/bong.txt\")}",
- "foo-bar": "baz",
- },
- },
- {
- "empty.hcl",
- false,
- map[string]interface{}{
- "resource": []map[string]interface{}{
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{},
- },
- },
- },
- },
- },
- {
- "tfvars.hcl",
- false,
- map[string]interface{}{
- "regularvar": "Should work",
- "map.key1": "Value",
- "map.key2": "Other value",
- },
- },
- {
- "escape.hcl",
- false,
- map[string]interface{}{
- "foo": "bar\"baz\\n",
- "qux": "back\\slash",
- "bar": "new\nline",
- "qax": `slash\:colon`,
- "nested": `${HH\\:mm\\:ss}`,
- "nestedquotes": `${"\"stringwrappedinquotes\""}`,
- },
- },
- {
- "float.hcl",
- false,
- map[string]interface{}{
- "a": 1.02,
- "b": 2,
- },
- },
- {
- "multiline_bad.hcl",
- true,
- nil,
- },
- {
- "multiline_literal.hcl",
- true,
- nil,
- },
- {
- "multiline_literal_with_hil.hcl",
- false,
- map[string]interface{}{"multiline_literal_with_hil": "${hello\n world}"},
- },
- {
- "multiline_no_marker.hcl",
- true,
- nil,
- },
- {
- "multiline.hcl",
- false,
- map[string]interface{}{"foo": "bar\nbaz\n"},
- },
- {
- "multiline_indented.hcl",
- false,
- map[string]interface{}{"foo": " bar\n baz\n"},
- },
- {
- "multiline_no_hanging_indent.hcl",
- false,
- map[string]interface{}{"foo": " baz\n bar\n foo\n"},
- },
- {
- "multiline_no_eof.hcl",
- false,
- map[string]interface{}{"foo": "bar\nbaz\n", "key": "value"},
- },
- {
- "multiline.json",
- false,
- map[string]interface{}{"foo": "bar\nbaz"},
- },
- {
- "null_strings.json",
- false,
- map[string]interface{}{
- "module": []map[string]interface{}{
- map[string]interface{}{
- "app": []map[string]interface{}{
- map[string]interface{}{"foo": ""},
- },
- },
- },
- },
- },
- {
- "scientific.json",
- false,
- map[string]interface{}{
- "a": 1e-10,
- "b": 1e+10,
- "c": 1e10,
- "d": 1.2e-10,
- "e": 1.2e+10,
- "f": 1.2e10,
- },
- },
- {
- "scientific.hcl",
- false,
- map[string]interface{}{
- "a": 1e-10,
- "b": 1e+10,
- "c": 1e10,
- "d": 1.2e-10,
- "e": 1.2e+10,
- "f": 1.2e10,
- },
- },
- {
- "terraform_heroku.hcl",
- false,
- map[string]interface{}{
- "name": "terraform-test-app",
- "config_vars": []map[string]interface{}{
- map[string]interface{}{
- "FOO": "bar",
- },
- },
- },
- },
- {
- "structure_multi.hcl",
- false,
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "baz": []map[string]interface{}{
- map[string]interface{}{"key": 7},
- },
- },
- map[string]interface{}{
- "bar": []map[string]interface{}{
- map[string]interface{}{"key": 12},
- },
- },
- },
- },
- },
- {
- "structure_multi.json",
- false,
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "baz": []map[string]interface{}{
- map[string]interface{}{"key": 7},
- },
- },
- map[string]interface{}{
- "bar": []map[string]interface{}{
- map[string]interface{}{"key": 12},
- },
- },
- },
- },
- },
- {
- "list_of_lists.hcl",
- false,
- map[string]interface{}{
- "foo": []interface{}{
- []interface{}{"foo"},
- []interface{}{"bar"},
- },
- },
- },
- {
- "list_of_maps.hcl",
- false,
- map[string]interface{}{
- "foo": []interface{}{
- map[string]interface{}{"somekey1": "someval1"},
- map[string]interface{}{"somekey2": "someval2", "someextrakey": "someextraval"},
- },
- },
- },
- {
- "assign_deep.hcl",
- false,
- map[string]interface{}{
- "resource": []interface{}{
- map[string]interface{}{
- "foo": []interface{}{
- map[string]interface{}{
- "bar": []map[string]interface{}{
- map[string]interface{}{}}}}}}},
- },
- {
- "structure_list.hcl",
- false,
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "key": 7,
- },
- map[string]interface{}{
- "key": 12,
- },
- },
- },
- },
- {
- "structure_list.json",
- false,
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "key": 7,
- },
- map[string]interface{}{
- "key": 12,
- },
- },
- },
- },
- {
- "structure_list_deep.json",
- false,
- map[string]interface{}{
- "bar": []map[string]interface{}{
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "name": "terraform_example",
- "ingress": []map[string]interface{}{
- map[string]interface{}{
- "from_port": 22,
- },
- map[string]interface{}{
- "from_port": 80,
- },
- },
- },
- },
- },
- },
- },
- },
-
- {
- "structure_list_empty.json",
- false,
- map[string]interface{}{
- "foo": []interface{}{},
- },
- },
-
- {
- "nested_block_comment.hcl",
- false,
- map[string]interface{}{
- "bar": "value",
- },
- },
-
- {
- "unterminated_block_comment.hcl",
- true,
- nil,
- },
-
- {
- "unterminated_brace.hcl",
- true,
- nil,
- },
-
- {
- "nested_provider_bad.hcl",
- true,
- nil,
- },
-
- {
- "object_list.json",
- false,
- map[string]interface{}{
- "resource": []map[string]interface{}{
- map[string]interface{}{
- "aws_instance": []map[string]interface{}{
- map[string]interface{}{
- "db": []map[string]interface{}{
- map[string]interface{}{
- "vpc": "foo",
- "provisioner": []map[string]interface{}{
- map[string]interface{}{
- "file": []map[string]interface{}{
- map[string]interface{}{
- "source": "foo",
- "destination": "bar",
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
-
- // Terraform GH-8295 sanity test that basic decoding into
- // interface{} works.
- {
- "terraform_variable_invalid.json",
- false,
- map[string]interface{}{
- "variable": []map[string]interface{}{
- map[string]interface{}{
- "whatever": "abc123",
- },
- },
- },
- },
-
- {
- "interpolate.json",
- false,
- map[string]interface{}{
- "default": `${replace("europe-west", "-", " ")}`,
- },
- },
-
- {
- "block_assign.hcl",
- true,
- nil,
- },
-
- {
- "escape_backslash.hcl",
- false,
- map[string]interface{}{
- "output": []map[string]interface{}{
- map[string]interface{}{
- "one": `${replace(var.sub_domain, ".", "\\.")}`,
- "two": `${replace(var.sub_domain, ".", "\\\\.")}`,
- "many": `${replace(var.sub_domain, ".", "\\\\\\\\.")}`,
- },
- },
- },
- },
-
- {
- "git_crypt.hcl",
- true,
- nil,
- },
-
- {
- "object_with_bool.hcl",
- false,
- map[string]interface{}{
- "path": []map[string]interface{}{
- map[string]interface{}{
- "policy": "write",
- "permissions": []map[string]interface{}{
- map[string]interface{}{
- "bool": []interface{}{false},
- },
- },
- },
- },
- },
- },
- }
-
- for _, tc := range cases {
- t.Run(tc.File, func(t *testing.T) {
- d, err := ioutil.ReadFile(filepath.Join(fixtureDir, tc.File))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- var out interface{}
- err = Decode(&out, string(d))
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %s\n\nError: %s", tc.File, err)
- }
-
- if !reflect.DeepEqual(out, tc.Out) {
- t.Fatalf("Input: %s. Actual, Expected.\n\n%#v\n\n%#v", tc.File, out, tc.Out)
- }
-
- var v interface{}
- err = Unmarshal(d, &v)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %s\n\nError: %s", tc.File, err)
- }
-
- if !reflect.DeepEqual(v, tc.Out) {
- t.Fatalf("Input: %s. Actual, Expected.\n\n%#v\n\n%#v", tc.File, out, tc.Out)
- }
- })
- }
-}
-
-func TestDecode_interfaceInline(t *testing.T) {
- cases := []struct {
- Value string
- Err bool
- Out interface{}
- }{
- {"t t e{{}}", true, nil},
- {"t=0t d {}", true, map[string]interface{}{"t": 0}},
- {"v=0E0v d{}", true, map[string]interface{}{"v": float64(0)}},
- }
-
- for _, tc := range cases {
- t.Logf("Testing: %q", tc.Value)
-
- var out interface{}
- err := Decode(&out, tc.Value)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %q\n\nError: %s", tc.Value, err)
- }
-
- if !reflect.DeepEqual(out, tc.Out) {
- t.Fatalf("Input: %q. Actual, Expected.\n\n%#v\n\n%#v", tc.Value, out, tc.Out)
- }
-
- var v interface{}
- err = Unmarshal([]byte(tc.Value), &v)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %q\n\nError: %s", tc.Value, err)
- }
-
- if !reflect.DeepEqual(v, tc.Out) {
- t.Fatalf("Input: %q. Actual, Expected.\n\n%#v\n\n%#v", tc.Value, out, tc.Out)
- }
- }
-}
-
-func TestDecode_equal(t *testing.T) {
- cases := []struct {
- One, Two string
- }{
- {
- "basic.hcl",
- "basic.json",
- },
- {
- "float.hcl",
- "float.json",
- },
- /*
- {
- "structure.hcl",
- "structure.json",
- },
- */
- {
- "structure.hcl",
- "structure_flat.json",
- },
- {
- "terraform_heroku.hcl",
- "terraform_heroku.json",
- },
- }
-
- for _, tc := range cases {
- p1 := filepath.Join(fixtureDir, tc.One)
- p2 := filepath.Join(fixtureDir, tc.Two)
-
- d1, err := ioutil.ReadFile(p1)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- d2, err := ioutil.ReadFile(p2)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- var i1, i2 interface{}
- err = Decode(&i1, string(d1))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = Decode(&i2, string(d2))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if !reflect.DeepEqual(i1, i2) {
- t.Fatalf(
- "%s != %s\n\n%#v\n\n%#v",
- tc.One, tc.Two,
- i1, i2)
- }
- }
-}
-
-func TestDecode_flatMap(t *testing.T) {
- var val map[string]map[string]string
-
- err := Decode(&val, testReadFile(t, "structure_flatmap.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- expected := map[string]map[string]string{
- "foo": map[string]string{
- "foo": "bar",
- "key": "7",
- },
- }
-
- if !reflect.DeepEqual(val, expected) {
- t.Fatalf("Actual: %#v\n\nExpected: %#v", val, expected)
- }
-}
-
-func TestDecode_structure(t *testing.T) {
- type Embedded interface{}
-
- type V struct {
- Embedded `hcl:"-"`
- Key int
- Foo string
- }
-
- var actual V
-
- err := Decode(&actual, testReadFile(t, "flat.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- expected := V{
- Key: 7,
- Foo: "bar",
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Actual: %#v\n\nExpected: %#v", actual, expected)
- }
-}
-
-func TestDecode_structurePtr(t *testing.T) {
- type V struct {
- Key int
- Foo string
- }
-
- var actual *V
-
- err := Decode(&actual, testReadFile(t, "flat.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- expected := &V{
- Key: 7,
- Foo: "bar",
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Actual: %#v\n\nExpected: %#v", actual, expected)
- }
-}
-
-func TestDecode_structureArray(t *testing.T) {
- // This test is extracted from a failure in Consul (consul.io),
- // hence the interesting structure naming.
-
- type KeyPolicyType string
-
- type KeyPolicy struct {
- Prefix string `hcl:",key"`
- Policy KeyPolicyType
- }
-
- type Policy struct {
- Keys []KeyPolicy `hcl:"key,expand"`
- }
-
- expected := Policy{
- Keys: []KeyPolicy{
- KeyPolicy{
- Prefix: "",
- Policy: "read",
- },
- KeyPolicy{
- Prefix: "foo/",
- Policy: "write",
- },
- KeyPolicy{
- Prefix: "foo/bar/",
- Policy: "read",
- },
- KeyPolicy{
- Prefix: "foo/bar/baz",
- Policy: "deny",
- },
- },
- }
-
- files := []string{
- "decode_policy.hcl",
- "decode_policy.json",
- }
-
- for _, f := range files {
- var actual Policy
-
- err := Decode(&actual, testReadFile(t, f))
- if err != nil {
- t.Fatalf("Input: %s\n\nerr: %s", f, err)
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected)
- }
- }
-}
-
-func TestDecode_sliceExpand(t *testing.T) {
- type testInner struct {
- Name string `hcl:",key"`
- Key string
- }
-
- type testStruct struct {
- Services []testInner `hcl:"service,expand"`
- }
-
- expected := testStruct{
- Services: []testInner{
- testInner{
- Name: "my-service-0",
- Key: "value",
- },
- testInner{
- Name: "my-service-1",
- Key: "value",
- },
- },
- }
-
- files := []string{
- "slice_expand.hcl",
- }
-
- for _, f := range files {
- t.Logf("Testing: %s", f)
-
- var actual testStruct
- err := Decode(&actual, testReadFile(t, f))
- if err != nil {
- t.Fatalf("Input: %s\n\nerr: %s", f, err)
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected)
- }
- }
-}
-
-func TestDecode_structureMap(t *testing.T) {
- // This test is extracted from a failure in Terraform (terraform.io),
- // hence the interesting structure naming.
-
- type hclVariable struct {
- Default interface{}
- Description string
- Fields []string `hcl:",decodedFields"`
- }
-
- type rawConfig struct {
- Variable map[string]hclVariable
- }
-
- expected := rawConfig{
- Variable: map[string]hclVariable{
- "foo": hclVariable{
- Default: "bar",
- Description: "bar",
- Fields: []string{"Default", "Description"},
- },
-
- "amis": hclVariable{
- Default: []map[string]interface{}{
- map[string]interface{}{
- "east": "foo",
- },
- },
- Fields: []string{"Default"},
- },
- },
- }
-
- files := []string{
- "decode_tf_variable.hcl",
- "decode_tf_variable.json",
- }
-
- for _, f := range files {
- t.Logf("Testing: %s", f)
-
- var actual rawConfig
- err := Decode(&actual, testReadFile(t, f))
- if err != nil {
- t.Fatalf("Input: %s\n\nerr: %s", f, err)
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected)
- }
- }
-}
-
-func TestDecode_structureMapInvalid(t *testing.T) {
- // Terraform GH-8295
-
- type hclVariable struct {
- Default interface{}
- Description string
- Fields []string `hcl:",decodedFields"`
- }
-
- type rawConfig struct {
- Variable map[string]*hclVariable
- }
-
- var actual rawConfig
- err := Decode(&actual, testReadFile(t, "terraform_variable_invalid.json"))
- if err == nil {
- t.Fatal("expected error")
- }
-}
-
-func TestDecode_interfaceNonPointer(t *testing.T) {
- var value interface{}
- err := Decode(value, testReadFile(t, "basic_int_string.hcl"))
- if err == nil {
- t.Fatal("should error")
- }
-}
-
-func TestDecode_intString(t *testing.T) {
- var value struct {
- Count int
- }
-
- err := Decode(&value, testReadFile(t, "basic_int_string.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if value.Count != 3 {
- t.Fatalf("bad: %#v", value.Count)
- }
-}
-
-func TestDecode_float32(t *testing.T) {
- var value struct {
- A float32 `hcl:"a"`
- B float32 `hcl:"b"`
- }
-
- err := Decode(&value, testReadFile(t, "float.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if got, want := value.A, float32(1.02); got != want {
- t.Fatalf("wrong result %#v; want %#v", got, want)
- }
- if got, want := value.B, float32(2); got != want {
- t.Fatalf("wrong result %#v; want %#v", got, want)
- }
-}
-
-func TestDecode_float64(t *testing.T) {
- var value struct {
- A float64 `hcl:"a"`
- B float64 `hcl:"b"`
- }
-
- err := Decode(&value, testReadFile(t, "float.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if got, want := value.A, float64(1.02); got != want {
- t.Fatalf("wrong result %#v; want %#v", got, want)
- }
- if got, want := value.B, float64(2); got != want {
- t.Fatalf("wrong result %#v; want %#v", got, want)
- }
-}
-
-func TestDecode_intStringAliased(t *testing.T) {
- var value struct {
- Count time.Duration
- }
-
- err := Decode(&value, testReadFile(t, "basic_int_string.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if value.Count != time.Duration(3) {
- t.Fatalf("bad: %#v", value.Count)
- }
-}
-
-func TestDecode_Node(t *testing.T) {
- // given
- var value struct {
- Content ast.Node
- Nested struct {
- Content ast.Node
- }
- }
-
- content := `
-content {
- hello = "world"
-}
-`
-
- // when
- err := Decode(&value, content)
-
- // then
- if err != nil {
- t.Errorf("unable to decode content, %v", err)
- return
- }
-
- // verify ast.Node can be decoded later
- var v map[string]interface{}
- err = DecodeObject(&v, value.Content)
- if err != nil {
- t.Errorf("unable to decode content, %v", err)
- return
- }
-
- if v["hello"] != "world" {
- t.Errorf("expected mapping to be returned")
- }
-}
-
-func TestDecode_NestedNode(t *testing.T) {
- // given
- var value struct {
- Nested struct {
- Content ast.Node
- }
- }
-
- content := `
-nested "content" {
- hello = "world"
-}
-`
-
- // when
- err := Decode(&value, content)
-
- // then
- if err != nil {
- t.Errorf("unable to decode content, %v", err)
- return
- }
-
- // verify ast.Node can be decoded later
- var v map[string]interface{}
- err = DecodeObject(&v, value.Nested.Content)
- if err != nil {
- t.Errorf("unable to decode content, %v", err)
- return
- }
-
- if v["hello"] != "world" {
- t.Errorf("expected mapping to be returned")
- }
-}
-
-// https://github.com/hashicorp/hcl/issues/60
-func TestDecode_topLevelKeys(t *testing.T) {
- type Template struct {
- Source string
- }
-
- templates := struct {
- Templates []*Template `hcl:"template"`
- }{}
-
- err := Decode(&templates, `
- template {
- source = "blah"
- }
-
- template {
- source = "blahblah"
- }`)
-
- if err != nil {
- t.Fatal(err)
- }
-
- if templates.Templates[0].Source != "blah" {
- t.Errorf("bad source: %s", templates.Templates[0].Source)
- }
-
- if templates.Templates[1].Source != "blahblah" {
- t.Errorf("bad source: %s", templates.Templates[1].Source)
- }
-}
-
-func TestDecode_flattenedJSON(t *testing.T) {
- // make sure we can also correctly extract a Name key too
- type V struct {
- Name string `hcl:",key"`
- Description string
- Default map[string]string
- }
- type Vars struct {
- Variable []*V
- }
-
- cases := []struct {
- JSON string
- Out interface{}
- Expected interface{}
- }{
- { // Nested object, no sibling keys
- JSON: `
-{
- "var_name": {
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
-}
- `,
- Out: &[]*V{},
- Expected: &[]*V{
- &V{
- Name: "var_name",
- Default: map[string]string{"key1": "a", "key2": "b"},
- },
- },
- },
-
- { // Nested object with a sibling key (this worked previously)
- JSON: `
-{
- "var_name": {
- "description": "Described",
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
-}
- `,
- Out: &[]*V{},
- Expected: &[]*V{
- &V{
- Name: "var_name",
- Description: "Described",
- Default: map[string]string{"key1": "a", "key2": "b"},
- },
- },
- },
-
- { // Multiple nested objects, one with a sibling key
- JSON: `
-{
- "variable": {
- "var_1": {
- "default": {
- "key1": "a",
- "key2": "b"
- }
- },
- "var_2": {
- "description": "Described",
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
- }
-}
- `,
- Out: &Vars{},
- Expected: &Vars{
- Variable: []*V{
- &V{
- Name: "var_1",
- Default: map[string]string{"key1": "a", "key2": "b"},
- },
- &V{
- Name: "var_2",
- Description: "Described",
- Default: map[string]string{"key1": "a", "key2": "b"},
- },
- },
- },
- },
-
- { // Nested object to maps
- JSON: `
-{
- "variable": {
- "var_name": {
- "description": "Described",
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
- }
-}
- `,
- Out: &[]map[string]interface{}{},
- Expected: &[]map[string]interface{}{
- {
- "variable": []map[string]interface{}{
- {
- "var_name": []map[string]interface{}{
- {
- "description": "Described",
- "default": []map[string]interface{}{
- {
- "key1": "a",
- "key2": "b",
- },
- },
- },
- },
- },
- },
- },
- },
- },
-
- { // Nested object to maps without a sibling key should decode the same as above
- JSON: `
-{
- "variable": {
- "var_name": {
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
- }
-}
- `,
- Out: &[]map[string]interface{}{},
- Expected: &[]map[string]interface{}{
- {
- "variable": []map[string]interface{}{
- {
- "var_name": []map[string]interface{}{
- {
- "default": []map[string]interface{}{
- {
- "key1": "a",
- "key2": "b",
- },
- },
- },
- },
- },
- },
- },
- },
- },
-
- { // Nested objects, one with a sibling key, and one without
- JSON: `
-{
- "variable": {
- "var_1": {
- "default": {
- "key1": "a",
- "key2": "b"
- }
- },
- "var_2": {
- "description": "Described",
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
- }
-}
- `,
- Out: &[]map[string]interface{}{},
- Expected: &[]map[string]interface{}{
- {
- "variable": []map[string]interface{}{
- {
- "var_1": []map[string]interface{}{
- {
- "default": []map[string]interface{}{
- {
- "key1": "a",
- "key2": "b",
- },
- },
- },
- },
- },
- },
- },
- {
- "variable": []map[string]interface{}{
- {
- "var_2": []map[string]interface{}{
- {
- "description": "Described",
- "default": []map[string]interface{}{
- {
- "key1": "a",
- "key2": "b",
- },
- },
- },
- },
- },
- },
- },
- },
- },
- }
-
- for i, tc := range cases {
- err := Decode(tc.Out, tc.JSON)
- if err != nil {
- t.Fatalf("[%d] err: %s", i, err)
- }
-
- if !reflect.DeepEqual(tc.Out, tc.Expected) {
- t.Fatalf("[%d]\ngot: %s\nexpected: %s\n", i, spew.Sdump(tc.Out), spew.Sdump(tc.Expected))
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl.go b/vendor/github.com/hashicorp/hcl/hcl.go
deleted file mode 100644
index 575a20b5..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Package hcl decodes HCL into usable Go structures.
-//
-// hcl input can come in either pure HCL format or JSON format.
-// It can be parsed into an AST, and then decoded into a structure,
-// or it can be decoded directly from a string into a structure.
-//
-// If you choose to parse HCL into a raw AST, the benefit is that you
-// can write custom visitor implementations to implement custom
-// semantic checks. By default, HCL does not perform any semantic
-// checks.
-package hcl
diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go b/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go
deleted file mode 100644
index 6e5ef654..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go
+++ /dev/null
@@ -1,219 +0,0 @@
-// Package ast declares the types used to represent syntax trees for HCL
-// (HashiCorp Configuration Language)
-package ast
-
-import (
- "fmt"
- "strings"
-
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-// Node is an element in the abstract syntax tree.
-type Node interface {
- node()
- Pos() token.Pos
-}
-
-func (File) node() {}
-func (ObjectList) node() {}
-func (ObjectKey) node() {}
-func (ObjectItem) node() {}
-func (Comment) node() {}
-func (CommentGroup) node() {}
-func (ObjectType) node() {}
-func (LiteralType) node() {}
-func (ListType) node() {}
-
-// File represents a single HCL file
-type File struct {
- Node Node // usually a *ObjectList
- Comments []*CommentGroup // list of all comments in the source
-}
-
-func (f *File) Pos() token.Pos {
- return f.Node.Pos()
-}
-
-// ObjectList represents a list of ObjectItems. An HCL file itself is an
-// ObjectList.
-type ObjectList struct {
- Items []*ObjectItem
-}
-
-func (o *ObjectList) Add(item *ObjectItem) {
- o.Items = append(o.Items, item)
-}
-
-// Filter filters out the objects with the given key list as a prefix.
-//
-// The returned list of objects contain ObjectItems where the keys have
-// this prefix already stripped off. This might result in objects with
-// zero-length key lists if they have no children.
-//
-// If no matches are found, an empty ObjectList (non-nil) is returned.
-func (o *ObjectList) Filter(keys ...string) *ObjectList {
- var result ObjectList
- for _, item := range o.Items {
- // If there aren't enough keys, then ignore this
- if len(item.Keys) < len(keys) {
- continue
- }
-
- match := true
- for i, key := range item.Keys[:len(keys)] {
- key := key.Token.Value().(string)
- if key != keys[i] && !strings.EqualFold(key, keys[i]) {
- match = false
- break
- }
- }
- if !match {
- continue
- }
-
- // Strip off the prefix from the children
- newItem := *item
- newItem.Keys = newItem.Keys[len(keys):]
- result.Add(&newItem)
- }
-
- return &result
-}
-
-// Children returns further nested objects (key length > 0) within this
-// ObjectList. This should be used with Filter to get at child items.
-func (o *ObjectList) Children() *ObjectList {
- var result ObjectList
- for _, item := range o.Items {
- if len(item.Keys) > 0 {
- result.Add(item)
- }
- }
-
- return &result
-}
-
-// Elem returns items in the list that are direct element assignments
-// (key length == 0). This should be used with Filter to get at elements.
-func (o *ObjectList) Elem() *ObjectList {
- var result ObjectList
- for _, item := range o.Items {
- if len(item.Keys) == 0 {
- result.Add(item)
- }
- }
-
- return &result
-}
-
-func (o *ObjectList) Pos() token.Pos {
- // always returns the uninitiliazed position
- return o.Items[0].Pos()
-}
-
-// ObjectItem represents a HCL Object Item. An item is represented with a key
-// (or keys). It can be an assignment or an object (both normal and nested)
-type ObjectItem struct {
- // keys is only one length long if it's of type assignment. If it's a
- // nested object it can be larger than one. In that case "assign" is
- // invalid as there is no assignments for a nested object.
- Keys []*ObjectKey
-
- // assign contains the position of "=", if any
- Assign token.Pos
-
- // val is the item itself. It can be an object,list, number, bool or a
- // string. If key length is larger than one, val can be only of type
- // Object.
- Val Node
-
- LeadComment *CommentGroup // associated lead comment
- LineComment *CommentGroup // associated line comment
-}
-
-func (o *ObjectItem) Pos() token.Pos {
- // I'm not entirely sure what causes this, but removing this causes
- // a test failure. We should investigate at some point.
- if len(o.Keys) == 0 {
- return token.Pos{}
- }
-
- return o.Keys[0].Pos()
-}
-
-// ObjectKeys are either an identifier or of type string.
-type ObjectKey struct {
- Token token.Token
-}
-
-func (o *ObjectKey) Pos() token.Pos {
- return o.Token.Pos
-}
-
-// LiteralType represents a literal of basic type. Valid types are:
-// token.NUMBER, token.FLOAT, token.BOOL and token.STRING
-type LiteralType struct {
- Token token.Token
-
- // comment types, only used when in a list
- LeadComment *CommentGroup
- LineComment *CommentGroup
-}
-
-func (l *LiteralType) Pos() token.Pos {
- return l.Token.Pos
-}
-
-// ListStatement represents a HCL List type
-type ListType struct {
- Lbrack token.Pos // position of "["
- Rbrack token.Pos // position of "]"
- List []Node // the elements in lexical order
-}
-
-func (l *ListType) Pos() token.Pos {
- return l.Lbrack
-}
-
-func (l *ListType) Add(node Node) {
- l.List = append(l.List, node)
-}
-
-// ObjectType represents a HCL Object Type
-type ObjectType struct {
- Lbrace token.Pos // position of "{"
- Rbrace token.Pos // position of "}"
- List *ObjectList // the nodes in lexical order
-}
-
-func (o *ObjectType) Pos() token.Pos {
- return o.Lbrace
-}
-
-// Comment node represents a single //, # style or /*- style commment
-type Comment struct {
- Start token.Pos // position of / or #
- Text string
-}
-
-func (c *Comment) Pos() token.Pos {
- return c.Start
-}
-
-// CommentGroup node represents a sequence of comments with no other tokens and
-// no empty lines between.
-type CommentGroup struct {
- List []*Comment // len(List) > 0
-}
-
-func (c *CommentGroup) Pos() token.Pos {
- return c.List[0].Pos()
-}
-
-//-------------------------------------------------------------------
-// GoStringer
-//-------------------------------------------------------------------
-
-func (o *ObjectKey) GoString() string { return fmt.Sprintf("*%#v", *o) }
-func (o *ObjectList) GoString() string { return fmt.Sprintf("*%#v", *o) }
diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go b/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go
deleted file mode 100644
index d4364a10..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go
+++ /dev/null
@@ -1,200 +0,0 @@
-package ast
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-func TestObjectListFilter(t *testing.T) {
- var cases = []struct {
- Filter []string
- Input []*ObjectItem
- Output []*ObjectItem
- }{
- {
- []string{"foo"},
- []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{
- Token: token.Token{Type: token.STRING, Text: `"foo"`},
- },
- },
- },
- },
- []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{},
- },
- },
- },
-
- {
- []string{"foo"},
- []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}},
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- },
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}},
- },
- },
- },
- []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- },
- },
- },
- }
-
- for _, tc := range cases {
- input := &ObjectList{Items: tc.Input}
- expected := &ObjectList{Items: tc.Output}
- if actual := input.Filter(tc.Filter...); !reflect.DeepEqual(actual, expected) {
- t.Fatalf("in order: input, expected, actual\n\n%#v\n\n%#v\n\n%#v", input, expected, actual)
- }
- }
-}
-
-func TestWalk(t *testing.T) {
- items := []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}},
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- Val: &LiteralType{Token: token.Token{Type: token.STRING, Text: `"example"`}},
- },
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}},
- },
- },
- }
-
- node := &ObjectList{Items: items}
-
- order := []string{
- "*ast.ObjectList",
- "*ast.ObjectItem",
- "*ast.ObjectKey",
- "*ast.ObjectKey",
- "*ast.LiteralType",
- "*ast.ObjectItem",
- "*ast.ObjectKey",
- }
- count := 0
-
- Walk(node, func(n Node) (Node, bool) {
- if n == nil {
- return n, false
- }
-
- typeName := reflect.TypeOf(n).String()
- if order[count] != typeName {
- t.Errorf("expected '%s' got: '%s'", order[count], typeName)
- }
- count++
- return n, true
- })
-}
-
-func TestWalkEquality(t *testing.T) {
- items := []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}},
- },
- },
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- },
- }
-
- node := &ObjectList{Items: items}
-
- rewritten := Walk(node, func(n Node) (Node, bool) { return n, true })
-
- newNode, ok := rewritten.(*ObjectList)
- if !ok {
- t.Fatalf("expected Objectlist, got %T", rewritten)
- }
-
- if !reflect.DeepEqual(node, newNode) {
- t.Fatal("rewritten node is not equal to the given node")
- }
-
- if len(newNode.Items) != 2 {
- t.Errorf("expected newNode length 2, got: %d", len(newNode.Items))
- }
-
- expected := []string{
- `"foo"`,
- `"bar"`,
- }
-
- for i, item := range newNode.Items {
- if len(item.Keys) != 1 {
- t.Errorf("expected keys newNode length 1, got: %d", len(item.Keys))
- }
-
- if item.Keys[0].Token.Text != expected[i] {
- t.Errorf("expected key %s, got %s", expected[i], item.Keys[0].Token.Text)
- }
-
- if item.Val != nil {
- t.Errorf("expected item value should be nil")
- }
- }
-}
-
-func TestWalkRewrite(t *testing.T) {
- items := []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}},
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- },
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}},
- },
- },
- }
-
- node := &ObjectList{Items: items}
-
- suffix := "_example"
- node = Walk(node, func(n Node) (Node, bool) {
- switch i := n.(type) {
- case *ObjectKey:
- i.Token.Text = i.Token.Text + suffix
- n = i
- }
- return n, true
- }).(*ObjectList)
-
- Walk(node, func(n Node) (Node, bool) {
- switch i := n.(type) {
- case *ObjectKey:
- if !strings.HasSuffix(i.Token.Text, suffix) {
- t.Errorf("Token '%s' should have suffix: %s", i.Token.Text, suffix)
- }
- }
- return n, true
- })
-
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/walk.go b/vendor/github.com/hashicorp/hcl/hcl/ast/walk.go
deleted file mode 100644
index ba07ad42..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/ast/walk.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package ast
-
-import "fmt"
-
-// WalkFunc describes a function to be called for each node during a Walk. The
-// returned node can be used to rewrite the AST. Walking stops the returned
-// bool is false.
-type WalkFunc func(Node) (Node, bool)
-
-// Walk traverses an AST in depth-first order: It starts by calling fn(node);
-// node must not be nil. If fn returns true, Walk invokes fn recursively for
-// each of the non-nil children of node, followed by a call of fn(nil). The
-// returned node of fn can be used to rewrite the passed node to fn.
-func Walk(node Node, fn WalkFunc) Node {
- rewritten, ok := fn(node)
- if !ok {
- return rewritten
- }
-
- switch n := node.(type) {
- case *File:
- n.Node = Walk(n.Node, fn)
- case *ObjectList:
- for i, item := range n.Items {
- n.Items[i] = Walk(item, fn).(*ObjectItem)
- }
- case *ObjectKey:
- // nothing to do
- case *ObjectItem:
- for i, k := range n.Keys {
- n.Keys[i] = Walk(k, fn).(*ObjectKey)
- }
-
- if n.Val != nil {
- n.Val = Walk(n.Val, fn)
- }
- case *LiteralType:
- // nothing to do
- case *ListType:
- for i, l := range n.List {
- n.List[i] = Walk(l, fn)
- }
- case *ObjectType:
- n.List = Walk(n.List, fn).(*ObjectList)
- default:
- // should we panic here?
- fmt.Printf("unknown type: %T\n", n)
- }
-
- fn(nil)
- return rewritten
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go
deleted file mode 100644
index 2380d71e..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Derivative work from:
-// - https://golang.org/src/cmd/gofmt/gofmt.go
-// - https://github.com/fatih/hclfmt
-
-package fmtcmd
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
-
- "github.com/hashicorp/hcl/hcl/printer"
-)
-
-var (
- ErrWriteStdin = errors.New("cannot use write option with standard input")
-)
-
-type Options struct {
- List bool // list files whose formatting differs
- Write bool // write result to (source) file instead of stdout
- Diff bool // display diffs of formatting changes
-}
-
-func isValidFile(f os.FileInfo, extensions []string) bool {
- if !f.IsDir() && !strings.HasPrefix(f.Name(), ".") {
- for _, ext := range extensions {
- if strings.HasSuffix(f.Name(), "."+ext) {
- return true
- }
- }
- }
-
- return false
-}
-
-// If in == nil, the source is the contents of the file with the given filename.
-func processFile(filename string, in io.Reader, out io.Writer, stdin bool, opts Options) error {
- if in == nil {
- f, err := os.Open(filename)
- if err != nil {
- return err
- }
- defer f.Close()
- in = f
- }
-
- src, err := ioutil.ReadAll(in)
- if err != nil {
- return err
- }
-
- res, err := printer.Format(src)
- if err != nil {
- return fmt.Errorf("In %s: %s", filename, err)
- }
-
- if !bytes.Equal(src, res) {
- // formatting has changed
- if opts.List {
- fmt.Fprintln(out, filename)
- }
- if opts.Write {
- err = ioutil.WriteFile(filename, res, 0644)
- if err != nil {
- return err
- }
- }
- if opts.Diff {
- data, err := diff(src, res)
- if err != nil {
- return fmt.Errorf("computing diff: %s", err)
- }
- fmt.Fprintf(out, "diff a/%s b/%s\n", filename, filename)
- out.Write(data)
- }
- }
-
- if !opts.List && !opts.Write && !opts.Diff {
- _, err = out.Write(res)
- }
-
- return err
-}
-
-func walkDir(path string, extensions []string, stdout io.Writer, opts Options) error {
- visitFile := func(path string, f os.FileInfo, err error) error {
- if err == nil && isValidFile(f, extensions) {
- err = processFile(path, nil, stdout, false, opts)
- }
- return err
- }
-
- return filepath.Walk(path, visitFile)
-}
-
-func Run(
- paths, extensions []string,
- stdin io.Reader,
- stdout io.Writer,
- opts Options,
-) error {
- if len(paths) == 0 {
- if opts.Write {
- return ErrWriteStdin
- }
- if err := processFile("", stdin, stdout, true, opts); err != nil {
- return err
- }
- return nil
- }
-
- for _, path := range paths {
- switch dir, err := os.Stat(path); {
- case err != nil:
- return err
- case dir.IsDir():
- if err := walkDir(path, extensions, stdout, opts); err != nil {
- return err
- }
- default:
- if err := processFile(path, nil, stdout, false, opts); err != nil {
- return err
- }
- }
- }
-
- return nil
-}
-
-func diff(b1, b2 []byte) (data []byte, err error) {
- f1, err := ioutil.TempFile("", "")
- if err != nil {
- return
- }
- defer os.Remove(f1.Name())
- defer f1.Close()
-
- f2, err := ioutil.TempFile("", "")
- if err != nil {
- return
- }
- defer os.Remove(f2.Name())
- defer f2.Close()
-
- f1.Write(b1)
- f2.Write(b2)
-
- data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput()
- if len(data) > 0 {
- // diff exits with a non-zero status when the files don't match.
- // Ignore that failure as long as we get output.
- err = nil
- }
- return
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go
deleted file mode 100644
index 66bed581..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go
+++ /dev/null
@@ -1,440 +0,0 @@
-// +build !windows
-// TODO(jen20): These need fixing on Windows but fmt is not used right now
-// and red CI is making it harder to process other bugs, so ignore until
-// we get around to fixing them.
-
-package fmtcmd
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "path/filepath"
- "reflect"
- "regexp"
- "sort"
- "syscall"
- "testing"
-
- "github.com/hashicorp/hcl/testhelper"
-)
-
-var fixtureExtensions = []string{"hcl"}
-
-func init() {
- sort.Sort(ByFilename(fixtures))
-}
-
-func TestIsValidFile(t *testing.T) {
- const fixtureDir = "./test-fixtures"
-
- cases := []struct {
- Path string
- Expected bool
- }{
- {"good.hcl", true},
- {".hidden.ignore", false},
- {"file.ignore", false},
- {"dir.ignore", false},
- }
-
- for _, tc := range cases {
- file, err := os.Stat(filepath.Join(fixtureDir, tc.Path))
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
-
- if res := isValidFile(file, fixtureExtensions); res != tc.Expected {
- t.Errorf("want: %t, got: %t", tc.Expected, res)
- }
- }
-}
-
-func TestRunMultiplePaths(t *testing.T) {
- path1, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path1)
- path2, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path2)
-
- var expectedOut bytes.Buffer
- for _, path := range []string{path1, path2} {
- for _, fixture := range fixtures {
- if !bytes.Equal(fixture.golden, fixture.input) {
- expectedOut.WriteString(filepath.Join(path, fixture.filename) + "\n")
- }
- }
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{path1, path2},
- fixtureExtensions,
- nil, stdout,
- Options{
- List: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if stdout.String() != expectedOut.String() {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut.String(), stdout.String())
- }
-}
-
-func TestRunSubDirectories(t *testing.T) {
- pathParent, err := ioutil.TempDir("", "")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(pathParent)
-
- path1, err := renderFixtures(pathParent)
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- path2, err := renderFixtures(pathParent)
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
-
- paths := []string{path1, path2}
- sort.Strings(paths)
-
- var expectedOut bytes.Buffer
- for _, path := range paths {
- for _, fixture := range fixtures {
- if !bytes.Equal(fixture.golden, fixture.input) {
- expectedOut.WriteString(filepath.Join(path, fixture.filename) + "\n")
- }
- }
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{pathParent},
- fixtureExtensions,
- nil, stdout,
- Options{
- List: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if stdout.String() != expectedOut.String() {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut.String(), stdout.String())
- }
-}
-
-func TestRunStdin(t *testing.T) {
- var expectedOut bytes.Buffer
- for i, fixture := range fixtures {
- if i != 0 {
- expectedOut.WriteString("\n")
- }
- expectedOut.Write(fixture.golden)
- }
-
- stdin, stdout := mockIO()
- for _, fixture := range fixtures {
- stdin.Write(fixture.input)
- }
-
- err := Run(
- []string{},
- fixtureExtensions,
- stdin, stdout,
- Options{},
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if !bytes.Equal(stdout.Bytes(), expectedOut.Bytes()) {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut.String(), stdout.String())
- }
-}
-
-func TestRunStdinAndWrite(t *testing.T) {
- var expectedOut = []byte{}
-
- stdin, stdout := mockIO()
- stdin.WriteString("")
- err := Run(
- []string{}, []string{},
- stdin, stdout,
- Options{
- Write: true,
- },
- )
-
- if err != ErrWriteStdin {
- t.Errorf("error want:\n%s\ngot:\n%s", ErrWriteStdin, err)
- }
- if !bytes.Equal(stdout.Bytes(), expectedOut) {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut, stdout)
- }
-}
-
-func TestRunFileError(t *testing.T) {
- path, err := ioutil.TempDir("", "")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
- filename := filepath.Join(path, "unreadable.hcl")
-
- var expectedError = &os.PathError{
- Op: "open",
- Path: filename,
- Err: syscall.EACCES,
- }
-
- err = ioutil.WriteFile(filename, []byte{}, 0000)
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{},
- )
-
- if !reflect.DeepEqual(err, expectedError) {
- t.Errorf("error want: %#v, got: %#v", expectedError, err)
- }
-}
-
-func TestRunNoOptions(t *testing.T) {
- path, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
-
- var expectedOut bytes.Buffer
- for _, fixture := range fixtures {
- expectedOut.Write(fixture.golden)
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{},
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if stdout.String() != expectedOut.String() {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut.String(), stdout.String())
- }
-}
-
-func TestRunList(t *testing.T) {
- path, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
-
- var expectedOut bytes.Buffer
- for _, fixture := range fixtures {
- if !bytes.Equal(fixture.golden, fixture.input) {
- expectedOut.WriteString(fmt.Sprintln(filepath.Join(path, fixture.filename)))
- }
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{
- List: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if stdout.String() != expectedOut.String() {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut.String(), stdout.String())
- }
-}
-
-func TestRunWrite(t *testing.T) {
- path, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{
- Write: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- for _, fixture := range fixtures {
- res, err := ioutil.ReadFile(filepath.Join(path, fixture.filename))
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if !bytes.Equal(res, fixture.golden) {
- t.Errorf("file %q contents want:\n%s\ngot:\n%s", fixture.filename, fixture.golden, res)
- }
- }
-}
-
-func TestRunDiff(t *testing.T) {
- path, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
-
- var expectedOut bytes.Buffer
- for _, fixture := range fixtures {
- if len(fixture.diff) > 0 {
- expectedOut.WriteString(
- regexp.QuoteMeta(
- fmt.Sprintf("diff a/%s/%s b/%s/%s\n", path, fixture.filename, path, fixture.filename),
- ),
- )
- // Need to use regex to ignore datetimes in diff.
- expectedOut.WriteString(`--- .+?\n`)
- expectedOut.WriteString(`\+\+\+ .+?\n`)
- expectedOut.WriteString(regexp.QuoteMeta(string(fixture.diff)))
- }
- }
-
- expectedOutString := testhelper.Unix2dos(expectedOut.String())
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{
- Diff: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if !regexp.MustCompile(expectedOutString).Match(stdout.Bytes()) {
- t.Errorf("stdout want match:\n%s\ngot:\n%q", expectedOutString, stdout)
- }
-}
-
-func mockIO() (stdin, stdout *bytes.Buffer) {
- return new(bytes.Buffer), new(bytes.Buffer)
-}
-
-type fixture struct {
- filename string
- input, golden, diff []byte
-}
-
-type ByFilename []fixture
-
-func (s ByFilename) Len() int { return len(s) }
-func (s ByFilename) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s ByFilename) Less(i, j int) bool { return len(s[i].filename) > len(s[j].filename) }
-
-var fixtures = []fixture{
- {
- "noop.hcl",
- []byte(`resource "aws_security_group" "firewall" {
- count = 5
-}
-`),
- []byte(`resource "aws_security_group" "firewall" {
- count = 5
-}
-`),
- []byte(``),
- }, {
- "align_equals.hcl",
- []byte(`variable "foo" {
- default = "bar"
- description = "bar"
-}
-`),
- []byte(`variable "foo" {
- default = "bar"
- description = "bar"
-}
-`),
- []byte(`@@ -1,4 +1,4 @@
- variable "foo" {
-- default = "bar"
-+ default = "bar"
- description = "bar"
- }
-`),
- }, {
- "indentation.hcl",
- []byte(`provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-`),
- []byte(`provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-`),
- []byte(`@@ -1,4 +1,4 @@
- provider "aws" {
-- access_key = "foo"
-- secret_key = "bar"
-+ access_key = "foo"
-+ secret_key = "bar"
- }
-`),
- },
-}
-
-// parent can be an empty string, in which case the system's default
-// temporary directory will be used.
-func renderFixtures(parent string) (path string, err error) {
- path, err = ioutil.TempDir(parent, "")
- if err != nil {
- return "", err
- }
-
- for _, fixture := range fixtures {
- err = ioutil.WriteFile(filepath.Join(path, fixture.filename), []byte(fixture.input), 0644)
- if err != nil {
- os.RemoveAll(path)
- return "", err
- }
- }
-
- return path, nil
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/.hidden.ignore b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/.hidden.ignore
deleted file mode 100644
index 9977a283..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/.hidden.ignore
+++ /dev/null
@@ -1 +0,0 @@
-invalid
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/dir.ignore b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/dir.ignore
deleted file mode 100644
index e69de29b..00000000
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/file.ignore b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/file.ignore
deleted file mode 100644
index 9977a283..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/file.ignore
+++ /dev/null
@@ -1 +0,0 @@
-invalid
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/good.hcl b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/good.hcl
deleted file mode 100644
index e69de29b..00000000
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/error.go b/vendor/github.com/hashicorp/hcl/hcl/parser/error.go
deleted file mode 100644
index 5c99381d..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/error.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package parser
-
-import (
- "fmt"
-
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-// PosError is a parse error that contains a position.
-type PosError struct {
- Pos token.Pos
- Err error
-}
-
-func (e *PosError) Error() string {
- return fmt.Sprintf("At %s: %s", e.Pos, e.Err)
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go b/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go
deleted file mode 100644
index 32399fec..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package parser
-
-import (
- "testing"
-)
-
-func TestPosError_impl(t *testing.T) {
- var _ error = new(PosError)
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
deleted file mode 100644
index 64c83bcf..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
+++ /dev/null
@@ -1,532 +0,0 @@
-// Package parser implements a parser for HCL (HashiCorp Configuration
-// Language)
-package parser
-
-import (
- "bytes"
- "errors"
- "fmt"
- "strings"
-
- "github.com/hashicorp/hcl/hcl/ast"
- "github.com/hashicorp/hcl/hcl/scanner"
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-type Parser struct {
- sc *scanner.Scanner
-
- // Last read token
- tok token.Token
- commaPrev token.Token
-
- comments []*ast.CommentGroup
- leadComment *ast.CommentGroup // last lead comment
- lineComment *ast.CommentGroup // last line comment
-
- enableTrace bool
- indent int
- n int // buffer size (max = 1)
-}
-
-func newParser(src []byte) *Parser {
- return &Parser{
- sc: scanner.New(src),
- }
-}
-
-// Parse returns the fully parsed source and returns the abstract syntax tree.
-func Parse(src []byte) (*ast.File, error) {
- // normalize all line endings
- // since the scanner and output only work with "\n" line endings, we may
- // end up with dangling "\r" characters in the parsed data.
- src = bytes.Replace(src, []byte("\r\n"), []byte("\n"), -1)
-
- p := newParser(src)
- return p.Parse()
-}
-
-var errEofToken = errors.New("EOF token found")
-
-// Parse returns the fully parsed source and returns the abstract syntax tree.
-func (p *Parser) Parse() (*ast.File, error) {
- f := &ast.File{}
- var err, scerr error
- p.sc.Error = func(pos token.Pos, msg string) {
- scerr = &PosError{Pos: pos, Err: errors.New(msg)}
- }
-
- f.Node, err = p.objectList(false)
- if scerr != nil {
- return nil, scerr
- }
- if err != nil {
- return nil, err
- }
-
- f.Comments = p.comments
- return f, nil
-}
-
-// objectList parses a list of items within an object (generally k/v pairs).
-// The parameter" obj" tells this whether to we are within an object (braces:
-// '{', '}') or just at the top level. If we're within an object, we end
-// at an RBRACE.
-func (p *Parser) objectList(obj bool) (*ast.ObjectList, error) {
- defer un(trace(p, "ParseObjectList"))
- node := &ast.ObjectList{}
-
- for {
- if obj {
- tok := p.scan()
- p.unscan()
- if tok.Type == token.RBRACE {
- break
- }
- }
-
- n, err := p.objectItem()
- if err == errEofToken {
- break // we are finished
- }
-
- // we don't return a nil node, because might want to use already
- // collected items.
- if err != nil {
- return node, err
- }
-
- node.Add(n)
-
- // object lists can be optionally comma-delimited e.g. when a list of maps
- // is being expressed, so a comma is allowed here - it's simply consumed
- tok := p.scan()
- if tok.Type != token.COMMA {
- p.unscan()
- }
- }
- return node, nil
-}
-
-func (p *Parser) consumeComment() (comment *ast.Comment, endline int) {
- endline = p.tok.Pos.Line
-
- // count the endline if it's multiline comment, ie starting with /*
- if len(p.tok.Text) > 1 && p.tok.Text[1] == '*' {
- // don't use range here - no need to decode Unicode code points
- for i := 0; i < len(p.tok.Text); i++ {
- if p.tok.Text[i] == '\n' {
- endline++
- }
- }
- }
-
- comment = &ast.Comment{Start: p.tok.Pos, Text: p.tok.Text}
- p.tok = p.sc.Scan()
- return
-}
-
-func (p *Parser) consumeCommentGroup(n int) (comments *ast.CommentGroup, endline int) {
- var list []*ast.Comment
- endline = p.tok.Pos.Line
-
- for p.tok.Type == token.COMMENT && p.tok.Pos.Line <= endline+n {
- var comment *ast.Comment
- comment, endline = p.consumeComment()
- list = append(list, comment)
- }
-
- // add comment group to the comments list
- comments = &ast.CommentGroup{List: list}
- p.comments = append(p.comments, comments)
-
- return
-}
-
-// objectItem parses a single object item
-func (p *Parser) objectItem() (*ast.ObjectItem, error) {
- defer un(trace(p, "ParseObjectItem"))
-
- keys, err := p.objectKey()
- if len(keys) > 0 && err == errEofToken {
- // We ignore eof token here since it is an error if we didn't
- // receive a value (but we did receive a key) for the item.
- err = nil
- }
- if len(keys) > 0 && err != nil && p.tok.Type == token.RBRACE {
- // This is a strange boolean statement, but what it means is:
- // We have keys with no value, and we're likely in an object
- // (since RBrace ends an object). For this, we set err to nil so
- // we continue and get the error below of having the wrong value
- // type.
- err = nil
-
- // Reset the token type so we don't think it completed fine. See
- // objectType which uses p.tok.Type to check if we're done with
- // the object.
- p.tok.Type = token.EOF
- }
- if err != nil {
- return nil, err
- }
-
- o := &ast.ObjectItem{
- Keys: keys,
- }
-
- if p.leadComment != nil {
- o.LeadComment = p.leadComment
- p.leadComment = nil
- }
-
- switch p.tok.Type {
- case token.ASSIGN:
- o.Assign = p.tok.Pos
- o.Val, err = p.object()
- if err != nil {
- return nil, err
- }
- case token.LBRACE:
- o.Val, err = p.objectType()
- if err != nil {
- return nil, err
- }
- default:
- keyStr := make([]string, 0, len(keys))
- for _, k := range keys {
- keyStr = append(keyStr, k.Token.Text)
- }
-
- return nil, &PosError{
- Pos: p.tok.Pos,
- Err: fmt.Errorf(
- "key '%s' expected start of object ('{') or assignment ('=')",
- strings.Join(keyStr, " ")),
- }
- }
-
- // key=#comment
- // val
- if p.lineComment != nil {
- o.LineComment, p.lineComment = p.lineComment, nil
- }
-
- // do a look-ahead for line comment
- p.scan()
- if len(keys) > 0 && o.Val.Pos().Line == keys[0].Pos().Line && p.lineComment != nil {
- o.LineComment = p.lineComment
- p.lineComment = nil
- }
- p.unscan()
- return o, nil
-}
-
-// objectKey parses an object key and returns a ObjectKey AST
-func (p *Parser) objectKey() ([]*ast.ObjectKey, error) {
- keyCount := 0
- keys := make([]*ast.ObjectKey, 0)
-
- for {
- tok := p.scan()
- switch tok.Type {
- case token.EOF:
- // It is very important to also return the keys here as well as
- // the error. This is because we need to be able to tell if we
- // did parse keys prior to finding the EOF, or if we just found
- // a bare EOF.
- return keys, errEofToken
- case token.ASSIGN:
- // assignment or object only, but not nested objects. this is not
- // allowed: `foo bar = {}`
- if keyCount > 1 {
- return nil, &PosError{
- Pos: p.tok.Pos,
- Err: fmt.Errorf("nested object expected: LBRACE got: %s", p.tok.Type),
- }
- }
-
- if keyCount == 0 {
- return nil, &PosError{
- Pos: p.tok.Pos,
- Err: errors.New("no object keys found!"),
- }
- }
-
- return keys, nil
- case token.LBRACE:
- var err error
-
- // If we have no keys, then it is a syntax error. i.e. {{}} is not
- // allowed.
- if len(keys) == 0 {
- err = &PosError{
- Pos: p.tok.Pos,
- Err: fmt.Errorf("expected: IDENT | STRING got: %s", p.tok.Type),
- }
- }
-
- // object
- return keys, err
- case token.IDENT, token.STRING:
- keyCount++
- keys = append(keys, &ast.ObjectKey{Token: p.tok})
- case token.ILLEGAL:
- return keys, &PosError{
- Pos: p.tok.Pos,
- Err: fmt.Errorf("illegal character"),
- }
- default:
- return keys, &PosError{
- Pos: p.tok.Pos,
- Err: fmt.Errorf("expected: IDENT | STRING | ASSIGN | LBRACE got: %s", p.tok.Type),
- }
- }
- }
-}
-
-// object parses any type of object, such as number, bool, string, object or
-// list.
-func (p *Parser) object() (ast.Node, error) {
- defer un(trace(p, "ParseType"))
- tok := p.scan()
-
- switch tok.Type {
- case token.NUMBER, token.FLOAT, token.BOOL, token.STRING, token.HEREDOC:
- return p.literalType()
- case token.LBRACE:
- return p.objectType()
- case token.LBRACK:
- return p.listType()
- case token.COMMENT:
- // implement comment
- case token.EOF:
- return nil, errEofToken
- }
-
- return nil, &PosError{
- Pos: tok.Pos,
- Err: fmt.Errorf("Unknown token: %+v", tok),
- }
-}
-
-// objectType parses an object type and returns a ObjectType AST
-func (p *Parser) objectType() (*ast.ObjectType, error) {
- defer un(trace(p, "ParseObjectType"))
-
- // we assume that the currently scanned token is a LBRACE
- o := &ast.ObjectType{
- Lbrace: p.tok.Pos,
- }
-
- l, err := p.objectList(true)
-
- // if we hit RBRACE, we are good to go (means we parsed all Items), if it's
- // not a RBRACE, it's an syntax error and we just return it.
- if err != nil && p.tok.Type != token.RBRACE {
- return nil, err
- }
-
- // No error, scan and expect the ending to be a brace
- if tok := p.scan(); tok.Type != token.RBRACE {
- return nil, &PosError{
- Pos: tok.Pos,
- Err: fmt.Errorf("object expected closing RBRACE got: %s", tok.Type),
- }
- }
-
- o.List = l
- o.Rbrace = p.tok.Pos // advanced via parseObjectList
- return o, nil
-}
-
-// listType parses a list type and returns a ListType AST
-func (p *Parser) listType() (*ast.ListType, error) {
- defer un(trace(p, "ParseListType"))
-
- // we assume that the currently scanned token is a LBRACK
- l := &ast.ListType{
- Lbrack: p.tok.Pos,
- }
-
- needComma := false
- for {
- tok := p.scan()
- if needComma {
- switch tok.Type {
- case token.COMMA, token.RBRACK:
- default:
- return nil, &PosError{
- Pos: tok.Pos,
- Err: fmt.Errorf(
- "error parsing list, expected comma or list end, got: %s",
- tok.Type),
- }
- }
- }
- switch tok.Type {
- case token.BOOL, token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC:
- node, err := p.literalType()
- if err != nil {
- return nil, err
- }
-
- // If there is a lead comment, apply it
- if p.leadComment != nil {
- node.LeadComment = p.leadComment
- p.leadComment = nil
- }
-
- l.Add(node)
- needComma = true
- case token.COMMA:
- // get next list item or we are at the end
- // do a look-ahead for line comment
- p.scan()
- if p.lineComment != nil && len(l.List) > 0 {
- lit, ok := l.List[len(l.List)-1].(*ast.LiteralType)
- if ok {
- lit.LineComment = p.lineComment
- l.List[len(l.List)-1] = lit
- p.lineComment = nil
- }
- }
- p.unscan()
-
- needComma = false
- continue
- case token.LBRACE:
- // Looks like a nested object, so parse it out
- node, err := p.objectType()
- if err != nil {
- return nil, &PosError{
- Pos: tok.Pos,
- Err: fmt.Errorf(
- "error while trying to parse object within list: %s", err),
- }
- }
- l.Add(node)
- needComma = true
- case token.LBRACK:
- node, err := p.listType()
- if err != nil {
- return nil, &PosError{
- Pos: tok.Pos,
- Err: fmt.Errorf(
- "error while trying to parse list within list: %s", err),
- }
- }
- l.Add(node)
- case token.RBRACK:
- // finished
- l.Rbrack = p.tok.Pos
- return l, nil
- default:
- return nil, &PosError{
- Pos: tok.Pos,
- Err: fmt.Errorf("unexpected token while parsing list: %s", tok.Type),
- }
- }
- }
-}
-
-// literalType parses a literal type and returns a LiteralType AST
-func (p *Parser) literalType() (*ast.LiteralType, error) {
- defer un(trace(p, "ParseLiteral"))
-
- return &ast.LiteralType{
- Token: p.tok,
- }, nil
-}
-
-// scan returns the next token from the underlying scanner. If a token has
-// been unscanned then read that instead. In the process, it collects any
-// comment groups encountered, and remembers the last lead and line comments.
-func (p *Parser) scan() token.Token {
- // If we have a token on the buffer, then return it.
- if p.n != 0 {
- p.n = 0
- return p.tok
- }
-
- // Otherwise read the next token from the scanner and Save it to the buffer
- // in case we unscan later.
- prev := p.tok
- p.tok = p.sc.Scan()
-
- if p.tok.Type == token.COMMENT {
- var comment *ast.CommentGroup
- var endline int
-
- // fmt.Printf("p.tok.Pos.Line = %+v prev: %d endline %d \n",
- // p.tok.Pos.Line, prev.Pos.Line, endline)
- if p.tok.Pos.Line == prev.Pos.Line {
- // The comment is on same line as the previous token; it
- // cannot be a lead comment but may be a line comment.
- comment, endline = p.consumeCommentGroup(0)
- if p.tok.Pos.Line != endline {
- // The next token is on a different line, thus
- // the last comment group is a line comment.
- p.lineComment = comment
- }
- }
-
- // consume successor comments, if any
- endline = -1
- for p.tok.Type == token.COMMENT {
- comment, endline = p.consumeCommentGroup(1)
- }
-
- if endline+1 == p.tok.Pos.Line && p.tok.Type != token.RBRACE {
- switch p.tok.Type {
- case token.RBRACE, token.RBRACK:
- // Do not count for these cases
- default:
- // The next token is following on the line immediately after the
- // comment group, thus the last comment group is a lead comment.
- p.leadComment = comment
- }
- }
-
- }
-
- return p.tok
-}
-
-// unscan pushes the previously read token back onto the buffer.
-func (p *Parser) unscan() {
- p.n = 1
-}
-
-// ----------------------------------------------------------------------------
-// Parsing support
-
-func (p *Parser) printTrace(a ...interface{}) {
- if !p.enableTrace {
- return
- }
-
- const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
- const n = len(dots)
- fmt.Printf("%5d:%3d: ", p.tok.Pos.Line, p.tok.Pos.Column)
-
- i := 2 * p.indent
- for i > n {
- fmt.Print(dots)
- i -= n
- }
- // i <= n
- fmt.Print(dots[0:i])
- fmt.Println(a...)
-}
-
-func trace(p *Parser, msg string) *Parser {
- p.printTrace(msg, "(")
- p.indent++
- return p
-}
-
-// Usage pattern: defer un(trace(p, "..."))
-func un(p *Parser) {
- p.indent--
- p.printTrace(")")
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go
deleted file mode 100644
index 27021220..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go
+++ /dev/null
@@ -1,575 +0,0 @@
-package parser
-
-import (
- "fmt"
- "io/ioutil"
- "path/filepath"
- "reflect"
- "runtime"
- "strings"
- "testing"
-
- "github.com/hashicorp/hcl/hcl/ast"
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-func TestType(t *testing.T) {
- var literals = []struct {
- typ token.Type
- src string
- }{
- {token.STRING, `foo = "foo"`},
- {token.NUMBER, `foo = 123`},
- {token.NUMBER, `foo = -29`},
- {token.FLOAT, `foo = 123.12`},
- {token.FLOAT, `foo = -123.12`},
- {token.BOOL, `foo = true`},
- {token.HEREDOC, "foo = <= 0 {
- result = p.heredocIndent(result)
- }
- }
-
- return result
-}
-
-// objectItem returns the printable HCL form of an object item. An object type
-// starts with one/multiple keys and has a value. The value might be of any
-// type.
-func (p *printer) objectItem(o *ast.ObjectItem) []byte {
- defer un(trace(p, fmt.Sprintf("ObjectItem: %s", o.Keys[0].Token.Text)))
- var buf bytes.Buffer
-
- if o.LeadComment != nil {
- for _, comment := range o.LeadComment.List {
- buf.WriteString(comment.Text)
- buf.WriteByte(newline)
- }
- }
-
- // If key and val are on different lines, treat line comments like lead comments.
- if o.LineComment != nil && o.Val.Pos().Line != o.Keys[0].Pos().Line {
- for _, comment := range o.LineComment.List {
- buf.WriteString(comment.Text)
- buf.WriteByte(newline)
- }
- }
-
- for i, k := range o.Keys {
- buf.WriteString(k.Token.Text)
- buf.WriteByte(blank)
-
- // reach end of key
- if o.Assign.IsValid() && i == len(o.Keys)-1 && len(o.Keys) == 1 {
- buf.WriteString("=")
- buf.WriteByte(blank)
- }
- }
-
- buf.Write(p.output(o.Val))
-
- if o.LineComment != nil && o.Val.Pos().Line == o.Keys[0].Pos().Line {
- buf.WriteByte(blank)
- for _, comment := range o.LineComment.List {
- buf.WriteString(comment.Text)
- }
- }
-
- return buf.Bytes()
-}
-
-// objectType returns the printable HCL form of an object type. An object type
-// begins with a brace and ends with a brace.
-func (p *printer) objectType(o *ast.ObjectType) []byte {
- defer un(trace(p, "ObjectType"))
- var buf bytes.Buffer
- buf.WriteString("{")
-
- var index int
- var nextItem token.Pos
- var commented, newlinePrinted bool
- for {
- // Determine the location of the next actual non-comment
- // item. If we're at the end, the next item is the closing brace
- if index != len(o.List.Items) {
- nextItem = o.List.Items[index].Pos()
- } else {
- nextItem = o.Rbrace
- }
-
- // Go through the standalone comments in the file and print out
- // the comments that we should be for this object item.
- for _, c := range p.standaloneComments {
- printed := false
- var lastCommentPos token.Pos
- for _, comment := range c.List {
- // We only care about comments after the previous item
- // we've printed so that comments are printed in the
- // correct locations (between two objects for example).
- // And before the next item.
- if comment.Pos().After(p.prev) && comment.Pos().Before(nextItem) {
- // If there are standalone comments and the initial newline has not
- // been printed yet, do it now.
- if !newlinePrinted {
- newlinePrinted = true
- buf.WriteByte(newline)
- }
-
- // add newline if it's between other printed nodes
- if index > 0 {
- commented = true
- buf.WriteByte(newline)
- }
-
- // Store this position
- lastCommentPos = comment.Pos()
-
- // output the comment itself
- buf.Write(p.indent(p.heredocIndent([]byte(comment.Text))))
-
- // Set printed to true to note that we printed something
- printed = true
-
- /*
- if index != len(o.List.Items) {
- buf.WriteByte(newline) // do not print on the end
- }
- */
- }
- }
-
- // Stuff to do if we had comments
- if printed {
- // Always write a newline
- buf.WriteByte(newline)
-
- // If there is another item in the object and our comment
- // didn't hug it directly, then make sure there is a blank
- // line separating them.
- if nextItem != o.Rbrace && nextItem.Line != lastCommentPos.Line+1 {
- buf.WriteByte(newline)
- }
- }
- }
-
- if index == len(o.List.Items) {
- p.prev = o.Rbrace
- break
- }
-
- // At this point we are sure that it's not a totally empty block: print
- // the initial newline if it hasn't been printed yet by the previous
- // block about standalone comments.
- if !newlinePrinted {
- buf.WriteByte(newline)
- newlinePrinted = true
- }
-
- // check if we have adjacent one liner items. If yes we'll going to align
- // the comments.
- var aligned []*ast.ObjectItem
- for _, item := range o.List.Items[index:] {
- // we don't group one line lists
- if len(o.List.Items) == 1 {
- break
- }
-
- // one means a oneliner with out any lead comment
- // two means a oneliner with lead comment
- // anything else might be something else
- cur := lines(string(p.objectItem(item)))
- if cur > 2 {
- break
- }
-
- curPos := item.Pos()
-
- nextPos := token.Pos{}
- if index != len(o.List.Items)-1 {
- nextPos = o.List.Items[index+1].Pos()
- }
-
- prevPos := token.Pos{}
- if index != 0 {
- prevPos = o.List.Items[index-1].Pos()
- }
-
- // fmt.Println("DEBUG ----------------")
- // fmt.Printf("prev = %+v prevPos: %s\n", prev, prevPos)
- // fmt.Printf("cur = %+v curPos: %s\n", cur, curPos)
- // fmt.Printf("next = %+v nextPos: %s\n", next, nextPos)
-
- if curPos.Line+1 == nextPos.Line {
- aligned = append(aligned, item)
- index++
- continue
- }
-
- if curPos.Line-1 == prevPos.Line {
- aligned = append(aligned, item)
- index++
-
- // finish if we have a new line or comment next. This happens
- // if the next item is not adjacent
- if curPos.Line+1 != nextPos.Line {
- break
- }
- continue
- }
-
- break
- }
-
- // put newlines if the items are between other non aligned items.
- // newlines are also added if there is a standalone comment already, so
- // check it too
- if !commented && index != len(aligned) {
- buf.WriteByte(newline)
- }
-
- if len(aligned) >= 1 {
- p.prev = aligned[len(aligned)-1].Pos()
-
- items := p.alignedItems(aligned)
- buf.Write(p.indent(items))
- } else {
- p.prev = o.List.Items[index].Pos()
-
- buf.Write(p.indent(p.objectItem(o.List.Items[index])))
- index++
- }
-
- buf.WriteByte(newline)
- }
-
- buf.WriteString("}")
- return buf.Bytes()
-}
-
-func (p *printer) alignedItems(items []*ast.ObjectItem) []byte {
- var buf bytes.Buffer
-
- // find the longest key and value length, needed for alignment
- var longestKeyLen int // longest key length
- var longestValLen int // longest value length
- for _, item := range items {
- key := len(item.Keys[0].Token.Text)
- val := len(p.output(item.Val))
-
- if key > longestKeyLen {
- longestKeyLen = key
- }
-
- if val > longestValLen {
- longestValLen = val
- }
- }
-
- for i, item := range items {
- if item.LeadComment != nil {
- for _, comment := range item.LeadComment.List {
- buf.WriteString(comment.Text)
- buf.WriteByte(newline)
- }
- }
-
- for i, k := range item.Keys {
- keyLen := len(k.Token.Text)
- buf.WriteString(k.Token.Text)
- for i := 0; i < longestKeyLen-keyLen+1; i++ {
- buf.WriteByte(blank)
- }
-
- // reach end of key
- if i == len(item.Keys)-1 && len(item.Keys) == 1 {
- buf.WriteString("=")
- buf.WriteByte(blank)
- }
- }
-
- val := p.output(item.Val)
- valLen := len(val)
- buf.Write(val)
-
- if item.Val.Pos().Line == item.Keys[0].Pos().Line && item.LineComment != nil {
- for i := 0; i < longestValLen-valLen+1; i++ {
- buf.WriteByte(blank)
- }
-
- for _, comment := range item.LineComment.List {
- buf.WriteString(comment.Text)
- }
- }
-
- // do not print for the last item
- if i != len(items)-1 {
- buf.WriteByte(newline)
- }
- }
-
- return buf.Bytes()
-}
-
-// list returns the printable HCL form of an list type.
-func (p *printer) list(l *ast.ListType) []byte {
- if p.isSingleLineList(l) {
- return p.singleLineList(l)
- }
-
- var buf bytes.Buffer
- buf.WriteString("[")
- buf.WriteByte(newline)
-
- var longestLine int
- for _, item := range l.List {
- // for now we assume that the list only contains literal types
- if lit, ok := item.(*ast.LiteralType); ok {
- lineLen := len(lit.Token.Text)
- if lineLen > longestLine {
- longestLine = lineLen
- }
- }
- }
-
- haveEmptyLine := false
- for i, item := range l.List {
- // If we have a lead comment, then we want to write that first
- leadComment := false
- if lit, ok := item.(*ast.LiteralType); ok && lit.LeadComment != nil {
- leadComment = true
-
- // Ensure an empty line before every element with a
- // lead comment (except the first item in a list).
- if !haveEmptyLine && i != 0 {
- buf.WriteByte(newline)
- }
-
- for _, comment := range lit.LeadComment.List {
- buf.Write(p.indent([]byte(comment.Text)))
- buf.WriteByte(newline)
- }
- }
-
- // also indent each line
- val := p.output(item)
- curLen := len(val)
- buf.Write(p.indent(val))
-
- // if this item is a heredoc, then we output the comma on
- // the next line. This is the only case this happens.
- comma := []byte{','}
- if lit, ok := item.(*ast.LiteralType); ok && lit.Token.Type == token.HEREDOC {
- buf.WriteByte(newline)
- comma = p.indent(comma)
- }
-
- buf.Write(comma)
-
- if lit, ok := item.(*ast.LiteralType); ok && lit.LineComment != nil {
- // if the next item doesn't have any comments, do not align
- buf.WriteByte(blank) // align one space
- for i := 0; i < longestLine-curLen; i++ {
- buf.WriteByte(blank)
- }
-
- for _, comment := range lit.LineComment.List {
- buf.WriteString(comment.Text)
- }
- }
-
- buf.WriteByte(newline)
-
- // Ensure an empty line after every element with a
- // lead comment (except the first item in a list).
- haveEmptyLine = leadComment && i != len(l.List)-1
- if haveEmptyLine {
- buf.WriteByte(newline)
- }
- }
-
- buf.WriteString("]")
- return buf.Bytes()
-}
-
-// isSingleLineList returns true if:
-// * they were previously formatted entirely on one line
-// * they consist entirely of literals
-// * there are either no heredoc strings or the list has exactly one element
-// * there are no line comments
-func (printer) isSingleLineList(l *ast.ListType) bool {
- for _, item := range l.List {
- if item.Pos().Line != l.Lbrack.Line {
- return false
- }
-
- lit, ok := item.(*ast.LiteralType)
- if !ok {
- return false
- }
-
- if lit.Token.Type == token.HEREDOC && len(l.List) != 1 {
- return false
- }
-
- if lit.LineComment != nil {
- return false
- }
- }
-
- return true
-}
-
-// singleLineList prints a simple single line list.
-// For a definition of "simple", see isSingleLineList above.
-func (p *printer) singleLineList(l *ast.ListType) []byte {
- buf := &bytes.Buffer{}
-
- buf.WriteString("[")
- for i, item := range l.List {
- if i != 0 {
- buf.WriteString(", ")
- }
-
- // Output the item itself
- buf.Write(p.output(item))
-
- // The heredoc marker needs to be at the end of line.
- if lit, ok := item.(*ast.LiteralType); ok && lit.Token.Type == token.HEREDOC {
- buf.WriteByte(newline)
- }
- }
-
- buf.WriteString("]")
- return buf.Bytes()
-}
-
-// indent indents the lines of the given buffer for each non-empty line
-func (p *printer) indent(buf []byte) []byte {
- var prefix []byte
- if p.cfg.SpacesWidth != 0 {
- for i := 0; i < p.cfg.SpacesWidth; i++ {
- prefix = append(prefix, blank)
- }
- } else {
- prefix = []byte{tab}
- }
-
- var res []byte
- bol := true
- for _, c := range buf {
- if bol && c != '\n' {
- res = append(res, prefix...)
- }
-
- res = append(res, c)
- bol = c == '\n'
- }
- return res
-}
-
-// unindent removes all the indentation from the tombstoned lines
-func (p *printer) unindent(buf []byte) []byte {
- var res []byte
- for i := 0; i < len(buf); i++ {
- skip := len(buf)-i <= len(unindent)
- if !skip {
- skip = !bytes.Equal(unindent, buf[i:i+len(unindent)])
- }
- if skip {
- res = append(res, buf[i])
- continue
- }
-
- // We have a marker. we have to backtrace here and clean out
- // any whitespace ahead of our tombstone up to a \n
- for j := len(res) - 1; j >= 0; j-- {
- if res[j] == '\n' {
- break
- }
-
- res = res[:j]
- }
-
- // Skip the entire unindent marker
- i += len(unindent) - 1
- }
-
- return res
-}
-
-// heredocIndent marks all the 2nd and further lines as unindentable
-func (p *printer) heredocIndent(buf []byte) []byte {
- var res []byte
- bol := false
- for _, c := range buf {
- if bol && c != '\n' {
- res = append(res, unindent...)
- }
- res = append(res, c)
- bol = c == '\n'
- }
- return res
-}
-
-// isSingleLineObject tells whether the given object item is a single
-// line object such as "obj {}".
-//
-// A single line object:
-//
-// * has no lead comments (hence multi-line)
-// * has no assignment
-// * has no values in the stanza (within {})
-//
-func (p *printer) isSingleLineObject(val *ast.ObjectItem) bool {
- // If there is a lead comment, can't be one line
- if val.LeadComment != nil {
- return false
- }
-
- // If there is assignment, we always break by line
- if val.Assign.IsValid() {
- return false
- }
-
- // If it isn't an object type, then its not a single line object
- ot, ok := val.Val.(*ast.ObjectType)
- if !ok {
- return false
- }
-
- // If the object has no items, it is single line!
- return len(ot.List.Items) == 0
-}
-
-func lines(txt string) int {
- endline := 1
- for i := 0; i < len(txt); i++ {
- if txt[i] == '\n' {
- endline++
- }
- }
- return endline
-}
-
-// ----------------------------------------------------------------------------
-// Tracing support
-
-func (p *printer) printTrace(a ...interface{}) {
- if !p.enableTrace {
- return
- }
-
- const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
- const n = len(dots)
- i := 2 * p.indentTrace
- for i > n {
- fmt.Print(dots)
- i -= n
- }
- // i <= n
- fmt.Print(dots[0:i])
- fmt.Println(a...)
-}
-
-func trace(p *printer, msg string) *printer {
- p.printTrace(msg, "(")
- p.indentTrace++
- return p
-}
-
-// Usage pattern: defer un(trace(p, "..."))
-func un(p *printer) {
- p.indentTrace--
- p.printTrace(")")
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/printer.go b/vendor/github.com/hashicorp/hcl/hcl/printer/printer.go
deleted file mode 100644
index 6617ab8e..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/printer.go
+++ /dev/null
@@ -1,66 +0,0 @@
-// Package printer implements printing of AST nodes to HCL format.
-package printer
-
-import (
- "bytes"
- "io"
- "text/tabwriter"
-
- "github.com/hashicorp/hcl/hcl/ast"
- "github.com/hashicorp/hcl/hcl/parser"
-)
-
-var DefaultConfig = Config{
- SpacesWidth: 2,
-}
-
-// A Config node controls the output of Fprint.
-type Config struct {
- SpacesWidth int // if set, it will use spaces instead of tabs for alignment
-}
-
-func (c *Config) Fprint(output io.Writer, node ast.Node) error {
- p := &printer{
- cfg: *c,
- comments: make([]*ast.CommentGroup, 0),
- standaloneComments: make([]*ast.CommentGroup, 0),
- // enableTrace: true,
- }
-
- p.collectComments(node)
-
- if _, err := output.Write(p.unindent(p.output(node))); err != nil {
- return err
- }
-
- // flush tabwriter, if any
- var err error
- if tw, _ := output.(*tabwriter.Writer); tw != nil {
- err = tw.Flush()
- }
-
- return err
-}
-
-// Fprint "pretty-prints" an HCL node to output
-// It calls Config.Fprint with default settings.
-func Fprint(output io.Writer, node ast.Node) error {
- return DefaultConfig.Fprint(output, node)
-}
-
-// Format formats src HCL and returns the result.
-func Format(src []byte) ([]byte, error) {
- node, err := parser.Parse(src)
- if err != nil {
- return nil, err
- }
-
- var buf bytes.Buffer
- if err := DefaultConfig.Fprint(&buf, node); err != nil {
- return nil, err
- }
-
- // Add trailing newline to result
- buf.WriteString("\n")
- return buf.Bytes(), nil
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go b/vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go
deleted file mode 100644
index 8ae747ab..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package printer
-
-import (
- "bytes"
- "errors"
- "flag"
- "fmt"
- "io/ioutil"
- "path/filepath"
- "testing"
-
- "github.com/hashicorp/hcl/hcl/parser"
-)
-
-var update = flag.Bool("update", false, "update golden files")
-
-const (
- dataDir = "testdata"
-)
-
-type entry struct {
- source, golden string
-}
-
-// Use go test -update to create/update the respective golden files.
-var data = []entry{
- {"complexhcl.input", "complexhcl.golden"},
- {"list.input", "list.golden"},
- {"list_comment.input", "list_comment.golden"},
- {"comment.input", "comment.golden"},
- {"comment_crlf.input", "comment.golden"},
- {"comment_aligned.input", "comment_aligned.golden"},
- {"comment_array.input", "comment_array.golden"},
- {"comment_end_file.input", "comment_end_file.golden"},
- {"comment_multiline_indent.input", "comment_multiline_indent.golden"},
- {"comment_multiline_no_stanza.input", "comment_multiline_no_stanza.golden"},
- {"comment_multiline_stanza.input", "comment_multiline_stanza.golden"},
- {"comment_newline.input", "comment_newline.golden"},
- {"comment_object_multi.input", "comment_object_multi.golden"},
- {"comment_standalone.input", "comment_standalone.golden"},
- {"empty_block.input", "empty_block.golden"},
- {"list_of_objects.input", "list_of_objects.golden"},
- {"multiline_string.input", "multiline_string.golden"},
- {"object_singleline.input", "object_singleline.golden"},
- {"object_with_heredoc.input", "object_with_heredoc.golden"},
-}
-
-func TestFiles(t *testing.T) {
- for _, e := range data {
- source := filepath.Join(dataDir, e.source)
- golden := filepath.Join(dataDir, e.golden)
- t.Run(e.source, func(t *testing.T) {
- check(t, source, golden)
- })
- }
-}
-
-func check(t *testing.T, source, golden string) {
- src, err := ioutil.ReadFile(source)
- if err != nil {
- t.Error(err)
- return
- }
-
- res, err := format(src)
- if err != nil {
- t.Error(err)
- return
- }
-
- // update golden files if necessary
- if *update {
- if err := ioutil.WriteFile(golden, res, 0644); err != nil {
- t.Error(err)
- }
- return
- }
-
- // get golden
- gld, err := ioutil.ReadFile(golden)
- if err != nil {
- t.Error(err)
- return
- }
-
- // formatted source and golden must be the same
- if err := diff(source, golden, res, gld); err != nil {
- t.Error(err)
- return
- }
-}
-
-// diff compares a and b.
-func diff(aname, bname string, a, b []byte) error {
- var buf bytes.Buffer // holding long error message
-
- // compare lengths
- if len(a) != len(b) {
- fmt.Fprintf(&buf, "\nlength changed: len(%s) = %d, len(%s) = %d", aname, len(a), bname, len(b))
- }
-
- // compare contents
- line := 1
- offs := 1
- for i := 0; i < len(a) && i < len(b); i++ {
- ch := a[i]
- if ch != b[i] {
- fmt.Fprintf(&buf, "\n%s:%d:%d: %q", aname, line, i-offs+1, lineAt(a, offs))
- fmt.Fprintf(&buf, "\n%s:%d:%d: %q", bname, line, i-offs+1, lineAt(b, offs))
- fmt.Fprintf(&buf, "\n\n")
- break
- }
- if ch == '\n' {
- line++
- offs = i + 1
- }
- }
-
- if buf.Len() > 0 {
- return errors.New(buf.String())
- }
- return nil
-}
-
-// format parses src, prints the corresponding AST, verifies the resulting
-// src is syntactically correct, and returns the resulting src or an error
-// if any.
-func format(src []byte) ([]byte, error) {
- formatted, err := Format(src)
- if err != nil {
- return nil, err
- }
-
- // make sure formatted output is syntactically correct
- if _, err := parser.Parse(formatted); err != nil {
- return nil, fmt.Errorf("parse: %s\n%s", err, formatted)
- }
-
- return formatted, nil
-}
-
-// lineAt returns the line in text starting at offset offs.
-func lineAt(text []byte, offs int) []byte {
- i := offs
- for i < len(text) && text[i] != '\n' {
- i++
- }
- return text[offs:i]
-}
-
-// TestFormatParsable ensures that the output of Format() is can be parsed again.
-func TestFormatValidOutput(t *testing.T) {
- cases := []string{
- "#\x00",
- "#\ue123t",
- "x=//\n0y=<<_\n_\n",
- "y=[1,//\n]",
- "Y=<<4\n4/\n\n\n/4/@=4/\n\n\n/4000000004\r\r\n00004\n",
- "x=<<_\n_\r\r\n_\n",
- "X=<<-\n\r\r\n",
- }
-
- for _, c := range cases {
- f, err := Format([]byte(c))
- if err != nil {
- // ignore these failures, not all inputs are valid HCL.
- t.Logf("Format(%q) = %v", c, err)
- continue
- }
-
- if _, err := parser.Parse(f); err != nil {
- t.Errorf("Format(%q) = %q; Parse(%q) = %v", c, f, f, err)
- continue
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden
deleted file mode 100644
index 192c26aa..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden
+++ /dev/null
@@ -1,39 +0,0 @@
-// A standalone comment is a comment which is not attached to any kind of node
-
-// This comes from Terraform, as a test
-variable "foo" {
- # Standalone comment should be still here
-
- default = "bar"
- description = "bar" # yooo
-}
-
-/* This is a multi line standalone
-comment*/
-
-// fatih arslan
-/* This is a developer test
-account and a multine comment */
-developer = ["fatih", "arslan"] // fatih arslan
-
-# One line here
-numbers = [1, 2] // another line here
-
-# Another comment
-variable = {
- description = "bar" # another yooo
-
- foo {
- # Nested standalone
-
- bar = "fatih"
- }
-}
-
-// lead comment
-foo {
- bar = "fatih" // line comment 2
-} // line comment 3
-
-// comment
-multiline = "assignment"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input
deleted file mode 100644
index c4b29de7..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input
+++ /dev/null
@@ -1,39 +0,0 @@
-// A standalone comment is a comment which is not attached to any kind of node
-
- // This comes from Terraform, as a test
-variable "foo" {
- # Standalone comment should be still here
-
- default = "bar"
- description = "bar" # yooo
-}
-
-/* This is a multi line standalone
-comment*/
-
-
-// fatih arslan
-/* This is a developer test
-account and a multine comment */
-developer = [ "fatih", "arslan"] // fatih arslan
-
-# One line here
-numbers = [1,2] // another line here
-
- # Another comment
-variable = {
- description = "bar" # another yooo
- foo {
- # Nested standalone
-
- bar = "fatih"
- }
-}
-
- // lead comment
-foo {
- bar = "fatih" // line comment 2
-} // line comment 3
-
-multiline = // comment
-"assignment"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden
deleted file mode 100644
index 6ff21504..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden
+++ /dev/null
@@ -1,32 +0,0 @@
-aligned {
- # We have some aligned items below
- foo = "fatih" # yoo1
- default = "bar" # yoo2
- bar = "bar and foo" # yoo3
-
- default = {
- bar = "example"
- }
-
- #deneme arslan
- fatih = ["fatih"] # yoo4
-
- #fatih arslan
- fatiharslan = ["arslan"] // yoo5
-
- default = {
- bar = "example"
- }
-
- security_groups = [
- "foo", # kenya 1
- "${aws_security_group.firewall.foo}", # kenya 2
- ]
-
- security_groups2 = [
- "foo", # kenya 1
- "bar", # kenya 1.5
- "${aws_security_group.firewall.foo}", # kenya 2
- "foobar", # kenya 3
- ]
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input
deleted file mode 100644
index bd43ab1a..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input
+++ /dev/null
@@ -1,28 +0,0 @@
-aligned {
-# We have some aligned items below
- foo = "fatih" # yoo1
- default = "bar" # yoo2
- bar = "bar and foo" # yoo3
- default = {
- bar = "example"
- }
- #deneme arslan
- fatih = ["fatih"] # yoo4
- #fatih arslan
- fatiharslan = ["arslan"] // yoo5
- default = {
- bar = "example"
- }
-
-security_groups = [
- "foo", # kenya 1
- "${aws_security_group.firewall.foo}", # kenya 2
-]
-
-security_groups2 = [
- "foo", # kenya 1
- "bar", # kenya 1.5
- "${aws_security_group.firewall.foo}", # kenya 2
- "foobar", # kenya 3
-]
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.golden
deleted file mode 100644
index e778eafa..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.golden
+++ /dev/null
@@ -1,13 +0,0 @@
-banana = [
- # I really want to comment this item in the array.
- "a",
-
- # This as well
- "b",
-
- "c", # And C
- "d",
-
- # And another
- "e",
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.input
deleted file mode 100644
index e778eafa..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.input
+++ /dev/null
@@ -1,13 +0,0 @@
-banana = [
- # I really want to comment this item in the array.
- "a",
-
- # This as well
- "b",
-
- "c", # And C
- "d",
-
- # And another
- "e",
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_crlf.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_crlf.input
deleted file mode 100644
index e074b2b4..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_crlf.input
+++ /dev/null
@@ -1,39 +0,0 @@
-// A standalone comment is a comment which is not attached to any kind of node
-
- // This comes from Terraform, as a test
-variable "foo" {
- # Standalone comment should be still here
-
- default = "bar"
- description = "bar" # yooo
-}
-
-/* This is a multi line standalone
-comment*/
-
-
-// fatih arslan
-/* This is a developer test
-account and a multine comment */
-developer = [ "fatih", "arslan"] // fatih arslan
-
-# One line here
-numbers = [1,2] // another line here
-
- # Another comment
-variable = {
- description = "bar" # another yooo
- foo {
- # Nested standalone
-
- bar = "fatih"
- }
-}
-
- // lead comment
-foo {
- bar = "fatih" // line comment 2
-} // line comment 3
-
-multiline = // comment
-"assignment"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.golden
deleted file mode 100644
index dbeae36a..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.golden
+++ /dev/null
@@ -1,6 +0,0 @@
-resource "blah" "blah" {}
-
-//
-//
-//
-
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.input
deleted file mode 100644
index 68c4c282..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.input
+++ /dev/null
@@ -1,5 +0,0 @@
-resource "blah" "blah" {}
-
-//
-//
-//
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.golden
deleted file mode 100644
index 74c4ccd8..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.golden
+++ /dev/null
@@ -1,12 +0,0 @@
-resource "provider" "resource" {
- /*
- SPACE_SENSITIVE_CODE = < 0 {
- // common case: last character was not a '\n'
- s.tokPos.Line = s.srcPos.Line
- s.tokPos.Column = s.srcPos.Column
- } else {
- // last character was a '\n'
- // (we cannot be at the beginning of the source
- // since we have called next() at least once)
- s.tokPos.Line = s.srcPos.Line - 1
- s.tokPos.Column = s.lastLineLen
- }
-
- switch {
- case isLetter(ch):
- tok = token.IDENT
- lit := s.scanIdentifier()
- if lit == "true" || lit == "false" {
- tok = token.BOOL
- }
- case isDecimal(ch):
- tok = s.scanNumber(ch)
- default:
- switch ch {
- case eof:
- tok = token.EOF
- case '"':
- tok = token.STRING
- s.scanString()
- case '#', '/':
- tok = token.COMMENT
- s.scanComment(ch)
- case '.':
- tok = token.PERIOD
- ch = s.peek()
- if isDecimal(ch) {
- tok = token.FLOAT
- ch = s.scanMantissa(ch)
- ch = s.scanExponent(ch)
- }
- case '<':
- tok = token.HEREDOC
- s.scanHeredoc()
- case '[':
- tok = token.LBRACK
- case ']':
- tok = token.RBRACK
- case '{':
- tok = token.LBRACE
- case '}':
- tok = token.RBRACE
- case ',':
- tok = token.COMMA
- case '=':
- tok = token.ASSIGN
- case '+':
- tok = token.ADD
- case '-':
- if isDecimal(s.peek()) {
- ch := s.next()
- tok = s.scanNumber(ch)
- } else {
- tok = token.SUB
- }
- default:
- s.err("illegal char")
- }
- }
-
- // finish token ending
- s.tokEnd = s.srcPos.Offset
-
- // create token literal
- var tokenText string
- if s.tokStart >= 0 {
- tokenText = string(s.src[s.tokStart:s.tokEnd])
- }
- s.tokStart = s.tokEnd // ensure idempotency of tokenText() call
-
- return token.Token{
- Type: tok,
- Pos: s.tokPos,
- Text: tokenText,
- }
-}
-
-func (s *Scanner) scanComment(ch rune) {
- // single line comments
- if ch == '#' || (ch == '/' && s.peek() != '*') {
- if ch == '/' && s.peek() != '/' {
- s.err("expected '/' for comment")
- return
- }
-
- ch = s.next()
- for ch != '\n' && ch >= 0 && ch != eof {
- ch = s.next()
- }
- if ch != eof && ch >= 0 {
- s.unread()
- }
- return
- }
-
- // be sure we get the character after /* This allows us to find comment's
- // that are not erminated
- if ch == '/' {
- s.next()
- ch = s.next() // read character after "/*"
- }
-
- // look for /* - style comments
- for {
- if ch < 0 || ch == eof {
- s.err("comment not terminated")
- break
- }
-
- ch0 := ch
- ch = s.next()
- if ch0 == '*' && ch == '/' {
- break
- }
- }
-}
-
-// scanNumber scans a HCL number definition starting with the given rune
-func (s *Scanner) scanNumber(ch rune) token.Type {
- if ch == '0' {
- // check for hexadecimal, octal or float
- ch = s.next()
- if ch == 'x' || ch == 'X' {
- // hexadecimal
- ch = s.next()
- found := false
- for isHexadecimal(ch) {
- ch = s.next()
- found = true
- }
-
- if !found {
- s.err("illegal hexadecimal number")
- }
-
- if ch != eof {
- s.unread()
- }
-
- return token.NUMBER
- }
-
- // now it's either something like: 0421(octal) or 0.1231(float)
- illegalOctal := false
- for isDecimal(ch) {
- ch = s.next()
- if ch == '8' || ch == '9' {
- // this is just a possibility. For example 0159 is illegal, but
- // 0159.23 is valid. So we mark a possible illegal octal. If
- // the next character is not a period, we'll print the error.
- illegalOctal = true
- }
- }
-
- if ch == 'e' || ch == 'E' {
- ch = s.scanExponent(ch)
- return token.FLOAT
- }
-
- if ch == '.' {
- ch = s.scanFraction(ch)
-
- if ch == 'e' || ch == 'E' {
- ch = s.next()
- ch = s.scanExponent(ch)
- }
- return token.FLOAT
- }
-
- if illegalOctal {
- s.err("illegal octal number")
- }
-
- if ch != eof {
- s.unread()
- }
- return token.NUMBER
- }
-
- s.scanMantissa(ch)
- ch = s.next() // seek forward
- if ch == 'e' || ch == 'E' {
- ch = s.scanExponent(ch)
- return token.FLOAT
- }
-
- if ch == '.' {
- ch = s.scanFraction(ch)
- if ch == 'e' || ch == 'E' {
- ch = s.next()
- ch = s.scanExponent(ch)
- }
- return token.FLOAT
- }
-
- if ch != eof {
- s.unread()
- }
- return token.NUMBER
-}
-
-// scanMantissa scans the mantissa beginning from the rune. It returns the next
-// non decimal rune. It's used to determine wheter it's a fraction or exponent.
-func (s *Scanner) scanMantissa(ch rune) rune {
- scanned := false
- for isDecimal(ch) {
- ch = s.next()
- scanned = true
- }
-
- if scanned && ch != eof {
- s.unread()
- }
- return ch
-}
-
-// scanFraction scans the fraction after the '.' rune
-func (s *Scanner) scanFraction(ch rune) rune {
- if ch == '.' {
- ch = s.peek() // we peek just to see if we can move forward
- ch = s.scanMantissa(ch)
- }
- return ch
-}
-
-// scanExponent scans the remaining parts of an exponent after the 'e' or 'E'
-// rune.
-func (s *Scanner) scanExponent(ch rune) rune {
- if ch == 'e' || ch == 'E' {
- ch = s.next()
- if ch == '-' || ch == '+' {
- ch = s.next()
- }
- ch = s.scanMantissa(ch)
- }
- return ch
-}
-
-// scanHeredoc scans a heredoc string
-func (s *Scanner) scanHeredoc() {
- // Scan the second '<' in example: '<= len(identBytes) && identRegexp.Match(s.src[lineStart:s.srcPos.Offset-s.lastCharLen]) {
- break
- }
-
- // Not an anchor match, record the start of a new line
- lineStart = s.srcPos.Offset
- }
-
- if ch == eof {
- s.err("heredoc not terminated")
- return
- }
- }
-
- return
-}
-
-// scanString scans a quoted string
-func (s *Scanner) scanString() {
- braces := 0
- for {
- // '"' opening already consumed
- // read character after quote
- ch := s.next()
-
- if (ch == '\n' && braces == 0) || ch < 0 || ch == eof {
- s.err("literal not terminated")
- return
- }
-
- if ch == '"' && braces == 0 {
- break
- }
-
- // If we're going into a ${} then we can ignore quotes for awhile
- if braces == 0 && ch == '$' && s.peek() == '{' {
- braces++
- s.next()
- } else if braces > 0 && ch == '{' {
- braces++
- }
- if braces > 0 && ch == '}' {
- braces--
- }
-
- if ch == '\\' {
- s.scanEscape()
- }
- }
-
- return
-}
-
-// scanEscape scans an escape sequence
-func (s *Scanner) scanEscape() rune {
- // http://en.cppreference.com/w/cpp/language/escape
- ch := s.next() // read character after '/'
- switch ch {
- case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '"':
- // nothing to do
- case '0', '1', '2', '3', '4', '5', '6', '7':
- // octal notation
- ch = s.scanDigits(ch, 8, 3)
- case 'x':
- // hexademical notation
- ch = s.scanDigits(s.next(), 16, 2)
- case 'u':
- // universal character name
- ch = s.scanDigits(s.next(), 16, 4)
- case 'U':
- // universal character name
- ch = s.scanDigits(s.next(), 16, 8)
- default:
- s.err("illegal char escape")
- }
- return ch
-}
-
-// scanDigits scans a rune with the given base for n times. For example an
-// octal notation \184 would yield in scanDigits(ch, 8, 3)
-func (s *Scanner) scanDigits(ch rune, base, n int) rune {
- start := n
- for n > 0 && digitVal(ch) < base {
- ch = s.next()
- if ch == eof {
- // If we see an EOF, we halt any more scanning of digits
- // immediately.
- break
- }
-
- n--
- }
- if n > 0 {
- s.err("illegal char escape")
- }
-
- if n != start && ch != eof {
- // we scanned all digits, put the last non digit char back,
- // only if we read anything at all
- s.unread()
- }
-
- return ch
-}
-
-// scanIdentifier scans an identifier and returns the literal string
-func (s *Scanner) scanIdentifier() string {
- offs := s.srcPos.Offset - s.lastCharLen
- ch := s.next()
- for isLetter(ch) || isDigit(ch) || ch == '-' || ch == '.' {
- ch = s.next()
- }
-
- if ch != eof {
- s.unread() // we got identifier, put back latest char
- }
-
- return string(s.src[offs:s.srcPos.Offset])
-}
-
-// recentPosition returns the position of the character immediately after the
-// character or token returned by the last call to Scan.
-func (s *Scanner) recentPosition() (pos token.Pos) {
- pos.Offset = s.srcPos.Offset - s.lastCharLen
- switch {
- case s.srcPos.Column > 0:
- // common case: last character was not a '\n'
- pos.Line = s.srcPos.Line
- pos.Column = s.srcPos.Column
- case s.lastLineLen > 0:
- // last character was a '\n'
- // (we cannot be at the beginning of the source
- // since we have called next() at least once)
- pos.Line = s.srcPos.Line - 1
- pos.Column = s.lastLineLen
- default:
- // at the beginning of the source
- pos.Line = 1
- pos.Column = 1
- }
- return
-}
-
-// err prints the error of any scanning to s.Error function. If the function is
-// not defined, by default it prints them to os.Stderr
-func (s *Scanner) err(msg string) {
- s.ErrorCount++
- pos := s.recentPosition()
-
- if s.Error != nil {
- s.Error(pos, msg)
- return
- }
-
- fmt.Fprintf(os.Stderr, "%s: %s\n", pos, msg)
-}
-
-// isHexadecimal returns true if the given rune is a letter
-func isLetter(ch rune) bool {
- return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch)
-}
-
-// isDigit returns true if the given rune is a decimal digit
-func isDigit(ch rune) bool {
- return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch)
-}
-
-// isDecimal returns true if the given rune is a decimal number
-func isDecimal(ch rune) bool {
- return '0' <= ch && ch <= '9'
-}
-
-// isHexadecimal returns true if the given rune is an hexadecimal number
-func isHexadecimal(ch rune) bool {
- return '0' <= ch && ch <= '9' || 'a' <= ch && ch <= 'f' || 'A' <= ch && ch <= 'F'
-}
-
-// isWhitespace returns true if the rune is a space, tab, newline or carriage return
-func isWhitespace(ch rune) bool {
- return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'
-}
-
-// digitVal returns the integer value of a given octal,decimal or hexadecimal rune
-func digitVal(ch rune) int {
- switch {
- case '0' <= ch && ch <= '9':
- return int(ch - '0')
- case 'a' <= ch && ch <= 'f':
- return int(ch - 'a' + 10)
- case 'A' <= ch && ch <= 'F':
- return int(ch - 'A' + 10)
- }
- return 16 // larger than any legal digit val
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go
deleted file mode 100644
index 58d68f5c..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go
+++ /dev/null
@@ -1,642 +0,0 @@
-package scanner
-
-import (
- "bytes"
- "fmt"
- "testing"
-
- "strings"
-
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-var f100 = strings.Repeat("f", 100)
-
-type tokenPair struct {
- tok token.Type
- text string
-}
-
-var tokenLists = map[string][]tokenPair{
- "comment": []tokenPair{
- {token.COMMENT, "//"},
- {token.COMMENT, "////"},
- {token.COMMENT, "// comment"},
- {token.COMMENT, "// /* comment */"},
- {token.COMMENT, "// // comment //"},
- {token.COMMENT, "//" + f100},
- {token.COMMENT, "#"},
- {token.COMMENT, "##"},
- {token.COMMENT, "# comment"},
- {token.COMMENT, "# /* comment */"},
- {token.COMMENT, "# # comment #"},
- {token.COMMENT, "#" + f100},
- {token.COMMENT, "/**/"},
- {token.COMMENT, "/***/"},
- {token.COMMENT, "/* comment */"},
- {token.COMMENT, "/* // comment */"},
- {token.COMMENT, "/* /* comment */"},
- {token.COMMENT, "/*\n comment\n*/"},
- {token.COMMENT, "/*" + f100 + "*/"},
- },
- "operator": []tokenPair{
- {token.LBRACK, "["},
- {token.LBRACE, "{"},
- {token.COMMA, ","},
- {token.PERIOD, "."},
- {token.RBRACK, "]"},
- {token.RBRACE, "}"},
- {token.ASSIGN, "="},
- {token.ADD, "+"},
- {token.SUB, "-"},
- },
- "bool": []tokenPair{
- {token.BOOL, "true"},
- {token.BOOL, "false"},
- },
- "ident": []tokenPair{
- {token.IDENT, "a"},
- {token.IDENT, "a0"},
- {token.IDENT, "foobar"},
- {token.IDENT, "foo-bar"},
- {token.IDENT, "abc123"},
- {token.IDENT, "LGTM"},
- {token.IDENT, "_"},
- {token.IDENT, "_abc123"},
- {token.IDENT, "abc123_"},
- {token.IDENT, "_abc_123_"},
- {token.IDENT, "_äöü"},
- {token.IDENT, "_本"},
- {token.IDENT, "äöü"},
- {token.IDENT, "本"},
- {token.IDENT, "a۰۱۸"},
- {token.IDENT, "foo६४"},
- {token.IDENT, "bar9876"},
- },
- "heredoc": []tokenPair{
- {token.HEREDOC, "< 0 for %q", s.ErrorCount, src)
- }
-}
-
-func testTokenList(t *testing.T, tokenList []tokenPair) {
- // create artifical source code
- buf := new(bytes.Buffer)
- for _, ident := range tokenList {
- fmt.Fprintf(buf, "%s\n", ident.text)
- }
-
- s := New(buf.Bytes())
- for _, ident := range tokenList {
- tok := s.Scan()
- if tok.Type != ident.tok {
- t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text)
- }
-
- if tok.Text != ident.text {
- t.Errorf("text = %q want %q", tok.String(), ident.text)
- }
-
- }
-}
-
-func countNewlines(s string) int {
- n := 0
- for _, ch := range s {
- if ch == '\n' {
- n++
- }
- }
- return n
-}
-
-func TestScanDigitsUnread(t *testing.T) {
- cases := []string{
- "M=0\"\\00",
- "M=\"\\00",
- "\"\\00",
- "M=[\"\\00",
- "U{\"\\00",
- "\"\n{}#\n\"\\00",
- "M=[[\"\\00",
- "U{d=0\"\\U00",
- "#\n\"\\x00",
- "m=[[[\"\\00",
- }
-
- for _, c := range cases {
- s := New([]byte(c))
-
- for {
- tok := s.Scan()
- if tok.Type == token.EOF {
- break
- }
- t.Logf("s.Scan() = %s", tok)
- }
- }
-}
-
-func TestScanHeredocRegexpCompile(t *testing.T) {
- cases := []string{
- "0\xe1\n<<ȸ\nhello\nworld\nȸ",
- }
-
- for _, c := range cases {
- s := New([]byte(c))
-
- for {
- tok := s.Scan()
- if tok.Type == token.EOF {
- break
- }
- t.Logf("s.Scan() = %s", tok)
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go b/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go
deleted file mode 100644
index 5f981eaa..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go
+++ /dev/null
@@ -1,241 +0,0 @@
-package strconv
-
-import (
- "errors"
- "unicode/utf8"
-)
-
-// ErrSyntax indicates that a value does not have the right syntax for the target type.
-var ErrSyntax = errors.New("invalid syntax")
-
-// Unquote interprets s as a single-quoted, double-quoted,
-// or backquoted Go string literal, returning the string value
-// that s quotes. (If s is single-quoted, it would be a Go
-// character literal; Unquote returns the corresponding
-// one-character string.)
-func Unquote(s string) (t string, err error) {
- n := len(s)
- if n < 2 {
- return "", ErrSyntax
- }
- quote := s[0]
- if quote != s[n-1] {
- return "", ErrSyntax
- }
- s = s[1 : n-1]
-
- if quote != '"' {
- return "", ErrSyntax
- }
- if !contains(s, '$') && !contains(s, '{') && contains(s, '\n') {
- return "", ErrSyntax
- }
-
- // Is it trivial? Avoid allocation.
- if !contains(s, '\\') && !contains(s, quote) && !contains(s, '$') {
- switch quote {
- case '"':
- return s, nil
- case '\'':
- r, size := utf8.DecodeRuneInString(s)
- if size == len(s) && (r != utf8.RuneError || size != 1) {
- return s, nil
- }
- }
- }
-
- var runeTmp [utf8.UTFMax]byte
- buf := make([]byte, 0, 3*len(s)/2) // Try to avoid more allocations.
- for len(s) > 0 {
- // If we're starting a '${}' then let it through un-unquoted.
- // Specifically: we don't unquote any characters within the `${}`
- // section.
- if s[0] == '$' && len(s) > 1 && s[1] == '{' {
- buf = append(buf, '$', '{')
- s = s[2:]
-
- // Continue reading until we find the closing brace, copying as-is
- braces := 1
- for len(s) > 0 && braces > 0 {
- r, size := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError {
- return "", ErrSyntax
- }
-
- s = s[size:]
-
- n := utf8.EncodeRune(runeTmp[:], r)
- buf = append(buf, runeTmp[:n]...)
-
- switch r {
- case '{':
- braces++
- case '}':
- braces--
- }
- }
- if braces != 0 {
- return "", ErrSyntax
- }
- if len(s) == 0 {
- // If there's no string left, we're done!
- break
- } else {
- // If there's more left, we need to pop back up to the top of the loop
- // in case there's another interpolation in this string.
- continue
- }
- }
-
- if s[0] == '\n' {
- return "", ErrSyntax
- }
-
- c, multibyte, ss, err := unquoteChar(s, quote)
- if err != nil {
- return "", err
- }
- s = ss
- if c < utf8.RuneSelf || !multibyte {
- buf = append(buf, byte(c))
- } else {
- n := utf8.EncodeRune(runeTmp[:], c)
- buf = append(buf, runeTmp[:n]...)
- }
- if quote == '\'' && len(s) != 0 {
- // single-quoted must be single character
- return "", ErrSyntax
- }
- }
- return string(buf), nil
-}
-
-// contains reports whether the string contains the byte c.
-func contains(s string, c byte) bool {
- for i := 0; i < len(s); i++ {
- if s[i] == c {
- return true
- }
- }
- return false
-}
-
-func unhex(b byte) (v rune, ok bool) {
- c := rune(b)
- switch {
- case '0' <= c && c <= '9':
- return c - '0', true
- case 'a' <= c && c <= 'f':
- return c - 'a' + 10, true
- case 'A' <= c && c <= 'F':
- return c - 'A' + 10, true
- }
- return
-}
-
-func unquoteChar(s string, quote byte) (value rune, multibyte bool, tail string, err error) {
- // easy cases
- switch c := s[0]; {
- case c == quote && (quote == '\'' || quote == '"'):
- err = ErrSyntax
- return
- case c >= utf8.RuneSelf:
- r, size := utf8.DecodeRuneInString(s)
- return r, true, s[size:], nil
- case c != '\\':
- return rune(s[0]), false, s[1:], nil
- }
-
- // hard case: c is backslash
- if len(s) <= 1 {
- err = ErrSyntax
- return
- }
- c := s[1]
- s = s[2:]
-
- switch c {
- case 'a':
- value = '\a'
- case 'b':
- value = '\b'
- case 'f':
- value = '\f'
- case 'n':
- value = '\n'
- case 'r':
- value = '\r'
- case 't':
- value = '\t'
- case 'v':
- value = '\v'
- case 'x', 'u', 'U':
- n := 0
- switch c {
- case 'x':
- n = 2
- case 'u':
- n = 4
- case 'U':
- n = 8
- }
- var v rune
- if len(s) < n {
- err = ErrSyntax
- return
- }
- for j := 0; j < n; j++ {
- x, ok := unhex(s[j])
- if !ok {
- err = ErrSyntax
- return
- }
- v = v<<4 | x
- }
- s = s[n:]
- if c == 'x' {
- // single-byte string, possibly not UTF-8
- value = v
- break
- }
- if v > utf8.MaxRune {
- err = ErrSyntax
- return
- }
- value = v
- multibyte = true
- case '0', '1', '2', '3', '4', '5', '6', '7':
- v := rune(c) - '0'
- if len(s) < 2 {
- err = ErrSyntax
- return
- }
- for j := 0; j < 2; j++ { // one digit already; two more
- x := rune(s[j]) - '0'
- if x < 0 || x > 7 {
- err = ErrSyntax
- return
- }
- v = (v << 3) | x
- }
- s = s[2:]
- if v > 255 {
- err = ErrSyntax
- return
- }
- value = v
- case '\\':
- value = '\\'
- case '\'', '"':
- if c != quote {
- err = ErrSyntax
- return
- }
- value = rune(c)
- default:
- err = ErrSyntax
- return
- }
- tail = s
- return
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go b/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go
deleted file mode 100644
index 65be375d..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package strconv
-
-import "testing"
-
-type quoteTest struct {
- in string
- out string
- ascii string
-}
-
-var quotetests = []quoteTest{
- {"\a\b\f\r\n\t\v", `"\a\b\f\r\n\t\v"`, `"\a\b\f\r\n\t\v"`},
- {"\\", `"\\"`, `"\\"`},
- {"abc\xffdef", `"abc\xffdef"`, `"abc\xffdef"`},
- {"\u263a", `"☺"`, `"\u263a"`},
- {"\U0010ffff", `"\U0010ffff"`, `"\U0010ffff"`},
- {"\x04", `"\x04"`, `"\x04"`},
-}
-
-type unQuoteTest struct {
- in string
- out string
-}
-
-var unquotetests = []unQuoteTest{
- {`""`, ""},
- {`"a"`, "a"},
- {`"abc"`, "abc"},
- {`"☺"`, "☺"},
- {`"hello world"`, "hello world"},
- {`"\xFF"`, "\xFF"},
- {`"\377"`, "\377"},
- {`"\u1234"`, "\u1234"},
- {`"\U00010111"`, "\U00010111"},
- {`"\U0001011111"`, "\U0001011111"},
- {`"\a\b\f\n\r\t\v\\\""`, "\a\b\f\n\r\t\v\\\""},
- {`"'"`, "'"},
- {`"${file("foo")}"`, `${file("foo")}`},
- {`"${file("\"foo\"")}"`, `${file("\"foo\"")}`},
- {`"echo ${var.region}${element(split(",",var.zones),0)}"`,
- `echo ${var.region}${element(split(",",var.zones),0)}`},
- {`"${HH\\:mm\\:ss}"`, `${HH\\:mm\\:ss}`},
- {`"${\n}"`, `${\n}`},
-}
-
-var misquoted = []string{
- ``,
- `"`,
- `"a`,
- `"'`,
- `b"`,
- `"\"`,
- `"\9"`,
- `"\19"`,
- `"\129"`,
- `'\'`,
- `'\9'`,
- `'\19'`,
- `'\129'`,
- `'ab'`,
- `"\x1!"`,
- `"\U12345678"`,
- `"\z"`,
- "`",
- "`xxx",
- "`\"",
- `"\'"`,
- `'\"'`,
- "\"\n\"",
- "\"\\n\n\"",
- "'\n'",
- `"${"`,
- `"${foo{}"`,
- "\"${foo}\n\"",
-}
-
-func TestUnquote(t *testing.T) {
- for _, tt := range unquotetests {
- if out, err := Unquote(tt.in); err != nil || out != tt.out {
- t.Errorf("Unquote(%#q) = %q, %v want %q, nil", tt.in, out, err, tt.out)
- }
- }
-
- // run the quote tests too, backward
- for _, tt := range quotetests {
- if in, err := Unquote(tt.out); in != tt.in {
- t.Errorf("Unquote(%#q) = %q, %v, want %q, nil", tt.out, in, err, tt.in)
- }
- }
-
- for _, s := range misquoted {
- if out, err := Unquote(s); out != "" || err != ErrSyntax {
- t.Errorf("Unquote(%#q) = %q, %v want %q, %v", s, out, err, "", ErrSyntax)
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/array_comment.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/array_comment.hcl
deleted file mode 100644
index 78c26758..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/array_comment.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = [
- "1",
- "2", # comment
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/assign_colon.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/assign_colon.hcl
deleted file mode 100644
index eb5a99a6..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/assign_colon.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-resource = [{
- "foo": {
- "bar": {},
- "baz": [1, 2, "foo"],
- }
-}]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment.hcl
deleted file mode 100644
index e32be87e..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment.hcl
+++ /dev/null
@@ -1,15 +0,0 @@
-// Foo
-
-/* Bar */
-
-/*
-/*
-Baz
-*/
-
-# Another
-
-# Multiple
-# Lines
-
-foo = "bar"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment_single.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment_single.hcl
deleted file mode 100644
index fec56017..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment_single.hcl
+++ /dev/null
@@ -1 +0,0 @@
-# Hello
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex.hcl
deleted file mode 100644
index cccb5b06..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex.hcl
+++ /dev/null
@@ -1,42 +0,0 @@
-// This comes from Terraform, as a test
-variable "foo" {
- default = "bar"
- description = "bar"
-}
-
-provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-
-provider "do" {
- api_key = "${var.foo}"
-}
-
-resource "aws_security_group" "firewall" {
- count = 5
-}
-
-resource aws_instance "web" {
- ami = "${var.foo}"
- security_groups = [
- "foo",
- "${aws_security_group.firewall.foo}"
- ]
-
- network_interface {
- device_index = 0
- description = "Main network interface"
- }
-}
-
-resource "aws_instance" "db" {
- security_groups = "${aws_security_group.firewall.*.id}"
- VPC = "foo"
-
- depends_on = ["aws_instance.web"]
-}
-
-output "web_ip" {
- value = "${aws_instance.web.private_ip}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex_key.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex_key.hcl
deleted file mode 100644
index 0007aaf5..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex_key.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo.bar = "baz"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/empty.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/empty.hcl
deleted file mode 100644
index e69de29b..00000000
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list.hcl
deleted file mode 100644
index ece7f13c..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo = [1, 2, "foo"]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list_comma.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list_comma.hcl
deleted file mode 100644
index 50f4218a..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list_comma.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo = [1, 2, "foo",]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/multiple.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/multiple.hcl
deleted file mode 100644
index 803bbdc4..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/multiple.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = "bar"
-key = 7
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/old.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/old.hcl
deleted file mode 100644
index e9f77cae..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/old.hcl
+++ /dev/null
@@ -1,3 +0,0 @@
-default = {
- "eu-west-1": "ami-b1cf19c6",
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure.hcl
deleted file mode 100644
index 92592fbb..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-// This is a test structure for the lexer
-foo bar "baz" {
- key = 7
- foo = "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_basic.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_basic.hcl
deleted file mode 100644
index 3f1ccf0c..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_basic.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-foo {
- value = 7
- "value" = 8
- "complex::value" = 9
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_empty.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_empty.hcl
deleted file mode 100644
index 78357488..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_empty.hcl
+++ /dev/null
@@ -1 +0,0 @@
-resource "foo" "bar" {}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/types.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/types.hcl
deleted file mode 100644
index 28f49434..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/types.hcl
+++ /dev/null
@@ -1,7 +0,0 @@
-foo = "bar"
-bar = 7
-baz = [1,2,3]
-foo = -12
-bar = 3.14159
-foo = true
-bar = false
diff --git a/vendor/github.com/hashicorp/hcl/hcl/token/position.go b/vendor/github.com/hashicorp/hcl/hcl/token/position.go
deleted file mode 100644
index 59c1bb72..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/token/position.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package token
-
-import "fmt"
-
-// Pos describes an arbitrary source position
-// including the file, line, and column location.
-// A Position is valid if the line number is > 0.
-type Pos struct {
- Filename string // filename, if any
- Offset int // offset, starting at 0
- Line int // line number, starting at 1
- Column int // column number, starting at 1 (character count)
-}
-
-// IsValid returns true if the position is valid.
-func (p *Pos) IsValid() bool { return p.Line > 0 }
-
-// String returns a string in one of several forms:
-//
-// file:line:column valid position with file name
-// line:column valid position without file name
-// file invalid position with file name
-// - invalid position without file name
-func (p Pos) String() string {
- s := p.Filename
- if p.IsValid() {
- if s != "" {
- s += ":"
- }
- s += fmt.Sprintf("%d:%d", p.Line, p.Column)
- }
- if s == "" {
- s = "-"
- }
- return s
-}
-
-// Before reports whether the position p is before u.
-func (p Pos) Before(u Pos) bool {
- return u.Offset > p.Offset || u.Line > p.Line
-}
-
-// After reports whether the position p is after u.
-func (p Pos) After(u Pos) bool {
- return u.Offset < p.Offset || u.Line < p.Line
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/token/token.go b/vendor/github.com/hashicorp/hcl/hcl/token/token.go
deleted file mode 100644
index e37c0664..00000000
--- a/vendor/github.com/hashicorp/hcl/hcl/token/token.go
+++ /dev/null
@@ -1,219 +0,0 @@
-// Package token defines constants representing the lexical tokens for HCL
-// (HashiCorp Configuration Language)
-package token
-
-import (
- "fmt"
- "strconv"
- "strings"
-
- hclstrconv "github.com/hashicorp/hcl/hcl/strconv"
-)
-
-// Token defines a single HCL token which can be obtained via the Scanner
-type Token struct {
- Type Type
- Pos Pos
- Text string
- JSON bool
-}
-
-// Type is the set of lexical tokens of the HCL (HashiCorp Configuration Language)
-type Type int
-
-const (
- // Special tokens
- ILLEGAL Type = iota
- EOF
- COMMENT
-
- identifier_beg
- IDENT // literals
- literal_beg
- NUMBER // 12345
- FLOAT // 123.45
- BOOL // true,false
- STRING // "abc"
- HEREDOC // < 0 {
- // Pop the current item
- n := len(frontier)
- item := frontier[n-1]
- frontier = frontier[:n-1]
-
- switch v := item.Val.(type) {
- case *ast.ObjectType:
- items, frontier = flattenObjectType(v, item, items, frontier)
- case *ast.ListType:
- items, frontier = flattenListType(v, item, items, frontier)
- default:
- items = append(items, item)
- }
- }
-
- // Reverse the list since the frontier model runs things backwards
- for i := len(items)/2 - 1; i >= 0; i-- {
- opp := len(items) - 1 - i
- items[i], items[opp] = items[opp], items[i]
- }
-
- // Done! Set the original items
- list.Items = items
- return n, true
- })
-}
-
-func flattenListType(
- ot *ast.ListType,
- item *ast.ObjectItem,
- items []*ast.ObjectItem,
- frontier []*ast.ObjectItem) ([]*ast.ObjectItem, []*ast.ObjectItem) {
- // If the list is empty, keep the original list
- if len(ot.List) == 0 {
- items = append(items, item)
- return items, frontier
- }
-
- // All the elements of this object must also be objects!
- for _, subitem := range ot.List {
- if _, ok := subitem.(*ast.ObjectType); !ok {
- items = append(items, item)
- return items, frontier
- }
- }
-
- // Great! We have a match go through all the items and flatten
- for _, elem := range ot.List {
- // Add it to the frontier so that we can recurse
- frontier = append(frontier, &ast.ObjectItem{
- Keys: item.Keys,
- Assign: item.Assign,
- Val: elem,
- LeadComment: item.LeadComment,
- LineComment: item.LineComment,
- })
- }
-
- return items, frontier
-}
-
-func flattenObjectType(
- ot *ast.ObjectType,
- item *ast.ObjectItem,
- items []*ast.ObjectItem,
- frontier []*ast.ObjectItem) ([]*ast.ObjectItem, []*ast.ObjectItem) {
- // If the list has no items we do not have to flatten anything
- if ot.List.Items == nil {
- items = append(items, item)
- return items, frontier
- }
-
- // All the elements of this object must also be objects!
- for _, subitem := range ot.List.Items {
- if _, ok := subitem.Val.(*ast.ObjectType); !ok {
- items = append(items, item)
- return items, frontier
- }
- }
-
- // Great! We have a match go through all the items and flatten
- for _, subitem := range ot.List.Items {
- // Copy the new key
- keys := make([]*ast.ObjectKey, len(item.Keys)+len(subitem.Keys))
- copy(keys, item.Keys)
- copy(keys[len(item.Keys):], subitem.Keys)
-
- // Add it to the frontier so that we can recurse
- frontier = append(frontier, &ast.ObjectItem{
- Keys: keys,
- Assign: item.Assign,
- Val: subitem.Val,
- LeadComment: item.LeadComment,
- LineComment: item.LineComment,
- })
- }
-
- return items, frontier
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/parser.go b/vendor/github.com/hashicorp/hcl/json/parser/parser.go
deleted file mode 100644
index 125a5f07..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/parser.go
+++ /dev/null
@@ -1,313 +0,0 @@
-package parser
-
-import (
- "errors"
- "fmt"
-
- "github.com/hashicorp/hcl/hcl/ast"
- hcltoken "github.com/hashicorp/hcl/hcl/token"
- "github.com/hashicorp/hcl/json/scanner"
- "github.com/hashicorp/hcl/json/token"
-)
-
-type Parser struct {
- sc *scanner.Scanner
-
- // Last read token
- tok token.Token
- commaPrev token.Token
-
- enableTrace bool
- indent int
- n int // buffer size (max = 1)
-}
-
-func newParser(src []byte) *Parser {
- return &Parser{
- sc: scanner.New(src),
- }
-}
-
-// Parse returns the fully parsed source and returns the abstract syntax tree.
-func Parse(src []byte) (*ast.File, error) {
- p := newParser(src)
- return p.Parse()
-}
-
-var errEofToken = errors.New("EOF token found")
-
-// Parse returns the fully parsed source and returns the abstract syntax tree.
-func (p *Parser) Parse() (*ast.File, error) {
- f := &ast.File{}
- var err, scerr error
- p.sc.Error = func(pos token.Pos, msg string) {
- scerr = fmt.Errorf("%s: %s", pos, msg)
- }
-
- // The root must be an object in JSON
- object, err := p.object()
- if scerr != nil {
- return nil, scerr
- }
- if err != nil {
- return nil, err
- }
-
- // We make our final node an object list so it is more HCL compatible
- f.Node = object.List
-
- // Flatten it, which finds patterns and turns them into more HCL-like
- // AST trees.
- flattenObjects(f.Node)
-
- return f, nil
-}
-
-func (p *Parser) objectList() (*ast.ObjectList, error) {
- defer un(trace(p, "ParseObjectList"))
- node := &ast.ObjectList{}
-
- for {
- n, err := p.objectItem()
- if err == errEofToken {
- break // we are finished
- }
-
- // we don't return a nil node, because might want to use already
- // collected items.
- if err != nil {
- return node, err
- }
-
- node.Add(n)
-
- // Check for a followup comma. If it isn't a comma, then we're done
- if tok := p.scan(); tok.Type != token.COMMA {
- break
- }
- }
-
- return node, nil
-}
-
-// objectItem parses a single object item
-func (p *Parser) objectItem() (*ast.ObjectItem, error) {
- defer un(trace(p, "ParseObjectItem"))
-
- keys, err := p.objectKey()
- if err != nil {
- return nil, err
- }
-
- o := &ast.ObjectItem{
- Keys: keys,
- }
-
- switch p.tok.Type {
- case token.COLON:
- pos := p.tok.Pos
- o.Assign = hcltoken.Pos{
- Filename: pos.Filename,
- Offset: pos.Offset,
- Line: pos.Line,
- Column: pos.Column,
- }
-
- o.Val, err = p.objectValue()
- if err != nil {
- return nil, err
- }
- }
-
- return o, nil
-}
-
-// objectKey parses an object key and returns a ObjectKey AST
-func (p *Parser) objectKey() ([]*ast.ObjectKey, error) {
- keyCount := 0
- keys := make([]*ast.ObjectKey, 0)
-
- for {
- tok := p.scan()
- switch tok.Type {
- case token.EOF:
- return nil, errEofToken
- case token.STRING:
- keyCount++
- keys = append(keys, &ast.ObjectKey{
- Token: p.tok.HCLToken(),
- })
- case token.COLON:
- // If we have a zero keycount it means that we never got
- // an object key, i.e. `{ :`. This is a syntax error.
- if keyCount == 0 {
- return nil, fmt.Errorf("expected: STRING got: %s", p.tok.Type)
- }
-
- // Done
- return keys, nil
- case token.ILLEGAL:
- return nil, errors.New("illegal")
- default:
- return nil, fmt.Errorf("expected: STRING got: %s", p.tok.Type)
- }
- }
-}
-
-// object parses any type of object, such as number, bool, string, object or
-// list.
-func (p *Parser) objectValue() (ast.Node, error) {
- defer un(trace(p, "ParseObjectValue"))
- tok := p.scan()
-
- switch tok.Type {
- case token.NUMBER, token.FLOAT, token.BOOL, token.NULL, token.STRING:
- return p.literalType()
- case token.LBRACE:
- return p.objectType()
- case token.LBRACK:
- return p.listType()
- case token.EOF:
- return nil, errEofToken
- }
-
- return nil, fmt.Errorf("Expected object value, got unknown token: %+v", tok)
-}
-
-// object parses any type of object, such as number, bool, string, object or
-// list.
-func (p *Parser) object() (*ast.ObjectType, error) {
- defer un(trace(p, "ParseType"))
- tok := p.scan()
-
- switch tok.Type {
- case token.LBRACE:
- return p.objectType()
- case token.EOF:
- return nil, errEofToken
- }
-
- return nil, fmt.Errorf("Expected object, got unknown token: %+v", tok)
-}
-
-// objectType parses an object type and returns a ObjectType AST
-func (p *Parser) objectType() (*ast.ObjectType, error) {
- defer un(trace(p, "ParseObjectType"))
-
- // we assume that the currently scanned token is a LBRACE
- o := &ast.ObjectType{}
-
- l, err := p.objectList()
-
- // if we hit RBRACE, we are good to go (means we parsed all Items), if it's
- // not a RBRACE, it's an syntax error and we just return it.
- if err != nil && p.tok.Type != token.RBRACE {
- return nil, err
- }
-
- o.List = l
- return o, nil
-}
-
-// listType parses a list type and returns a ListType AST
-func (p *Parser) listType() (*ast.ListType, error) {
- defer un(trace(p, "ParseListType"))
-
- // we assume that the currently scanned token is a LBRACK
- l := &ast.ListType{}
-
- for {
- tok := p.scan()
- switch tok.Type {
- case token.NUMBER, token.FLOAT, token.STRING:
- node, err := p.literalType()
- if err != nil {
- return nil, err
- }
-
- l.Add(node)
- case token.COMMA:
- continue
- case token.LBRACE:
- node, err := p.objectType()
- if err != nil {
- return nil, err
- }
-
- l.Add(node)
- case token.BOOL:
- // TODO(arslan) should we support? not supported by HCL yet
- case token.LBRACK:
- // TODO(arslan) should we support nested lists? Even though it's
- // written in README of HCL, it's not a part of the grammar
- // (not defined in parse.y)
- case token.RBRACK:
- // finished
- return l, nil
- default:
- return nil, fmt.Errorf("unexpected token while parsing list: %s", tok.Type)
- }
-
- }
-}
-
-// literalType parses a literal type and returns a LiteralType AST
-func (p *Parser) literalType() (*ast.LiteralType, error) {
- defer un(trace(p, "ParseLiteral"))
-
- return &ast.LiteralType{
- Token: p.tok.HCLToken(),
- }, nil
-}
-
-// scan returns the next token from the underlying scanner. If a token has
-// been unscanned then read that instead.
-func (p *Parser) scan() token.Token {
- // If we have a token on the buffer, then return it.
- if p.n != 0 {
- p.n = 0
- return p.tok
- }
-
- p.tok = p.sc.Scan()
- return p.tok
-}
-
-// unscan pushes the previously read token back onto the buffer.
-func (p *Parser) unscan() {
- p.n = 1
-}
-
-// ----------------------------------------------------------------------------
-// Parsing support
-
-func (p *Parser) printTrace(a ...interface{}) {
- if !p.enableTrace {
- return
- }
-
- const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
- const n = len(dots)
- fmt.Printf("%5d:%3d: ", p.tok.Pos.Line, p.tok.Pos.Column)
-
- i := 2 * p.indent
- for i > n {
- fmt.Print(dots)
- i -= n
- }
- // i <= n
- fmt.Print(dots[0:i])
- fmt.Println(a...)
-}
-
-func trace(p *Parser, msg string) *Parser {
- p.printTrace(msg, "(")
- p.indent++
- return p
-}
-
-// Usage pattern: defer un(trace(p, "..."))
-func un(p *Parser) {
- p.indent--
- p.printTrace(")")
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go b/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go
deleted file mode 100644
index e0cebf50..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go
+++ /dev/null
@@ -1,384 +0,0 @@
-package parser
-
-import (
- "fmt"
- "io/ioutil"
- "path/filepath"
- "reflect"
- "runtime"
- "testing"
-
- "github.com/hashicorp/hcl/hcl/ast"
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-func TestType(t *testing.T) {
- var literals = []struct {
- typ token.Type
- src string
- }{
- {token.STRING, `"foo": "bar"`},
- {token.NUMBER, `"foo": 123`},
- {token.FLOAT, `"foo": 123.12`},
- {token.FLOAT, `"foo": -123.12`},
- {token.BOOL, `"foo": true`},
- {token.STRING, `"foo": null`},
- }
-
- for _, l := range literals {
- t.Logf("Testing: %s", l.src)
-
- p := newParser([]byte(l.src))
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- }
-
- lit, ok := item.Val.(*ast.LiteralType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- if lit.Token.Type != l.typ {
- t.Errorf("want: %s, got: %s", l.typ, lit.Token.Type)
- }
- }
-}
-
-func TestListType(t *testing.T) {
- var literals = []struct {
- src string
- tokens []token.Type
- }{
- {
- `"foo": ["123", 123]`,
- []token.Type{token.STRING, token.NUMBER},
- },
- {
- `"foo": [123, "123",]`,
- []token.Type{token.NUMBER, token.STRING},
- },
- {
- `"foo": []`,
- []token.Type{},
- },
- {
- `"foo": ["123", 123]`,
- []token.Type{token.STRING, token.NUMBER},
- },
- {
- `"foo": ["123", {}]`,
- []token.Type{token.STRING, token.LBRACE},
- },
- }
-
- for _, l := range literals {
- t.Logf("Testing: %s", l.src)
-
- p := newParser([]byte(l.src))
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- }
-
- list, ok := item.Val.(*ast.ListType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- tokens := []token.Type{}
- for _, li := range list.List {
- switch v := li.(type) {
- case *ast.LiteralType:
- tokens = append(tokens, v.Token.Type)
- case *ast.ObjectType:
- tokens = append(tokens, token.LBRACE)
- }
- }
-
- equals(t, l.tokens, tokens)
- }
-}
-
-func TestObjectType(t *testing.T) {
- var literals = []struct {
- src string
- nodeType []ast.Node
- itemLen int
- }{
- {
- `"foo": {}`,
- nil,
- 0,
- },
- {
- `"foo": {
- "bar": "fatih"
- }`,
- []ast.Node{&ast.LiteralType{}},
- 1,
- },
- {
- `"foo": {
- "bar": "fatih",
- "baz": ["arslan"]
- }`,
- []ast.Node{
- &ast.LiteralType{},
- &ast.ListType{},
- },
- 2,
- },
- {
- `"foo": {
- "bar": {}
- }`,
- []ast.Node{
- &ast.ObjectType{},
- },
- 1,
- },
- {
- `"foo": {
- "bar": {},
- "foo": true
- }`,
- []ast.Node{
- &ast.ObjectType{},
- &ast.LiteralType{},
- },
- 2,
- },
- }
-
- for _, l := range literals {
- t.Logf("Testing:\n%s\n", l.src)
-
- p := newParser([]byte(l.src))
- // p.enableTrace = true
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- }
-
- // we know that the ObjectKey name is foo for all cases, what matters
- // is the object
- obj, ok := item.Val.(*ast.ObjectType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- // check if the total length of items are correct
- equals(t, l.itemLen, len(obj.List.Items))
-
- // check if the types are correct
- for i, item := range obj.List.Items {
- equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val))
- }
- }
-}
-
-func TestFlattenObjects(t *testing.T) {
- var literals = []struct {
- src string
- nodeType []ast.Node
- itemLen int
- }{
- {
- `{
- "foo": [
- {
- "foo": "svh",
- "bar": "fatih"
- }
- ]
- }`,
- []ast.Node{
- &ast.ObjectType{},
- &ast.LiteralType{},
- &ast.LiteralType{},
- },
- 3,
- },
- {
- `{
- "variable": {
- "foo": {}
- }
- }`,
- []ast.Node{
- &ast.ObjectType{},
- },
- 1,
- },
- {
- `{
- "empty": []
- }`,
- []ast.Node{
- &ast.ListType{},
- },
- 1,
- },
- {
- `{
- "basic": [1, 2, 3]
- }`,
- []ast.Node{
- &ast.ListType{},
- },
- 1,
- },
- }
-
- for _, l := range literals {
- t.Logf("Testing:\n%s\n", l.src)
-
- f, err := Parse([]byte(l.src))
- if err != nil {
- t.Error(err)
- }
-
- // the first object is always an ObjectList so just assert that one
- // so we can use it as such
- obj, ok := f.Node.(*ast.ObjectList)
- if !ok {
- t.Errorf("node should be *ast.ObjectList, got: %T", f.Node)
- }
-
- // check if the types are correct
- var i int
- for _, item := range obj.Items {
- equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val))
- i++
-
- if obj, ok := item.Val.(*ast.ObjectType); ok {
- for _, item := range obj.List.Items {
- equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val))
- i++
- }
- }
- }
-
- // check if the number of items is correct
- equals(t, l.itemLen, i)
-
- }
-}
-
-func TestObjectKey(t *testing.T) {
- keys := []struct {
- exp []token.Type
- src string
- }{
- {[]token.Type{token.STRING}, `"foo": {}`},
- }
-
- for _, k := range keys {
- p := newParser([]byte(k.src))
- keys, err := p.objectKey()
- if err != nil {
- t.Fatal(err)
- }
-
- tokens := []token.Type{}
- for _, o := range keys {
- tokens = append(tokens, o.Token.Type)
- }
-
- equals(t, k.exp, tokens)
- }
-
- errKeys := []struct {
- src string
- }{
- {`foo 12 {}`},
- {`foo bar = {}`},
- {`foo []`},
- {`12 {}`},
- }
-
- for _, k := range errKeys {
- p := newParser([]byte(k.src))
- _, err := p.objectKey()
- if err == nil {
- t.Errorf("case '%s' should give an error", k.src)
- }
- }
-}
-
-// Official HCL tests
-func TestParse(t *testing.T) {
- cases := []struct {
- Name string
- Err bool
- }{
- {
- "array.json",
- false,
- },
- {
- "basic.json",
- false,
- },
- {
- "object.json",
- false,
- },
- {
- "types.json",
- false,
- },
- {
- "bad_input_128.json",
- true,
- },
- {
- "bad_input_tf_8110.json",
- true,
- },
- {
- "good_input_tf_8110.json",
- false,
- },
- }
-
- const fixtureDir = "./test-fixtures"
-
- for _, tc := range cases {
- d, err := ioutil.ReadFile(filepath.Join(fixtureDir, tc.Name))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- _, err = Parse(d)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %s\n\nError: %s", tc.Name, err)
- }
- }
-}
-
-func TestParse_inline(t *testing.T) {
- cases := []struct {
- Value string
- Err bool
- }{
- {"{:{", true},
- }
-
- for _, tc := range cases {
- _, err := Parse([]byte(tc.Value))
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %q\n\nError: %s", tc.Value, err)
- }
- }
-}
-
-// equals fails the test if exp is not equal to act.
-func equals(tb testing.TB, exp, act interface{}) {
- if !reflect.DeepEqual(exp, act) {
- _, file, line, _ := runtime.Caller(1)
- fmt.Printf("\033[31m%s:%d:\n\n\texp: %s\n\n\tgot: %s\033[39m\n\n", filepath.Base(file), line, exp, act)
- tb.FailNow()
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/array.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/array.json
deleted file mode 100644
index c06153d2..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/array.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "foo": [1, 2, "bar"],
- "bar": "baz"
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_128.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_128.json
deleted file mode 100644
index b5f850c9..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_128.json
+++ /dev/null
@@ -1 +0,0 @@
-{:{
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_tf_8110.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_tf_8110.json
deleted file mode 100644
index a0438583..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_tf_8110.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "variable": {
- "poc": {
- "default": "${replace("europe-west", "-", " ")}"
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/basic.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/basic.json
deleted file mode 100644
index 460b5331..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/basic.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "foo": "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/good_input_tf_8110.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/good_input_tf_8110.json
deleted file mode 100644
index f21aa090..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/good_input_tf_8110.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "variable": {
- "poc": {
- "default": "${replace(\"europe-west\", \"-\", \" \")}"
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/object.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/object.json
deleted file mode 100644
index f7bed802..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/object.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "foo": {
- "bar": [1,2]
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/types.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/types.json
deleted file mode 100644
index c419cf26..00000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/types.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foo": "bar",
- "bar": 7,
- "baz": [1,2,3],
- "foo": -12,
- "bar": 3.14159,
- "foo": true,
- "bar": false,
- "foo": null
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go b/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go
deleted file mode 100644
index fe3f0f09..00000000
--- a/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go
+++ /dev/null
@@ -1,451 +0,0 @@
-package scanner
-
-import (
- "bytes"
- "fmt"
- "os"
- "unicode"
- "unicode/utf8"
-
- "github.com/hashicorp/hcl/json/token"
-)
-
-// eof represents a marker rune for the end of the reader.
-const eof = rune(0)
-
-// Scanner defines a lexical scanner
-type Scanner struct {
- buf *bytes.Buffer // Source buffer for advancing and scanning
- src []byte // Source buffer for immutable access
-
- // Source Position
- srcPos token.Pos // current position
- prevPos token.Pos // previous position, used for peek() method
-
- lastCharLen int // length of last character in bytes
- lastLineLen int // length of last line in characters (for correct column reporting)
-
- tokStart int // token text start position
- tokEnd int // token text end position
-
- // Error is called for each error encountered. If no Error
- // function is set, the error is reported to os.Stderr.
- Error func(pos token.Pos, msg string)
-
- // ErrorCount is incremented by one for each error encountered.
- ErrorCount int
-
- // tokPos is the start position of most recently scanned token; set by
- // Scan. The Filename field is always left untouched by the Scanner. If
- // an error is reported (via Error) and Position is invalid, the scanner is
- // not inside a token.
- tokPos token.Pos
-}
-
-// New creates and initializes a new instance of Scanner using src as
-// its source content.
-func New(src []byte) *Scanner {
- // even though we accept a src, we read from a io.Reader compatible type
- // (*bytes.Buffer). So in the future we might easily change it to streaming
- // read.
- b := bytes.NewBuffer(src)
- s := &Scanner{
- buf: b,
- src: src,
- }
-
- // srcPosition always starts with 1
- s.srcPos.Line = 1
- return s
-}
-
-// next reads the next rune from the bufferred reader. Returns the rune(0) if
-// an error occurs (or io.EOF is returned).
-func (s *Scanner) next() rune {
- ch, size, err := s.buf.ReadRune()
- if err != nil {
- // advance for error reporting
- s.srcPos.Column++
- s.srcPos.Offset += size
- s.lastCharLen = size
- return eof
- }
-
- if ch == utf8.RuneError && size == 1 {
- s.srcPos.Column++
- s.srcPos.Offset += size
- s.lastCharLen = size
- s.err("illegal UTF-8 encoding")
- return ch
- }
-
- // remember last position
- s.prevPos = s.srcPos
-
- s.srcPos.Column++
- s.lastCharLen = size
- s.srcPos.Offset += size
-
- if ch == '\n' {
- s.srcPos.Line++
- s.lastLineLen = s.srcPos.Column
- s.srcPos.Column = 0
- }
-
- // debug
- // fmt.Printf("ch: %q, offset:column: %d:%d\n", ch, s.srcPos.Offset, s.srcPos.Column)
- return ch
-}
-
-// unread unreads the previous read Rune and updates the source position
-func (s *Scanner) unread() {
- if err := s.buf.UnreadRune(); err != nil {
- panic(err) // this is user fault, we should catch it
- }
- s.srcPos = s.prevPos // put back last position
-}
-
-// peek returns the next rune without advancing the reader.
-func (s *Scanner) peek() rune {
- peek, _, err := s.buf.ReadRune()
- if err != nil {
- return eof
- }
-
- s.buf.UnreadRune()
- return peek
-}
-
-// Scan scans the next token and returns the token.
-func (s *Scanner) Scan() token.Token {
- ch := s.next()
-
- // skip white space
- for isWhitespace(ch) {
- ch = s.next()
- }
-
- var tok token.Type
-
- // token text markings
- s.tokStart = s.srcPos.Offset - s.lastCharLen
-
- // token position, initial next() is moving the offset by one(size of rune
- // actually), though we are interested with the starting point
- s.tokPos.Offset = s.srcPos.Offset - s.lastCharLen
- if s.srcPos.Column > 0 {
- // common case: last character was not a '\n'
- s.tokPos.Line = s.srcPos.Line
- s.tokPos.Column = s.srcPos.Column
- } else {
- // last character was a '\n'
- // (we cannot be at the beginning of the source
- // since we have called next() at least once)
- s.tokPos.Line = s.srcPos.Line - 1
- s.tokPos.Column = s.lastLineLen
- }
-
- switch {
- case isLetter(ch):
- lit := s.scanIdentifier()
- if lit == "true" || lit == "false" {
- tok = token.BOOL
- } else if lit == "null" {
- tok = token.NULL
- } else {
- s.err("illegal char")
- }
- case isDecimal(ch):
- tok = s.scanNumber(ch)
- default:
- switch ch {
- case eof:
- tok = token.EOF
- case '"':
- tok = token.STRING
- s.scanString()
- case '.':
- tok = token.PERIOD
- ch = s.peek()
- if isDecimal(ch) {
- tok = token.FLOAT
- ch = s.scanMantissa(ch)
- ch = s.scanExponent(ch)
- }
- case '[':
- tok = token.LBRACK
- case ']':
- tok = token.RBRACK
- case '{':
- tok = token.LBRACE
- case '}':
- tok = token.RBRACE
- case ',':
- tok = token.COMMA
- case ':':
- tok = token.COLON
- case '-':
- if isDecimal(s.peek()) {
- ch := s.next()
- tok = s.scanNumber(ch)
- } else {
- s.err("illegal char")
- }
- default:
- s.err("illegal char: " + string(ch))
- }
- }
-
- // finish token ending
- s.tokEnd = s.srcPos.Offset
-
- // create token literal
- var tokenText string
- if s.tokStart >= 0 {
- tokenText = string(s.src[s.tokStart:s.tokEnd])
- }
- s.tokStart = s.tokEnd // ensure idempotency of tokenText() call
-
- return token.Token{
- Type: tok,
- Pos: s.tokPos,
- Text: tokenText,
- }
-}
-
-// scanNumber scans a HCL number definition starting with the given rune
-func (s *Scanner) scanNumber(ch rune) token.Type {
- zero := ch == '0'
- pos := s.srcPos
-
- s.scanMantissa(ch)
- ch = s.next() // seek forward
- if ch == 'e' || ch == 'E' {
- ch = s.scanExponent(ch)
- return token.FLOAT
- }
-
- if ch == '.' {
- ch = s.scanFraction(ch)
- if ch == 'e' || ch == 'E' {
- ch = s.next()
- ch = s.scanExponent(ch)
- }
- return token.FLOAT
- }
-
- if ch != eof {
- s.unread()
- }
-
- // If we have a larger number and this is zero, error
- if zero && pos != s.srcPos {
- s.err("numbers cannot start with 0")
- }
-
- return token.NUMBER
-}
-
-// scanMantissa scans the mantissa beginning from the rune. It returns the next
-// non decimal rune. It's used to determine wheter it's a fraction or exponent.
-func (s *Scanner) scanMantissa(ch rune) rune {
- scanned := false
- for isDecimal(ch) {
- ch = s.next()
- scanned = true
- }
-
- if scanned && ch != eof {
- s.unread()
- }
- return ch
-}
-
-// scanFraction scans the fraction after the '.' rune
-func (s *Scanner) scanFraction(ch rune) rune {
- if ch == '.' {
- ch = s.peek() // we peek just to see if we can move forward
- ch = s.scanMantissa(ch)
- }
- return ch
-}
-
-// scanExponent scans the remaining parts of an exponent after the 'e' or 'E'
-// rune.
-func (s *Scanner) scanExponent(ch rune) rune {
- if ch == 'e' || ch == 'E' {
- ch = s.next()
- if ch == '-' || ch == '+' {
- ch = s.next()
- }
- ch = s.scanMantissa(ch)
- }
- return ch
-}
-
-// scanString scans a quoted string
-func (s *Scanner) scanString() {
- braces := 0
- for {
- // '"' opening already consumed
- // read character after quote
- ch := s.next()
-
- if ch == '\n' || ch < 0 || ch == eof {
- s.err("literal not terminated")
- return
- }
-
- if ch == '"' {
- break
- }
-
- // If we're going into a ${} then we can ignore quotes for awhile
- if braces == 0 && ch == '$' && s.peek() == '{' {
- braces++
- s.next()
- } else if braces > 0 && ch == '{' {
- braces++
- }
- if braces > 0 && ch == '}' {
- braces--
- }
-
- if ch == '\\' {
- s.scanEscape()
- }
- }
-
- return
-}
-
-// scanEscape scans an escape sequence
-func (s *Scanner) scanEscape() rune {
- // http://en.cppreference.com/w/cpp/language/escape
- ch := s.next() // read character after '/'
- switch ch {
- case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '"':
- // nothing to do
- case '0', '1', '2', '3', '4', '5', '6', '7':
- // octal notation
- ch = s.scanDigits(ch, 8, 3)
- case 'x':
- // hexademical notation
- ch = s.scanDigits(s.next(), 16, 2)
- case 'u':
- // universal character name
- ch = s.scanDigits(s.next(), 16, 4)
- case 'U':
- // universal character name
- ch = s.scanDigits(s.next(), 16, 8)
- default:
- s.err("illegal char escape")
- }
- return ch
-}
-
-// scanDigits scans a rune with the given base for n times. For example an
-// octal notation \184 would yield in scanDigits(ch, 8, 3)
-func (s *Scanner) scanDigits(ch rune, base, n int) rune {
- for n > 0 && digitVal(ch) < base {
- ch = s.next()
- n--
- }
- if n > 0 {
- s.err("illegal char escape")
- }
-
- // we scanned all digits, put the last non digit char back
- s.unread()
- return ch
-}
-
-// scanIdentifier scans an identifier and returns the literal string
-func (s *Scanner) scanIdentifier() string {
- offs := s.srcPos.Offset - s.lastCharLen
- ch := s.next()
- for isLetter(ch) || isDigit(ch) || ch == '-' {
- ch = s.next()
- }
-
- if ch != eof {
- s.unread() // we got identifier, put back latest char
- }
-
- return string(s.src[offs:s.srcPos.Offset])
-}
-
-// recentPosition returns the position of the character immediately after the
-// character or token returned by the last call to Scan.
-func (s *Scanner) recentPosition() (pos token.Pos) {
- pos.Offset = s.srcPos.Offset - s.lastCharLen
- switch {
- case s.srcPos.Column > 0:
- // common case: last character was not a '\n'
- pos.Line = s.srcPos.Line
- pos.Column = s.srcPos.Column
- case s.lastLineLen > 0:
- // last character was a '\n'
- // (we cannot be at the beginning of the source
- // since we have called next() at least once)
- pos.Line = s.srcPos.Line - 1
- pos.Column = s.lastLineLen
- default:
- // at the beginning of the source
- pos.Line = 1
- pos.Column = 1
- }
- return
-}
-
-// err prints the error of any scanning to s.Error function. If the function is
-// not defined, by default it prints them to os.Stderr
-func (s *Scanner) err(msg string) {
- s.ErrorCount++
- pos := s.recentPosition()
-
- if s.Error != nil {
- s.Error(pos, msg)
- return
- }
-
- fmt.Fprintf(os.Stderr, "%s: %s\n", pos, msg)
-}
-
-// isHexadecimal returns true if the given rune is a letter
-func isLetter(ch rune) bool {
- return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch)
-}
-
-// isHexadecimal returns true if the given rune is a decimal digit
-func isDigit(ch rune) bool {
- return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch)
-}
-
-// isHexadecimal returns true if the given rune is a decimal number
-func isDecimal(ch rune) bool {
- return '0' <= ch && ch <= '9'
-}
-
-// isHexadecimal returns true if the given rune is an hexadecimal number
-func isHexadecimal(ch rune) bool {
- return '0' <= ch && ch <= '9' || 'a' <= ch && ch <= 'f' || 'A' <= ch && ch <= 'F'
-}
-
-// isWhitespace returns true if the rune is a space, tab, newline or carriage return
-func isWhitespace(ch rune) bool {
- return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'
-}
-
-// digitVal returns the integer value of a given octal,decimal or hexadecimal rune
-func digitVal(ch rune) int {
- switch {
- case '0' <= ch && ch <= '9':
- return int(ch - '0')
- case 'a' <= ch && ch <= 'f':
- return int(ch - 'a' + 10)
- case 'A' <= ch && ch <= 'F':
- return int(ch - 'A' + 10)
- }
- return 16 // larger than any legal digit val
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go b/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go
deleted file mode 100644
index 3033a579..00000000
--- a/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go
+++ /dev/null
@@ -1,362 +0,0 @@
-package scanner
-
-import (
- "bytes"
- "fmt"
- "testing"
-
- "github.com/hashicorp/hcl/json/token"
-)
-
-var f100 = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
-
-type tokenPair struct {
- tok token.Type
- text string
-}
-
-var tokenLists = map[string][]tokenPair{
- "operator": []tokenPair{
- {token.LBRACK, "["},
- {token.LBRACE, "{"},
- {token.COMMA, ","},
- {token.PERIOD, "."},
- {token.RBRACK, "]"},
- {token.RBRACE, "}"},
- },
- "bool": []tokenPair{
- {token.BOOL, "true"},
- {token.BOOL, "false"},
- },
- "string": []tokenPair{
- {token.STRING, `" "`},
- {token.STRING, `"a"`},
- {token.STRING, `"本"`},
- {token.STRING, `"${file(\"foo\")}"`},
- {token.STRING, `"\a"`},
- {token.STRING, `"\b"`},
- {token.STRING, `"\f"`},
- {token.STRING, `"\n"`},
- {token.STRING, `"\r"`},
- {token.STRING, `"\t"`},
- {token.STRING, `"\v"`},
- {token.STRING, `"\""`},
- {token.STRING, `"\000"`},
- {token.STRING, `"\777"`},
- {token.STRING, `"\x00"`},
- {token.STRING, `"\xff"`},
- {token.STRING, `"\u0000"`},
- {token.STRING, `"\ufA16"`},
- {token.STRING, `"\U00000000"`},
- {token.STRING, `"\U0000ffAB"`},
- {token.STRING, `"` + f100 + `"`},
- },
- "number": []tokenPair{
- {token.NUMBER, "0"},
- {token.NUMBER, "1"},
- {token.NUMBER, "9"},
- {token.NUMBER, "42"},
- {token.NUMBER, "1234567890"},
- {token.NUMBER, "-0"},
- {token.NUMBER, "-1"},
- {token.NUMBER, "-9"},
- {token.NUMBER, "-42"},
- {token.NUMBER, "-1234567890"},
- },
- "float": []tokenPair{
- {token.FLOAT, "0."},
- {token.FLOAT, "1."},
- {token.FLOAT, "42."},
- {token.FLOAT, "01234567890."},
- {token.FLOAT, ".0"},
- {token.FLOAT, ".1"},
- {token.FLOAT, ".42"},
- {token.FLOAT, ".0123456789"},
- {token.FLOAT, "0.0"},
- {token.FLOAT, "1.0"},
- {token.FLOAT, "42.0"},
- {token.FLOAT, "01234567890.0"},
- {token.FLOAT, "0e0"},
- {token.FLOAT, "1e0"},
- {token.FLOAT, "42e0"},
- {token.FLOAT, "01234567890e0"},
- {token.FLOAT, "0E0"},
- {token.FLOAT, "1E0"},
- {token.FLOAT, "42E0"},
- {token.FLOAT, "01234567890E0"},
- {token.FLOAT, "0e+10"},
- {token.FLOAT, "1e-10"},
- {token.FLOAT, "42e+10"},
- {token.FLOAT, "01234567890e-10"},
- {token.FLOAT, "0E+10"},
- {token.FLOAT, "1E-10"},
- {token.FLOAT, "42E+10"},
- {token.FLOAT, "01234567890E-10"},
- {token.FLOAT, "01.8e0"},
- {token.FLOAT, "1.4e0"},
- {token.FLOAT, "42.2e0"},
- {token.FLOAT, "01234567890.12e0"},
- {token.FLOAT, "0.E0"},
- {token.FLOAT, "1.12E0"},
- {token.FLOAT, "42.123E0"},
- {token.FLOAT, "01234567890.213E0"},
- {token.FLOAT, "0.2e+10"},
- {token.FLOAT, "1.2e-10"},
- {token.FLOAT, "42.54e+10"},
- {token.FLOAT, "01234567890.98e-10"},
- {token.FLOAT, "0.1E+10"},
- {token.FLOAT, "1.1E-10"},
- {token.FLOAT, "42.1E+10"},
- {token.FLOAT, "01234567890.1E-10"},
- {token.FLOAT, "-0.0"},
- {token.FLOAT, "-1.0"},
- {token.FLOAT, "-42.0"},
- {token.FLOAT, "-01234567890.0"},
- {token.FLOAT, "-0e0"},
- {token.FLOAT, "-1e0"},
- {token.FLOAT, "-42e0"},
- {token.FLOAT, "-01234567890e0"},
- {token.FLOAT, "-0E0"},
- {token.FLOAT, "-1E0"},
- {token.FLOAT, "-42E0"},
- {token.FLOAT, "-01234567890E0"},
- {token.FLOAT, "-0e+10"},
- {token.FLOAT, "-1e-10"},
- {token.FLOAT, "-42e+10"},
- {token.FLOAT, "-01234567890e-10"},
- {token.FLOAT, "-0E+10"},
- {token.FLOAT, "-1E-10"},
- {token.FLOAT, "-42E+10"},
- {token.FLOAT, "-01234567890E-10"},
- {token.FLOAT, "-01.8e0"},
- {token.FLOAT, "-1.4e0"},
- {token.FLOAT, "-42.2e0"},
- {token.FLOAT, "-01234567890.12e0"},
- {token.FLOAT, "-0.E0"},
- {token.FLOAT, "-1.12E0"},
- {token.FLOAT, "-42.123E0"},
- {token.FLOAT, "-01234567890.213E0"},
- {token.FLOAT, "-0.2e+10"},
- {token.FLOAT, "-1.2e-10"},
- {token.FLOAT, "-42.54e+10"},
- {token.FLOAT, "-01234567890.98e-10"},
- {token.FLOAT, "-0.1E+10"},
- {token.FLOAT, "-1.1E-10"},
- {token.FLOAT, "-42.1E+10"},
- {token.FLOAT, "-01234567890.1E-10"},
- },
-}
-
-var orderedTokenLists = []string{
- "comment",
- "operator",
- "bool",
- "string",
- "number",
- "float",
-}
-
-func TestPosition(t *testing.T) {
- // create artifical source code
- buf := new(bytes.Buffer)
-
- for _, listName := range orderedTokenLists {
- for _, ident := range tokenLists[listName] {
- fmt.Fprintf(buf, "\t\t\t\t%s\n", ident.text)
- }
- }
-
- s := New(buf.Bytes())
-
- pos := token.Pos{"", 4, 1, 5}
- s.Scan()
- for _, listName := range orderedTokenLists {
-
- for _, k := range tokenLists[listName] {
- curPos := s.tokPos
- // fmt.Printf("[%q] s = %+v:%+v\n", k.text, curPos.Offset, curPos.Column)
-
- if curPos.Offset != pos.Offset {
- t.Fatalf("offset = %d, want %d for %q", curPos.Offset, pos.Offset, k.text)
- }
- if curPos.Line != pos.Line {
- t.Fatalf("line = %d, want %d for %q", curPos.Line, pos.Line, k.text)
- }
- if curPos.Column != pos.Column {
- t.Fatalf("column = %d, want %d for %q", curPos.Column, pos.Column, k.text)
- }
- pos.Offset += 4 + len(k.text) + 1 // 4 tabs + token bytes + newline
- pos.Line += countNewlines(k.text) + 1 // each token is on a new line
-
- s.Error = func(pos token.Pos, msg string) {
- t.Errorf("error %q for %q", msg, k.text)
- }
-
- s.Scan()
- }
- }
- // make sure there were no token-internal errors reported by scanner
- if s.ErrorCount != 0 {
- t.Errorf("%d errors", s.ErrorCount)
- }
-}
-
-func TestComment(t *testing.T) {
- testTokenList(t, tokenLists["comment"])
-}
-
-func TestOperator(t *testing.T) {
- testTokenList(t, tokenLists["operator"])
-}
-
-func TestBool(t *testing.T) {
- testTokenList(t, tokenLists["bool"])
-}
-
-func TestIdent(t *testing.T) {
- testTokenList(t, tokenLists["ident"])
-}
-
-func TestString(t *testing.T) {
- testTokenList(t, tokenLists["string"])
-}
-
-func TestNumber(t *testing.T) {
- testTokenList(t, tokenLists["number"])
-}
-
-func TestFloat(t *testing.T) {
- testTokenList(t, tokenLists["float"])
-}
-
-func TestRealExample(t *testing.T) {
- complexReal := `
-{
- "variable": {
- "foo": {
- "default": "bar",
- "description": "bar",
- "depends_on": ["something"]
- }
- }
-}`
-
- literals := []struct {
- tokenType token.Type
- literal string
- }{
- {token.LBRACE, `{`},
- {token.STRING, `"variable"`},
- {token.COLON, `:`},
- {token.LBRACE, `{`},
- {token.STRING, `"foo"`},
- {token.COLON, `:`},
- {token.LBRACE, `{`},
- {token.STRING, `"default"`},
- {token.COLON, `:`},
- {token.STRING, `"bar"`},
- {token.COMMA, `,`},
- {token.STRING, `"description"`},
- {token.COLON, `:`},
- {token.STRING, `"bar"`},
- {token.COMMA, `,`},
- {token.STRING, `"depends_on"`},
- {token.COLON, `:`},
- {token.LBRACK, `[`},
- {token.STRING, `"something"`},
- {token.RBRACK, `]`},
- {token.RBRACE, `}`},
- {token.RBRACE, `}`},
- {token.RBRACE, `}`},
- {token.EOF, ``},
- }
-
- s := New([]byte(complexReal))
- for _, l := range literals {
- tok := s.Scan()
- if l.tokenType != tok.Type {
- t.Errorf("got: %s want %s for %s\n", tok, l.tokenType, tok.String())
- }
-
- if l.literal != tok.Text {
- t.Errorf("got: %s want %s\n", tok, l.literal)
- }
- }
-
-}
-
-func TestError(t *testing.T) {
- testError(t, "\x80", "1:1", "illegal UTF-8 encoding", token.ILLEGAL)
- testError(t, "\xff", "1:1", "illegal UTF-8 encoding", token.ILLEGAL)
-
- testError(t, `"ab`+"\x80", "1:4", "illegal UTF-8 encoding", token.STRING)
- testError(t, `"abc`+"\xff", "1:5", "illegal UTF-8 encoding", token.STRING)
-
- testError(t, `01238`, "1:7", "numbers cannot start with 0", token.NUMBER)
- testError(t, `01238123`, "1:10", "numbers cannot start with 0", token.NUMBER)
- testError(t, `'aa'`, "1:1", "illegal char: '", token.ILLEGAL)
-
- testError(t, `"`, "1:2", "literal not terminated", token.STRING)
- testError(t, `"abc`, "1:5", "literal not terminated", token.STRING)
- testError(t, `"abc`+"\n", "1:5", "literal not terminated", token.STRING)
-}
-
-func testError(t *testing.T, src, pos, msg string, tok token.Type) {
- s := New([]byte(src))
-
- errorCalled := false
- s.Error = func(p token.Pos, m string) {
- if !errorCalled {
- if pos != p.String() {
- t.Errorf("pos = %q, want %q for %q", p, pos, src)
- }
-
- if m != msg {
- t.Errorf("msg = %q, want %q for %q", m, msg, src)
- }
- errorCalled = true
- }
- }
-
- tk := s.Scan()
- if tk.Type != tok {
- t.Errorf("tok = %s, want %s for %q", tk, tok, src)
- }
- if !errorCalled {
- t.Errorf("error handler not called for %q", src)
- }
- if s.ErrorCount == 0 {
- t.Errorf("count = %d, want > 0 for %q", s.ErrorCount, src)
- }
-}
-
-func testTokenList(t *testing.T, tokenList []tokenPair) {
- // create artifical source code
- buf := new(bytes.Buffer)
- for _, ident := range tokenList {
- fmt.Fprintf(buf, "%s\n", ident.text)
- }
-
- s := New(buf.Bytes())
- for _, ident := range tokenList {
- tok := s.Scan()
- if tok.Type != ident.tok {
- t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text)
- }
-
- if tok.Text != ident.text {
- t.Errorf("text = %q want %q", tok.String(), ident.text)
- }
-
- }
-}
-
-func countNewlines(s string) int {
- n := 0
- for _, ch := range s {
- if ch == '\n' {
- n++
- }
- }
- return n
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/test-fixtures/array.json b/vendor/github.com/hashicorp/hcl/json/test-fixtures/array.json
deleted file mode 100644
index c06153d2..00000000
--- a/vendor/github.com/hashicorp/hcl/json/test-fixtures/array.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "foo": [1, 2, "bar"],
- "bar": "baz"
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/test-fixtures/basic.json b/vendor/github.com/hashicorp/hcl/json/test-fixtures/basic.json
deleted file mode 100644
index 460b5331..00000000
--- a/vendor/github.com/hashicorp/hcl/json/test-fixtures/basic.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "foo": "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/test-fixtures/object.json b/vendor/github.com/hashicorp/hcl/json/test-fixtures/object.json
deleted file mode 100644
index f7bed802..00000000
--- a/vendor/github.com/hashicorp/hcl/json/test-fixtures/object.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "foo": {
- "bar": [1,2]
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/test-fixtures/types.json b/vendor/github.com/hashicorp/hcl/json/test-fixtures/types.json
deleted file mode 100644
index c419cf26..00000000
--- a/vendor/github.com/hashicorp/hcl/json/test-fixtures/types.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foo": "bar",
- "bar": 7,
- "baz": [1,2,3],
- "foo": -12,
- "bar": 3.14159,
- "foo": true,
- "bar": false,
- "foo": null
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/token/position.go b/vendor/github.com/hashicorp/hcl/json/token/position.go
deleted file mode 100644
index 59c1bb72..00000000
--- a/vendor/github.com/hashicorp/hcl/json/token/position.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package token
-
-import "fmt"
-
-// Pos describes an arbitrary source position
-// including the file, line, and column location.
-// A Position is valid if the line number is > 0.
-type Pos struct {
- Filename string // filename, if any
- Offset int // offset, starting at 0
- Line int // line number, starting at 1
- Column int // column number, starting at 1 (character count)
-}
-
-// IsValid returns true if the position is valid.
-func (p *Pos) IsValid() bool { return p.Line > 0 }
-
-// String returns a string in one of several forms:
-//
-// file:line:column valid position with file name
-// line:column valid position without file name
-// file invalid position with file name
-// - invalid position without file name
-func (p Pos) String() string {
- s := p.Filename
- if p.IsValid() {
- if s != "" {
- s += ":"
- }
- s += fmt.Sprintf("%d:%d", p.Line, p.Column)
- }
- if s == "" {
- s = "-"
- }
- return s
-}
-
-// Before reports whether the position p is before u.
-func (p Pos) Before(u Pos) bool {
- return u.Offset > p.Offset || u.Line > p.Line
-}
-
-// After reports whether the position p is after u.
-func (p Pos) After(u Pos) bool {
- return u.Offset < p.Offset || u.Line < p.Line
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/token/token.go b/vendor/github.com/hashicorp/hcl/json/token/token.go
deleted file mode 100644
index 95a0c3ee..00000000
--- a/vendor/github.com/hashicorp/hcl/json/token/token.go
+++ /dev/null
@@ -1,118 +0,0 @@
-package token
-
-import (
- "fmt"
- "strconv"
-
- hcltoken "github.com/hashicorp/hcl/hcl/token"
-)
-
-// Token defines a single HCL token which can be obtained via the Scanner
-type Token struct {
- Type Type
- Pos Pos
- Text string
-}
-
-// Type is the set of lexical tokens of the HCL (HashiCorp Configuration Language)
-type Type int
-
-const (
- // Special tokens
- ILLEGAL Type = iota
- EOF
-
- identifier_beg
- literal_beg
- NUMBER // 12345
- FLOAT // 123.45
- BOOL // true,false
- STRING // "abc"
- NULL // null
- literal_end
- identifier_end
-
- operator_beg
- LBRACK // [
- LBRACE // {
- COMMA // ,
- PERIOD // .
- COLON // :
-
- RBRACK // ]
- RBRACE // }
-
- operator_end
-)
-
-var tokens = [...]string{
- ILLEGAL: "ILLEGAL",
-
- EOF: "EOF",
-
- NUMBER: "NUMBER",
- FLOAT: "FLOAT",
- BOOL: "BOOL",
- STRING: "STRING",
- NULL: "NULL",
-
- LBRACK: "LBRACK",
- LBRACE: "LBRACE",
- COMMA: "COMMA",
- PERIOD: "PERIOD",
- COLON: "COLON",
-
- RBRACK: "RBRACK",
- RBRACE: "RBRACE",
-}
-
-// String returns the string corresponding to the token tok.
-func (t Type) String() string {
- s := ""
- if 0 <= t && t < Type(len(tokens)) {
- s = tokens[t]
- }
- if s == "" {
- s = "token(" + strconv.Itoa(int(t)) + ")"
- }
- return s
-}
-
-// IsIdentifier returns true for tokens corresponding to identifiers and basic
-// type literals; it returns false otherwise.
-func (t Type) IsIdentifier() bool { return identifier_beg < t && t < identifier_end }
-
-// IsLiteral returns true for tokens corresponding to basic type literals; it
-// returns false otherwise.
-func (t Type) IsLiteral() bool { return literal_beg < t && t < literal_end }
-
-// IsOperator returns true for tokens corresponding to operators and
-// delimiters; it returns false otherwise.
-func (t Type) IsOperator() bool { return operator_beg < t && t < operator_end }
-
-// String returns the token's literal text. Note that this is only
-// applicable for certain token types, such as token.IDENT,
-// token.STRING, etc..
-func (t Token) String() string {
- return fmt.Sprintf("%s %s %s", t.Pos.String(), t.Type.String(), t.Text)
-}
-
-// HCLToken converts this token to an HCL token.
-//
-// The token type must be a literal type or this will panic.
-func (t Token) HCLToken() hcltoken.Token {
- switch t.Type {
- case BOOL:
- return hcltoken.Token{Type: hcltoken.BOOL, Text: t.Text}
- case FLOAT:
- return hcltoken.Token{Type: hcltoken.FLOAT, Text: t.Text}
- case NULL:
- return hcltoken.Token{Type: hcltoken.STRING, Text: ""}
- case NUMBER:
- return hcltoken.Token{Type: hcltoken.NUMBER, Text: t.Text}
- case STRING:
- return hcltoken.Token{Type: hcltoken.STRING, Text: t.Text, JSON: true}
- default:
- panic(fmt.Sprintf("unimplemented HCLToken for type: %s", t.Type))
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/token/token_test.go b/vendor/github.com/hashicorp/hcl/json/token/token_test.go
deleted file mode 100644
index a83fdd55..00000000
--- a/vendor/github.com/hashicorp/hcl/json/token/token_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package token
-
-import (
- "testing"
-)
-
-func TestTypeString(t *testing.T) {
- var tokens = []struct {
- tt Type
- str string
- }{
- {ILLEGAL, "ILLEGAL"},
- {EOF, "EOF"},
- {NUMBER, "NUMBER"},
- {FLOAT, "FLOAT"},
- {BOOL, "BOOL"},
- {STRING, "STRING"},
- {NULL, "NULL"},
- {LBRACK, "LBRACK"},
- {LBRACE, "LBRACE"},
- {COMMA, "COMMA"},
- {PERIOD, "PERIOD"},
- {RBRACK, "RBRACK"},
- {RBRACE, "RBRACE"},
- }
-
- for _, token := range tokens {
- if token.tt.String() != token.str {
- t.Errorf("want: %q got:%q\n", token.str, token.tt)
-
- }
- }
-
-}
diff --git a/vendor/github.com/hashicorp/hcl/lex.go b/vendor/github.com/hashicorp/hcl/lex.go
deleted file mode 100644
index d9993c29..00000000
--- a/vendor/github.com/hashicorp/hcl/lex.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package hcl
-
-import (
- "unicode"
- "unicode/utf8"
-)
-
-type lexModeValue byte
-
-const (
- lexModeUnknown lexModeValue = iota
- lexModeHcl
- lexModeJson
-)
-
-// lexMode returns whether we're going to be parsing in JSON
-// mode or HCL mode.
-func lexMode(v []byte) lexModeValue {
- var (
- r rune
- w int
- offset int
- )
-
- for {
- r, w = utf8.DecodeRune(v[offset:])
- offset += w
- if unicode.IsSpace(r) {
- continue
- }
- if r == '{' {
- return lexModeJson
- }
- break
- }
-
- return lexModeHcl
-}
diff --git a/vendor/github.com/hashicorp/hcl/lex_test.go b/vendor/github.com/hashicorp/hcl/lex_test.go
deleted file mode 100644
index 80627644..00000000
--- a/vendor/github.com/hashicorp/hcl/lex_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package hcl
-
-import (
- "testing"
-)
-
-func TestLexMode(t *testing.T) {
- cases := []struct {
- Input string
- Mode lexModeValue
- }{
- {
- "",
- lexModeHcl,
- },
- {
- "foo",
- lexModeHcl,
- },
- {
- "{}",
- lexModeJson,
- },
- {
- " {}",
- lexModeJson,
- },
- }
-
- for i, tc := range cases {
- actual := lexMode([]byte(tc.Input))
-
- if actual != tc.Mode {
- t.Fatalf("%d: %#v", i, actual)
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/parse.go b/vendor/github.com/hashicorp/hcl/parse.go
deleted file mode 100644
index 1fca53c4..00000000
--- a/vendor/github.com/hashicorp/hcl/parse.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package hcl
-
-import (
- "fmt"
-
- "github.com/hashicorp/hcl/hcl/ast"
- hclParser "github.com/hashicorp/hcl/hcl/parser"
- jsonParser "github.com/hashicorp/hcl/json/parser"
-)
-
-// ParseBytes accepts as input byte slice and returns ast tree.
-//
-// Input can be either JSON or HCL
-func ParseBytes(in []byte) (*ast.File, error) {
- return parse(in)
-}
-
-// ParseString accepts input as a string and returns ast tree.
-func ParseString(input string) (*ast.File, error) {
- return parse([]byte(input))
-}
-
-func parse(in []byte) (*ast.File, error) {
- switch lexMode(in) {
- case lexModeHcl:
- return hclParser.Parse(in)
- case lexModeJson:
- return jsonParser.Parse(in)
- }
-
- return nil, fmt.Errorf("unknown config format")
-}
-
-// Parse parses the given input and returns the root object.
-//
-// The input format can be either HCL or JSON.
-func Parse(input string) (*ast.File, error) {
- return parse([]byte(input))
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/assign_deep.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/assign_deep.hcl
deleted file mode 100644
index a2f977df..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/assign_deep.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-resource = [{
- foo = [{
- bar = {}
- }]
-}]
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/basic.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/basic.hcl
deleted file mode 100644
index dcaa4ecf..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/basic.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = "bar"
-bar = "${file("bing/bong.txt")}"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/basic.json b/vendor/github.com/hashicorp/hcl/test-fixtures/basic.json
deleted file mode 100644
index 22c43fb2..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/basic.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "foo": "bar",
- "bar": "${file(\"bing/bong.txt\")}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl
deleted file mode 100644
index 4e415da2..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl
+++ /dev/null
@@ -1 +0,0 @@
-count = "3"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl
deleted file mode 100644
index 363697b4..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl
+++ /dev/null
@@ -1,3 +0,0 @@
-foo="bar"
-bar="${file("bing/bong.txt")}"
-foo-bar="baz"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/block_assign.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/block_assign.hcl
deleted file mode 100644
index ee8b06fe..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/block_assign.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-environment = "aws" {
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl
deleted file mode 100644
index 5b185cc9..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl
+++ /dev/null
@@ -1,15 +0,0 @@
-key "" {
- policy = "read"
-}
-
-key "foo/" {
- policy = "write"
-}
-
-key "foo/bar/" {
- policy = "read"
-}
-
-key "foo/bar/baz" {
- policy = "deny"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.json b/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.json
deleted file mode 100644
index 151864ee..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "key": {
- "": {
- "policy": "read"
- },
-
- "foo/": {
- "policy": "write"
- },
-
- "foo/bar/": {
- "policy": "read"
- },
-
- "foo/bar/baz": {
- "policy": "deny"
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl
deleted file mode 100644
index 52dcaa1b..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl
+++ /dev/null
@@ -1,10 +0,0 @@
-variable "foo" {
- default = "bar"
- description = "bar"
-}
-
-variable "amis" {
- default = {
- east = "foo"
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json b/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json
deleted file mode 100644
index 49f921ed..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "variable": {
- "foo": {
- "default": "bar",
- "description": "bar"
- },
-
- "amis": {
- "default": {
- "east": "foo"
- }
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/empty.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/empty.hcl
deleted file mode 100644
index 5be1b231..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/empty.hcl
+++ /dev/null
@@ -1 +0,0 @@
-resource "foo" {}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/escape.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/escape.hcl
deleted file mode 100644
index f818b15e..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/escape.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-foo = "bar\"baz\\n"
-bar = "new\nline"
-qux = "back\\slash"
-qax = "slash\\:colon"
-nested = "${HH\\:mm\\:ss}"
-nestedquotes = "${"\"stringwrappedinquotes\""}"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/escape_backslash.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/escape_backslash.hcl
deleted file mode 100644
index bc337fb7..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/escape_backslash.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-output {
- one = "${replace(var.sub_domain, ".", "\\.")}"
- two = "${replace(var.sub_domain, ".", "\\\\.")}"
- many = "${replace(var.sub_domain, ".", "\\\\\\\\.")}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/flat.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/flat.hcl
deleted file mode 100644
index f05b0fc4..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/flat.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = "bar"
-Key = 7
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/float.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/float.hcl
deleted file mode 100644
index edf355e3..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/float.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-a = 1.02
-b = 2
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/float.json b/vendor/github.com/hashicorp/hcl/test-fixtures/float.json
deleted file mode 100644
index 58086804..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/float.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "a": 1.02,
- "b": 2
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/git_crypt.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/git_crypt.hcl
deleted file mode 100644
index f691948e1b4238d680e670973bbae039c809e5ca..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 10
RcmZQ@_Y83kiVO(h0ssw90)YSk
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/interpolate.json b/vendor/github.com/hashicorp/hcl/test-fixtures/interpolate.json
deleted file mode 100644
index cad01519..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/interpolate.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "default": "${replace(\"europe-west\", \"-\", \" \")}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_lists.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_lists.hcl
deleted file mode 100644
index 8af34584..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_lists.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = [["foo"], ["bar"]]
-
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_maps.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_maps.hcl
deleted file mode 100644
index 985a33ba..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_maps.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = [
- {somekey1 = "someval1"},
- {somekey2 = "someval2", someextrakey = "someextraval"},
-]
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.hcl
deleted file mode 100644
index f883bd70..00000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = <
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/vendor/github.com/juju/ansiterm/Makefile b/vendor/github.com/juju/ansiterm/Makefile
deleted file mode 100644
index 212fdcbe..00000000
--- a/vendor/github.com/juju/ansiterm/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright 2016 Canonical Ltd.
-# Licensed under the LGPLv3, see LICENCE file for details.
-
-default: check
-
-check:
- go test
-
-docs:
- godoc2md github.com/juju/ansiterm > README.md
- sed -i 's|\[godoc-link-here\]|[![GoDoc](https://godoc.org/github.com/juju/ansiterm?status.svg)](https://godoc.org/github.com/juju/ansiterm)|' README.md
-
-
-.PHONY: default check docs
diff --git a/vendor/github.com/juju/ansiterm/README.md b/vendor/github.com/juju/ansiterm/README.md
deleted file mode 100644
index 56743872..00000000
--- a/vendor/github.com/juju/ansiterm/README.md
+++ /dev/null
@@ -1,323 +0,0 @@
-
-# ansiterm
- import "github.com/juju/ansiterm"
-
-Package ansiterm provides a Writer that writes out the ANSI escape
-codes for color and styles.
-
-
-
-
-
-
-
-## type Color
-``` go
-type Color int
-```
-Color represents one of the standard 16 ANSI colors.
-
-
-
-``` go
-const (
- Default Color
- Black
- Red
- Green
- Yellow
- Blue
- Magenta
- Cyan
- Gray
- DarkGray
- BrightRed
- BrightGreen
- BrightYellow
- BrightBlue
- BrightMagenta
- BrightCyan
- White
-)
-```
-
-
-
-
-
-
-
-
-### func (Color) String
-``` go
-func (c Color) String() string
-```
-String returns the name of the color.
-
-
-
-## type Context
-``` go
-type Context struct {
- Foreground Color
- Background Color
- Styles []Style
-}
-```
-Context provides a way to specify both foreground and background colors
-along with other styles and write text to a Writer with those colors and
-styles.
-
-
-
-
-
-
-
-
-
-### func Background
-``` go
-func Background(color Color) *Context
-```
-Background is a convenience function that creates a Context with the
-specified color as the background color.
-
-
-### func Foreground
-``` go
-func Foreground(color Color) *Context
-```
-Foreground is a convenience function that creates a Context with the
-specified color as the foreground color.
-
-
-### func Styles
-``` go
-func Styles(styles ...Style) *Context
-```
-Styles is a convenience function that creates a Context with the
-specified styles set.
-
-
-
-
-### func (\*Context) Fprint
-``` go
-func (c *Context) Fprint(w sgrWriter, args ...interface{})
-```
-Fprint will set the sgr values of the writer to the specified foreground,
-background and styles, then formats using the default formats for its
-operands and writes to w. Spaces are added between operands when neither is
-a string. It returns the number of bytes written and any write error
-encountered.
-
-
-
-### func (\*Context) Fprintf
-``` go
-func (c *Context) Fprintf(w sgrWriter, format string, args ...interface{})
-```
-Fprintf will set the sgr values of the writer to the specified
-foreground, background and styles, then write the formatted string,
-then reset the writer.
-
-
-
-### func (\*Context) SetBackground
-``` go
-func (c *Context) SetBackground(color Color) *Context
-```
-SetBackground sets the background to the specified color.
-
-
-
-### func (\*Context) SetForeground
-``` go
-func (c *Context) SetForeground(color Color) *Context
-```
-SetForeground sets the foreground to the specified color.
-
-
-
-### func (\*Context) SetStyle
-``` go
-func (c *Context) SetStyle(styles ...Style) *Context
-```
-SetStyle replaces the styles with the new values.
-
-
-
-## type Style
-``` go
-type Style int
-```
-
-
-``` go
-const (
- Bold Style
- Faint
- Italic
- Underline
- Blink
- Reverse
- Strikethrough
- Conceal
-)
-```
-
-
-
-
-
-
-
-
-### func (Style) String
-``` go
-func (s Style) String() string
-```
-
-
-## type TabWriter
-``` go
-type TabWriter struct {
- Writer
- // contains filtered or unexported fields
-}
-```
-TabWriter is a filter that inserts padding around tab-delimited
-columns in its input to align them in the output.
-
-It also setting of colors and styles over and above the standard
-tabwriter package.
-
-
-
-
-
-
-
-
-
-### func NewTabWriter
-``` go
-func NewTabWriter(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *TabWriter
-```
-NewTabWriter returns a writer that is able to set colors and styels.
-The ansi escape codes are stripped for width calculations.
-
-
-
-
-### func (\*TabWriter) Flush
-``` go
-func (t *TabWriter) Flush() error
-```
-Flush should be called after the last call to Write to ensure
-that any data buffered in the Writer is written to output. Any
-incomplete escape sequence at the end is considered
-complete for formatting purposes.
-
-
-
-### func (\*TabWriter) Init
-``` go
-func (t *TabWriter) Init(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *TabWriter
-```
-A Writer must be initialized with a call to Init. The first parameter (output)
-specifies the filter output. The remaining parameters control the formatting:
-
-
- minwidth minimal cell width including any padding
- tabwidth width of tab characters (equivalent number of spaces)
- padding padding added to a cell before computing its width
- padchar ASCII char used for padding
- if padchar == '\t', the Writer will assume that the
- width of a '\t' in the formatted output is tabwidth,
- and cells are left-aligned independent of align_left
- (for correct-looking results, tabwidth must correspond
- to the tab width in the viewer displaying the result)
- flags formatting control
-
-
-
-## type Writer
-``` go
-type Writer struct {
- io.Writer
- // contains filtered or unexported fields
-}
-```
-Writer allows colors and styles to be specified. If the io.Writer
-is not a terminal capable of color, all attempts to set colors or
-styles are no-ops.
-
-
-
-
-
-
-
-
-
-### func NewWriter
-``` go
-func NewWriter(w io.Writer) *Writer
-```
-NewWriter returns a Writer that allows the caller to specify colors and
-styles. If the io.Writer is not a terminal capable of color, all attempts
-to set colors or styles are no-ops.
-
-
-
-
-### func (\*Writer) ClearStyle
-``` go
-func (w *Writer) ClearStyle(s Style)
-```
-ClearStyle clears the text style.
-
-
-
-### func (\*Writer) Reset
-``` go
-func (w *Writer) Reset()
-```
-Reset returns the default foreground and background colors with no styles.
-
-
-
-### func (\*Writer) SetBackground
-``` go
-func (w *Writer) SetBackground(c Color)
-```
-SetBackground sets the background color.
-
-
-
-### func (\*Writer) SetForeground
-``` go
-func (w *Writer) SetForeground(c Color)
-```
-SetForeground sets the foreground color.
-
-
-
-### func (\*Writer) SetStyle
-``` go
-func (w *Writer) SetStyle(s Style)
-```
-SetStyle sets the text style.
-
-
-
-
-
-
-
-
-
-- - -
-Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)
\ No newline at end of file
diff --git a/vendor/github.com/juju/ansiterm/attribute.go b/vendor/github.com/juju/ansiterm/attribute.go
deleted file mode 100644
index f2daa481..00000000
--- a/vendor/github.com/juju/ansiterm/attribute.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import (
- "fmt"
- "sort"
- "strings"
-)
-
-type attribute int
-
-const (
- unknownAttribute attribute = -1
- reset attribute = 0
-)
-
-// sgr returns the escape sequence for the Select Graphic Rendition
-// for the attribute.
-func (a attribute) sgr() string {
- if a < 0 {
- return ""
- }
- return fmt.Sprintf("\x1b[%dm", a)
-}
-
-type attributes []attribute
-
-func (a attributes) Len() int { return len(a) }
-func (a attributes) Less(i, j int) bool { return a[i] < a[j] }
-func (a attributes) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-
-// sgr returns the combined escape sequence for the Select Graphic Rendition
-// for the sequence of attributes.
-func (a attributes) sgr() string {
- switch len(a) {
- case 0:
- return ""
- case 1:
- return a[0].sgr()
- default:
- sort.Sort(a)
- var values []string
- for _, attr := range a {
- values = append(values, fmt.Sprint(attr))
- }
- return fmt.Sprintf("\x1b[%sm", strings.Join(values, ";"))
- }
-}
diff --git a/vendor/github.com/juju/ansiterm/attribute_test.go b/vendor/github.com/juju/ansiterm/attribute_test.go
deleted file mode 100644
index eebfd127..00000000
--- a/vendor/github.com/juju/ansiterm/attribute_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import gc "gopkg.in/check.v1"
-
-type attributeSuite struct{}
-
-var _ = gc.Suite(&attributeSuite{})
-
-func (*attributeSuite) TestSGR(c *gc.C) {
- c.Check(unknownAttribute.sgr(), gc.Equals, "")
- c.Check(reset.sgr(), gc.Equals, "\x1b[0m")
- var yellow attribute = 33
- c.Check(yellow.sgr(), gc.Equals, "\x1b[33m")
-}
-
-func (*attributeSuite) TestAttributes(c *gc.C) {
- var a attributes
- c.Check(a.sgr(), gc.Equals, "")
- a = append(a, Yellow.foreground())
- c.Check(a.sgr(), gc.Equals, "\x1b[33m")
- a = append(a, Blue.background())
- c.Check(a.sgr(), gc.Equals, "\x1b[33;44m")
-
- // Add bold to the end to show sorting of the attributes.
- a = append(a, Bold.enable())
- c.Check(a.sgr(), gc.Equals, "\x1b[1;33;44m")
-}
diff --git a/vendor/github.com/juju/ansiterm/color.go b/vendor/github.com/juju/ansiterm/color.go
deleted file mode 100644
index 0a97de31..00000000
--- a/vendor/github.com/juju/ansiterm/color.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-const (
- _ Color = iota
- Default
- Black
- Red
- Green
- Yellow
- Blue
- Magenta
- Cyan
- Gray
- DarkGray
- BrightRed
- BrightGreen
- BrightYellow
- BrightBlue
- BrightMagenta
- BrightCyan
- White
-)
-
-// Color represents one of the standard 16 ANSI colors.
-type Color int
-
-// String returns the name of the color.
-func (c Color) String() string {
- switch c {
- case Default:
- return "default"
- case Black:
- return "black"
- case Red:
- return "red"
- case Green:
- return "green"
- case Yellow:
- return "yellow"
- case Blue:
- return "blue"
- case Magenta:
- return "magenta"
- case Cyan:
- return "cyan"
- case Gray:
- return "gray"
- case DarkGray:
- return "darkgray"
- case BrightRed:
- return "brightred"
- case BrightGreen:
- return "brightgreen"
- case BrightYellow:
- return "brightyellow"
- case BrightBlue:
- return "brightblue"
- case BrightMagenta:
- return "brightmagenta"
- case BrightCyan:
- return "brightcyan"
- case White:
- return "white"
- default:
- return ""
- }
-}
-
-func (c Color) foreground() attribute {
- switch c {
- case Default:
- return 39
- case Black:
- return 30
- case Red:
- return 31
- case Green:
- return 32
- case Yellow:
- return 33
- case Blue:
- return 34
- case Magenta:
- return 35
- case Cyan:
- return 36
- case Gray:
- return 37
- case DarkGray:
- return 90
- case BrightRed:
- return 91
- case BrightGreen:
- return 92
- case BrightYellow:
- return 93
- case BrightBlue:
- return 94
- case BrightMagenta:
- return 95
- case BrightCyan:
- return 96
- case White:
- return 97
- default:
- return unknownAttribute
- }
-}
-
-func (c Color) background() attribute {
- value := c.foreground()
- if value != unknownAttribute {
- return value + 10
- }
- return value
-}
diff --git a/vendor/github.com/juju/ansiterm/color_test.go b/vendor/github.com/juju/ansiterm/color_test.go
deleted file mode 100644
index 45ec3cbb..00000000
--- a/vendor/github.com/juju/ansiterm/color_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import gc "gopkg.in/check.v1"
-
-type colorSuite struct{}
-
-var _ = gc.Suite(&colorSuite{})
-
-func (*colorSuite) TestString(c *gc.C) {
- c.Check(Default.String(), gc.Equals, "default")
- c.Check(Yellow.String(), gc.Equals, "yellow")
- c.Check(BrightMagenta.String(), gc.Equals, "brightmagenta")
- var blank Color
- c.Check(blank.String(), gc.Equals, "")
- var huge Color = 1234
- c.Check(huge.String(), gc.Equals, "")
- var negative Color = -1
- c.Check(negative.String(), gc.Equals, "")
-}
diff --git a/vendor/github.com/juju/ansiterm/context.go b/vendor/github.com/juju/ansiterm/context.go
deleted file mode 100644
index e61a867f..00000000
--- a/vendor/github.com/juju/ansiterm/context.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import (
- "fmt"
- "io"
-)
-
-// Context provides a way to specify both foreground and background colors
-// along with other styles and write text to a Writer with those colors and
-// styles.
-type Context struct {
- Foreground Color
- Background Color
- Styles []Style
-}
-
-// Foreground is a convenience function that creates a Context with the
-// specified color as the foreground color.
-func Foreground(color Color) *Context {
- return &Context{Foreground: color}
-}
-
-// Background is a convenience function that creates a Context with the
-// specified color as the background color.
-func Background(color Color) *Context {
- return &Context{Background: color}
-}
-
-// Styles is a convenience function that creates a Context with the
-// specified styles set.
-func Styles(styles ...Style) *Context {
- return &Context{Styles: styles}
-}
-
-// SetForeground sets the foreground to the specified color.
-func (c *Context) SetForeground(color Color) *Context {
- c.Foreground = color
- return c
-}
-
-// SetBackground sets the background to the specified color.
-func (c *Context) SetBackground(color Color) *Context {
- c.Background = color
- return c
-}
-
-// SetStyle replaces the styles with the new values.
-func (c *Context) SetStyle(styles ...Style) *Context {
- c.Styles = styles
- return c
-}
-
-type sgrWriter interface {
- io.Writer
- writeSGR(value sgr)
-}
-
-// Fprintf will set the sgr values of the writer to the specified
-// foreground, background and styles, then write the formatted string,
-// then reset the writer.
-func (c *Context) Fprintf(w sgrWriter, format string, args ...interface{}) {
- w.writeSGR(c)
- fmt.Fprintf(w, format, args...)
- w.writeSGR(reset)
-}
-
-// Fprint will set the sgr values of the writer to the specified foreground,
-// background and styles, then formats using the default formats for its
-// operands and writes to w. Spaces are added between operands when neither is
-// a string. It returns the number of bytes written and any write error
-// encountered.
-func (c *Context) Fprint(w sgrWriter, args ...interface{}) {
- w.writeSGR(c)
- fmt.Fprint(w, args...)
- w.writeSGR(reset)
-}
-
-func (c *Context) sgr() string {
- var values attributes
- if foreground := c.Foreground.foreground(); foreground != unknownAttribute {
- values = append(values, foreground)
- }
- if background := c.Background.background(); background != unknownAttribute {
- values = append(values, background)
- }
- for _, style := range c.Styles {
- if value := style.enable(); value != unknownAttribute {
- values = append(values, value)
- }
- }
- return values.sgr()
-}
diff --git a/vendor/github.com/juju/ansiterm/context_test.go b/vendor/github.com/juju/ansiterm/context_test.go
deleted file mode 100644
index 47f46a07..00000000
--- a/vendor/github.com/juju/ansiterm/context_test.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import (
- "bytes"
-
- gc "gopkg.in/check.v1"
-)
-
-type contextSuite struct{}
-
-var _ = gc.Suite(&contextSuite{})
-
-func (*contextSuite) newWriter() (*bytes.Buffer, *Writer) {
- buff := &bytes.Buffer{}
- writer := NewWriter(buff)
- writer.noColor = false
- return buff, writer
-}
-
-func (*contextSuite) TestBlank(c *gc.C) {
- var context Context
- c.Assert(context.sgr(), gc.Equals, "")
-}
-
-func (*contextSuite) TestAllUnknown(c *gc.C) {
- context := Context{
- Foreground: 123,
- Background: 432,
- Styles: []Style{456, 99},
- }
- c.Assert(context.sgr(), gc.Equals, "")
-}
-
-func (*contextSuite) TestForeground(c *gc.C) {
- context := Foreground(Yellow)
- c.Assert(context.sgr(), gc.Equals, "\x1b[33m")
-}
-
-func (*contextSuite) TestBackground(c *gc.C) {
- context := Background(Blue)
- c.Assert(context.sgr(), gc.Equals, "\x1b[44m")
-}
-
-func (*contextSuite) TestStyles(c *gc.C) {
- context := Styles(Bold, Italic)
- c.Assert(context.sgr(), gc.Equals, "\x1b[1;3m")
-}
-
-func (*contextSuite) TestValid(c *gc.C) {
- context := Context{
- Foreground: Yellow,
- Background: Blue,
- Styles: []Style{Bold, Italic},
- }
- c.Assert(context.sgr(), gc.Equals, "\x1b[1;3;33;44m")
-}
-
-func (*contextSuite) TestSetForeground(c *gc.C) {
- var context Context
- context.SetForeground(Yellow)
- c.Assert(context.sgr(), gc.Equals, "\x1b[33m")
-}
-
-func (*contextSuite) TestSetBackground(c *gc.C) {
- var context Context
- context.SetBackground(Blue)
- c.Assert(context.sgr(), gc.Equals, "\x1b[44m")
-}
-
-func (*contextSuite) TestSetStyles(c *gc.C) {
- var context Context
- context.SetStyle(Bold, Italic)
- c.Assert(context.sgr(), gc.Equals, "\x1b[1;3m")
-}
-
-func (s *contextSuite) TestFprintfNoColor(c *gc.C) {
- buff, writer := s.newWriter()
- writer.noColor = true
-
- context := Context{
- Foreground: Yellow,
- Background: Blue,
- Styles: []Style{Bold, Italic},
- }
-
- context.Fprintf(writer, "hello %s, %d", "world", 42)
- c.Assert(buff.String(), gc.Equals, "hello world, 42")
-}
-
-func (s *contextSuite) TestFprintfColor(c *gc.C) {
- buff, writer := s.newWriter()
-
- context := Context{
- Foreground: Yellow,
- Background: Blue,
- Styles: []Style{Bold, Italic},
- }
-
- context.Fprintf(writer, "hello %s, %d", "world", 42)
- c.Assert(buff.String(), gc.Equals, "\x1b[1;3;33;44mhello world, 42\x1b[0m")
-}
diff --git a/vendor/github.com/juju/ansiterm/doc.go b/vendor/github.com/juju/ansiterm/doc.go
deleted file mode 100644
index 78270077..00000000
--- a/vendor/github.com/juju/ansiterm/doc.go
+++ /dev/null
@@ -1,6 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-// Package ansiterm provides a Writer that writes out the ANSI escape
-// codes for color and styles.
-package ansiterm
diff --git a/vendor/github.com/juju/ansiterm/package_test.go b/vendor/github.com/juju/ansiterm/package_test.go
deleted file mode 100644
index fb15919a..00000000
--- a/vendor/github.com/juju/ansiterm/package_test.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import (
- "testing"
-
- gc "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- gc.TestingT(t)
-}
diff --git a/vendor/github.com/juju/ansiterm/style.go b/vendor/github.com/juju/ansiterm/style.go
deleted file mode 100644
index 0be42da5..00000000
--- a/vendor/github.com/juju/ansiterm/style.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-const (
- _ Style = iota
- Bold
- Faint
- Italic
- Underline
- Blink
- Reverse
- Strikethrough
- Conceal
-)
-
-type Style int
-
-func (s Style) String() string {
- switch s {
- case Bold:
- return "bold"
- case Faint:
- return "faint"
- case Italic:
- return "italic"
- case Underline:
- return "underline"
- case Blink:
- return "blink"
- case Reverse:
- return "reverse"
- case Strikethrough:
- return "strikethrough"
- case Conceal:
- return "conceal"
- default:
- return ""
- }
-}
-
-func (s Style) enable() attribute {
- switch s {
- case Bold:
- return 1
- case Faint:
- return 2
- case Italic:
- return 3
- case Underline:
- return 4
- case Blink:
- return 5
- case Reverse:
- return 7
- case Conceal:
- return 8
- case Strikethrough:
- return 9
- default:
- return unknownAttribute
- }
-}
-
-func (s Style) disable() attribute {
- value := s.enable()
- if value != unknownAttribute {
- return value + 20
- }
- return value
-}
diff --git a/vendor/github.com/juju/ansiterm/style_test.go b/vendor/github.com/juju/ansiterm/style_test.go
deleted file mode 100644
index 998a7ef6..00000000
--- a/vendor/github.com/juju/ansiterm/style_test.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import gc "gopkg.in/check.v1"
-
-type styleSuite struct{}
-
-var _ = gc.Suite(&styleSuite{})
-
-func (*styleSuite) TestString(c *gc.C) {
- c.Check(Bold.String(), gc.Equals, "bold")
- c.Check(Strikethrough.String(), gc.Equals, "strikethrough")
- var blank Style
- c.Check(blank.String(), gc.Equals, "")
- var huge Style = 1234
- c.Check(huge.String(), gc.Equals, "")
- var negative Style = -1
- c.Check(negative.String(), gc.Equals, "")
-}
diff --git a/vendor/github.com/juju/ansiterm/tabwriter.go b/vendor/github.com/juju/ansiterm/tabwriter.go
deleted file mode 100644
index 1ff6faaa..00000000
--- a/vendor/github.com/juju/ansiterm/tabwriter.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import (
- "io"
-
- "github.com/juju/ansiterm/tabwriter"
-)
-
-// NewTabWriter returns a writer that is able to set colors and styels.
-// The ansi escape codes are stripped for width calculations.
-func NewTabWriter(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *TabWriter {
- return new(TabWriter).Init(output, minwidth, tabwidth, padding, padchar, flags)
-}
-
-// TabWriter is a filter that inserts padding around tab-delimited
-// columns in its input to align them in the output.
-//
-// It also setting of colors and styles over and above the standard
-// tabwriter package.
-type TabWriter struct {
- Writer
- tw tabwriter.Writer
-}
-
-// Flush should be called after the last call to Write to ensure
-// that any data buffered in the Writer is written to output. Any
-// incomplete escape sequence at the end is considered
-// complete for formatting purposes.
-//
-func (t *TabWriter) Flush() error {
- return t.tw.Flush()
-}
-
-// SetColumnAlignRight will mark a particular column as align right.
-// This is reset on the next flush.
-func (t *TabWriter) SetColumnAlignRight(column int) {
- t.tw.SetColumnAlignRight(column)
-}
-
-// A Writer must be initialized with a call to Init. The first parameter (output)
-// specifies the filter output. The remaining parameters control the formatting:
-//
-// minwidth minimal cell width including any padding
-// tabwidth width of tab characters (equivalent number of spaces)
-// padding padding added to a cell before computing its width
-// padchar ASCII char used for padding
-// if padchar == '\t', the Writer will assume that the
-// width of a '\t' in the formatted output is tabwidth,
-// and cells are left-aligned independent of align_left
-// (for correct-looking results, tabwidth must correspond
-// to the tab width in the viewer displaying the result)
-// flags formatting control
-//
-func (t *TabWriter) Init(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *TabWriter {
- writer, colorCapable := colorEnabledWriter(output)
- t.Writer = Writer{
- Writer: t.tw.Init(writer, minwidth, tabwidth, padding, padchar, flags),
- noColor: !colorCapable,
- }
- return t
-}
diff --git a/vendor/github.com/juju/ansiterm/tabwriter/LICENSE b/vendor/github.com/juju/ansiterm/tabwriter/LICENSE
deleted file mode 100644
index 74487567..00000000
--- a/vendor/github.com/juju/ansiterm/tabwriter/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/juju/ansiterm/tabwriter/tabwriter.go b/vendor/github.com/juju/ansiterm/tabwriter/tabwriter.go
deleted file mode 100644
index 98949d03..00000000
--- a/vendor/github.com/juju/ansiterm/tabwriter/tabwriter.go
+++ /dev/null
@@ -1,587 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This file is mostly a copy of the go standard library text/tabwriter. With
-// the additional stripping of ansi control characters for width calculations.
-
-// Package tabwriter implements a write filter (tabwriter.Writer) that
-// translates tabbed columns in input into properly aligned text.
-//
-// The package is using the Elastic Tabstops algorithm described at
-// http://nickgravgaard.com/elastictabstops/index.html.
-//
-package tabwriter
-
-import (
- "bytes"
- "io"
- "unicode/utf8"
-
- "github.com/lunixbochs/vtclean"
-)
-
-// ----------------------------------------------------------------------------
-// Filter implementation
-
-// A cell represents a segment of text terminated by tabs or line breaks.
-// The text itself is stored in a separate buffer; cell only describes the
-// segment's size in bytes, its width in runes, and whether it's an htab
-// ('\t') terminated cell.
-//
-type cell struct {
- size int // cell size in bytes
- width int // cell width in runes
- htab bool // true if the cell is terminated by an htab ('\t')
-}
-
-// A Writer is a filter that inserts padding around tab-delimited
-// columns in its input to align them in the output.
-//
-// The Writer treats incoming bytes as UTF-8 encoded text consisting
-// of cells terminated by (horizontal or vertical) tabs or line
-// breaks (newline or formfeed characters). Cells in adjacent lines
-// constitute a column. The Writer inserts padding as needed to
-// make all cells in a column have the same width, effectively
-// aligning the columns. It assumes that all characters have the
-// same width except for tabs for which a tabwidth must be specified.
-// Note that cells are tab-terminated, not tab-separated: trailing
-// non-tab text at the end of a line does not form a column cell.
-//
-// The Writer assumes that all Unicode code points have the same width;
-// this may not be true in some fonts.
-//
-// If DiscardEmptyColumns is set, empty columns that are terminated
-// entirely by vertical (or "soft") tabs are discarded. Columns
-// terminated by horizontal (or "hard") tabs are not affected by
-// this flag.
-//
-// If a Writer is configured to filter HTML, HTML tags and entities
-// are passed through. The widths of tags and entities are
-// assumed to be zero (tags) and one (entities) for formatting purposes.
-//
-// A segment of text may be escaped by bracketing it with Escape
-// characters. The tabwriter passes escaped text segments through
-// unchanged. In particular, it does not interpret any tabs or line
-// breaks within the segment. If the StripEscape flag is set, the
-// Escape characters are stripped from the output; otherwise they
-// are passed through as well. For the purpose of formatting, the
-// width of the escaped text is always computed excluding the Escape
-// characters.
-//
-// The formfeed character ('\f') acts like a newline but it also
-// terminates all columns in the current line (effectively calling
-// Flush). Cells in the next line start new columns. Unless found
-// inside an HTML tag or inside an escaped text segment, formfeed
-// characters appear as newlines in the output.
-//
-// The Writer must buffer input internally, because proper spacing
-// of one line may depend on the cells in future lines. Clients must
-// call Flush when done calling Write.
-//
-type Writer struct {
- // configuration
- output io.Writer
- minwidth int
- tabwidth int
- padding int
- padbytes [8]byte
- flags uint
-
- // current state
- buf bytes.Buffer // collected text excluding tabs or line breaks
- pos int // buffer position up to which cell.width of incomplete cell has been computed
- cell cell // current incomplete cell; cell.width is up to buf[pos] excluding ignored sections
- endChar byte // terminating char of escaped sequence (Escape for escapes, '>', ';' for HTML tags/entities, or 0)
- lines [][]cell // list of lines; each line is a list of cells
- widths []int // list of column widths in runes - re-used during formatting
- alignment map[int]uint // column alignment
-}
-
-func (b *Writer) addLine() { b.lines = append(b.lines, []cell{}) }
-
-// Reset the current state.
-func (b *Writer) reset() {
- b.buf.Reset()
- b.pos = 0
- b.cell = cell{}
- b.endChar = 0
- b.lines = b.lines[0:0]
- b.widths = b.widths[0:0]
- b.alignment = make(map[int]uint)
- b.addLine()
-}
-
-// Internal representation (current state):
-//
-// - all text written is appended to buf; tabs and line breaks are stripped away
-// - at any given time there is a (possibly empty) incomplete cell at the end
-// (the cell starts after a tab or line break)
-// - cell.size is the number of bytes belonging to the cell so far
-// - cell.width is text width in runes of that cell from the start of the cell to
-// position pos; html tags and entities are excluded from this width if html
-// filtering is enabled
-// - the sizes and widths of processed text are kept in the lines list
-// which contains a list of cells for each line
-// - the widths list is a temporary list with current widths used during
-// formatting; it is kept in Writer because it's re-used
-//
-// |<---------- size ---------->|
-// | |
-// |<- width ->|<- ignored ->| |
-// | | | |
-// [---processed---tab------------......]
-// ^ ^ ^
-// | | |
-// buf start of incomplete cell pos
-
-// Formatting can be controlled with these flags.
-const (
- // Ignore html tags and treat entities (starting with '&'
- // and ending in ';') as single characters (width = 1).
- FilterHTML uint = 1 << iota
-
- // Strip Escape characters bracketing escaped text segments
- // instead of passing them through unchanged with the text.
- StripEscape
-
- // Force right-alignment of cell content.
- // Default is left-alignment.
- AlignRight
-
- // Handle empty columns as if they were not present in
- // the input in the first place.
- DiscardEmptyColumns
-
- // Always use tabs for indentation columns (i.e., padding of
- // leading empty cells on the left) independent of padchar.
- TabIndent
-
- // Print a vertical bar ('|') between columns (after formatting).
- // Discarded columns appear as zero-width columns ("||").
- Debug
-)
-
-// A Writer must be initialized with a call to Init. The first parameter (output)
-// specifies the filter output. The remaining parameters control the formatting:
-//
-// minwidth minimal cell width including any padding
-// tabwidth width of tab characters (equivalent number of spaces)
-// padding padding added to a cell before computing its width
-// padchar ASCII char used for padding
-// if padchar == '\t', the Writer will assume that the
-// width of a '\t' in the formatted output is tabwidth,
-// and cells are left-aligned independent of align_left
-// (for correct-looking results, tabwidth must correspond
-// to the tab width in the viewer displaying the result)
-// flags formatting control
-//
-func (b *Writer) Init(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer {
- if minwidth < 0 || tabwidth < 0 || padding < 0 {
- panic("negative minwidth, tabwidth, or padding")
- }
- b.output = output
- b.minwidth = minwidth
- b.tabwidth = tabwidth
- b.padding = padding
- for i := range b.padbytes {
- b.padbytes[i] = padchar
- }
- if padchar == '\t' {
- // tab padding enforces left-alignment
- flags &^= AlignRight
- }
- b.flags = flags
-
- b.reset()
-
- return b
-}
-
-// debugging support (keep code around)
-func (b *Writer) dump() {
- pos := 0
- for i, line := range b.lines {
- print("(", i, ") ")
- for _, c := range line {
- print("[", string(b.buf.Bytes()[pos:pos+c.size]), "]")
- pos += c.size
- }
- print("\n")
- }
- print("\n")
-}
-
-// local error wrapper so we can distinguish errors we want to return
-// as errors from genuine panics (which we don't want to return as errors)
-type osError struct {
- err error
-}
-
-func (b *Writer) write0(buf []byte) {
- n, err := b.output.Write(buf)
- if n != len(buf) && err == nil {
- err = io.ErrShortWrite
- }
- if err != nil {
- panic(osError{err})
- }
-}
-
-func (b *Writer) writeN(src []byte, n int) {
- for n > len(src) {
- b.write0(src)
- n -= len(src)
- }
- b.write0(src[0:n])
-}
-
-var (
- newline = []byte{'\n'}
- tabs = []byte("\t\t\t\t\t\t\t\t")
-)
-
-func (b *Writer) writePadding(textw, cellw int, useTabs bool) {
- if b.padbytes[0] == '\t' || useTabs {
- // padding is done with tabs
- if b.tabwidth == 0 {
- return // tabs have no width - can't do any padding
- }
- // make cellw the smallest multiple of b.tabwidth
- cellw = (cellw + b.tabwidth - 1) / b.tabwidth * b.tabwidth
- n := cellw - textw // amount of padding
- if n < 0 {
- panic("internal error")
- }
- b.writeN(tabs, (n+b.tabwidth-1)/b.tabwidth)
- return
- }
-
- // padding is done with non-tab characters
- b.writeN(b.padbytes[0:], cellw-textw)
-}
-
-var vbar = []byte{'|'}
-
-func (b *Writer) writeLines(pos0 int, line0, line1 int) (pos int) {
- pos = pos0
- for i := line0; i < line1; i++ {
- line := b.lines[i]
-
- // if TabIndent is set, use tabs to pad leading empty cells
- useTabs := b.flags&TabIndent != 0
-
- for j, c := range line {
- if j > 0 && b.flags&Debug != 0 {
- // indicate column break
- b.write0(vbar)
- }
-
- if c.size == 0 {
- // empty cell
- if j < len(b.widths) {
- b.writePadding(c.width, b.widths[j], useTabs)
- }
- } else {
- // non-empty cell
- useTabs = false
- alignColumnRight := b.alignment[j] == AlignRight
- if (b.flags&AlignRight == 0) && !alignColumnRight { // align left
- b.write0(b.buf.Bytes()[pos : pos+c.size])
- pos += c.size
- if j < len(b.widths) {
- b.writePadding(c.width, b.widths[j], false)
- }
- } else if alignColumnRight && j < len(b.widths) {
- // just this column
- internalSize := b.widths[j] - b.padding
- if j < len(b.widths) {
- b.writePadding(c.width, internalSize, false)
- }
- b.write0(b.buf.Bytes()[pos : pos+c.size])
- if b.padding > 0 {
- b.writePadding(0, b.padding, false)
- }
- pos += c.size
- } else { // align right
- if j < len(b.widths) {
- b.writePadding(c.width, b.widths[j], false)
- }
- b.write0(b.buf.Bytes()[pos : pos+c.size])
- pos += c.size
- }
- }
- }
-
- if i+1 == len(b.lines) {
- // last buffered line - we don't have a newline, so just write
- // any outstanding buffered data
- b.write0(b.buf.Bytes()[pos : pos+b.cell.size])
- pos += b.cell.size
- } else {
- // not the last line - write newline
- b.write0(newline)
- }
- }
- return
-}
-
-// Format the text between line0 and line1 (excluding line1); pos
-// is the buffer position corresponding to the beginning of line0.
-// Returns the buffer position corresponding to the beginning of
-// line1 and an error, if any.
-//
-func (b *Writer) format(pos0 int, line0, line1 int) (pos int) {
- pos = pos0
- column := len(b.widths)
- for this := line0; this < line1; this++ {
- line := b.lines[this]
-
- if column < len(line)-1 {
- // cell exists in this column => this line
- // has more cells than the previous line
- // (the last cell per line is ignored because cells are
- // tab-terminated; the last cell per line describes the
- // text before the newline/formfeed and does not belong
- // to a column)
-
- // print unprinted lines until beginning of block
- pos = b.writeLines(pos, line0, this)
- line0 = this
-
- // column block begin
- width := b.minwidth // minimal column width
- discardable := true // true if all cells in this column are empty and "soft"
- for ; this < line1; this++ {
- line = b.lines[this]
- if column < len(line)-1 {
- // cell exists in this column
- c := line[column]
- // update width
- if w := c.width + b.padding; w > width {
- width = w
- }
- // update discardable
- if c.width > 0 || c.htab {
- discardable = false
- }
- } else {
- break
- }
- }
- // column block end
-
- // discard empty columns if necessary
- if discardable && b.flags&DiscardEmptyColumns != 0 {
- width = 0
- }
-
- // format and print all columns to the right of this column
- // (we know the widths of this column and all columns to the left)
- b.widths = append(b.widths, width) // push width
- pos = b.format(pos, line0, this)
- b.widths = b.widths[0 : len(b.widths)-1] // pop width
- line0 = this
- }
- }
-
- // print unprinted lines until end
- return b.writeLines(pos, line0, line1)
-}
-
-// Append text to current cell.
-func (b *Writer) append(text []byte) {
- b.buf.Write(text)
- b.cell.size += len(text)
-}
-
-// Update the cell width.
-func (b *Writer) updateWidth() {
- // ---- Changes here -----
- newChars := b.buf.Bytes()[b.pos:b.buf.Len()]
- cleaned := vtclean.Clean(string(newChars), false) // false to strip colors
- b.cell.width += utf8.RuneCount([]byte(cleaned))
- // --- end of changes ----
- b.pos = b.buf.Len()
-}
-
-// To escape a text segment, bracket it with Escape characters.
-// For instance, the tab in this string "Ignore this tab: \xff\t\xff"
-// does not terminate a cell and constitutes a single character of
-// width one for formatting purposes.
-//
-// The value 0xff was chosen because it cannot appear in a valid UTF-8 sequence.
-//
-const Escape = '\xff'
-
-// Start escaped mode.
-func (b *Writer) startEscape(ch byte) {
- switch ch {
- case Escape:
- b.endChar = Escape
- case '<':
- b.endChar = '>'
- case '&':
- b.endChar = ';'
- }
-}
-
-// Terminate escaped mode. If the escaped text was an HTML tag, its width
-// is assumed to be zero for formatting purposes; if it was an HTML entity,
-// its width is assumed to be one. In all other cases, the width is the
-// unicode width of the text.
-//
-func (b *Writer) endEscape() {
- switch b.endChar {
- case Escape:
- b.updateWidth()
- if b.flags&StripEscape == 0 {
- b.cell.width -= 2 // don't count the Escape chars
- }
- case '>': // tag of zero width
- case ';':
- b.cell.width++ // entity, count as one rune
- }
- b.pos = b.buf.Len()
- b.endChar = 0
-}
-
-// Terminate the current cell by adding it to the list of cells of the
-// current line. Returns the number of cells in that line.
-//
-func (b *Writer) terminateCell(htab bool) int {
- b.cell.htab = htab
- line := &b.lines[len(b.lines)-1]
- *line = append(*line, b.cell)
- b.cell = cell{}
- return len(*line)
-}
-
-func handlePanic(err *error, op string) {
- if e := recover(); e != nil {
- if nerr, ok := e.(osError); ok {
- *err = nerr.err
- return
- }
- panic("tabwriter: panic during " + op)
- }
-}
-
-// Flush should be called after the last call to Write to ensure
-// that any data buffered in the Writer is written to output. Any
-// incomplete escape sequence at the end is considered
-// complete for formatting purposes.
-//
-func (b *Writer) Flush() (err error) {
- defer b.reset() // even in the presence of errors
- defer handlePanic(&err, "Flush")
-
- // add current cell if not empty
- if b.cell.size > 0 {
- if b.endChar != 0 {
- // inside escape - terminate it even if incomplete
- b.endEscape()
- }
- b.terminateCell(false)
- }
-
- // format contents of buffer
- b.format(0, 0, len(b.lines))
-
- return
-}
-
-var hbar = []byte("---\n")
-
-// SetColumnAlignRight will mark a particular column as align right.
-// This is reset on the next flush.
-func (b *Writer) SetColumnAlignRight(column int) {
- b.alignment[column] = AlignRight
-}
-
-// Write writes buf to the writer b.
-// The only errors returned are ones encountered
-// while writing to the underlying output stream.
-//
-func (b *Writer) Write(buf []byte) (n int, err error) {
- defer handlePanic(&err, "Write")
-
- // split text into cells
- n = 0
- for i, ch := range buf {
- if b.endChar == 0 {
- // outside escape
- switch ch {
- case '\t', '\v', '\n', '\f':
- // end of cell
- b.append(buf[n:i])
- b.updateWidth()
- n = i + 1 // ch consumed
- ncells := b.terminateCell(ch == '\t')
- if ch == '\n' || ch == '\f' {
- // terminate line
- b.addLine()
- if ch == '\f' || ncells == 1 {
- // A '\f' always forces a flush. Otherwise, if the previous
- // line has only one cell which does not have an impact on
- // the formatting of the following lines (the last cell per
- // line is ignored by format()), thus we can flush the
- // Writer contents.
- if err = b.Flush(); err != nil {
- return
- }
- if ch == '\f' && b.flags&Debug != 0 {
- // indicate section break
- b.write0(hbar)
- }
- }
- }
-
- case Escape:
- // start of escaped sequence
- b.append(buf[n:i])
- b.updateWidth()
- n = i
- if b.flags&StripEscape != 0 {
- n++ // strip Escape
- }
- b.startEscape(Escape)
-
- case '<', '&':
- // possibly an html tag/entity
- if b.flags&FilterHTML != 0 {
- // begin of tag/entity
- b.append(buf[n:i])
- b.updateWidth()
- n = i
- b.startEscape(ch)
- }
- }
-
- } else {
- // inside escape
- if ch == b.endChar {
- // end of tag/entity
- j := i + 1
- if ch == Escape && b.flags&StripEscape != 0 {
- j = i // strip Escape
- }
- b.append(buf[n:j])
- n = i + 1 // ch consumed
- b.endEscape()
- }
- }
- }
-
- // append leftover text
- b.append(buf[n:])
- n = len(buf)
- return
-}
-
-// NewWriter allocates and initializes a new tabwriter.Writer.
-// The parameters are the same as for the Init function.
-//
-func NewWriter(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer {
- return new(Writer).Init(output, minwidth, tabwidth, padding, padchar, flags)
-}
diff --git a/vendor/github.com/juju/ansiterm/tabwriter/tabwriter_test.go b/vendor/github.com/juju/ansiterm/tabwriter/tabwriter_test.go
deleted file mode 100644
index 20664809..00000000
--- a/vendor/github.com/juju/ansiterm/tabwriter/tabwriter_test.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package tabwriter
-
-import (
- "bytes"
- "testing"
-
- gc "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) {
- gc.TestingT(t)
-}
-
-type tabwriterSuite struct{}
-
-var _ = gc.Suite(&tabwriterSuite{})
-
-func (s *tabwriterSuite) TestRightAlignOverflow(c *gc.C) {
- var buf bytes.Buffer
- tw := NewWriter(&buf, 0, 1, 2, ' ', 0)
- tw.SetColumnAlignRight(2)
- tw.Write([]byte("not\tenough\ttabs"))
- tw.Flush()
- c.Assert(buf.String(), gc.Equals, "not enough tabs")
-}
diff --git a/vendor/github.com/juju/ansiterm/terminal.go b/vendor/github.com/juju/ansiterm/terminal.go
deleted file mode 100644
index 96fd11c5..00000000
--- a/vendor/github.com/juju/ansiterm/terminal.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import (
- "io"
- "os"
-
- "github.com/mattn/go-colorable"
- "github.com/mattn/go-isatty"
-)
-
-// colorEnabledWriter returns a writer that can handle the ansi color codes
-// and true if the writer passed in is a terminal capable of color. If the
-// TERM environment variable is set to "dumb", the terminal is not considered
-// color capable.
-func colorEnabledWriter(w io.Writer) (io.Writer, bool) {
- f, ok := w.(*os.File)
- if !ok {
- return w, false
- }
- // Check the TERM environment variable specifically
- // to check for "dumb" terminals.
- if os.Getenv("TERM") == "dumb" {
- return w, false
- }
- if !isatty.IsTerminal(f.Fd()) {
- return w, false
- }
- return colorable.NewColorable(f), true
-}
diff --git a/vendor/github.com/juju/ansiterm/writer.go b/vendor/github.com/juju/ansiterm/writer.go
deleted file mode 100644
index 32437bb2..00000000
--- a/vendor/github.com/juju/ansiterm/writer.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import (
- "fmt"
- "io"
-)
-
-// Writer allows colors and styles to be specified. If the io.Writer
-// is not a terminal capable of color, all attempts to set colors or
-// styles are no-ops.
-type Writer struct {
- io.Writer
-
- noColor bool
-}
-
-// NewWriter returns a Writer that allows the caller to specify colors and
-// styles. If the io.Writer is not a terminal capable of color, all attempts
-// to set colors or styles are no-ops.
-func NewWriter(w io.Writer) *Writer {
- writer, colorCapable := colorEnabledWriter(w)
- return &Writer{
- Writer: writer,
- noColor: !colorCapable,
- }
-}
-
-// SetColorCapable forces the writer to either write the ANSI escape color
-// if capable is true, or to not write them if capable is false.
-func (w *Writer) SetColorCapable(capable bool) {
- w.noColor = !capable
-}
-
-// SetForeground sets the foreground color.
-func (w *Writer) SetForeground(c Color) {
- w.writeSGR(c.foreground())
-}
-
-// SetBackground sets the background color.
-func (w *Writer) SetBackground(c Color) {
- w.writeSGR(c.background())
-}
-
-// SetStyle sets the text style.
-func (w *Writer) SetStyle(s Style) {
- w.writeSGR(s.enable())
-}
-
-// ClearStyle clears the text style.
-func (w *Writer) ClearStyle(s Style) {
- w.writeSGR(s.disable())
-}
-
-// Reset returns the default foreground and background colors with no styles.
-func (w *Writer) Reset() {
- w.writeSGR(reset)
-}
-
-type sgr interface {
- // sgr returns the combined escape sequence for the Select Graphic Rendition.
- sgr() string
-}
-
-// writeSGR takes the appropriate integer SGR parameters
-// and writes out the ANIS escape code.
-func (w *Writer) writeSGR(value sgr) {
- if w.noColor {
- return
- }
- fmt.Fprint(w, value.sgr())
-}
diff --git a/vendor/github.com/juju/ansiterm/writer_test.go b/vendor/github.com/juju/ansiterm/writer_test.go
deleted file mode 100644
index 68329319..00000000
--- a/vendor/github.com/juju/ansiterm/writer_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 Canonical Ltd.
-// Licensed under the LGPLv3, see LICENCE file for details.
-
-package ansiterm
-
-import (
- "bytes"
-
- gc "gopkg.in/check.v1"
-)
-
-type writerSuite struct{}
-
-var _ = gc.Suite(&writerSuite{})
-
-func (*writerSuite) TestNoColor(c *gc.C) {
- buff := &bytes.Buffer{}
- writer := NewWriter(buff)
- c.Check(writer.noColor, gc.Equals, true)
-
- writer.SetForeground(Yellow)
- writer.SetBackground(Blue)
- writer.SetStyle(Bold)
- writer.ClearStyle(Bold)
- writer.Reset()
-
- c.Check(buff.String(), gc.Equals, "")
-}
-
-func (*writerSuite) TestSetColorCapable(c *gc.C) {
- buff := &bytes.Buffer{}
- writer := NewWriter(buff)
- c.Check(writer.noColor, gc.Equals, true)
-
- writer.SetColorCapable(true)
- c.Check(writer.noColor, gc.Equals, false)
-
- writer.SetColorCapable(false)
- c.Check(writer.noColor, gc.Equals, true)
-}
-
-func (*writerSuite) newWriter() (*bytes.Buffer, *Writer) {
- buff := &bytes.Buffer{}
- writer := NewWriter(buff)
- writer.noColor = false
- return buff, writer
-}
-
-func (s *writerSuite) TestSetForeground(c *gc.C) {
- buff, writer := s.newWriter()
- writer.SetForeground(Yellow)
- c.Check(buff.String(), gc.Equals, "\x1b[33m")
-}
-
-func (s *writerSuite) TestSetBackground(c *gc.C) {
- buff, writer := s.newWriter()
- writer.SetBackground(Blue)
- c.Check(buff.String(), gc.Equals, "\x1b[44m")
-}
-
-func (s *writerSuite) TestSetStyle(c *gc.C) {
- buff, writer := s.newWriter()
- writer.SetStyle(Bold)
- c.Check(buff.String(), gc.Equals, "\x1b[1m")
-}
-
-func (s *writerSuite) TestClearStyle(c *gc.C) {
- buff, writer := s.newWriter()
- writer.ClearStyle(Bold)
- c.Check(buff.String(), gc.Equals, "\x1b[21m")
-}
-
-func (s *writerSuite) TestReset(c *gc.C) {
- buff, writer := s.newWriter()
- writer.Reset()
- c.Check(buff.String(), gc.Equals, "\x1b[0m")
-}
diff --git a/vendor/github.com/lunixbochs/vtclean/.travis.yml b/vendor/github.com/lunixbochs/vtclean/.travis.yml
deleted file mode 100644
index fc0a5432..00000000
--- a/vendor/github.com/lunixbochs/vtclean/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-sudo: false
-
-script: go test -v
-
-go:
- - 1.5
- - 1.6
- - 1.7
diff --git a/vendor/github.com/lunixbochs/vtclean/LICENSE b/vendor/github.com/lunixbochs/vtclean/LICENSE
deleted file mode 100644
index 42e82633..00000000
--- a/vendor/github.com/lunixbochs/vtclean/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2015 Ryan Hileman
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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 SOFTWARE.
diff --git a/vendor/github.com/lunixbochs/vtclean/README.md b/vendor/github.com/lunixbochs/vtclean/README.md
deleted file mode 100644
index 99910a46..00000000
--- a/vendor/github.com/lunixbochs/vtclean/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-[![Build Status](https://travis-ci.org/lunixbochs/vtclean.svg?branch=master)](https://travis-ci.org/lunixbochs/vtclean)
-
-vtclean
-----
-
-Clean up raw terminal output by stripping escape sequences, optionally preserving color.
-
-Get it: `go get github.com/lunixbochs/vtclean/vtclean`
-
-API:
-
- import "github.com/lunixbochs/vtclean"
- vtclean.Clean(line string, color bool) string
-
-Command line example:
-
- $ echo -e '\x1b[1;32mcolor example
- color forced to stop at end of line
- backspace is ba\b\bgood
- no beeps!\x07\x07' | ./vtclean -color
-
- color example
- color forced to stop at end of line
- backspace is good
- no beeps!
-
-Go example:
-
- package main
-
- import (
- "fmt"
- "github.com/lunixbochs/vtclean"
- )
-
- func main() {
- line := vtclean.Clean(
- "\033[1;32mcolor, " +
- "curs\033[Aor, " +
- "backspace\b\b\b\b\b\b\b\b\b\b\b\033[K", false)
- fmt.Println(line)
- }
-
-Output:
-
- color, cursor
diff --git a/vendor/github.com/lunixbochs/vtclean/io.go b/vendor/github.com/lunixbochs/vtclean/io.go
deleted file mode 100644
index 31be0076..00000000
--- a/vendor/github.com/lunixbochs/vtclean/io.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package vtclean
-
-import (
- "bufio"
- "bytes"
- "io"
-)
-
-type reader struct {
- io.Reader
- scanner *bufio.Scanner
- buf []byte
-
- color bool
-}
-
-func NewReader(r io.Reader, color bool) io.Reader {
- return &reader{Reader: r, color: color}
-}
-
-func (r *reader) scan() bool {
- if r.scanner == nil {
- r.scanner = bufio.NewScanner(r.Reader)
- }
- if len(r.buf) > 0 {
- return true
- }
- if r.scanner.Scan() {
- r.buf = []byte(Clean(r.scanner.Text(), r.color) + "\n")
- return true
- }
- return false
-}
-
-func (r *reader) fill(p []byte) int {
- n := len(r.buf)
- copy(p, r.buf)
- if len(p) < len(r.buf) {
- r.buf = r.buf[len(p):]
- n = len(p)
- } else {
- r.buf = nil
- }
- return n
-}
-
-func (r *reader) Read(p []byte) (int, error) {
- n := r.fill(p)
- if n < len(p) {
- if !r.scan() {
- if n == 0 {
- return 0, io.EOF
- }
- return n, nil
- }
- n += r.fill(p[n:])
- }
- return n, nil
-}
-
-type writer struct {
- io.Writer
- buf []byte
- color bool
-}
-
-func NewWriter(w io.Writer, color bool) io.WriteCloser {
- return &writer{Writer: w, color: color}
-}
-
-func (w *writer) Write(p []byte) (int, error) {
- buf := append(w.buf, p...)
- lines := bytes.Split(buf, []byte("\n"))
- if len(lines) > 0 {
- last := len(lines) - 1
- w.buf = lines[last]
- count := 0
- for _, line := range lines[:last] {
- n, err := w.Writer.Write([]byte(Clean(string(line), w.color) + "\n"))
- count += n
- if err != nil {
- return count, err
- }
- }
- }
- return len(p), nil
-}
-
-func (w *writer) Close() error {
- cl := Clean(string(w.buf), w.color)
- _, err := w.Writer.Write([]byte(cl))
- return err
-}
diff --git a/vendor/github.com/lunixbochs/vtclean/line.go b/vendor/github.com/lunixbochs/vtclean/line.go
deleted file mode 100644
index 66ee990b..00000000
--- a/vendor/github.com/lunixbochs/vtclean/line.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package vtclean
-
-type char struct {
- char byte
- vt100 []byte
-}
-
-func chars(p []byte) []char {
- tmp := make([]char, len(p))
- for i, v := range p {
- tmp[i].char = v
- }
- return tmp
-}
-
-type lineEdit struct {
- buf []char
- pos, size int
- vt100 []byte
-}
-
-func newLineEdit(length int) *lineEdit {
- return &lineEdit{buf: make([]char, length)}
-}
-
-func (l *lineEdit) Vt100(p []byte) {
- l.vt100 = p
-}
-
-func (l *lineEdit) Move(x int) {
- if x < 0 && l.pos <= -x {
- l.pos = 0
- } else if x > 0 && l.pos+x > l.size {
- l.pos = l.size
- } else {
- l.pos += x
- }
-}
-
-func (l *lineEdit) MoveAbs(x int) {
- if x < l.size {
- l.pos = x
- }
-}
-
-func (l *lineEdit) Write(p []byte) {
- c := chars(p)
- if len(c) > 0 {
- c[0].vt100 = l.vt100
- l.vt100 = nil
- }
- if len(l.buf)-l.pos < len(c) {
- l.buf = append(l.buf[:l.pos], c...)
- } else {
- copy(l.buf[l.pos:], c)
- }
- l.pos += len(c)
- if l.pos > l.size {
- l.size = l.pos
- }
-}
-
-func (l *lineEdit) Insert(p []byte) {
- c := chars(p)
- if len(c) > 0 {
- c[0].vt100 = l.vt100
- l.vt100 = nil
- }
- l.size += len(c)
- c = append(c, l.buf[l.pos:]...)
- l.buf = append(l.buf[:l.pos], c...)
-}
-
-func (l *lineEdit) Delete(n int) {
- most := l.size - l.pos
- if n > most {
- n = most
- }
- copy(l.buf[l.pos:], l.buf[l.pos+n:])
- l.size -= n
-}
-
-func (l *lineEdit) Clear() {
- for i := 0; i < len(l.buf); i++ {
- l.buf[i].char = ' '
- }
-}
-func (l *lineEdit) ClearLeft() {
- for i := 0; i < l.pos+1; i++ {
- l.buf[i].char = ' '
- }
-}
-func (l *lineEdit) ClearRight() {
- l.size = l.pos
-}
-
-func (l *lineEdit) Bytes() []byte {
- length := 0
- buf := l.buf[:l.size]
- for _, v := range buf {
- length += 1 + len(v.vt100)
- }
- tmp := make([]byte, 0, length)
- for _, v := range buf {
- tmp = append(tmp, v.vt100...)
- tmp = append(tmp, v.char)
- }
- return tmp
-}
-
-func (l *lineEdit) String() string {
- return string(l.Bytes())
-}
diff --git a/vendor/github.com/lunixbochs/vtclean/regex.txt b/vendor/github.com/lunixbochs/vtclean/regex.txt
deleted file mode 100644
index e55e7f29..00000000
--- a/vendor/github.com/lunixbochs/vtclean/regex.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-this is the source definitions for the scary escape code regex
-
-# from tests in Terminal.app, this regex should cover all basic \e[ and \e] cases
-^([\[\]]([\d\?]+)?(;[\d\?]+)*)?.
-
-# this catches any case the above does not
-# make sure to not include any special characters the main regex finds (like ?)
-\[[^a-zA-Z0-9@\?]+.
-
-# esc + paren + any single char
-[\(\)].
-
-# didn't re-check this one (not included)
-[\[K]\d+;\d+
diff --git a/vendor/github.com/lunixbochs/vtclean/vtclean.go b/vendor/github.com/lunixbochs/vtclean/vtclean.go
deleted file mode 100644
index fec492c6..00000000
--- a/vendor/github.com/lunixbochs/vtclean/vtclean.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package vtclean
-
-import (
- "bytes"
- "regexp"
- "strconv"
-)
-
-// see regex.txt for a slightly separated version of this regex
-var vt100re = regexp.MustCompile(`^\033([\[\]]([\d\?]+)?(;[\d\?]+)*)?(.)`)
-var vt100exc = regexp.MustCompile(`^\033(\[[^a-zA-Z0-9@\?]+|[\(\)]).`)
-
-// this is to handle the RGB escape generated by `tput initc 1 500 500 500`
-var vt100long = regexp.MustCompile(`^\033](\d+);([^\033]+)\033\\`)
-
-func Clean(line string, color bool) string {
- var edit = newLineEdit(len(line))
- lineb := []byte(line)
-
- hadColor := false
- for i := 0; i < len(lineb); {
- c := lineb[i]
- switch c {
- case '\b':
- edit.Move(-1)
- case '\033':
- // set terminal title
- if bytes.HasPrefix(lineb[i:], []byte("\x1b]0;")) {
- pos := bytes.Index(lineb[i:], []byte("\a"))
- if pos != -1 {
- i += pos + 1
- continue
- }
- }
- if m := vt100long.Find(lineb[i:]); m != nil {
- i += len(m)
- } else if m := vt100exc.Find(lineb[i:]); m != nil {
- i += len(m)
- } else if m := vt100re.FindSubmatch(lineb[i:]); m != nil {
- i += len(m[0])
- num := string(m[2])
- n, err := strconv.Atoi(num)
- if err != nil || n > 10000 {
- n = 1
- }
- switch m[4][0] {
- case 'm':
- if color {
- hadColor = true
- edit.Vt100(m[0])
- }
- case '@':
- edit.Insert(bytes.Repeat([]byte{' '}, n))
- case 'G':
- edit.MoveAbs(n)
- case 'C':
- edit.Move(n)
- case 'D':
- edit.Move(-n)
- case 'P':
- edit.Delete(n)
- case 'K':
- switch num {
- case "", "0":
- edit.ClearRight()
- case "1":
- edit.ClearLeft()
- case "2":
- edit.Clear()
- }
- }
- } else {
- i += 1
- }
- continue
- default:
- if c == '\n' || c >= ' ' {
- edit.Write([]byte{c})
- }
- }
- i += 1
- }
- out := edit.Bytes()
- if hadColor {
- out = append(out, []byte("\033[0m")...)
- }
- return string(out)
-}
diff --git a/vendor/github.com/lunixbochs/vtclean/vtclean/vtclean.go b/vendor/github.com/lunixbochs/vtclean/vtclean/vtclean.go
deleted file mode 100644
index 2c4f1778..00000000
--- a/vendor/github.com/lunixbochs/vtclean/vtclean/vtclean.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package main
-
-import (
- "flag"
- "github.com/lunixbochs/vtclean"
- "io"
- "os"
-)
-
-func main() {
- color := flag.Bool("color", false, "enable color")
- flag.Parse()
-
- stdout := vtclean.NewWriter(os.Stdout, *color)
- defer stdout.Close()
- io.Copy(stdout, os.Stdin)
-}
diff --git a/vendor/github.com/lunixbochs/vtclean/vtclean_test.go b/vendor/github.com/lunixbochs/vtclean/vtclean_test.go
deleted file mode 100644
index 9606746f..00000000
--- a/vendor/github.com/lunixbochs/vtclean/vtclean_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package vtclean
-
-import (
- "testing"
-)
-
-var tests = map[string]string{
- // "set title" special case
- "\x1b]0;asdjklfasdkljf\atest": "test",
-
- "hi man\x1b[3Gdude": "hi dude",
-
- // basic escape
- "\033[12laaa": "aaa",
- "\033[?1049laaa": "aaa",
-
- // for the second regex
- "a\033[!pa": "aa",
-
- // backspace and clear
- "aaa\b\bb": "aba",
- "aaa\b\b\033[K": "a",
- "aaa\b\b\033[1K": " a",
- "aaa\b\b\033[2Ka": " a ",
-
- // character movement
- "aaa\033[2Db": "aba",
- "aaa\033[4D\033[2Cb": "aab",
- "aaa\033[4D\033[1Cb": "aba",
- "aaa\033[1Cb": "aaab",
-
- // vt52
- "aaa\033D\033Db": "aba",
- "a\033@b": "ab",
-
- // delete and insert
- "aaa\b\b\033[2@": "a aa",
- "aaa\b\b\033[P": "aa",
- "aaa\b\b\033[4P": "a",
-
- // strip color
- "aaa \033[25;25mtest": "aaa test",
-
- "bbb \033]4;1;rgb:38/54/71\033\\test": "bbb test",
- "ccc \033]4;1;rgb:38/54/71test": "ccc rgb:38/54/71test",
-}
-
-var colorTests = map[string]string{
- "aaa \033[25;25mtest": "aaa \033[25;25mtest\x1b[0m",
-}
-
-func TestMain(t *testing.T) {
- for a, b := range tests {
- tmp := Clean(a, false)
- if tmp != b {
- t.Logf("Clean() failed: %#v -> %#v != %#v\n", a, tmp, b)
- t.Fail()
- }
- }
-}
-
-func TestColor(t *testing.T) {
- for a, b := range colorTests {
- tmp := Clean(a, true)
- if tmp != b {
- t.Logf("Clean() failed: %#v -> %#v != %#v\n", a, tmp, b)
- t.Fail()
- }
- }
-}
-
-func TestWriteBounds(t *testing.T) {
- l := &lineEdit{buf: nil}
- s := "asdf"
- l.Write([]byte(s))
- if l.String() != s {
- t.Fatalf("l.String(): %#v != %#v", l.String(), s)
- }
-}
diff --git a/vendor/github.com/magiconair/properties/.gitignore b/vendor/github.com/magiconair/properties/.gitignore
deleted file mode 100644
index e7081ff5..00000000
--- a/vendor/github.com/magiconair/properties/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-*.sublime-project
-*.sublime-workspace
-*.un~
-*.swp
-.idea/
-*.iml
diff --git a/vendor/github.com/magiconair/properties/.travis.yml b/vendor/github.com/magiconair/properties/.travis.yml
deleted file mode 100644
index 3e7c3d2c..00000000
--- a/vendor/github.com/magiconair/properties/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-language: go
-go:
- - 1.4.x
- - 1.5.x
- - 1.6.x
- - 1.7.x
- - 1.8.x
- - 1.9.x
- - "1.10.x"
- - tip
diff --git a/vendor/github.com/magiconair/properties/CHANGELOG.md b/vendor/github.com/magiconair/properties/CHANGELOG.md
deleted file mode 100644
index f83adc20..00000000
--- a/vendor/github.com/magiconair/properties/CHANGELOG.md
+++ /dev/null
@@ -1,131 +0,0 @@
-## Changelog
-
-### [1.8](https://github.com/magiconair/properties/tree/v1.8) - 15 May 2018
-
- * [PR #26](https://github.com/magiconair/properties/pull/26): Disable expansion during loading
-
- This adds the option to disable property expansion during loading.
-
- Thanks to [@kmala](https://github.com/kmala) for the patch.
-
-### [1.7.6](https://github.com/magiconair/properties/tree/v1.7.6) - 14 Feb 2018
-
- * [PR #29](https://github.com/magiconair/properties/pull/29): Reworked expansion logic to handle more complex cases.
-
- See PR for an example.
-
- Thanks to [@yobert](https://github.com/yobert) for the fix.
-
-### [1.7.5](https://github.com/magiconair/properties/tree/v1.7.5) - 13 Feb 2018
-
- * [PR #28](https://github.com/magiconair/properties/pull/28): Support duplicate expansions in the same value
-
- Values which expand the same key multiple times (e.g. `key=${a} ${a}`) will no longer fail
- with a `circular reference error`.
-
- Thanks to [@yobert](https://github.com/yobert) for the fix.
-
-### [1.7.4](https://github.com/magiconair/properties/tree/v1.7.4) - 31 Oct 2017
-
- * [Issue #23](https://github.com/magiconair/properties/issues/23): Ignore blank lines with whitespaces
-
- * [PR #24](https://github.com/magiconair/properties/pull/24): Update keys when DisableExpansion is enabled
-
- Thanks to [@mgurov](https://github.com/mgurov) for the fix.
-
-### [1.7.3](https://github.com/magiconair/properties/tree/v1.7.3) - 10 Jul 2017
-
- * [Issue #17](https://github.com/magiconair/properties/issues/17): Add [SetValue()](http://godoc.org/github.com/magiconair/properties#Properties.SetValue) method to set values generically
- * [Issue #22](https://github.com/magiconair/properties/issues/22): Add [LoadMap()](http://godoc.org/github.com/magiconair/properties#LoadMap) function to load properties from a string map
-
-### [1.7.2](https://github.com/magiconair/properties/tree/v1.7.2) - 20 Mar 2017
-
- * [Issue #15](https://github.com/magiconair/properties/issues/15): Drop gocheck dependency
- * [PR #21](https://github.com/magiconair/properties/pull/21): Add [Map()](http://godoc.org/github.com/magiconair/properties#Properties.Map) and [FilterFunc()](http://godoc.org/github.com/magiconair/properties#Properties.FilterFunc)
-
-### [1.7.1](https://github.com/magiconair/properties/tree/v1.7.1) - 13 Jan 2017
-
- * [Issue #14](https://github.com/magiconair/properties/issues/14): Decouple TestLoadExpandedFile from `$USER`
- * [PR #12](https://github.com/magiconair/properties/pull/12): Load from files and URLs
- * [PR #16](https://github.com/magiconair/properties/pull/16): Keep gofmt happy
- * [PR #18](https://github.com/magiconair/properties/pull/18): Fix Delete() function
-
-### [1.7.0](https://github.com/magiconair/properties/tree/v1.7.0) - 20 Mar 2016
-
- * [Issue #10](https://github.com/magiconair/properties/issues/10): Add [LoadURL,LoadURLs,MustLoadURL,MustLoadURLs](http://godoc.org/github.com/magiconair/properties#LoadURL) method to load properties from a URL.
- * [Issue #11](https://github.com/magiconair/properties/issues/11): Add [LoadString,MustLoadString](http://godoc.org/github.com/magiconair/properties#LoadString) method to load properties from an UTF8 string.
- * [PR #8](https://github.com/magiconair/properties/pull/8): Add [MustFlag](http://godoc.org/github.com/magiconair/properties#Properties.MustFlag) method to provide overrides via command line flags. (@pascaldekloe)
-
-### [1.6.0](https://github.com/magiconair/properties/tree/v1.6.0) - 11 Dec 2015
-
- * Add [Decode](http://godoc.org/github.com/magiconair/properties#Properties.Decode) method to populate struct from properties via tags.
-
-### [1.5.6](https://github.com/magiconair/properties/tree/v1.5.6) - 18 Oct 2015
-
- * Vendored in gopkg.in/check.v1
-
-### [1.5.5](https://github.com/magiconair/properties/tree/v1.5.5) - 31 Jul 2015
-
- * [PR #6](https://github.com/magiconair/properties/pull/6): Add [Delete](http://godoc.org/github.com/magiconair/properties#Properties.Delete) method to remove keys including comments. (@gerbenjacobs)
-
-### [1.5.4](https://github.com/magiconair/properties/tree/v1.5.4) - 23 Jun 2015
-
- * [Issue #5](https://github.com/magiconair/properties/issues/5): Allow disabling of property expansion [DisableExpansion](http://godoc.org/github.com/magiconair/properties#Properties.DisableExpansion). When property expansion is disabled Properties become a simple key/value store and don't check for circular references.
-
-### [1.5.3](https://github.com/magiconair/properties/tree/v1.5.3) - 02 Jun 2015
-
- * [Issue #4](https://github.com/magiconair/properties/issues/4): Maintain key order in [Filter()](http://godoc.org/github.com/magiconair/properties#Properties.Filter), [FilterPrefix()](http://godoc.org/github.com/magiconair/properties#Properties.FilterPrefix) and [FilterRegexp()](http://godoc.org/github.com/magiconair/properties#Properties.FilterRegexp)
-
-### [1.5.2](https://github.com/magiconair/properties/tree/v1.5.2) - 10 Apr 2015
-
- * [Issue #3](https://github.com/magiconair/properties/issues/3): Don't print comments in [WriteComment()](http://godoc.org/github.com/magiconair/properties#Properties.WriteComment) if they are all empty
- * Add clickable links to README
-
-### [1.5.1](https://github.com/magiconair/properties/tree/v1.5.1) - 08 Dec 2014
-
- * Added [GetParsedDuration()](http://godoc.org/github.com/magiconair/properties#Properties.GetParsedDuration) and [MustGetParsedDuration()](http://godoc.org/github.com/magiconair/properties#Properties.MustGetParsedDuration) for values specified compatible with
- [time.ParseDuration()](http://golang.org/pkg/time/#ParseDuration).
-
-### [1.5.0](https://github.com/magiconair/properties/tree/v1.5.0) - 18 Nov 2014
-
- * Added support for single and multi-line comments (reading, writing and updating)
- * The order of keys is now preserved
- * Calling [Set()](http://godoc.org/github.com/magiconair/properties#Properties.Set) with an empty key now silently ignores the call and does not create a new entry
- * Added a [MustSet()](http://godoc.org/github.com/magiconair/properties#Properties.MustSet) method
- * Migrated test library from launchpad.net/gocheck to [gopkg.in/check.v1](http://gopkg.in/check.v1)
-
-### [1.4.2](https://github.com/magiconair/properties/tree/v1.4.2) - 15 Nov 2014
-
- * [Issue #2](https://github.com/magiconair/properties/issues/2): Fixed goroutine leak in parser which created two lexers but cleaned up only one
-
-### [1.4.1](https://github.com/magiconair/properties/tree/v1.4.1) - 13 Nov 2014
-
- * [Issue #1](https://github.com/magiconair/properties/issues/1): Fixed bug in Keys() method which returned an empty string
-
-### [1.4.0](https://github.com/magiconair/properties/tree/v1.4.0) - 23 Sep 2014
-
- * Added [Keys()](http://godoc.org/github.com/magiconair/properties#Properties.Keys) to get the keys
- * Added [Filter()](http://godoc.org/github.com/magiconair/properties#Properties.Filter), [FilterRegexp()](http://godoc.org/github.com/magiconair/properties#Properties.FilterRegexp) and [FilterPrefix()](http://godoc.org/github.com/magiconair/properties#Properties.FilterPrefix) to get a subset of the properties
-
-### [1.3.0](https://github.com/magiconair/properties/tree/v1.3.0) - 18 Mar 2014
-
-* Added support for time.Duration
-* Made MustXXX() failure beha[ior configurable (log.Fatal, panic](https://github.com/magiconair/properties/tree/vior configurable (log.Fatal, panic) - custom)
-* Changed default of MustXXX() failure from panic to log.Fatal
-
-### [1.2.0](https://github.com/magiconair/properties/tree/v1.2.0) - 05 Mar 2014
-
-* Added MustGet... functions
-* Added support for int and uint with range checks on 32 bit platforms
-
-### [1.1.0](https://github.com/magiconair/properties/tree/v1.1.0) - 20 Jan 2014
-
-* Renamed from goproperties to properties
-* Added support for expansion of environment vars in
- filenames and value expressions
-* Fixed bug where value expressions were not at the
- start of the string
-
-### [1.0.0](https://github.com/magiconair/properties/tree/v1.0.0) - 7 Jan 2014
-
-* Initial release
diff --git a/vendor/github.com/magiconair/properties/LICENSE b/vendor/github.com/magiconair/properties/LICENSE
deleted file mode 100644
index b387087c..00000000
--- a/vendor/github.com/magiconair/properties/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-goproperties - properties file decoder for Go
-
-Copyright (c) 2013-2018 - Frank Schroeder
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/magiconair/properties/README.md b/vendor/github.com/magiconair/properties/README.md
deleted file mode 100644
index 2c05f290..00000000
--- a/vendor/github.com/magiconair/properties/README.md
+++ /dev/null
@@ -1,129 +0,0 @@
-[![](https://img.shields.io/github/tag/magiconair/properties.svg?style=flat-square&label=release)](https://github.com/magiconair/properties/releases)
-[![Travis CI Status](https://img.shields.io/travis/magiconair/properties.svg?branch=master&style=flat-square&label=travis)](https://travis-ci.org/magiconair/properties)
-[![Codeship CI Status](https://img.shields.io/codeship/16aaf660-f615-0135-b8f0-7e33b70920c0/master.svg?label=codeship&style=flat-square)](https://app.codeship.com/projects/274177")
-[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg?style=flat-square)](https://raw.githubusercontent.com/magiconair/properties/master/LICENSE)
-[![GoDoc](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](http://godoc.org/github.com/magiconair/properties)
-
-# Overview
-
-#### Please run `git pull --tags` to update the tags. See [below](#updated-git-tags) why.
-
-properties is a Go library for reading and writing properties files.
-
-It supports reading from multiple files or URLs and Spring style recursive
-property expansion of expressions like `${key}` to their corresponding value.
-Value expressions can refer to other keys like in `${key}` or to environment
-variables like in `${USER}`. Filenames can also contain environment variables
-like in `/home/${USER}/myapp.properties`.
-
-Properties can be decoded into structs, maps, arrays and values through
-struct tags.
-
-Comments and the order of keys are preserved. Comments can be modified
-and can be written to the output.
-
-The properties library supports both ISO-8859-1 and UTF-8 encoded data.
-
-Starting from version 1.3.0 the behavior of the MustXXX() functions is
-configurable by providing a custom `ErrorHandler` function. The default has
-changed from `panic` to `log.Fatal` but this is configurable and custom
-error handling functions can be provided. See the package documentation for
-details.
-
-Read the full documentation on [GoDoc](https://godoc.org/github.com/magiconair/properties) [![GoDoc](https://godoc.org/github.com/magiconair/properties?status.png)](https://godoc.org/github.com/magiconair/properties)
-
-## Getting Started
-
-```go
-import (
- "flag"
- "github.com/magiconair/properties"
-)
-
-func main() {
- // init from a file
- p := properties.MustLoadFile("${HOME}/config.properties", properties.UTF8)
-
- // or multiple files
- p = properties.MustLoadFiles([]string{
- "${HOME}/config.properties",
- "${HOME}/config-${USER}.properties",
- }, properties.UTF8, true)
-
- // or from a map
- p = properties.LoadMap(map[string]string{"key": "value", "abc": "def"})
-
- // or from a string
- p = properties.MustLoadString("key=value\nabc=def")
-
- // or from a URL
- p = properties.MustLoadURL("http://host/path")
-
- // or from multiple URLs
- p = properties.MustLoadURL([]string{
- "http://host/config",
- "http://host/config-${USER}",
- }, true)
-
- // or from flags
- p.MustFlag(flag.CommandLine)
-
- // get values through getters
- host := p.MustGetString("host")
- port := p.GetInt("port", 8080)
-
- // or through Decode
- type Config struct {
- Host string `properties:"host"`
- Port int `properties:"port,default=9000"`
- Accept []string `properties:"accept,default=image/png;image;gif"`
- Timeout time.Duration `properties:"timeout,default=5s"`
- }
- var cfg Config
- if err := p.Decode(&cfg); err != nil {
- log.Fatal(err)
- }
-}
-
-```
-
-## Installation and Upgrade
-
-```
-$ go get -u github.com/magiconair/properties
-```
-
-## License
-
-2 clause BSD license. See [LICENSE](https://github.com/magiconair/properties/blob/master/LICENSE) file for details.
-
-## ToDo
-
-* Dump contents with passwords and secrets obscured
-
-## Updated Git tags
-
-#### 13 Feb 2018
-
-I realized that all of the git tags I had pushed before v1.7.5 were lightweight tags
-and I've only recently learned that this doesn't play well with `git describe` 😞
-
-I have replaced all lightweight tags with signed tags using this script which should
-retain the commit date, name and email address. Please run `git pull --tags` to update them.
-
-Worst case you have to reclone the repo.
-
-```shell
-#!/bin/bash
-tag=$1
-echo "Updating $tag"
-date=$(git show ${tag}^0 --format=%aD | head -1)
-email=$(git show ${tag}^0 --format=%aE | head -1)
-name=$(git show ${tag}^0 --format=%aN | head -1)
-GIT_COMMITTER_DATE="$date" GIT_COMMITTER_NAME="$name" GIT_COMMITTER_EMAIL="$email" git tag -s -f ${tag} ${tag}^0 -m ${tag}
-```
-
-I apologize for the inconvenience.
-
-Frank
-
diff --git a/vendor/github.com/magiconair/properties/assert/assert.go b/vendor/github.com/magiconair/properties/assert/assert.go
deleted file mode 100644
index d0f27046..00000000
--- a/vendor/github.com/magiconair/properties/assert/assert.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package assert provides helper functions for testing.
-package assert
-
-import (
- "fmt"
- "path/filepath"
- "reflect"
- "regexp"
- "runtime"
- "strings"
- "testing"
-)
-
-// skip defines the default call depth
-const skip = 2
-
-// Equal asserts that got and want are equal as defined by
-// reflect.DeepEqual. The test fails with msg if they are not equal.
-func Equal(t *testing.T, got, want interface{}, msg ...string) {
- if x := equal(2, got, want, msg...); x != "" {
- fmt.Println(x)
- t.Fail()
- }
-}
-
-func equal(skip int, got, want interface{}, msg ...string) string {
- if !reflect.DeepEqual(got, want) {
- return fail(skip, "got %v want %v %s", got, want, strings.Join(msg, " "))
- }
- return ""
-}
-
-// Panic asserts that function fn() panics.
-// It assumes that recover() either returns a string or
-// an error and fails if the message does not match
-// the regular expression in 'matches'.
-func Panic(t *testing.T, fn func(), matches string) {
- if x := doesPanic(2, fn, matches); x != "" {
- fmt.Println(x)
- t.Fail()
- }
-}
-
-func doesPanic(skip int, fn func(), expr string) (err string) {
- defer func() {
- r := recover()
- if r == nil {
- err = fail(skip, "did not panic")
- return
- }
- var v string
- switch r.(type) {
- case error:
- v = r.(error).Error()
- case string:
- v = r.(string)
- }
- err = matches(skip, v, expr)
- }()
- fn()
- return ""
-}
-
-// Matches asserts that a value matches a given regular expression.
-func Matches(t *testing.T, value, expr string) {
- if x := matches(2, value, expr); x != "" {
- fmt.Println(x)
- t.Fail()
- }
-}
-
-func matches(skip int, value, expr string) string {
- ok, err := regexp.MatchString(expr, value)
- if err != nil {
- return fail(skip, "invalid pattern %q. %s", expr, err)
- }
- if !ok {
- return fail(skip, "got %s which does not match %s", value, expr)
- }
- return ""
-}
-
-func fail(skip int, format string, args ...interface{}) string {
- _, file, line, _ := runtime.Caller(skip)
- return fmt.Sprintf("\t%s:%d: %s\n", filepath.Base(file), line, fmt.Sprintf(format, args...))
-}
diff --git a/vendor/github.com/magiconair/properties/assert/assert_test.go b/vendor/github.com/magiconair/properties/assert/assert_test.go
deleted file mode 100644
index ddb6bf04..00000000
--- a/vendor/github.com/magiconair/properties/assert/assert_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package assert
-
-import "testing"
-
-func TestEqualEquals(t *testing.T) {
- if got, want := equal(2, "a", "a"), ""; got != want {
- t.Fatalf("got %q want %q", got, want)
- }
-}
-
-func TestEqualFails(t *testing.T) {
- if got, want := equal(2, "a", "b"), "\tassert_test.go:16: got a want b \n"; got != want {
- t.Fatalf("got %q want %q", got, want)
- }
-}
-
-func TestPanicPanics(t *testing.T) {
- if got, want := doesPanic(2, func() { panic("foo") }, ""), ""; got != want {
- t.Fatalf("got %q want %q", got, want)
- }
-}
-
-func TestPanicPanicsAndMatches(t *testing.T) {
- if got, want := doesPanic(2, func() { panic("foo") }, "foo"), ""; got != want {
- t.Fatalf("got %q want %q", got, want)
- }
-}
-
-func TestPanicPanicsAndDoesNotMatch(t *testing.T) {
- if got, want := doesPanic(2, func() { panic("foo") }, "bar"), "\tassert.go:62: got foo which does not match bar\n"; got != want {
- t.Fatalf("got %q want %q", got, want)
- }
-}
-
-func TestPanicPanicsAndDoesNotPanic(t *testing.T) {
- if got, want := doesPanic(2, func() {}, "bar"), "\tassert.go:65: did not panic\n"; got != want {
- t.Fatalf("got %q want %q", got, want)
- }
-}
-
-func TestMatchesMatches(t *testing.T) {
- if got, want := matches(2, "aaa", "a"), ""; got != want {
- t.Fatalf("got %q want %q", got, want)
- }
-}
-
-func TestMatchesDoesNotMatch(t *testing.T) {
- if got, want := matches(2, "aaa", "b"), "\tassert_test.go:52: got aaa which does not match b\n"; got != want {
- t.Fatalf("got %q want %q", got, want)
- }
-}
diff --git a/vendor/github.com/magiconair/properties/benchmark_test.go b/vendor/github.com/magiconair/properties/benchmark_test.go
deleted file mode 100644
index 62c7cc57..00000000
--- a/vendor/github.com/magiconair/properties/benchmark_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2013-2014 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "fmt"
- "testing"
-)
-
-// Benchmarks the decoder by creating a property file with 1000 key/value pairs.
-func BenchmarkLoad(b *testing.B) {
- input := ""
- for i := 0; i < 1000; i++ {
- input += fmt.Sprintf("key%d=value%d\n", i, i)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if _, err := Load([]byte(input), ISO_8859_1); err != nil {
- b.Fatal(err)
- }
- }
-}
diff --git a/vendor/github.com/magiconair/properties/decode.go b/vendor/github.com/magiconair/properties/decode.go
deleted file mode 100644
index 3ebf8049..00000000
--- a/vendor/github.com/magiconair/properties/decode.go
+++ /dev/null
@@ -1,289 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-// Decode assigns property values to exported fields of a struct.
-//
-// Decode traverses v recursively and returns an error if a value cannot be
-// converted to the field type or a required value is missing for a field.
-//
-// The following type dependent decodings are used:
-//
-// String, boolean, numeric fields have the value of the property key assigned.
-// The property key name is the name of the field. A different key and a default
-// value can be set in the field's tag. Fields without default value are
-// required. If the value cannot be converted to the field type an error is
-// returned.
-//
-// time.Duration fields have the result of time.ParseDuration() assigned.
-//
-// time.Time fields have the vaule of time.Parse() assigned. The default layout
-// is time.RFC3339 but can be set in the field's tag.
-//
-// Arrays and slices of string, boolean, numeric, time.Duration and time.Time
-// fields have the value interpreted as a comma separated list of values. The
-// individual values are trimmed of whitespace and empty values are ignored. A
-// default value can be provided as a semicolon separated list in the field's
-// tag.
-//
-// Struct fields are decoded recursively using the field name plus "." as
-// prefix. The prefix (without dot) can be overridden in the field's tag.
-// Default values are not supported in the field's tag. Specify them on the
-// fields of the inner struct instead.
-//
-// Map fields must have a key of type string and are decoded recursively by
-// using the field's name plus ".' as prefix and the next element of the key
-// name as map key. The prefix (without dot) can be overridden in the field's
-// tag. Default values are not supported.
-//
-// Examples:
-//
-// // Field is ignored.
-// Field int `properties:"-"`
-//
-// // Field is assigned value of 'Field'.
-// Field int
-//
-// // Field is assigned value of 'myName'.
-// Field int `properties:"myName"`
-//
-// // Field is assigned value of key 'myName' and has a default
-// // value 15 if the key does not exist.
-// Field int `properties:"myName,default=15"`
-//
-// // Field is assigned value of key 'Field' and has a default
-// // value 15 if the key does not exist.
-// Field int `properties:",default=15"`
-//
-// // Field is assigned value of key 'date' and the date
-// // is in format 2006-01-02
-// Field time.Time `properties:"date,layout=2006-01-02"`
-//
-// // Field is assigned the non-empty and whitespace trimmed
-// // values of key 'Field' split by commas.
-// Field []string
-//
-// // Field is assigned the non-empty and whitespace trimmed
-// // values of key 'Field' split by commas and has a default
-// // value ["a", "b", "c"] if the key does not exist.
-// Field []string `properties:",default=a;b;c"`
-//
-// // Field is decoded recursively with "Field." as key prefix.
-// Field SomeStruct
-//
-// // Field is decoded recursively with "myName." as key prefix.
-// Field SomeStruct `properties:"myName"`
-//
-// // Field is decoded recursively with "Field." as key prefix
-// // and the next dotted element of the key as map key.
-// Field map[string]string
-//
-// // Field is decoded recursively with "myName." as key prefix
-// // and the next dotted element of the key as map key.
-// Field map[string]string `properties:"myName"`
-func (p *Properties) Decode(x interface{}) error {
- t, v := reflect.TypeOf(x), reflect.ValueOf(x)
- if t.Kind() != reflect.Ptr || v.Elem().Type().Kind() != reflect.Struct {
- return fmt.Errorf("not a pointer to struct: %s", t)
- }
- if err := dec(p, "", nil, nil, v); err != nil {
- return err
- }
- return nil
-}
-
-func dec(p *Properties, key string, def *string, opts map[string]string, v reflect.Value) error {
- t := v.Type()
-
- // value returns the property value for key or the default if provided.
- value := func() (string, error) {
- if val, ok := p.Get(key); ok {
- return val, nil
- }
- if def != nil {
- return *def, nil
- }
- return "", fmt.Errorf("missing required key %s", key)
- }
-
- // conv converts a string to a value of the given type.
- conv := func(s string, t reflect.Type) (val reflect.Value, err error) {
- var v interface{}
-
- switch {
- case isDuration(t):
- v, err = time.ParseDuration(s)
-
- case isTime(t):
- layout := opts["layout"]
- if layout == "" {
- layout = time.RFC3339
- }
- v, err = time.Parse(layout, s)
-
- case isBool(t):
- v, err = boolVal(s), nil
-
- case isString(t):
- v, err = s, nil
-
- case isFloat(t):
- v, err = strconv.ParseFloat(s, 64)
-
- case isInt(t):
- v, err = strconv.ParseInt(s, 10, 64)
-
- case isUint(t):
- v, err = strconv.ParseUint(s, 10, 64)
-
- default:
- return reflect.Zero(t), fmt.Errorf("unsupported type %s", t)
- }
- if err != nil {
- return reflect.Zero(t), err
- }
- return reflect.ValueOf(v).Convert(t), nil
- }
-
- // keydef returns the property key and the default value based on the
- // name of the struct field and the options in the tag.
- keydef := func(f reflect.StructField) (string, *string, map[string]string) {
- _key, _opts := parseTag(f.Tag.Get("properties"))
-
- var _def *string
- if d, ok := _opts["default"]; ok {
- _def = &d
- }
- if _key != "" {
- return _key, _def, _opts
- }
- return f.Name, _def, _opts
- }
-
- switch {
- case isDuration(t) || isTime(t) || isBool(t) || isString(t) || isFloat(t) || isInt(t) || isUint(t):
- s, err := value()
- if err != nil {
- return err
- }
- val, err := conv(s, t)
- if err != nil {
- return err
- }
- v.Set(val)
-
- case isPtr(t):
- return dec(p, key, def, opts, v.Elem())
-
- case isStruct(t):
- for i := 0; i < v.NumField(); i++ {
- fv := v.Field(i)
- fk, def, opts := keydef(t.Field(i))
- if !fv.CanSet() {
- return fmt.Errorf("cannot set %s", t.Field(i).Name)
- }
- if fk == "-" {
- continue
- }
- if key != "" {
- fk = key + "." + fk
- }
- if err := dec(p, fk, def, opts, fv); err != nil {
- return err
- }
- }
- return nil
-
- case isArray(t):
- val, err := value()
- if err != nil {
- return err
- }
- vals := split(val, ";")
- a := reflect.MakeSlice(t, 0, len(vals))
- for _, s := range vals {
- val, err := conv(s, t.Elem())
- if err != nil {
- return err
- }
- a = reflect.Append(a, val)
- }
- v.Set(a)
-
- case isMap(t):
- valT := t.Elem()
- m := reflect.MakeMap(t)
- for postfix := range p.FilterStripPrefix(key + ".").m {
- pp := strings.SplitN(postfix, ".", 2)
- mk, mv := pp[0], reflect.New(valT)
- if err := dec(p, key+"."+mk, nil, nil, mv); err != nil {
- return err
- }
- m.SetMapIndex(reflect.ValueOf(mk), mv.Elem())
- }
- v.Set(m)
-
- default:
- return fmt.Errorf("unsupported type %s", t)
- }
- return nil
-}
-
-// split splits a string on sep, trims whitespace of elements
-// and omits empty elements
-func split(s string, sep string) []string {
- var a []string
- for _, v := range strings.Split(s, sep) {
- if v = strings.TrimSpace(v); v != "" {
- a = append(a, v)
- }
- }
- return a
-}
-
-// parseTag parses a "key,k=v,k=v,..."
-func parseTag(tag string) (key string, opts map[string]string) {
- opts = map[string]string{}
- for i, s := range strings.Split(tag, ",") {
- if i == 0 {
- key = s
- continue
- }
-
- pp := strings.SplitN(s, "=", 2)
- if len(pp) == 1 {
- opts[pp[0]] = ""
- } else {
- opts[pp[0]] = pp[1]
- }
- }
- return key, opts
-}
-
-func isArray(t reflect.Type) bool { return t.Kind() == reflect.Array || t.Kind() == reflect.Slice }
-func isBool(t reflect.Type) bool { return t.Kind() == reflect.Bool }
-func isDuration(t reflect.Type) bool { return t == reflect.TypeOf(time.Second) }
-func isMap(t reflect.Type) bool { return t.Kind() == reflect.Map }
-func isPtr(t reflect.Type) bool { return t.Kind() == reflect.Ptr }
-func isString(t reflect.Type) bool { return t.Kind() == reflect.String }
-func isStruct(t reflect.Type) bool { return t.Kind() == reflect.Struct }
-func isTime(t reflect.Type) bool { return t == reflect.TypeOf(time.Time{}) }
-func isFloat(t reflect.Type) bool {
- return t.Kind() == reflect.Float32 || t.Kind() == reflect.Float64
-}
-func isInt(t reflect.Type) bool {
- return t.Kind() == reflect.Int || t.Kind() == reflect.Int8 || t.Kind() == reflect.Int16 || t.Kind() == reflect.Int32 || t.Kind() == reflect.Int64
-}
-func isUint(t reflect.Type) bool {
- return t.Kind() == reflect.Uint || t.Kind() == reflect.Uint8 || t.Kind() == reflect.Uint16 || t.Kind() == reflect.Uint32 || t.Kind() == reflect.Uint64
-}
diff --git a/vendor/github.com/magiconair/properties/decode_test.go b/vendor/github.com/magiconair/properties/decode_test.go
deleted file mode 100644
index 9431b832..00000000
--- a/vendor/github.com/magiconair/properties/decode_test.go
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "reflect"
- "testing"
- "time"
-)
-
-func TestDecodeValues(t *testing.T) {
- type S struct {
- S string
- BT bool
- BF bool
- I int
- I8 int8
- I16 int16
- I32 int32
- I64 int64
- U uint
- U8 uint8
- U16 uint16
- U32 uint32
- U64 uint64
- F32 float32
- F64 float64
- D time.Duration
- TM time.Time
- }
- in := `
- S=abc
- BT=true
- BF=false
- I=-1
- I8=-8
- I16=-16
- I32=-32
- I64=-64
- U=1
- U8=8
- U16=16
- U32=32
- U64=64
- F32=3.2
- F64=6.4
- D=5s
- TM=2015-01-02T12:34:56Z
- `
- out := &S{
- S: "abc",
- BT: true,
- BF: false,
- I: -1,
- I8: -8,
- I16: -16,
- I32: -32,
- I64: -64,
- U: 1,
- U8: 8,
- U16: 16,
- U32: 32,
- U64: 64,
- F32: 3.2,
- F64: 6.4,
- D: 5 * time.Second,
- TM: tm(t, time.RFC3339, "2015-01-02T12:34:56Z"),
- }
- testDecode(t, in, &S{}, out)
-}
-
-func TestDecodeValueDefaults(t *testing.T) {
- type S struct {
- S string `properties:",default=abc"`
- BT bool `properties:",default=true"`
- BF bool `properties:",default=false"`
- I int `properties:",default=-1"`
- I8 int8 `properties:",default=-8"`
- I16 int16 `properties:",default=-16"`
- I32 int32 `properties:",default=-32"`
- I64 int64 `properties:",default=-64"`
- U uint `properties:",default=1"`
- U8 uint8 `properties:",default=8"`
- U16 uint16 `properties:",default=16"`
- U32 uint32 `properties:",default=32"`
- U64 uint64 `properties:",default=64"`
- F32 float32 `properties:",default=3.2"`
- F64 float64 `properties:",default=6.4"`
- D time.Duration `properties:",default=5s"`
- TM time.Time `properties:",default=2015-01-02T12:34:56Z"`
- }
- out := &S{
- S: "abc",
- BT: true,
- BF: false,
- I: -1,
- I8: -8,
- I16: -16,
- I32: -32,
- I64: -64,
- U: 1,
- U8: 8,
- U16: 16,
- U32: 32,
- U64: 64,
- F32: 3.2,
- F64: 6.4,
- D: 5 * time.Second,
- TM: tm(t, time.RFC3339, "2015-01-02T12:34:56Z"),
- }
- testDecode(t, "", &S{}, out)
-}
-
-func TestDecodeArrays(t *testing.T) {
- type S struct {
- S []string
- B []bool
- I []int
- I8 []int8
- I16 []int16
- I32 []int32
- I64 []int64
- U []uint
- U8 []uint8
- U16 []uint16
- U32 []uint32
- U64 []uint64
- F32 []float32
- F64 []float64
- D []time.Duration
- TM []time.Time
- }
- in := `
- S=a;b
- B=true;false
- I=-1;-2
- I8=-8;-9
- I16=-16;-17
- I32=-32;-33
- I64=-64;-65
- U=1;2
- U8=8;9
- U16=16;17
- U32=32;33
- U64=64;65
- F32=3.2;3.3
- F64=6.4;6.5
- D=4s;5s
- TM=2015-01-01T00:00:00Z;2016-01-01T00:00:00Z
- `
- out := &S{
- S: []string{"a", "b"},
- B: []bool{true, false},
- I: []int{-1, -2},
- I8: []int8{-8, -9},
- I16: []int16{-16, -17},
- I32: []int32{-32, -33},
- I64: []int64{-64, -65},
- U: []uint{1, 2},
- U8: []uint8{8, 9},
- U16: []uint16{16, 17},
- U32: []uint32{32, 33},
- U64: []uint64{64, 65},
- F32: []float32{3.2, 3.3},
- F64: []float64{6.4, 6.5},
- D: []time.Duration{4 * time.Second, 5 * time.Second},
- TM: []time.Time{tm(t, time.RFC3339, "2015-01-01T00:00:00Z"), tm(t, time.RFC3339, "2016-01-01T00:00:00Z")},
- }
- testDecode(t, in, &S{}, out)
-}
-
-func TestDecodeArrayDefaults(t *testing.T) {
- type S struct {
- S []string `properties:",default=a;b"`
- B []bool `properties:",default=true;false"`
- I []int `properties:",default=-1;-2"`
- I8 []int8 `properties:",default=-8;-9"`
- I16 []int16 `properties:",default=-16;-17"`
- I32 []int32 `properties:",default=-32;-33"`
- I64 []int64 `properties:",default=-64;-65"`
- U []uint `properties:",default=1;2"`
- U8 []uint8 `properties:",default=8;9"`
- U16 []uint16 `properties:",default=16;17"`
- U32 []uint32 `properties:",default=32;33"`
- U64 []uint64 `properties:",default=64;65"`
- F32 []float32 `properties:",default=3.2;3.3"`
- F64 []float64 `properties:",default=6.4;6.5"`
- D []time.Duration `properties:",default=4s;5s"`
- TM []time.Time `properties:",default=2015-01-01T00:00:00Z;2016-01-01T00:00:00Z"`
- }
- out := &S{
- S: []string{"a", "b"},
- B: []bool{true, false},
- I: []int{-1, -2},
- I8: []int8{-8, -9},
- I16: []int16{-16, -17},
- I32: []int32{-32, -33},
- I64: []int64{-64, -65},
- U: []uint{1, 2},
- U8: []uint8{8, 9},
- U16: []uint16{16, 17},
- U32: []uint32{32, 33},
- U64: []uint64{64, 65},
- F32: []float32{3.2, 3.3},
- F64: []float64{6.4, 6.5},
- D: []time.Duration{4 * time.Second, 5 * time.Second},
- TM: []time.Time{tm(t, time.RFC3339, "2015-01-01T00:00:00Z"), tm(t, time.RFC3339, "2016-01-01T00:00:00Z")},
- }
- testDecode(t, "", &S{}, out)
-}
-
-func TestDecodeSkipUndef(t *testing.T) {
- type S struct {
- X string `properties:"-"`
- Undef string `properties:",default=some value"`
- }
- in := `X=ignore`
- out := &S{"", "some value"}
- testDecode(t, in, &S{}, out)
-}
-
-func TestDecodeStruct(t *testing.T) {
- type A struct {
- S string
- T string `properties:"t"`
- U string `properties:"u,default=uuu"`
- }
- type S struct {
- A A
- B A `properties:"b"`
- }
- in := `
- A.S=sss
- A.t=ttt
- b.S=SSS
- b.t=TTT
- `
- out := &S{
- A{S: "sss", T: "ttt", U: "uuu"},
- A{S: "SSS", T: "TTT", U: "uuu"},
- }
- testDecode(t, in, &S{}, out)
-}
-
-func TestDecodeMap(t *testing.T) {
- type S struct {
- A string `properties:"a"`
- }
- type X struct {
- A map[string]string
- B map[string][]string
- C map[string]map[string]string
- D map[string]S
- E map[string]int
- F map[string]int `properties:"-"`
- }
- in := `
- A.foo=bar
- A.bar=bang
- B.foo=a;b;c
- B.bar=1;2;3
- C.foo.one=1
- C.foo.two=2
- C.bar.three=3
- C.bar.four=4
- D.foo.a=bar
- `
- out := &X{
- A: map[string]string{"foo": "bar", "bar": "bang"},
- B: map[string][]string{"foo": []string{"a", "b", "c"}, "bar": []string{"1", "2", "3"}},
- C: map[string]map[string]string{"foo": map[string]string{"one": "1", "two": "2"}, "bar": map[string]string{"three": "3", "four": "4"}},
- D: map[string]S{"foo": S{"bar"}},
- E: map[string]int{},
- }
- testDecode(t, in, &X{}, out)
-}
-
-func testDecode(t *testing.T, in string, v, out interface{}) {
- p, err := parse(in)
- if err != nil {
- t.Fatalf("got %v want nil", err)
- }
- if err := p.Decode(v); err != nil {
- t.Fatalf("got %v want nil", err)
- }
- if got, want := v, out; !reflect.DeepEqual(got, want) {
- t.Fatalf("\ngot %+v\nwant %+v", got, want)
- }
-}
-
-func tm(t *testing.T, layout, s string) time.Time {
- tm, err := time.Parse(layout, s)
- if err != nil {
- t.Fatalf("got %v want nil", err)
- }
- return tm
-}
diff --git a/vendor/github.com/magiconair/properties/doc.go b/vendor/github.com/magiconair/properties/doc.go
deleted file mode 100644
index f8822da2..00000000
--- a/vendor/github.com/magiconair/properties/doc.go
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package properties provides functions for reading and writing
-// ISO-8859-1 and UTF-8 encoded .properties files and has
-// support for recursive property expansion.
-//
-// Java properties files are ISO-8859-1 encoded and use Unicode
-// literals for characters outside the ISO character set. Unicode
-// literals can be used in UTF-8 encoded properties files but
-// aren't necessary.
-//
-// To load a single properties file use MustLoadFile():
-//
-// p := properties.MustLoadFile(filename, properties.UTF8)
-//
-// To load multiple properties files use MustLoadFiles()
-// which loads the files in the given order and merges the
-// result. Missing properties files can be ignored if the
-// 'ignoreMissing' flag is set to true.
-//
-// Filenames can contain environment variables which are expanded
-// before loading.
-//
-// f1 := "/etc/myapp/myapp.conf"
-// f2 := "/home/${USER}/myapp.conf"
-// p := MustLoadFiles([]string{f1, f2}, properties.UTF8, true)
-//
-// All of the different key/value delimiters ' ', ':' and '=' are
-// supported as well as the comment characters '!' and '#' and
-// multi-line values.
-//
-// ! this is a comment
-// # and so is this
-//
-// # the following expressions are equal
-// key value
-// key=value
-// key:value
-// key = value
-// key : value
-// key = val\
-// ue
-//
-// Properties stores all comments preceding a key and provides
-// GetComments() and SetComments() methods to retrieve and
-// update them. The convenience functions GetComment() and
-// SetComment() allow access to the last comment. The
-// WriteComment() method writes properties files including
-// the comments and with the keys in the original order.
-// This can be used for sanitizing properties files.
-//
-// Property expansion is recursive and circular references
-// and malformed expressions are not allowed and cause an
-// error. Expansion of environment variables is supported.
-//
-// # standard property
-// key = value
-//
-// # property expansion: key2 = value
-// key2 = ${key}
-//
-// # recursive expansion: key3 = value
-// key3 = ${key2}
-//
-// # circular reference (error)
-// key = ${key}
-//
-// # malformed expression (error)
-// key = ${ke
-//
-// # refers to the users' home dir
-// home = ${HOME}
-//
-// # local key takes precedence over env var: u = foo
-// USER = foo
-// u = ${USER}
-//
-// The default property expansion format is ${key} but can be
-// changed by setting different pre- and postfix values on the
-// Properties object.
-//
-// p := properties.NewProperties()
-// p.Prefix = "#["
-// p.Postfix = "]#"
-//
-// Properties provides convenience functions for getting typed
-// values with default values if the key does not exist or the
-// type conversion failed.
-//
-// # Returns true if the value is either "1", "on", "yes" or "true"
-// # Returns false for every other value and the default value if
-// # the key does not exist.
-// v = p.GetBool("key", false)
-//
-// # Returns the value if the key exists and the format conversion
-// # was successful. Otherwise, the default value is returned.
-// v = p.GetInt64("key", 999)
-// v = p.GetUint64("key", 999)
-// v = p.GetFloat64("key", 123.0)
-// v = p.GetString("key", "def")
-// v = p.GetDuration("key", 999)
-//
-// As an alternative properties may be applied with the standard
-// library's flag implementation at any time.
-//
-// # Standard configuration
-// v = flag.Int("key", 999, "help message")
-// flag.Parse()
-//
-// # Merge p into the flag set
-// p.MustFlag(flag.CommandLine)
-//
-// Properties provides several MustXXX() convenience functions
-// which will terminate the app if an error occurs. The behavior
-// of the failure is configurable and the default is to call
-// log.Fatal(err). To have the MustXXX() functions panic instead
-// of logging the error set a different ErrorHandler before
-// you use the Properties package.
-//
-// properties.ErrorHandler = properties.PanicHandler
-//
-// # Will panic instead of logging an error
-// p := properties.MustLoadFile("config.properties")
-//
-// You can also provide your own ErrorHandler function. The only requirement
-// is that the error handler function must exit after handling the error.
-//
-// properties.ErrorHandler = func(err error) {
-// fmt.Println(err)
-// os.Exit(1)
-// }
-//
-// # Will write to stdout and then exit
-// p := properties.MustLoadFile("config.properties")
-//
-// Properties can also be loaded into a struct via the `Decode`
-// method, e.g.
-//
-// type S struct {
-// A string `properties:"a,default=foo"`
-// D time.Duration `properties:"timeout,default=5s"`
-// E time.Time `properties:"expires,layout=2006-01-02,default=2015-01-01"`
-// }
-//
-// See `Decode()` method for the full documentation.
-//
-// The following documents provide a description of the properties
-// file format.
-//
-// http://en.wikipedia.org/wiki/.properties
-//
-// http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load%28java.io.Reader%29
-//
-package properties
diff --git a/vendor/github.com/magiconair/properties/example_test.go b/vendor/github.com/magiconair/properties/example_test.go
deleted file mode 100644
index 4d0bbea7..00000000
--- a/vendor/github.com/magiconair/properties/example_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "fmt"
- "log"
-)
-
-func ExampleLoad_iso88591() {
- buf := []byte("key = ISO-8859-1 value with unicode literal \\u2318 and umlaut \xE4") // 0xE4 == ä
- p, _ := Load(buf, ISO_8859_1)
- v, ok := p.Get("key")
- fmt.Println(ok)
- fmt.Println(v)
- // Output:
- // true
- // ISO-8859-1 value with unicode literal ⌘ and umlaut ä
-}
-
-func ExampleLoad_utf8() {
- p, _ := Load([]byte("key = UTF-8 value with unicode character ⌘ and umlaut ä"), UTF8)
- v, ok := p.Get("key")
- fmt.Println(ok)
- fmt.Println(v)
- // Output:
- // true
- // UTF-8 value with unicode character ⌘ and umlaut ä
-}
-
-func ExampleProperties_GetBool() {
- var input = `
- key=1
- key2=On
- key3=YES
- key4=true`
- p, _ := Load([]byte(input), ISO_8859_1)
- fmt.Println(p.GetBool("key", false))
- fmt.Println(p.GetBool("key2", false))
- fmt.Println(p.GetBool("key3", false))
- fmt.Println(p.GetBool("key4", false))
- fmt.Println(p.GetBool("keyX", false))
- // Output:
- // true
- // true
- // true
- // true
- // false
-}
-
-func ExampleProperties_GetString() {
- p, _ := Load([]byte("key=value"), ISO_8859_1)
- v := p.GetString("another key", "default value")
- fmt.Println(v)
- // Output:
- // default value
-}
-
-func Example() {
- // Decode some key/value pairs with expressions
- p, err := Load([]byte("key=value\nkey2=${key}"), ISO_8859_1)
- if err != nil {
- log.Fatal(err)
- }
-
- // Get a valid key
- if v, ok := p.Get("key"); ok {
- fmt.Println(v)
- }
-
- // Get an invalid key
- if _, ok := p.Get("does not exist"); !ok {
- fmt.Println("invalid key")
- }
-
- // Get a key with a default value
- v := p.GetString("does not exist", "some value")
- fmt.Println(v)
-
- // Dump the expanded key/value pairs of the Properties
- fmt.Println("Expanded key/value pairs")
- fmt.Println(p)
-
- // Output:
- // value
- // invalid key
- // some value
- // Expanded key/value pairs
- // key = value
- // key2 = value
-}
diff --git a/vendor/github.com/magiconair/properties/integrate.go b/vendor/github.com/magiconair/properties/integrate.go
deleted file mode 100644
index 74d38dc6..00000000
--- a/vendor/github.com/magiconair/properties/integrate.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import "flag"
-
-// MustFlag sets flags that are skipped by dst.Parse when p contains
-// the respective key for flag.Flag.Name.
-//
-// It's use is recommended with command line arguments as in:
-// flag.Parse()
-// p.MustFlag(flag.CommandLine)
-func (p *Properties) MustFlag(dst *flag.FlagSet) {
- m := make(map[string]*flag.Flag)
- dst.VisitAll(func(f *flag.Flag) {
- m[f.Name] = f
- })
- dst.Visit(func(f *flag.Flag) {
- delete(m, f.Name) // overridden
- })
-
- for name, f := range m {
- v, ok := p.Get(name)
- if !ok {
- continue
- }
-
- if err := f.Value.Set(v); err != nil {
- ErrorHandler(err)
- }
- }
-}
diff --git a/vendor/github.com/magiconair/properties/integrate_test.go b/vendor/github.com/magiconair/properties/integrate_test.go
deleted file mode 100644
index 5ed74e24..00000000
--- a/vendor/github.com/magiconair/properties/integrate_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "flag"
- "fmt"
- "testing"
-)
-
-// TestFlag verifies Properties.MustFlag without flag.FlagSet.Parse
-func TestFlag(t *testing.T) {
- f := flag.NewFlagSet("src", flag.PanicOnError)
- gotS := f.String("s", "?", "string flag")
- gotI := f.Int("i", -1, "int flag")
-
- p := NewProperties()
- p.MustSet("s", "t")
- p.MustSet("i", "9")
- p.MustFlag(f)
-
- if want := "t"; *gotS != want {
- t.Errorf("Got string s=%q, want %q", *gotS, want)
- }
- if want := 9; *gotI != want {
- t.Errorf("Got int i=%d, want %d", *gotI, want)
- }
-}
-
-// TestFlagOverride verifies Properties.MustFlag with flag.FlagSet.Parse.
-func TestFlagOverride(t *testing.T) {
- f := flag.NewFlagSet("src", flag.PanicOnError)
- gotA := f.Int("a", 1, "remain default")
- gotB := f.Int("b", 2, "customized")
- gotC := f.Int("c", 3, "overridden")
-
- if err := f.Parse([]string{"-c", "4"}); err != nil {
- t.Fatal(err)
- }
-
- p := NewProperties()
- p.MustSet("b", "5")
- p.MustSet("c", "6")
- p.MustFlag(f)
-
- if want := 1; *gotA != want {
- t.Errorf("Got remain default a=%d, want %d", *gotA, want)
- }
- if want := 5; *gotB != want {
- t.Errorf("Got customized b=%d, want %d", *gotB, want)
- }
- if want := 4; *gotC != want {
- t.Errorf("Got overridden c=%d, want %d", *gotC, want)
- }
-}
-
-func ExampleProperties_MustFlag() {
- x := flag.Int("x", 0, "demo customize")
- y := flag.Int("y", 0, "demo override")
-
- // Demo alternative for flag.Parse():
- flag.CommandLine.Parse([]string{"-y", "10"})
- fmt.Printf("flagged as x=%d, y=%d\n", *x, *y)
-
- p := NewProperties()
- p.MustSet("x", "7")
- p.MustSet("y", "42") // note discard
- p.MustFlag(flag.CommandLine)
- fmt.Printf("configured to x=%d, y=%d\n", *x, *y)
-
- // Output:
- // flagged as x=0, y=10
- // configured to x=7, y=10
-}
diff --git a/vendor/github.com/magiconair/properties/lex.go b/vendor/github.com/magiconair/properties/lex.go
deleted file mode 100644
index 367166d5..00000000
--- a/vendor/github.com/magiconair/properties/lex.go
+++ /dev/null
@@ -1,407 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-//
-// Parts of the lexer are from the template/text/parser package
-// For these parts the following applies:
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file of the go 1.2
-// distribution.
-
-package properties
-
-import (
- "fmt"
- "strconv"
- "strings"
- "unicode/utf8"
-)
-
-// item represents a token or text string returned from the scanner.
-type item struct {
- typ itemType // The type of this item.
- pos int // The starting position, in bytes, of this item in the input string.
- val string // The value of this item.
-}
-
-func (i item) String() string {
- switch {
- case i.typ == itemEOF:
- return "EOF"
- case i.typ == itemError:
- return i.val
- case len(i.val) > 10:
- return fmt.Sprintf("%.10q...", i.val)
- }
- return fmt.Sprintf("%q", i.val)
-}
-
-// itemType identifies the type of lex items.
-type itemType int
-
-const (
- itemError itemType = iota // error occurred; value is text of error
- itemEOF
- itemKey // a key
- itemValue // a value
- itemComment // a comment
-)
-
-// defines a constant for EOF
-const eof = -1
-
-// permitted whitespace characters space, FF and TAB
-const whitespace = " \f\t"
-
-// stateFn represents the state of the scanner as a function that returns the next state.
-type stateFn func(*lexer) stateFn
-
-// lexer holds the state of the scanner.
-type lexer struct {
- input string // the string being scanned
- state stateFn // the next lexing function to enter
- pos int // current position in the input
- start int // start position of this item
- width int // width of last rune read from input
- lastPos int // position of most recent item returned by nextItem
- runes []rune // scanned runes for this item
- items chan item // channel of scanned items
-}
-
-// next returns the next rune in the input.
-func (l *lexer) next() rune {
- if l.pos >= len(l.input) {
- l.width = 0
- return eof
- }
- r, w := utf8.DecodeRuneInString(l.input[l.pos:])
- l.width = w
- l.pos += l.width
- return r
-}
-
-// peek returns but does not consume the next rune in the input.
-func (l *lexer) peek() rune {
- r := l.next()
- l.backup()
- return r
-}
-
-// backup steps back one rune. Can only be called once per call of next.
-func (l *lexer) backup() {
- l.pos -= l.width
-}
-
-// emit passes an item back to the client.
-func (l *lexer) emit(t itemType) {
- i := item{t, l.start, string(l.runes)}
- l.items <- i
- l.start = l.pos
- l.runes = l.runes[:0]
-}
-
-// ignore skips over the pending input before this point.
-func (l *lexer) ignore() {
- l.start = l.pos
-}
-
-// appends the rune to the current value
-func (l *lexer) appendRune(r rune) {
- l.runes = append(l.runes, r)
-}
-
-// accept consumes the next rune if it's from the valid set.
-func (l *lexer) accept(valid string) bool {
- if strings.ContainsRune(valid, l.next()) {
- return true
- }
- l.backup()
- return false
-}
-
-// acceptRun consumes a run of runes from the valid set.
-func (l *lexer) acceptRun(valid string) {
- for strings.ContainsRune(valid, l.next()) {
- }
- l.backup()
-}
-
-// acceptRunUntil consumes a run of runes up to a terminator.
-func (l *lexer) acceptRunUntil(term rune) {
- for term != l.next() {
- }
- l.backup()
-}
-
-// hasText returns true if the current parsed text is not empty.
-func (l *lexer) isNotEmpty() bool {
- return l.pos > l.start
-}
-
-// lineNumber reports which line we're on, based on the position of
-// the previous item returned by nextItem. Doing it this way
-// means we don't have to worry about peek double counting.
-func (l *lexer) lineNumber() int {
- return 1 + strings.Count(l.input[:l.lastPos], "\n")
-}
-
-// errorf returns an error token and terminates the scan by passing
-// back a nil pointer that will be the next state, terminating l.nextItem.
-func (l *lexer) errorf(format string, args ...interface{}) stateFn {
- l.items <- item{itemError, l.start, fmt.Sprintf(format, args...)}
- return nil
-}
-
-// nextItem returns the next item from the input.
-func (l *lexer) nextItem() item {
- i := <-l.items
- l.lastPos = i.pos
- return i
-}
-
-// lex creates a new scanner for the input string.
-func lex(input string) *lexer {
- l := &lexer{
- input: input,
- items: make(chan item),
- runes: make([]rune, 0, 32),
- }
- go l.run()
- return l
-}
-
-// run runs the state machine for the lexer.
-func (l *lexer) run() {
- for l.state = lexBeforeKey(l); l.state != nil; {
- l.state = l.state(l)
- }
-}
-
-// state functions
-
-// lexBeforeKey scans until a key begins.
-func lexBeforeKey(l *lexer) stateFn {
- switch r := l.next(); {
- case isEOF(r):
- l.emit(itemEOF)
- return nil
-
- case isEOL(r):
- l.ignore()
- return lexBeforeKey
-
- case isComment(r):
- return lexComment
-
- case isWhitespace(r):
- l.ignore()
- return lexBeforeKey
-
- default:
- l.backup()
- return lexKey
- }
-}
-
-// lexComment scans a comment line. The comment character has already been scanned.
-func lexComment(l *lexer) stateFn {
- l.acceptRun(whitespace)
- l.ignore()
- for {
- switch r := l.next(); {
- case isEOF(r):
- l.ignore()
- l.emit(itemEOF)
- return nil
- case isEOL(r):
- l.emit(itemComment)
- return lexBeforeKey
- default:
- l.appendRune(r)
- }
- }
-}
-
-// lexKey scans the key up to a delimiter
-func lexKey(l *lexer) stateFn {
- var r rune
-
-Loop:
- for {
- switch r = l.next(); {
-
- case isEscape(r):
- err := l.scanEscapeSequence()
- if err != nil {
- return l.errorf(err.Error())
- }
-
- case isEndOfKey(r):
- l.backup()
- break Loop
-
- case isEOF(r):
- break Loop
-
- default:
- l.appendRune(r)
- }
- }
-
- if len(l.runes) > 0 {
- l.emit(itemKey)
- }
-
- if isEOF(r) {
- l.emit(itemEOF)
- return nil
- }
-
- return lexBeforeValue
-}
-
-// lexBeforeValue scans the delimiter between key and value.
-// Leading and trailing whitespace is ignored.
-// We expect to be just after the key.
-func lexBeforeValue(l *lexer) stateFn {
- l.acceptRun(whitespace)
- l.accept(":=")
- l.acceptRun(whitespace)
- l.ignore()
- return lexValue
-}
-
-// lexValue scans text until the end of the line. We expect to be just after the delimiter.
-func lexValue(l *lexer) stateFn {
- for {
- switch r := l.next(); {
- case isEscape(r):
- if isEOL(l.peek()) {
- l.next()
- l.acceptRun(whitespace)
- } else {
- err := l.scanEscapeSequence()
- if err != nil {
- return l.errorf(err.Error())
- }
- }
-
- case isEOL(r):
- l.emit(itemValue)
- l.ignore()
- return lexBeforeKey
-
- case isEOF(r):
- l.emit(itemValue)
- l.emit(itemEOF)
- return nil
-
- default:
- l.appendRune(r)
- }
- }
-}
-
-// scanEscapeSequence scans either one of the escaped characters
-// or a unicode literal. We expect to be after the escape character.
-func (l *lexer) scanEscapeSequence() error {
- switch r := l.next(); {
-
- case isEscapedCharacter(r):
- l.appendRune(decodeEscapedCharacter(r))
- return nil
-
- case atUnicodeLiteral(r):
- return l.scanUnicodeLiteral()
-
- case isEOF(r):
- return fmt.Errorf("premature EOF")
-
- // silently drop the escape character and append the rune as is
- default:
- l.appendRune(r)
- return nil
- }
-}
-
-// scans a unicode literal in the form \uXXXX. We expect to be after the \u.
-func (l *lexer) scanUnicodeLiteral() error {
- // scan the digits
- d := make([]rune, 4)
- for i := 0; i < 4; i++ {
- d[i] = l.next()
- if d[i] == eof || !strings.ContainsRune("0123456789abcdefABCDEF", d[i]) {
- return fmt.Errorf("invalid unicode literal")
- }
- }
-
- // decode the digits into a rune
- r, err := strconv.ParseInt(string(d), 16, 0)
- if err != nil {
- return err
- }
-
- l.appendRune(rune(r))
- return nil
-}
-
-// decodeEscapedCharacter returns the unescaped rune. We expect to be after the escape character.
-func decodeEscapedCharacter(r rune) rune {
- switch r {
- case 'f':
- return '\f'
- case 'n':
- return '\n'
- case 'r':
- return '\r'
- case 't':
- return '\t'
- default:
- return r
- }
-}
-
-// atUnicodeLiteral reports whether we are at a unicode literal.
-// The escape character has already been consumed.
-func atUnicodeLiteral(r rune) bool {
- return r == 'u'
-}
-
-// isComment reports whether we are at the start of a comment.
-func isComment(r rune) bool {
- return r == '#' || r == '!'
-}
-
-// isEndOfKey reports whether the rune terminates the current key.
-func isEndOfKey(r rune) bool {
- return strings.ContainsRune(" \f\t\r\n:=", r)
-}
-
-// isEOF reports whether we are at EOF.
-func isEOF(r rune) bool {
- return r == eof
-}
-
-// isEOL reports whether we are at a new line character.
-func isEOL(r rune) bool {
- return r == '\n' || r == '\r'
-}
-
-// isEscape reports whether the rune is the escape character which
-// prefixes unicode literals and other escaped characters.
-func isEscape(r rune) bool {
- return r == '\\'
-}
-
-// isEscapedCharacter reports whether we are at one of the characters that need escaping.
-// The escape character has already been consumed.
-func isEscapedCharacter(r rune) bool {
- return strings.ContainsRune(" :=fnrt", r)
-}
-
-// isWhitespace reports whether the rune is a whitespace character.
-func isWhitespace(r rune) bool {
- return strings.ContainsRune(whitespace, r)
-}
diff --git a/vendor/github.com/magiconair/properties/load.go b/vendor/github.com/magiconair/properties/load.go
deleted file mode 100644
index c8e1b580..00000000
--- a/vendor/github.com/magiconair/properties/load.go
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "fmt"
- "io/ioutil"
- "net/http"
- "os"
- "strings"
-)
-
-// Encoding specifies encoding of the input data.
-type Encoding uint
-
-const (
- // utf8Default is a private placeholder for the zero value of Encoding to
- // ensure that it has the correct meaning. UTF8 is the default encoding but
- // was assigned a non-zero value which cannot be changed without breaking
- // existing code. Clients should continue to use the public constants.
- utf8Default Encoding = iota
-
- // UTF8 interprets the input data as UTF-8.
- UTF8
-
- // ISO_8859_1 interprets the input data as ISO-8859-1.
- ISO_8859_1
-)
-
-type Loader struct {
- // Encoding determines how the data from files and byte buffers
- // is interpreted. For URLs the Content-Type header is used
- // to determine the encoding of the data.
- Encoding Encoding
-
- // DisableExpansion configures the property expansion of the
- // returned property object. When set to true, the property values
- // will not be expanded and the Property object will not be checked
- // for invalid expansion expressions.
- DisableExpansion bool
-
- // IgnoreMissing configures whether missing files or URLs which return
- // 404 are reported as errors. When set to true, missing files and 404
- // status codes are not reported as errors.
- IgnoreMissing bool
-}
-
-// Load reads a buffer into a Properties struct.
-func (l *Loader) LoadBytes(buf []byte) (*Properties, error) {
- return l.loadBytes(buf, l.Encoding)
-}
-
-// LoadAll reads the content of multiple URLs or files in the given order into
-// a Properties struct. If IgnoreMissing is true then a 404 status code or
-// missing file will not be reported as error. Encoding sets the encoding for
-// files. For the URLs see LoadURL for the Content-Type header and the
-// encoding.
-func (l *Loader) LoadAll(names []string) (*Properties, error) {
- all := NewProperties()
- for _, name := range names {
- n, err := expandName(name)
- if err != nil {
- return nil, err
- }
-
- var p *Properties
- switch {
- case strings.HasPrefix(n, "http://"):
- p, err = l.LoadURL(n)
- case strings.HasPrefix(n, "https://"):
- p, err = l.LoadURL(n)
- default:
- p, err = l.LoadFile(n)
- }
- if err != nil {
- return nil, err
- }
- all.Merge(p)
- }
-
- all.DisableExpansion = l.DisableExpansion
- if all.DisableExpansion {
- return all, nil
- }
- return all, all.check()
-}
-
-// LoadFile reads a file into a Properties struct.
-// If IgnoreMissing is true then a missing file will not be
-// reported as error.
-func (l *Loader) LoadFile(filename string) (*Properties, error) {
- data, err := ioutil.ReadFile(filename)
- if err != nil {
- if l.IgnoreMissing && os.IsNotExist(err) {
- LogPrintf("properties: %s not found. skipping", filename)
- return NewProperties(), nil
- }
- return nil, err
- }
- return l.loadBytes(data, l.Encoding)
-}
-
-// LoadURL reads the content of the URL into a Properties struct.
-//
-// The encoding is determined via the Content-Type header which
-// should be set to 'text/plain'. If the 'charset' parameter is
-// missing, 'iso-8859-1' or 'latin1' the encoding is set to
-// ISO-8859-1. If the 'charset' parameter is set to 'utf-8' the
-// encoding is set to UTF-8. A missing content type header is
-// interpreted as 'text/plain; charset=utf-8'.
-func (l *Loader) LoadURL(url string) (*Properties, error) {
- resp, err := http.Get(url)
- if err != nil {
- return nil, fmt.Errorf("properties: error fetching %q. %s", url, err)
- }
-
- if resp.StatusCode == 404 && l.IgnoreMissing {
- LogPrintf("properties: %s returned %d. skipping", url, resp.StatusCode)
- return NewProperties(), nil
- }
-
- if resp.StatusCode != 200 {
- return nil, fmt.Errorf("properties: %s returned %d", url, resp.StatusCode)
- }
-
- body, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return nil, fmt.Errorf("properties: %s error reading response. %s", url, err)
- }
- defer resp.Body.Close()
-
- ct := resp.Header.Get("Content-Type")
- var enc Encoding
- switch strings.ToLower(ct) {
- case "text/plain", "text/plain; charset=iso-8859-1", "text/plain; charset=latin1":
- enc = ISO_8859_1
- case "", "text/plain; charset=utf-8":
- enc = UTF8
- default:
- return nil, fmt.Errorf("properties: invalid content type %s", ct)
- }
-
- return l.loadBytes(body, enc)
-}
-
-func (l *Loader) loadBytes(buf []byte, enc Encoding) (*Properties, error) {
- p, err := parse(convert(buf, enc))
- if err != nil {
- return nil, err
- }
- p.DisableExpansion = l.DisableExpansion
- if p.DisableExpansion {
- return p, nil
- }
- return p, p.check()
-}
-
-// Load reads a buffer into a Properties struct.
-func Load(buf []byte, enc Encoding) (*Properties, error) {
- l := &Loader{Encoding: enc}
- return l.LoadBytes(buf)
-}
-
-// LoadString reads an UTF8 string into a properties struct.
-func LoadString(s string) (*Properties, error) {
- l := &Loader{Encoding: UTF8}
- return l.LoadBytes([]byte(s))
-}
-
-// LoadMap creates a new Properties struct from a string map.
-func LoadMap(m map[string]string) *Properties {
- p := NewProperties()
- for k, v := range m {
- p.Set(k, v)
- }
- return p
-}
-
-// LoadFile reads a file into a Properties struct.
-func LoadFile(filename string, enc Encoding) (*Properties, error) {
- l := &Loader{Encoding: enc}
- return l.LoadAll([]string{filename})
-}
-
-// LoadFiles reads multiple files in the given order into
-// a Properties struct. If 'ignoreMissing' is true then
-// non-existent files will not be reported as error.
-func LoadFiles(filenames []string, enc Encoding, ignoreMissing bool) (*Properties, error) {
- l := &Loader{Encoding: enc, IgnoreMissing: ignoreMissing}
- return l.LoadAll(filenames)
-}
-
-// LoadURL reads the content of the URL into a Properties struct.
-// See Loader#LoadURL for details.
-func LoadURL(url string) (*Properties, error) {
- l := &Loader{Encoding: UTF8}
- return l.LoadAll([]string{url})
-}
-
-// LoadURLs reads the content of multiple URLs in the given order into a
-// Properties struct. If IgnoreMissing is true then a 404 status code will
-// not be reported as error. See Loader#LoadURL for the Content-Type header
-// and the encoding.
-func LoadURLs(urls []string, ignoreMissing bool) (*Properties, error) {
- l := &Loader{Encoding: UTF8, IgnoreMissing: ignoreMissing}
- return l.LoadAll(urls)
-}
-
-// LoadAll reads the content of multiple URLs or files in the given order into a
-// Properties struct. If 'ignoreMissing' is true then a 404 status code or missing file will
-// not be reported as error. Encoding sets the encoding for files. For the URLs please see
-// LoadURL for the Content-Type header and the encoding.
-func LoadAll(names []string, enc Encoding, ignoreMissing bool) (*Properties, error) {
- l := &Loader{Encoding: enc, IgnoreMissing: ignoreMissing}
- return l.LoadAll(names)
-}
-
-// MustLoadString reads an UTF8 string into a Properties struct and
-// panics on error.
-func MustLoadString(s string) *Properties {
- return must(LoadString(s))
-}
-
-// MustLoadFile reads a file into a Properties struct and
-// panics on error.
-func MustLoadFile(filename string, enc Encoding) *Properties {
- return must(LoadFile(filename, enc))
-}
-
-// MustLoadFiles reads multiple files in the given order into
-// a Properties struct and panics on error. If 'ignoreMissing'
-// is true then non-existent files will not be reported as error.
-func MustLoadFiles(filenames []string, enc Encoding, ignoreMissing bool) *Properties {
- return must(LoadFiles(filenames, enc, ignoreMissing))
-}
-
-// MustLoadURL reads the content of a URL into a Properties struct and
-// panics on error.
-func MustLoadURL(url string) *Properties {
- return must(LoadURL(url))
-}
-
-// MustLoadURLs reads the content of multiple URLs in the given order into a
-// Properties struct and panics on error. If 'ignoreMissing' is true then a 404
-// status code will not be reported as error.
-func MustLoadURLs(urls []string, ignoreMissing bool) *Properties {
- return must(LoadURLs(urls, ignoreMissing))
-}
-
-// MustLoadAll reads the content of multiple URLs or files in the given order into a
-// Properties struct. If 'ignoreMissing' is true then a 404 status code or missing file will
-// not be reported as error. Encoding sets the encoding for files. For the URLs please see
-// LoadURL for the Content-Type header and the encoding. It panics on error.
-func MustLoadAll(names []string, enc Encoding, ignoreMissing bool) *Properties {
- return must(LoadAll(names, enc, ignoreMissing))
-}
-
-func must(p *Properties, err error) *Properties {
- if err != nil {
- ErrorHandler(err)
- }
- return p
-}
-
-// expandName expands ${ENV_VAR} expressions in a name.
-// If the environment variable does not exist then it will be replaced
-// with an empty string. Malformed expressions like "${ENV_VAR" will
-// be reported as error.
-func expandName(name string) (string, error) {
- return expand(name, []string{}, "${", "}", make(map[string]string))
-}
-
-// Interprets a byte buffer either as an ISO-8859-1 or UTF-8 encoded string.
-// For ISO-8859-1 we can convert each byte straight into a rune since the
-// first 256 unicode code points cover ISO-8859-1.
-func convert(buf []byte, enc Encoding) string {
- switch enc {
- case utf8Default, UTF8:
- return string(buf)
- case ISO_8859_1:
- runes := make([]rune, len(buf))
- for i, b := range buf {
- runes[i] = rune(b)
- }
- return string(runes)
- default:
- ErrorHandler(fmt.Errorf("unsupported encoding %v", enc))
- }
- panic("ErrorHandler should exit")
-}
diff --git a/vendor/github.com/magiconair/properties/load_test.go b/vendor/github.com/magiconair/properties/load_test.go
deleted file mode 100644
index db28b993..00000000
--- a/vendor/github.com/magiconair/properties/load_test.go
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "fmt"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "os"
- "strings"
- "testing"
-
- "github.com/magiconair/properties/assert"
-)
-
-func TestEncoding(t *testing.T) {
- if got, want := utf8Default, Encoding(0); got != want {
- t.Fatalf("got encoding %d want %d", got, want)
- }
- if got, want := UTF8, Encoding(1); got != want {
- t.Fatalf("got encoding %d want %d", got, want)
- }
- if got, want := ISO_8859_1, Encoding(2); got != want {
- t.Fatalf("got encoding %d want %d", got, want)
- }
-}
-
-func TestLoadFailsWithNotExistingFile(t *testing.T) {
- _, err := LoadFile("doesnotexist.properties", ISO_8859_1)
- assert.Equal(t, err != nil, true, "")
- assert.Matches(t, err.Error(), "open.*no such file or directory")
-}
-
-func TestLoadFilesFailsOnNotExistingFile(t *testing.T) {
- _, err := LoadFile("doesnotexist.properties", ISO_8859_1)
- assert.Equal(t, err != nil, true, "")
- assert.Matches(t, err.Error(), "open.*no such file or directory")
-}
-
-func TestLoadFilesDoesNotFailOnNotExistingFileAndIgnoreMissing(t *testing.T) {
- p, err := LoadFiles([]string{"doesnotexist.properties"}, ISO_8859_1, true)
- assert.Equal(t, err, nil)
- assert.Equal(t, p.Len(), 0)
-}
-
-func TestLoadString(t *testing.T) {
- x := "key=äüö"
- p1 := MustLoadString(x)
- p2 := must(Load([]byte(x), UTF8))
- assert.Equal(t, p1, p2)
-}
-
-func TestLoadMap(t *testing.T) {
- // LoadMap does not guarantee the same import order
- // of keys every time since map access is randomized.
- // Therefore, we need to compare the generated maps.
- m := map[string]string{"key": "value", "abc": "def"}
- assert.Equal(t, LoadMap(m).Map(), m)
-}
-
-func TestLoadFile(t *testing.T) {
- tf := make(tempFiles, 0)
- defer tf.removeAll()
-
- filename := tf.makeFile("key=value")
- p := MustLoadFile(filename, ISO_8859_1)
-
- assert.Equal(t, p.Len(), 1)
- assertKeyValues(t, "", p, "key", "value")
-}
-
-func TestLoadFiles(t *testing.T) {
- tf := make(tempFiles, 0)
- defer tf.removeAll()
-
- filename := tf.makeFile("key=value")
- filename2 := tf.makeFile("key2=value2")
- p := MustLoadFiles([]string{filename, filename2}, ISO_8859_1, false)
- assertKeyValues(t, "", p, "key", "value", "key2", "value2")
-}
-
-func TestLoadExpandedFile(t *testing.T) {
- tf := make(tempFiles, 0)
- defer tf.removeAll()
-
- if err := os.Setenv("_VARX", "some-value"); err != nil {
- t.Fatal(err)
- }
- filename := tf.makeFilePrefix(os.Getenv("_VARX"), "key=value")
- filename = strings.Replace(filename, os.Getenv("_VARX"), "${_VARX}", -1)
- p := MustLoadFile(filename, ISO_8859_1)
- assertKeyValues(t, "", p, "key", "value")
-}
-
-func TestLoadFilesAndIgnoreMissing(t *testing.T) {
- tf := make(tempFiles, 0)
- defer tf.removeAll()
-
- filename := tf.makeFile("key=value")
- filename2 := tf.makeFile("key2=value2")
- p := MustLoadFiles([]string{filename, filename + "foo", filename2, filename2 + "foo"}, ISO_8859_1, true)
- assertKeyValues(t, "", p, "key", "value", "key2", "value2")
-}
-
-func TestLoadURL(t *testing.T) {
- srv := testServer()
- defer srv.Close()
- p := MustLoadURL(srv.URL + "/a")
- assertKeyValues(t, "", p, "key", "value")
-}
-
-func TestLoadURLs(t *testing.T) {
- srv := testServer()
- defer srv.Close()
- p := MustLoadURLs([]string{srv.URL + "/a", srv.URL + "/b"}, false)
- assertKeyValues(t, "", p, "key", "value", "key2", "value2")
-}
-
-func TestLoadURLsAndFailMissing(t *testing.T) {
- srv := testServer()
- defer srv.Close()
- p, err := LoadURLs([]string{srv.URL + "/a", srv.URL + "/c"}, false)
- assert.Equal(t, p, (*Properties)(nil))
- assert.Matches(t, err.Error(), ".*returned 404.*")
-}
-
-func TestLoadURLsAndIgnoreMissing(t *testing.T) {
- srv := testServer()
- defer srv.Close()
- p := MustLoadURLs([]string{srv.URL + "/a", srv.URL + "/b", srv.URL + "/c"}, true)
- assertKeyValues(t, "", p, "key", "value", "key2", "value2")
-}
-
-func TestLoadURLEncoding(t *testing.T) {
- srv := testServer()
- defer srv.Close()
-
- uris := []string{"/none", "/utf8", "/plain", "/latin1", "/iso88591"}
- for i, uri := range uris {
- p := MustLoadURL(srv.URL + uri)
- assert.Equal(t, p.GetString("key", ""), "äöü", fmt.Sprintf("%d", i))
- }
-}
-
-func TestLoadURLFailInvalidEncoding(t *testing.T) {
- srv := testServer()
- defer srv.Close()
-
- p, err := LoadURL(srv.URL + "/json")
- assert.Equal(t, p, (*Properties)(nil))
- assert.Matches(t, err.Error(), ".*invalid content type.*")
-}
-
-func TestLoadAll(t *testing.T) {
- tf := make(tempFiles, 0)
- defer tf.removeAll()
-
- filename := tf.makeFile("key=value")
- filename2 := tf.makeFile("key2=value3")
- filename3 := tf.makeFile("key=value4")
- srv := testServer()
- defer srv.Close()
- p := MustLoadAll([]string{filename, filename2, srv.URL + "/a", srv.URL + "/b", filename3}, UTF8, false)
- assertKeyValues(t, "", p, "key", "value4", "key2", "value2")
-}
-
-type tempFiles []string
-
-func (tf *tempFiles) removeAll() {
- for _, path := range *tf {
- err := os.Remove(path)
- if err != nil {
- fmt.Printf("os.Remove: %v", err)
- }
- }
-}
-
-func (tf *tempFiles) makeFile(data string) string {
- return tf.makeFilePrefix("properties", data)
-}
-
-func (tf *tempFiles) makeFilePrefix(prefix, data string) string {
- f, err := ioutil.TempFile("", prefix)
- if err != nil {
- panic("ioutil.TempFile: " + err.Error())
- }
-
- // remember the temp file so that we can remove it later
- *tf = append(*tf, f.Name())
-
- n, err := fmt.Fprint(f, data)
- if err != nil {
- panic("fmt.Fprintln: " + err.Error())
- }
- if n != len(data) {
- panic(fmt.Sprintf("Data size mismatch. expected=%d wrote=%d\n", len(data), n))
- }
-
- err = f.Close()
- if err != nil {
- panic("f.Close: " + err.Error())
- }
-
- return f.Name()
-}
-
-func testServer() *httptest.Server {
- return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- send := func(data []byte, contentType string) {
- w.Header().Set("Content-Type", contentType)
- if _, err := w.Write(data); err != nil {
- panic(err)
- }
- }
-
- utf8 := []byte("key=äöü")
- iso88591 := []byte{0x6b, 0x65, 0x79, 0x3d, 0xe4, 0xf6, 0xfc} // key=äöü
-
- switch r.RequestURI {
- case "/a":
- send([]byte("key=value"), "")
- case "/b":
- send([]byte("key2=value2"), "")
- case "/none":
- send(utf8, "")
- case "/utf8":
- send(utf8, "text/plain; charset=utf-8")
- case "/json":
- send(utf8, "application/json; charset=utf-8")
- case "/plain":
- send(iso88591, "text/plain")
- case "/latin1":
- send(iso88591, "text/plain; charset=latin1")
- case "/iso88591":
- send(iso88591, "text/plain; charset=iso-8859-1")
- default:
- w.WriteHeader(404)
- }
- }))
-}
diff --git a/vendor/github.com/magiconair/properties/parser.go b/vendor/github.com/magiconair/properties/parser.go
deleted file mode 100644
index cdc4a803..00000000
--- a/vendor/github.com/magiconair/properties/parser.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "fmt"
- "runtime"
-)
-
-type parser struct {
- lex *lexer
-}
-
-func parse(input string) (properties *Properties, err error) {
- p := &parser{lex: lex(input)}
- defer p.recover(&err)
-
- properties = NewProperties()
- key := ""
- comments := []string{}
-
- for {
- token := p.expectOneOf(itemComment, itemKey, itemEOF)
- switch token.typ {
- case itemEOF:
- goto done
- case itemComment:
- comments = append(comments, token.val)
- continue
- case itemKey:
- key = token.val
- if _, ok := properties.m[key]; !ok {
- properties.k = append(properties.k, key)
- }
- }
-
- token = p.expectOneOf(itemValue, itemEOF)
- if len(comments) > 0 {
- properties.c[key] = comments
- comments = []string{}
- }
- switch token.typ {
- case itemEOF:
- properties.m[key] = ""
- goto done
- case itemValue:
- properties.m[key] = token.val
- }
- }
-
-done:
- return properties, nil
-}
-
-func (p *parser) errorf(format string, args ...interface{}) {
- format = fmt.Sprintf("properties: Line %d: %s", p.lex.lineNumber(), format)
- panic(fmt.Errorf(format, args...))
-}
-
-func (p *parser) expect(expected itemType) (token item) {
- token = p.lex.nextItem()
- if token.typ != expected {
- p.unexpected(token)
- }
- return token
-}
-
-func (p *parser) expectOneOf(expected ...itemType) (token item) {
- token = p.lex.nextItem()
- for _, v := range expected {
- if token.typ == v {
- return token
- }
- }
- p.unexpected(token)
- panic("unexpected token")
-}
-
-func (p *parser) unexpected(token item) {
- p.errorf(token.String())
-}
-
-// recover is the handler that turns panics into returns from the top level of Parse.
-func (p *parser) recover(errp *error) {
- e := recover()
- if e != nil {
- if _, ok := e.(runtime.Error); ok {
- panic(e)
- }
- *errp = e.(error)
- }
- return
-}
diff --git a/vendor/github.com/magiconair/properties/properties.go b/vendor/github.com/magiconair/properties/properties.go
deleted file mode 100644
index cb3d1a33..00000000
--- a/vendor/github.com/magiconair/properties/properties.go
+++ /dev/null
@@ -1,833 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-// BUG(frank): Set() does not check for invalid unicode literals since this is currently handled by the lexer.
-// BUG(frank): Write() does not allow to configure the newline character. Therefore, on Windows LF is used.
-
-import (
- "fmt"
- "io"
- "log"
- "os"
- "regexp"
- "strconv"
- "strings"
- "time"
- "unicode/utf8"
-)
-
-const maxExpansionDepth = 64
-
-// ErrorHandlerFunc defines the type of function which handles failures
-// of the MustXXX() functions. An error handler function must exit
-// the application after handling the error.
-type ErrorHandlerFunc func(error)
-
-// ErrorHandler is the function which handles failures of the MustXXX()
-// functions. The default is LogFatalHandler.
-var ErrorHandler ErrorHandlerFunc = LogFatalHandler
-
-// LogHandlerFunc defines the function prototype for logging errors.
-type LogHandlerFunc func(fmt string, args ...interface{})
-
-// LogPrintf defines a log handler which uses log.Printf.
-var LogPrintf LogHandlerFunc = log.Printf
-
-// LogFatalHandler handles the error by logging a fatal error and exiting.
-func LogFatalHandler(err error) {
- log.Fatal(err)
-}
-
-// PanicHandler handles the error by panicking.
-func PanicHandler(err error) {
- panic(err)
-}
-
-// -----------------------------------------------------------------------------
-
-// A Properties contains the key/value pairs from the properties input.
-// All values are stored in unexpanded form and are expanded at runtime
-type Properties struct {
- // Pre-/Postfix for property expansion.
- Prefix string
- Postfix string
-
- // DisableExpansion controls the expansion of properties on Get()
- // and the check for circular references on Set(). When set to
- // true Properties behaves like a simple key/value store and does
- // not check for circular references on Get() or on Set().
- DisableExpansion bool
-
- // Stores the key/value pairs
- m map[string]string
-
- // Stores the comments per key.
- c map[string][]string
-
- // Stores the keys in order of appearance.
- k []string
-}
-
-// NewProperties creates a new Properties struct with the default
-// configuration for "${key}" expressions.
-func NewProperties() *Properties {
- return &Properties{
- Prefix: "${",
- Postfix: "}",
- m: map[string]string{},
- c: map[string][]string{},
- k: []string{},
- }
-}
-
-// Load reads a buffer into the given Properties struct.
-func (p *Properties) Load(buf []byte, enc Encoding) error {
- l := &Loader{Encoding: enc, DisableExpansion: p.DisableExpansion}
- newProperties, err := l.LoadBytes(buf)
- if err != nil {
- return err
- }
- p.Merge(newProperties)
- return nil
-}
-
-// Get returns the expanded value for the given key if exists.
-// Otherwise, ok is false.
-func (p *Properties) Get(key string) (value string, ok bool) {
- v, ok := p.m[key]
- if p.DisableExpansion {
- return v, ok
- }
- if !ok {
- return "", false
- }
-
- expanded, err := p.expand(key, v)
-
- // we guarantee that the expanded value is free of
- // circular references and malformed expressions
- // so we panic if we still get an error here.
- if err != nil {
- ErrorHandler(fmt.Errorf("%s in %q", err, key+" = "+v))
- }
-
- return expanded, true
-}
-
-// MustGet returns the expanded value for the given key if exists.
-// Otherwise, it panics.
-func (p *Properties) MustGet(key string) string {
- if v, ok := p.Get(key); ok {
- return v
- }
- ErrorHandler(invalidKeyError(key))
- panic("ErrorHandler should exit")
-}
-
-// ----------------------------------------------------------------------------
-
-// ClearComments removes the comments for all keys.
-func (p *Properties) ClearComments() {
- p.c = map[string][]string{}
-}
-
-// ----------------------------------------------------------------------------
-
-// GetComment returns the last comment before the given key or an empty string.
-func (p *Properties) GetComment(key string) string {
- comments, ok := p.c[key]
- if !ok || len(comments) == 0 {
- return ""
- }
- return comments[len(comments)-1]
-}
-
-// ----------------------------------------------------------------------------
-
-// GetComments returns all comments that appeared before the given key or nil.
-func (p *Properties) GetComments(key string) []string {
- if comments, ok := p.c[key]; ok {
- return comments
- }
- return nil
-}
-
-// ----------------------------------------------------------------------------
-
-// SetComment sets the comment for the key.
-func (p *Properties) SetComment(key, comment string) {
- p.c[key] = []string{comment}
-}
-
-// ----------------------------------------------------------------------------
-
-// SetComments sets the comments for the key. If the comments are nil then
-// all comments for this key are deleted.
-func (p *Properties) SetComments(key string, comments []string) {
- if comments == nil {
- delete(p.c, key)
- return
- }
- p.c[key] = comments
-}
-
-// ----------------------------------------------------------------------------
-
-// GetBool checks if the expanded value is one of '1', 'yes',
-// 'true' or 'on' if the key exists. The comparison is case-insensitive.
-// If the key does not exist the default value is returned.
-func (p *Properties) GetBool(key string, def bool) bool {
- v, err := p.getBool(key)
- if err != nil {
- return def
- }
- return v
-}
-
-// MustGetBool checks if the expanded value is one of '1', 'yes',
-// 'true' or 'on' if the key exists. The comparison is case-insensitive.
-// If the key does not exist the function panics.
-func (p *Properties) MustGetBool(key string) bool {
- v, err := p.getBool(key)
- if err != nil {
- ErrorHandler(err)
- }
- return v
-}
-
-func (p *Properties) getBool(key string) (value bool, err error) {
- if v, ok := p.Get(key); ok {
- return boolVal(v), nil
- }
- return false, invalidKeyError(key)
-}
-
-func boolVal(v string) bool {
- v = strings.ToLower(v)
- return v == "1" || v == "true" || v == "yes" || v == "on"
-}
-
-// ----------------------------------------------------------------------------
-
-// GetDuration parses the expanded value as an time.Duration (in ns) if the
-// key exists. If key does not exist or the value cannot be parsed the default
-// value is returned. In almost all cases you want to use GetParsedDuration().
-func (p *Properties) GetDuration(key string, def time.Duration) time.Duration {
- v, err := p.getInt64(key)
- if err != nil {
- return def
- }
- return time.Duration(v)
-}
-
-// MustGetDuration parses the expanded value as an time.Duration (in ns) if
-// the key exists. If key does not exist or the value cannot be parsed the
-// function panics. In almost all cases you want to use MustGetParsedDuration().
-func (p *Properties) MustGetDuration(key string) time.Duration {
- v, err := p.getInt64(key)
- if err != nil {
- ErrorHandler(err)
- }
- return time.Duration(v)
-}
-
-// ----------------------------------------------------------------------------
-
-// GetParsedDuration parses the expanded value with time.ParseDuration() if the key exists.
-// If key does not exist or the value cannot be parsed the default
-// value is returned.
-func (p *Properties) GetParsedDuration(key string, def time.Duration) time.Duration {
- s, ok := p.Get(key)
- if !ok {
- return def
- }
- v, err := time.ParseDuration(s)
- if err != nil {
- return def
- }
- return v
-}
-
-// MustGetParsedDuration parses the expanded value with time.ParseDuration() if the key exists.
-// If key does not exist or the value cannot be parsed the function panics.
-func (p *Properties) MustGetParsedDuration(key string) time.Duration {
- s, ok := p.Get(key)
- if !ok {
- ErrorHandler(invalidKeyError(key))
- }
- v, err := time.ParseDuration(s)
- if err != nil {
- ErrorHandler(err)
- }
- return v
-}
-
-// ----------------------------------------------------------------------------
-
-// GetFloat64 parses the expanded value as a float64 if the key exists.
-// If key does not exist or the value cannot be parsed the default
-// value is returned.
-func (p *Properties) GetFloat64(key string, def float64) float64 {
- v, err := p.getFloat64(key)
- if err != nil {
- return def
- }
- return v
-}
-
-// MustGetFloat64 parses the expanded value as a float64 if the key exists.
-// If key does not exist or the value cannot be parsed the function panics.
-func (p *Properties) MustGetFloat64(key string) float64 {
- v, err := p.getFloat64(key)
- if err != nil {
- ErrorHandler(err)
- }
- return v
-}
-
-func (p *Properties) getFloat64(key string) (value float64, err error) {
- if v, ok := p.Get(key); ok {
- value, err = strconv.ParseFloat(v, 64)
- if err != nil {
- return 0, err
- }
- return value, nil
- }
- return 0, invalidKeyError(key)
-}
-
-// ----------------------------------------------------------------------------
-
-// GetInt parses the expanded value as an int if the key exists.
-// If key does not exist or the value cannot be parsed the default
-// value is returned. If the value does not fit into an int the
-// function panics with an out of range error.
-func (p *Properties) GetInt(key string, def int) int {
- v, err := p.getInt64(key)
- if err != nil {
- return def
- }
- return intRangeCheck(key, v)
-}
-
-// MustGetInt parses the expanded value as an int if the key exists.
-// If key does not exist or the value cannot be parsed the function panics.
-// If the value does not fit into an int the function panics with
-// an out of range error.
-func (p *Properties) MustGetInt(key string) int {
- v, err := p.getInt64(key)
- if err != nil {
- ErrorHandler(err)
- }
- return intRangeCheck(key, v)
-}
-
-// ----------------------------------------------------------------------------
-
-// GetInt64 parses the expanded value as an int64 if the key exists.
-// If key does not exist or the value cannot be parsed the default
-// value is returned.
-func (p *Properties) GetInt64(key string, def int64) int64 {
- v, err := p.getInt64(key)
- if err != nil {
- return def
- }
- return v
-}
-
-// MustGetInt64 parses the expanded value as an int if the key exists.
-// If key does not exist or the value cannot be parsed the function panics.
-func (p *Properties) MustGetInt64(key string) int64 {
- v, err := p.getInt64(key)
- if err != nil {
- ErrorHandler(err)
- }
- return v
-}
-
-func (p *Properties) getInt64(key string) (value int64, err error) {
- if v, ok := p.Get(key); ok {
- value, err = strconv.ParseInt(v, 10, 64)
- if err != nil {
- return 0, err
- }
- return value, nil
- }
- return 0, invalidKeyError(key)
-}
-
-// ----------------------------------------------------------------------------
-
-// GetUint parses the expanded value as an uint if the key exists.
-// If key does not exist or the value cannot be parsed the default
-// value is returned. If the value does not fit into an int the
-// function panics with an out of range error.
-func (p *Properties) GetUint(key string, def uint) uint {
- v, err := p.getUint64(key)
- if err != nil {
- return def
- }
- return uintRangeCheck(key, v)
-}
-
-// MustGetUint parses the expanded value as an int if the key exists.
-// If key does not exist or the value cannot be parsed the function panics.
-// If the value does not fit into an int the function panics with
-// an out of range error.
-func (p *Properties) MustGetUint(key string) uint {
- v, err := p.getUint64(key)
- if err != nil {
- ErrorHandler(err)
- }
- return uintRangeCheck(key, v)
-}
-
-// ----------------------------------------------------------------------------
-
-// GetUint64 parses the expanded value as an uint64 if the key exists.
-// If key does not exist or the value cannot be parsed the default
-// value is returned.
-func (p *Properties) GetUint64(key string, def uint64) uint64 {
- v, err := p.getUint64(key)
- if err != nil {
- return def
- }
- return v
-}
-
-// MustGetUint64 parses the expanded value as an int if the key exists.
-// If key does not exist or the value cannot be parsed the function panics.
-func (p *Properties) MustGetUint64(key string) uint64 {
- v, err := p.getUint64(key)
- if err != nil {
- ErrorHandler(err)
- }
- return v
-}
-
-func (p *Properties) getUint64(key string) (value uint64, err error) {
- if v, ok := p.Get(key); ok {
- value, err = strconv.ParseUint(v, 10, 64)
- if err != nil {
- return 0, err
- }
- return value, nil
- }
- return 0, invalidKeyError(key)
-}
-
-// ----------------------------------------------------------------------------
-
-// GetString returns the expanded value for the given key if exists or
-// the default value otherwise.
-func (p *Properties) GetString(key, def string) string {
- if v, ok := p.Get(key); ok {
- return v
- }
- return def
-}
-
-// MustGetString returns the expanded value for the given key if exists or
-// panics otherwise.
-func (p *Properties) MustGetString(key string) string {
- if v, ok := p.Get(key); ok {
- return v
- }
- ErrorHandler(invalidKeyError(key))
- panic("ErrorHandler should exit")
-}
-
-// ----------------------------------------------------------------------------
-
-// Filter returns a new properties object which contains all properties
-// for which the key matches the pattern.
-func (p *Properties) Filter(pattern string) (*Properties, error) {
- re, err := regexp.Compile(pattern)
- if err != nil {
- return nil, err
- }
-
- return p.FilterRegexp(re), nil
-}
-
-// FilterRegexp returns a new properties object which contains all properties
-// for which the key matches the regular expression.
-func (p *Properties) FilterRegexp(re *regexp.Regexp) *Properties {
- pp := NewProperties()
- for _, k := range p.k {
- if re.MatchString(k) {
- // TODO(fs): we are ignoring the error which flags a circular reference.
- // TODO(fs): since we are just copying a subset of keys this cannot happen (fingers crossed)
- pp.Set(k, p.m[k])
- }
- }
- return pp
-}
-
-// FilterPrefix returns a new properties object with a subset of all keys
-// with the given prefix.
-func (p *Properties) FilterPrefix(prefix string) *Properties {
- pp := NewProperties()
- for _, k := range p.k {
- if strings.HasPrefix(k, prefix) {
- // TODO(fs): we are ignoring the error which flags a circular reference.
- // TODO(fs): since we are just copying a subset of keys this cannot happen (fingers crossed)
- pp.Set(k, p.m[k])
- }
- }
- return pp
-}
-
-// FilterStripPrefix returns a new properties object with a subset of all keys
-// with the given prefix and the prefix removed from the keys.
-func (p *Properties) FilterStripPrefix(prefix string) *Properties {
- pp := NewProperties()
- n := len(prefix)
- for _, k := range p.k {
- if len(k) > len(prefix) && strings.HasPrefix(k, prefix) {
- // TODO(fs): we are ignoring the error which flags a circular reference.
- // TODO(fs): since we are modifying keys I am not entirely sure whether we can create a circular reference
- // TODO(fs): this function should probably return an error but the signature is fixed
- pp.Set(k[n:], p.m[k])
- }
- }
- return pp
-}
-
-// Len returns the number of keys.
-func (p *Properties) Len() int {
- return len(p.m)
-}
-
-// Keys returns all keys in the same order as in the input.
-func (p *Properties) Keys() []string {
- keys := make([]string, len(p.k))
- copy(keys, p.k)
- return keys
-}
-
-// Set sets the property key to the corresponding value.
-// If a value for key existed before then ok is true and prev
-// contains the previous value. If the value contains a
-// circular reference or a malformed expression then
-// an error is returned.
-// An empty key is silently ignored.
-func (p *Properties) Set(key, value string) (prev string, ok bool, err error) {
- if key == "" {
- return "", false, nil
- }
-
- // if expansion is disabled we allow circular references
- if p.DisableExpansion {
- prev, ok = p.Get(key)
- p.m[key] = value
- if !ok {
- p.k = append(p.k, key)
- }
- return prev, ok, nil
- }
-
- // to check for a circular reference we temporarily need
- // to set the new value. If there is an error then revert
- // to the previous state. Only if all tests are successful
- // then we add the key to the p.k list.
- prev, ok = p.Get(key)
- p.m[key] = value
-
- // now check for a circular reference
- _, err = p.expand(key, value)
- if err != nil {
-
- // revert to the previous state
- if ok {
- p.m[key] = prev
- } else {
- delete(p.m, key)
- }
-
- return "", false, err
- }
-
- if !ok {
- p.k = append(p.k, key)
- }
-
- return prev, ok, nil
-}
-
-// SetValue sets property key to the default string value
-// as defined by fmt.Sprintf("%v").
-func (p *Properties) SetValue(key string, value interface{}) error {
- _, _, err := p.Set(key, fmt.Sprintf("%v", value))
- return err
-}
-
-// MustSet sets the property key to the corresponding value.
-// If a value for key existed before then ok is true and prev
-// contains the previous value. An empty key is silently ignored.
-func (p *Properties) MustSet(key, value string) (prev string, ok bool) {
- prev, ok, err := p.Set(key, value)
- if err != nil {
- ErrorHandler(err)
- }
- return prev, ok
-}
-
-// String returns a string of all expanded 'key = value' pairs.
-func (p *Properties) String() string {
- var s string
- for _, key := range p.k {
- value, _ := p.Get(key)
- s = fmt.Sprintf("%s%s = %s\n", s, key, value)
- }
- return s
-}
-
-// Write writes all unexpanded 'key = value' pairs to the given writer.
-// Write returns the number of bytes written and any write error encountered.
-func (p *Properties) Write(w io.Writer, enc Encoding) (n int, err error) {
- return p.WriteComment(w, "", enc)
-}
-
-// WriteComment writes all unexpanced 'key = value' pairs to the given writer.
-// If prefix is not empty then comments are written with a blank line and the
-// given prefix. The prefix should be either "# " or "! " to be compatible with
-// the properties file format. Otherwise, the properties parser will not be
-// able to read the file back in. It returns the number of bytes written and
-// any write error encountered.
-func (p *Properties) WriteComment(w io.Writer, prefix string, enc Encoding) (n int, err error) {
- var x int
-
- for _, key := range p.k {
- value := p.m[key]
-
- if prefix != "" {
- if comments, ok := p.c[key]; ok {
- // don't print comments if they are all empty
- allEmpty := true
- for _, c := range comments {
- if c != "" {
- allEmpty = false
- break
- }
- }
-
- if !allEmpty {
- // add a blank line between entries but not at the top
- if len(comments) > 0 && n > 0 {
- x, err = fmt.Fprintln(w)
- if err != nil {
- return
- }
- n += x
- }
-
- for _, c := range comments {
- x, err = fmt.Fprintf(w, "%s%s\n", prefix, encode(c, "", enc))
- if err != nil {
- return
- }
- n += x
- }
- }
- }
- }
-
- x, err = fmt.Fprintf(w, "%s = %s\n", encode(key, " :", enc), encode(value, "", enc))
- if err != nil {
- return
- }
- n += x
- }
- return
-}
-
-// Map returns a copy of the properties as a map.
-func (p *Properties) Map() map[string]string {
- m := make(map[string]string)
- for k, v := range p.m {
- m[k] = v
- }
- return m
-}
-
-// FilterFunc returns a copy of the properties which includes the values which passed all filters.
-func (p *Properties) FilterFunc(filters ...func(k, v string) bool) *Properties {
- pp := NewProperties()
-outer:
- for k, v := range p.m {
- for _, f := range filters {
- if !f(k, v) {
- continue outer
- }
- pp.Set(k, v)
- }
- }
- return pp
-}
-
-// ----------------------------------------------------------------------------
-
-// Delete removes the key and its comments.
-func (p *Properties) Delete(key string) {
- delete(p.m, key)
- delete(p.c, key)
- newKeys := []string{}
- for _, k := range p.k {
- if k != key {
- newKeys = append(newKeys, k)
- }
- }
- p.k = newKeys
-}
-
-// Merge merges properties, comments and keys from other *Properties into p
-func (p *Properties) Merge(other *Properties) {
- for k, v := range other.m {
- p.m[k] = v
- }
- for k, v := range other.c {
- p.c[k] = v
- }
-
-outer:
- for _, otherKey := range other.k {
- for _, key := range p.k {
- if otherKey == key {
- continue outer
- }
- }
- p.k = append(p.k, otherKey)
- }
-}
-
-// ----------------------------------------------------------------------------
-
-// check expands all values and returns an error if a circular reference or
-// a malformed expression was found.
-func (p *Properties) check() error {
- for key, value := range p.m {
- if _, err := p.expand(key, value); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (p *Properties) expand(key, input string) (string, error) {
- // no pre/postfix -> nothing to expand
- if p.Prefix == "" && p.Postfix == "" {
- return input, nil
- }
-
- return expand(input, []string{key}, p.Prefix, p.Postfix, p.m)
-}
-
-// expand recursively expands expressions of '(prefix)key(postfix)' to their corresponding values.
-// The function keeps track of the keys that were already expanded and stops if it
-// detects a circular reference or a malformed expression of the form '(prefix)key'.
-func expand(s string, keys []string, prefix, postfix string, values map[string]string) (string, error) {
- if len(keys) > maxExpansionDepth {
- return "", fmt.Errorf("expansion too deep")
- }
-
- for {
- start := strings.Index(s, prefix)
- if start == -1 {
- return s, nil
- }
-
- keyStart := start + len(prefix)
- keyLen := strings.Index(s[keyStart:], postfix)
- if keyLen == -1 {
- return "", fmt.Errorf("malformed expression")
- }
-
- end := keyStart + keyLen + len(postfix) - 1
- key := s[keyStart : keyStart+keyLen]
-
- // fmt.Printf("s:%q pp:%q start:%d end:%d keyStart:%d keyLen:%d key:%q\n", s, prefix + "..." + postfix, start, end, keyStart, keyLen, key)
-
- for _, k := range keys {
- if key == k {
- return "", fmt.Errorf("circular reference")
- }
- }
-
- val, ok := values[key]
- if !ok {
- val = os.Getenv(key)
- }
- new_val, err := expand(val, append(keys, key), prefix, postfix, values)
- if err != nil {
- return "", err
- }
- s = s[:start] + new_val + s[end+1:]
- }
- return s, nil
-}
-
-// encode encodes a UTF-8 string to ISO-8859-1 and escapes some characters.
-func encode(s string, special string, enc Encoding) string {
- switch enc {
- case UTF8:
- return encodeUtf8(s, special)
- case ISO_8859_1:
- return encodeIso(s, special)
- default:
- panic(fmt.Sprintf("unsupported encoding %v", enc))
- }
-}
-
-func encodeUtf8(s string, special string) string {
- v := ""
- for pos := 0; pos < len(s); {
- r, w := utf8.DecodeRuneInString(s[pos:])
- pos += w
- v += escape(r, special)
- }
- return v
-}
-
-func encodeIso(s string, special string) string {
- var r rune
- var w int
- var v string
- for pos := 0; pos < len(s); {
- switch r, w = utf8.DecodeRuneInString(s[pos:]); {
- case r < 1<<8: // single byte rune -> escape special chars only
- v += escape(r, special)
- case r < 1<<16: // two byte rune -> unicode literal
- v += fmt.Sprintf("\\u%04x", r)
- default: // more than two bytes per rune -> can't encode
- v += "?"
- }
- pos += w
- }
- return v
-}
-
-func escape(r rune, special string) string {
- switch r {
- case '\f':
- return "\\f"
- case '\n':
- return "\\n"
- case '\r':
- return "\\r"
- case '\t':
- return "\\t"
- default:
- if strings.ContainsRune(special, r) {
- return "\\" + string(r)
- }
- return string(r)
- }
-}
-
-func invalidKeyError(key string) error {
- return fmt.Errorf("unknown property: %s", key)
-}
diff --git a/vendor/github.com/magiconair/properties/properties_test.go b/vendor/github.com/magiconair/properties/properties_test.go
deleted file mode 100644
index 5db64c3e..00000000
--- a/vendor/github.com/magiconair/properties/properties_test.go
+++ /dev/null
@@ -1,985 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "bytes"
- "flag"
- "fmt"
- "math"
- "os"
- "reflect"
- "strings"
- "testing"
- "time"
-
- "github.com/magiconair/properties/assert"
-)
-
-var verbose = flag.Bool("verbose", false, "Verbose output")
-
-func init() {
- ErrorHandler = PanicHandler
-}
-
-// ----------------------------------------------------------------------------
-
-// define test cases in the form of
-// {"input", "key1", "value1", "key2", "value2", ...}
-var complexTests = [][]string{
- // whitespace prefix
- {" key=value", "key", "value"}, // SPACE prefix
- {"\fkey=value", "key", "value"}, // FF prefix
- {"\tkey=value", "key", "value"}, // TAB prefix
- {" \f\tkey=value", "key", "value"}, // mix prefix
-
- // multiple keys
- {"key1=value1\nkey2=value2\n", "key1", "value1", "key2", "value2"},
- {"key1=value1\rkey2=value2\r", "key1", "value1", "key2", "value2"},
- {"key1=value1\r\nkey2=value2\r\n", "key1", "value1", "key2", "value2"},
-
- // blank lines
- {"\nkey=value\n", "key", "value"},
- {"\rkey=value\r", "key", "value"},
- {"\r\nkey=value\r\n", "key", "value"},
- {"\nkey=value\n \nkey2=value2", "key", "value", "key2", "value2"},
- {"\nkey=value\n\t\nkey2=value2", "key", "value", "key2", "value2"},
-
- // escaped chars in key
- {"k\\ ey = value", "k ey", "value"},
- {"k\\:ey = value", "k:ey", "value"},
- {"k\\=ey = value", "k=ey", "value"},
- {"k\\fey = value", "k\fey", "value"},
- {"k\\ney = value", "k\ney", "value"},
- {"k\\rey = value", "k\rey", "value"},
- {"k\\tey = value", "k\tey", "value"},
-
- // escaped chars in value
- {"key = v\\ alue", "key", "v alue"},
- {"key = v\\:alue", "key", "v:alue"},
- {"key = v\\=alue", "key", "v=alue"},
- {"key = v\\falue", "key", "v\falue"},
- {"key = v\\nalue", "key", "v\nalue"},
- {"key = v\\ralue", "key", "v\ralue"},
- {"key = v\\talue", "key", "v\talue"},
-
- // silently dropped escape character
- {"k\\zey = value", "kzey", "value"},
- {"key = v\\zalue", "key", "vzalue"},
-
- // unicode literals
- {"key\\u2318 = value", "key⌘", "value"},
- {"k\\u2318ey = value", "k⌘ey", "value"},
- {"key = value\\u2318", "key", "value⌘"},
- {"key = valu\\u2318e", "key", "valu⌘e"},
-
- // multiline values
- {"key = valueA,\\\n valueB", "key", "valueA,valueB"}, // SPACE indent
- {"key = valueA,\\\n\f\f\fvalueB", "key", "valueA,valueB"}, // FF indent
- {"key = valueA,\\\n\t\t\tvalueB", "key", "valueA,valueB"}, // TAB indent
- {"key = valueA,\\\n \f\tvalueB", "key", "valueA,valueB"}, // mix indent
-
- // comments
- {"# this is a comment\n! and so is this\nkey1=value1\nkey#2=value#2\n\nkey!3=value!3\n# and another one\n! and the final one", "key1", "value1", "key#2", "value#2", "key!3", "value!3"},
-
- // expansion tests
- {"key=value\nkey2=${key}", "key", "value", "key2", "value"},
- {"key=value\nkey2=aa${key}", "key", "value", "key2", "aavalue"},
- {"key=value\nkey2=${key}bb", "key", "value", "key2", "valuebb"},
- {"key=value\nkey2=aa${key}bb", "key", "value", "key2", "aavaluebb"},
- {"key=value\nkey2=${key}\nkey3=${key2}", "key", "value", "key2", "value", "key3", "value"},
- {"key=value\nkey2=${key}${key}", "key", "value", "key2", "valuevalue"},
- {"key=value\nkey2=${key}${key}${key}${key}", "key", "value", "key2", "valuevaluevaluevalue"},
- {"key=value\nkey2=${key}${key3}\nkey3=${key}", "key", "value", "key2", "valuevalue", "key3", "value"},
- {"key=value\nkey2=${key3}${key}${key4}\nkey3=${key}\nkey4=${key}", "key", "value", "key2", "valuevaluevalue", "key3", "value", "key4", "value"},
- {"key=${USER}", "key", os.Getenv("USER")},
- {"key=${USER}\nUSER=value", "key", "value", "USER", "value"},
-}
-
-// ----------------------------------------------------------------------------
-
-var commentTests = []struct {
- input, key, value string
- comments []string
-}{
- {"key=value", "key", "value", nil},
- {"#\nkey=value", "key", "value", []string{""}},
- {"#comment\nkey=value", "key", "value", []string{"comment"}},
- {"# comment\nkey=value", "key", "value", []string{"comment"}},
- {"# comment\nkey=value", "key", "value", []string{"comment"}},
- {"# comment\n\nkey=value", "key", "value", []string{"comment"}},
- {"# comment1\n# comment2\nkey=value", "key", "value", []string{"comment1", "comment2"}},
- {"# comment1\n\n# comment2\n\nkey=value", "key", "value", []string{"comment1", "comment2"}},
- {"!comment\nkey=value", "key", "value", []string{"comment"}},
- {"! comment\nkey=value", "key", "value", []string{"comment"}},
- {"! comment\nkey=value", "key", "value", []string{"comment"}},
- {"! comment\n\nkey=value", "key", "value", []string{"comment"}},
- {"! comment1\n! comment2\nkey=value", "key", "value", []string{"comment1", "comment2"}},
- {"! comment1\n\n! comment2\n\nkey=value", "key", "value", []string{"comment1", "comment2"}},
-}
-
-// ----------------------------------------------------------------------------
-
-var errorTests = []struct {
- input, msg string
-}{
- // unicode literals
- {"key\\u1 = value", "invalid unicode literal"},
- {"key\\u12 = value", "invalid unicode literal"},
- {"key\\u123 = value", "invalid unicode literal"},
- {"key\\u123g = value", "invalid unicode literal"},
- {"key\\u123", "invalid unicode literal"},
-
- // circular references
- {"key=${key}", "circular reference"},
- {"key1=${key2}\nkey2=${key1}", "circular reference"},
-
- // malformed expressions
- {"key=${ke", "malformed expression"},
- {"key=valu${ke", "malformed expression"},
-}
-
-// ----------------------------------------------------------------------------
-
-var writeTests = []struct {
- input, output, encoding string
-}{
- // ISO-8859-1 tests
- {"key = value", "key = value\n", "ISO-8859-1"},
- {"key = value \\\n continued", "key = value continued\n", "ISO-8859-1"},
- {"key⌘ = value", "key\\u2318 = value\n", "ISO-8859-1"},
- {"ke\\ \\:y = value", "ke\\ \\:y = value\n", "ISO-8859-1"},
-
- // UTF-8 tests
- {"key = value", "key = value\n", "UTF-8"},
- {"key = value \\\n continued", "key = value continued\n", "UTF-8"},
- {"key⌘ = value⌘", "key⌘ = value⌘\n", "UTF-8"},
- {"ke\\ \\:y = value", "ke\\ \\:y = value\n", "UTF-8"},
-}
-
-// ----------------------------------------------------------------------------
-
-var writeCommentTests = []struct {
- input, output, encoding string
-}{
- // ISO-8859-1 tests
- {"key = value", "key = value\n", "ISO-8859-1"},
- {"#\nkey = value", "key = value\n", "ISO-8859-1"},
- {"#\n#\n#\nkey = value", "key = value\n", "ISO-8859-1"},
- {"# comment\nkey = value", "# comment\nkey = value\n", "ISO-8859-1"},
- {"\n# comment\nkey = value", "# comment\nkey = value\n", "ISO-8859-1"},
- {"# comment\n\nkey = value", "# comment\nkey = value\n", "ISO-8859-1"},
- {"# comment1\n# comment2\nkey = value", "# comment1\n# comment2\nkey = value\n", "ISO-8859-1"},
- {"#comment1\nkey1 = value1\n#comment2\nkey2 = value2", "# comment1\nkey1 = value1\n\n# comment2\nkey2 = value2\n", "ISO-8859-1"},
-
- // UTF-8 tests
- {"key = value", "key = value\n", "UTF-8"},
- {"# comment⌘\nkey = value⌘", "# comment⌘\nkey = value⌘\n", "UTF-8"},
- {"\n# comment⌘\nkey = value⌘", "# comment⌘\nkey = value⌘\n", "UTF-8"},
- {"# comment⌘\n\nkey = value⌘", "# comment⌘\nkey = value⌘\n", "UTF-8"},
- {"# comment1⌘\n# comment2⌘\nkey = value⌘", "# comment1⌘\n# comment2⌘\nkey = value⌘\n", "UTF-8"},
- {"#comment1⌘\nkey1 = value1⌘\n#comment2⌘\nkey2 = value2⌘", "# comment1⌘\nkey1 = value1⌘\n\n# comment2⌘\nkey2 = value2⌘\n", "UTF-8"},
-}
-
-// ----------------------------------------------------------------------------
-
-var boolTests = []struct {
- input, key string
- def, value bool
-}{
- // valid values for TRUE
- {"key = 1", "key", false, true},
- {"key = on", "key", false, true},
- {"key = On", "key", false, true},
- {"key = ON", "key", false, true},
- {"key = true", "key", false, true},
- {"key = True", "key", false, true},
- {"key = TRUE", "key", false, true},
- {"key = yes", "key", false, true},
- {"key = Yes", "key", false, true},
- {"key = YES", "key", false, true},
-
- // valid values for FALSE (all other)
- {"key = 0", "key", true, false},
- {"key = off", "key", true, false},
- {"key = false", "key", true, false},
- {"key = no", "key", true, false},
-
- // non existent key
- {"key = true", "key2", false, false},
-}
-
-// ----------------------------------------------------------------------------
-
-var durationTests = []struct {
- input, key string
- def, value time.Duration
-}{
- // valid values
- {"key = 1", "key", 999, 1},
- {"key = 0", "key", 999, 0},
- {"key = -1", "key", 999, -1},
- {"key = 0123", "key", 999, 123},
-
- // invalid values
- {"key = 0xff", "key", 999, 999},
- {"key = 1.0", "key", 999, 999},
- {"key = a", "key", 999, 999},
-
- // non existent key
- {"key = 1", "key2", 999, 999},
-}
-
-// ----------------------------------------------------------------------------
-
-var parsedDurationTests = []struct {
- input, key string
- def, value time.Duration
-}{
- // valid values
- {"key = -1ns", "key", 999, -1 * time.Nanosecond},
- {"key = 300ms", "key", 999, 300 * time.Millisecond},
- {"key = 5s", "key", 999, 5 * time.Second},
- {"key = 3h", "key", 999, 3 * time.Hour},
- {"key = 2h45m", "key", 999, 2*time.Hour + 45*time.Minute},
-
- // invalid values
- {"key = 0xff", "key", 999, 999},
- {"key = 1.0", "key", 999, 999},
- {"key = a", "key", 999, 999},
- {"key = 1", "key", 999, 999},
- {"key = 0", "key", 999, 0},
-
- // non existent key
- {"key = 1", "key2", 999, 999},
-}
-
-// ----------------------------------------------------------------------------
-
-var floatTests = []struct {
- input, key string
- def, value float64
-}{
- // valid values
- {"key = 1.0", "key", 999, 1.0},
- {"key = 0.0", "key", 999, 0.0},
- {"key = -1.0", "key", 999, -1.0},
- {"key = 1", "key", 999, 1},
- {"key = 0", "key", 999, 0},
- {"key = -1", "key", 999, -1},
- {"key = 0123", "key", 999, 123},
-
- // invalid values
- {"key = 0xff", "key", 999, 999},
- {"key = a", "key", 999, 999},
-
- // non existent key
- {"key = 1", "key2", 999, 999},
-}
-
-// ----------------------------------------------------------------------------
-
-var int64Tests = []struct {
- input, key string
- def, value int64
-}{
- // valid values
- {"key = 1", "key", 999, 1},
- {"key = 0", "key", 999, 0},
- {"key = -1", "key", 999, -1},
- {"key = 0123", "key", 999, 123},
-
- // invalid values
- {"key = 0xff", "key", 999, 999},
- {"key = 1.0", "key", 999, 999},
- {"key = a", "key", 999, 999},
-
- // non existent key
- {"key = 1", "key2", 999, 999},
-}
-
-// ----------------------------------------------------------------------------
-
-var uint64Tests = []struct {
- input, key string
- def, value uint64
-}{
- // valid values
- {"key = 1", "key", 999, 1},
- {"key = 0", "key", 999, 0},
- {"key = 0123", "key", 999, 123},
-
- // invalid values
- {"key = -1", "key", 999, 999},
- {"key = 0xff", "key", 999, 999},
- {"key = 1.0", "key", 999, 999},
- {"key = a", "key", 999, 999},
-
- // non existent key
- {"key = 1", "key2", 999, 999},
-}
-
-// ----------------------------------------------------------------------------
-
-var stringTests = []struct {
- input, key string
- def, value string
-}{
- // valid values
- {"key = abc", "key", "def", "abc"},
-
- // non existent key
- {"key = abc", "key2", "def", "def"},
-}
-
-// ----------------------------------------------------------------------------
-
-var keysTests = []struct {
- input string
- keys []string
-}{
- {"", []string{}},
- {"key = abc", []string{"key"}},
- {"key = abc\nkey2=def", []string{"key", "key2"}},
- {"key2 = abc\nkey=def", []string{"key2", "key"}},
- {"key = abc\nkey=def", []string{"key"}},
-}
-
-// ----------------------------------------------------------------------------
-
-var filterTests = []struct {
- input string
- pattern string
- keys []string
- err string
-}{
- {"", "", []string{}, ""},
- {"", "abc", []string{}, ""},
- {"key=value", "", []string{"key"}, ""},
- {"key=value", "key=", []string{}, ""},
- {"key=value\nfoo=bar", "", []string{"foo", "key"}, ""},
- {"key=value\nfoo=bar", "f", []string{"foo"}, ""},
- {"key=value\nfoo=bar", "fo", []string{"foo"}, ""},
- {"key=value\nfoo=bar", "foo", []string{"foo"}, ""},
- {"key=value\nfoo=bar", "fooo", []string{}, ""},
- {"key=value\nkey2=value2\nfoo=bar", "ey", []string{"key", "key2"}, ""},
- {"key=value\nkey2=value2\nfoo=bar", "key", []string{"key", "key2"}, ""},
- {"key=value\nkey2=value2\nfoo=bar", "^key", []string{"key", "key2"}, ""},
- {"key=value\nkey2=value2\nfoo=bar", "^(key|foo)", []string{"foo", "key", "key2"}, ""},
- {"key=value\nkey2=value2\nfoo=bar", "[ abc", nil, "error parsing regexp.*"},
-}
-
-// ----------------------------------------------------------------------------
-
-var filterPrefixTests = []struct {
- input string
- prefix string
- keys []string
-}{
- {"", "", []string{}},
- {"", "abc", []string{}},
- {"key=value", "", []string{"key"}},
- {"key=value", "key=", []string{}},
- {"key=value\nfoo=bar", "", []string{"foo", "key"}},
- {"key=value\nfoo=bar", "f", []string{"foo"}},
- {"key=value\nfoo=bar", "fo", []string{"foo"}},
- {"key=value\nfoo=bar", "foo", []string{"foo"}},
- {"key=value\nfoo=bar", "fooo", []string{}},
- {"key=value\nkey2=value2\nfoo=bar", "key", []string{"key", "key2"}},
-}
-
-// ----------------------------------------------------------------------------
-
-var filterStripPrefixTests = []struct {
- input string
- prefix string
- keys []string
-}{
- {"", "", []string{}},
- {"", "abc", []string{}},
- {"key=value", "", []string{"key"}},
- {"key=value", "key=", []string{}},
- {"key=value\nfoo=bar", "", []string{"foo", "key"}},
- {"key=value\nfoo=bar", "f", []string{"foo"}},
- {"key=value\nfoo=bar", "fo", []string{"foo"}},
- {"key=value\nfoo=bar", "foo", []string{"foo"}},
- {"key=value\nfoo=bar", "fooo", []string{}},
- {"key=value\nkey2=value2\nfoo=bar", "key", []string{"key", "key2"}},
-}
-
-// ----------------------------------------------------------------------------
-
-var setTests = []struct {
- input string
- key, value string
- prev string
- ok bool
- err string
- keys []string
-}{
- {"", "", "", "", false, "", []string{}},
- {"", "key", "value", "", false, "", []string{"key"}},
- {"key=value", "key2", "value2", "", false, "", []string{"key", "key2"}},
- {"key=value", "abc", "value3", "", false, "", []string{"key", "abc"}},
- {"key=value", "key", "value3", "value", true, "", []string{"key"}},
-}
-
-// ----------------------------------------------------------------------------
-
-// TestBasic tests basic single key/value combinations with all possible
-// whitespace, delimiter and newline permutations.
-func TestBasic(t *testing.T) {
- testWhitespaceAndDelimiterCombinations(t, "key", "")
- testWhitespaceAndDelimiterCombinations(t, "key", "value")
- testWhitespaceAndDelimiterCombinations(t, "key", "value ")
-}
-
-func TestComplex(t *testing.T) {
- for _, test := range complexTests {
- testKeyValue(t, test[0], test[1:]...)
- }
-}
-
-func TestErrors(t *testing.T) {
- for _, test := range errorTests {
- _, err := Load([]byte(test.input), ISO_8859_1)
- assert.Equal(t, err != nil, true, "want error")
- assert.Equal(t, strings.Contains(err.Error(), test.msg), true)
- }
-}
-
-func TestVeryDeep(t *testing.T) {
- input := "key0=value\n"
- prefix := "${"
- postfix := "}"
- i := 0
- for i = 0; i < maxExpansionDepth-1; i++ {
- input += fmt.Sprintf("key%d=%skey%d%s\n", i+1, prefix, i, postfix)
- }
-
- p, err := Load([]byte(input), ISO_8859_1)
- assert.Equal(t, err, nil)
- p.Prefix = prefix
- p.Postfix = postfix
-
- assert.Equal(t, p.MustGet(fmt.Sprintf("key%d", i)), "value")
-
- // Nudge input over the edge
- input += fmt.Sprintf("key%d=%skey%d%s\n", i+1, prefix, i, postfix)
-
- _, err = Load([]byte(input), ISO_8859_1)
- assert.Equal(t, err != nil, true, "want error")
- assert.Equal(t, strings.Contains(err.Error(), "expansion too deep"), true)
-}
-
-func TestDisableExpansion(t *testing.T) {
- input := "key=value\nkey2=${key}"
- p := mustParse(t, input)
- p.DisableExpansion = true
- assert.Equal(t, p.MustGet("key"), "value")
- assert.Equal(t, p.MustGet("key2"), "${key}")
-
- // with expansion disabled we can introduce circular references
- p.MustSet("keyA", "${keyB}")
- p.MustSet("keyB", "${keyA}")
- assert.Equal(t, p.MustGet("keyA"), "${keyB}")
- assert.Equal(t, p.MustGet("keyB"), "${keyA}")
-}
-
-func TestDisableExpansionStillUpdatesKeys(t *testing.T) {
- p := NewProperties()
- p.MustSet("p1", "a")
- assert.Equal(t, p.Keys(), []string{"p1"})
- assert.Equal(t, p.String(), "p1 = a\n")
-
- p.DisableExpansion = true
- p.MustSet("p2", "b")
-
- assert.Equal(t, p.Keys(), []string{"p1", "p2"})
- assert.Equal(t, p.String(), "p1 = a\np2 = b\n")
-}
-
-func TestMustGet(t *testing.T) {
- input := "key = value\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGet("key"), "value")
- assert.Panic(t, func() { p.MustGet("invalid") }, "unknown property: invalid")
-}
-
-func TestGetBool(t *testing.T) {
- for _, test := range boolTests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetBool(test.key, test.def), test.value)
- }
-}
-
-func TestMustGetBool(t *testing.T) {
- input := "key = true\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetBool("key"), true)
- assert.Panic(t, func() { p.MustGetBool("invalid") }, "unknown property: invalid")
-}
-
-func TestGetDuration(t *testing.T) {
- for _, test := range durationTests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetDuration(test.key, test.def), test.value)
- }
-}
-
-func TestMustGetDuration(t *testing.T) {
- input := "key = 123\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetDuration("key"), time.Duration(123))
- assert.Panic(t, func() { p.MustGetDuration("key2") }, "strconv.ParseInt: parsing.*")
- assert.Panic(t, func() { p.MustGetDuration("invalid") }, "unknown property: invalid")
-}
-
-func TestGetParsedDuration(t *testing.T) {
- for _, test := range parsedDurationTests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetParsedDuration(test.key, test.def), test.value)
- }
-}
-
-func TestMustGetParsedDuration(t *testing.T) {
- input := "key = 123ms\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetParsedDuration("key"), 123*time.Millisecond)
- assert.Panic(t, func() { p.MustGetParsedDuration("key2") }, "time: invalid duration ghi")
- assert.Panic(t, func() { p.MustGetParsedDuration("invalid") }, "unknown property: invalid")
-}
-
-func TestGetFloat64(t *testing.T) {
- for _, test := range floatTests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetFloat64(test.key, test.def), test.value)
- }
-}
-
-func TestMustGetFloat64(t *testing.T) {
- input := "key = 123\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetFloat64("key"), float64(123))
- assert.Panic(t, func() { p.MustGetFloat64("key2") }, "strconv.ParseFloat: parsing.*")
- assert.Panic(t, func() { p.MustGetFloat64("invalid") }, "unknown property: invalid")
-}
-
-func TestGetInt(t *testing.T) {
- for _, test := range int64Tests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetInt(test.key, int(test.def)), int(test.value))
- }
-}
-
-func TestMustGetInt(t *testing.T) {
- input := "key = 123\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetInt("key"), int(123))
- assert.Panic(t, func() { p.MustGetInt("key2") }, "strconv.ParseInt: parsing.*")
- assert.Panic(t, func() { p.MustGetInt("invalid") }, "unknown property: invalid")
-}
-
-func TestGetInt64(t *testing.T) {
- for _, test := range int64Tests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetInt64(test.key, test.def), test.value)
- }
-}
-
-func TestMustGetInt64(t *testing.T) {
- input := "key = 123\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetInt64("key"), int64(123))
- assert.Panic(t, func() { p.MustGetInt64("key2") }, "strconv.ParseInt: parsing.*")
- assert.Panic(t, func() { p.MustGetInt64("invalid") }, "unknown property: invalid")
-}
-
-func TestGetUint(t *testing.T) {
- for _, test := range uint64Tests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetUint(test.key, uint(test.def)), uint(test.value))
- }
-}
-
-func TestMustGetUint(t *testing.T) {
- input := "key = 123\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetUint("key"), uint(123))
- assert.Panic(t, func() { p.MustGetUint64("key2") }, "strconv.ParseUint: parsing.*")
- assert.Panic(t, func() { p.MustGetUint64("invalid") }, "unknown property: invalid")
-}
-
-func TestGetUint64(t *testing.T) {
- for _, test := range uint64Tests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetUint64(test.key, test.def), test.value)
- }
-}
-
-func TestMustGetUint64(t *testing.T) {
- input := "key = 123\nkey2 = ghi"
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetUint64("key"), uint64(123))
- assert.Panic(t, func() { p.MustGetUint64("key2") }, "strconv.ParseUint: parsing.*")
- assert.Panic(t, func() { p.MustGetUint64("invalid") }, "unknown property: invalid")
-}
-
-func TestGetString(t *testing.T) {
- for _, test := range stringTests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), 1)
- assert.Equal(t, p.GetString(test.key, test.def), test.value)
- }
-}
-
-func TestMustGetString(t *testing.T) {
- input := `key = value`
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetString("key"), "value")
- assert.Panic(t, func() { p.MustGetString("invalid") }, "unknown property: invalid")
-}
-
-func TestComment(t *testing.T) {
- for _, test := range commentTests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.MustGetString(test.key), test.value)
- assert.Equal(t, p.GetComments(test.key), test.comments)
- if test.comments != nil {
- assert.Equal(t, p.GetComment(test.key), test.comments[len(test.comments)-1])
- } else {
- assert.Equal(t, p.GetComment(test.key), "")
- }
-
- // test setting comments
- if len(test.comments) > 0 {
- // set single comment
- p.ClearComments()
- assert.Equal(t, len(p.c), 0)
- p.SetComment(test.key, test.comments[0])
- assert.Equal(t, p.GetComment(test.key), test.comments[0])
-
- // set multiple comments
- p.ClearComments()
- assert.Equal(t, len(p.c), 0)
- p.SetComments(test.key, test.comments)
- assert.Equal(t, p.GetComments(test.key), test.comments)
-
- // clear comments for a key
- p.SetComments(test.key, nil)
- assert.Equal(t, p.GetComment(test.key), "")
- assert.Equal(t, p.GetComments(test.key), ([]string)(nil))
- }
- }
-}
-
-func TestFilter(t *testing.T) {
- for _, test := range filterTests {
- p := mustParse(t, test.input)
- pp, err := p.Filter(test.pattern)
- if err != nil {
- assert.Matches(t, err.Error(), test.err)
- continue
- }
- assert.Equal(t, pp != nil, true, "want properties")
- assert.Equal(t, pp.Len(), len(test.keys))
- for _, key := range test.keys {
- v1, ok1 := p.Get(key)
- v2, ok2 := pp.Get(key)
- assert.Equal(t, ok1, true)
- assert.Equal(t, ok2, true)
- assert.Equal(t, v1, v2)
- }
- }
-}
-
-func TestFilterPrefix(t *testing.T) {
- for _, test := range filterPrefixTests {
- p := mustParse(t, test.input)
- pp := p.FilterPrefix(test.prefix)
- assert.Equal(t, pp != nil, true, "want properties")
- assert.Equal(t, pp.Len(), len(test.keys))
- for _, key := range test.keys {
- v1, ok1 := p.Get(key)
- v2, ok2 := pp.Get(key)
- assert.Equal(t, ok1, true)
- assert.Equal(t, ok2, true)
- assert.Equal(t, v1, v2)
- }
- }
-}
-
-func TestFilterStripPrefix(t *testing.T) {
- for _, test := range filterStripPrefixTests {
- p := mustParse(t, test.input)
- pp := p.FilterPrefix(test.prefix)
- assert.Equal(t, pp != nil, true, "want properties")
- assert.Equal(t, pp.Len(), len(test.keys))
- for _, key := range test.keys {
- v1, ok1 := p.Get(key)
- v2, ok2 := pp.Get(key)
- assert.Equal(t, ok1, true)
- assert.Equal(t, ok2, true)
- assert.Equal(t, v1, v2)
- }
- }
-}
-
-func TestKeys(t *testing.T) {
- for _, test := range keysTests {
- p := mustParse(t, test.input)
- assert.Equal(t, p.Len(), len(test.keys))
- assert.Equal(t, len(p.Keys()), len(test.keys))
- assert.Equal(t, p.Keys(), test.keys)
- }
-}
-
-func TestSet(t *testing.T) {
- for _, test := range setTests {
- p := mustParse(t, test.input)
- prev, ok, err := p.Set(test.key, test.value)
- if test.err != "" {
- assert.Matches(t, err.Error(), test.err)
- continue
- }
-
- assert.Equal(t, err, nil)
- assert.Equal(t, ok, test.ok)
- if ok {
- assert.Equal(t, prev, test.prev)
- }
- assert.Equal(t, p.Keys(), test.keys)
- }
-}
-
-func TestSetValue(t *testing.T) {
- tests := []interface{}{
- true, false,
- int8(123), int16(123), int32(123), int64(123), int(123),
- uint8(123), uint16(123), uint32(123), uint64(123), uint(123),
- float32(1.23), float64(1.23),
- "abc",
- }
-
- for _, v := range tests {
- p := NewProperties()
- err := p.SetValue("x", v)
- assert.Equal(t, err, nil)
- assert.Equal(t, p.GetString("x", ""), fmt.Sprintf("%v", v))
- }
-}
-
-func TestMustSet(t *testing.T) {
- input := "key=${key}"
- p := mustParse(t, input)
- assert.Panic(t, func() { p.MustSet("key", "${key}") }, "circular reference .*")
-}
-
-func TestWrite(t *testing.T) {
- for _, test := range writeTests {
- p, err := parse(test.input)
-
- buf := new(bytes.Buffer)
- var n int
- switch test.encoding {
- case "UTF-8":
- n, err = p.Write(buf, UTF8)
- case "ISO-8859-1":
- n, err = p.Write(buf, ISO_8859_1)
- }
- assert.Equal(t, err, nil)
- s := string(buf.Bytes())
- assert.Equal(t, n, len(test.output), fmt.Sprintf("input=%q expected=%q obtained=%q", test.input, test.output, s))
- assert.Equal(t, s, test.output, fmt.Sprintf("input=%q expected=%q obtained=%q", test.input, test.output, s))
- }
-}
-
-func TestWriteComment(t *testing.T) {
- for _, test := range writeCommentTests {
- p, err := parse(test.input)
-
- buf := new(bytes.Buffer)
- var n int
- switch test.encoding {
- case "UTF-8":
- n, err = p.WriteComment(buf, "# ", UTF8)
- case "ISO-8859-1":
- n, err = p.WriteComment(buf, "# ", ISO_8859_1)
- }
- assert.Equal(t, err, nil)
- s := string(buf.Bytes())
- assert.Equal(t, n, len(test.output), fmt.Sprintf("input=%q expected=%q obtained=%q", test.input, test.output, s))
- assert.Equal(t, s, test.output, fmt.Sprintf("input=%q expected=%q obtained=%q", test.input, test.output, s))
- }
-}
-
-func TestCustomExpansionExpression(t *testing.T) {
- testKeyValuePrePostfix(t, "*[", "]*", "key=value\nkey2=*[key]*", "key", "value", "key2", "value")
-}
-
-func TestPanicOn32BitIntOverflow(t *testing.T) {
- is32Bit = true
- var min, max int64 = math.MinInt32 - 1, math.MaxInt32 + 1
- input := fmt.Sprintf("min=%d\nmax=%d", min, max)
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetInt64("min"), min)
- assert.Equal(t, p.MustGetInt64("max"), max)
- assert.Panic(t, func() { p.MustGetInt("min") }, ".* out of range")
- assert.Panic(t, func() { p.MustGetInt("max") }, ".* out of range")
-}
-
-func TestPanicOn32BitUintOverflow(t *testing.T) {
- is32Bit = true
- var max uint64 = math.MaxUint32 + 1
- input := fmt.Sprintf("max=%d", max)
- p := mustParse(t, input)
- assert.Equal(t, p.MustGetUint64("max"), max)
- assert.Panic(t, func() { p.MustGetUint("max") }, ".* out of range")
-}
-
-func TestDeleteKey(t *testing.T) {
- input := "#comments should also be gone\nkey=to-be-deleted\nsecond=key"
- p := mustParse(t, input)
- assert.Equal(t, len(p.m), 2)
- assert.Equal(t, len(p.c), 1)
- assert.Equal(t, len(p.k), 2)
- p.Delete("key")
- assert.Equal(t, len(p.m), 1)
- assert.Equal(t, len(p.c), 0)
- assert.Equal(t, len(p.k), 1)
- assert.Equal(t, p.k[0], "second")
- assert.Equal(t, p.m["second"], "key")
-}
-
-func TestDeleteUnknownKey(t *testing.T) {
- input := "#comments should also be gone\nkey=to-be-deleted"
- p := mustParse(t, input)
- assert.Equal(t, len(p.m), 1)
- assert.Equal(t, len(p.c), 1)
- assert.Equal(t, len(p.k), 1)
- p.Delete("wrong-key")
- assert.Equal(t, len(p.m), 1)
- assert.Equal(t, len(p.c), 1)
- assert.Equal(t, len(p.k), 1)
-}
-
-func TestMerge(t *testing.T) {
- input1 := "#comment\nkey=value\nkey2=value2"
- input2 := "#another comment\nkey=another value\nkey3=value3"
- p1 := mustParse(t, input1)
- p2 := mustParse(t, input2)
- p1.Merge(p2)
- assert.Equal(t, len(p1.m), 3)
- assert.Equal(t, len(p1.c), 1)
- assert.Equal(t, len(p1.k), 3)
- assert.Equal(t, p1.MustGet("key"), "another value")
- assert.Equal(t, p1.GetComment("key"), "another comment")
-}
-
-func TestMap(t *testing.T) {
- input := "key=value\nabc=def"
- p := mustParse(t, input)
- m := map[string]string{"key": "value", "abc": "def"}
- assert.Equal(t, p.Map(), m)
-}
-
-func TestFilterFunc(t *testing.T) {
- input := "key=value\nabc=def"
- p := mustParse(t, input)
- pp := p.FilterFunc(func(k, v string) bool {
- return k != "abc"
- })
- m := map[string]string{"key": "value"}
- assert.Equal(t, pp.Map(), m)
-}
-
-func TestLoad(t *testing.T) {
- x := "key=${value}\nvalue=${key}"
- p := NewProperties()
- p.DisableExpansion = true
- err := p.Load([]byte(x), UTF8)
- assert.Equal(t, err, nil)
-}
-
-// ----------------------------------------------------------------------------
-
-// tests all combinations of delimiters, leading and/or trailing whitespace and newlines.
-func testWhitespaceAndDelimiterCombinations(t *testing.T, key, value string) {
- whitespace := []string{"", " ", "\f", "\t"}
- delimiters := []string{"", " ", "=", ":"}
- newlines := []string{"", "\r", "\n", "\r\n"}
- for _, dl := range delimiters {
- for _, ws1 := range whitespace {
- for _, ws2 := range whitespace {
- for _, nl := range newlines {
- // skip the one case where there is nothing between a key and a value
- if ws1 == "" && dl == "" && ws2 == "" && value != "" {
- continue
- }
-
- input := fmt.Sprintf("%s%s%s%s%s%s", key, ws1, dl, ws2, value, nl)
- testKeyValue(t, input, key, value)
- }
- }
- }
- }
-}
-
-// tests whether key/value pairs exist for a given input.
-// keyvalues is expected to be an even number of strings of "key", "value", ...
-func testKeyValue(t *testing.T, input string, keyvalues ...string) {
- testKeyValuePrePostfix(t, "${", "}", input, keyvalues...)
-}
-
-// tests whether key/value pairs exist for a given input.
-// keyvalues is expected to be an even number of strings of "key", "value", ...
-func testKeyValuePrePostfix(t *testing.T, prefix, postfix, input string, keyvalues ...string) {
- p, err := Load([]byte(input), ISO_8859_1)
- assert.Equal(t, err, nil)
- p.Prefix = prefix
- p.Postfix = postfix
- assertKeyValues(t, input, p, keyvalues...)
-}
-
-// tests whether key/value pairs exist for a given input.
-// keyvalues is expected to be an even number of strings of "key", "value", ...
-func assertKeyValues(t *testing.T, input string, p *Properties, keyvalues ...string) {
- assert.Equal(t, p != nil, true, "want properties")
- assert.Equal(t, 2*p.Len(), len(keyvalues), "Odd number of key/value pairs.")
-
- for i := 0; i < len(keyvalues); i += 2 {
- key, value := keyvalues[i], keyvalues[i+1]
- v, ok := p.Get(key)
- if !ok {
- t.Errorf("No key %q found (input=%q)", key, input)
- }
- if got, want := v, value; !reflect.DeepEqual(got, want) {
- t.Errorf("Value %q does not match %q (input=%q)", v, value, input)
- }
- }
-}
-
-func mustParse(t *testing.T, s string) *Properties {
- p, err := parse(s)
- if err != nil {
- t.Fatalf("parse failed with %s", err)
- }
- return p
-}
-
-// prints to stderr if the -verbose flag was given.
-func printf(format string, args ...interface{}) {
- if *verbose {
- fmt.Fprintf(os.Stderr, format, args...)
- }
-}
diff --git a/vendor/github.com/magiconair/properties/rangecheck.go b/vendor/github.com/magiconair/properties/rangecheck.go
deleted file mode 100644
index b013a2e5..00000000
--- a/vendor/github.com/magiconair/properties/rangecheck.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2018 Frank Schroeder. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package properties
-
-import (
- "fmt"
- "math"
-)
-
-// make this a var to overwrite it in a test
-var is32Bit = ^uint(0) == math.MaxUint32
-
-// intRangeCheck checks if the value fits into the int type and
-// panics if it does not.
-func intRangeCheck(key string, v int64) int {
- if is32Bit && (v < math.MinInt32 || v > math.MaxInt32) {
- panic(fmt.Sprintf("Value %d for key %s out of range", v, key))
- }
- return int(v)
-}
-
-// uintRangeCheck checks if the value fits into the uint type and
-// panics if it does not.
-func uintRangeCheck(key string, v uint64) uint {
- if is32Bit && v > math.MaxUint32 {
- panic(fmt.Sprintf("Value %d for key %s out of range", v, key))
- }
- return uint(v)
-}
diff --git a/vendor/github.com/manifoldco/promptui/.github/CONTRIBUTING.md b/vendor/github.com/manifoldco/promptui/.github/CONTRIBUTING.md
deleted file mode 100644
index 580a1206..00000000
--- a/vendor/github.com/manifoldco/promptui/.github/CONTRIBUTING.md
+++ /dev/null
@@ -1,73 +0,0 @@
-# Contributing Guidelines
-
-Contributions are always welcome; however, please read this document in its
-entirety before submitting a Pull Request or Reporting a bug.
-
-### Table of Contents
-
-- [Reporting a bug](#reporting-a-bug)
- - [Security disclosure](#security-disclosure)
-- [Creating an issue](#creating-an-issue)
-- [Feature requests](#feature-requests)
-- [Opening a pull request](#opening-a-pull-request)
-- [Code of Conduct](#code-of-conduct)
-- [License](#license)
-- [Contributor license agreement](#contributor-license-agreement)
-
----------------
-
-# Reporting a Bug
-
-Think you've found a bug? Let us know!
-
-### Security disclosure
-
-Security is a top priority for us. If you have encountered a security issue
-please responsibly disclose it by following our [security
-disclosure](../docs/security.md) document.
-
-# Creating an Issue
-
-Your issue must follow these guidelines for it to be considered:
-
-#### Before submitting
-
-- Check you’re on the latest version, we may have already fixed your bug!
-- [Search our issue
- tracker](https://github.com/manifoldco/promptui/issues/search&type=issues)
- for your problem, someone may have already reported it
-
-# Opening a Pull Request
-
-To contribute, [fork](https://help.github.com/articles/fork-a-repo/)
-`promptui`, commit your changes, and [open a pull
-request](https://help.github.com/articles/using-pull-requests/).
-
-Your request will be reviewed as soon as possible. You may be asked to make
-changes to your submission during the review process.
-
-#### Before submitting
-
-- Test your change thoroughly
-
-
-# Code of Conduct
-
-All community members are expected to adhere to our [code of
-conduct](../CODE_OF_CONDUCT.md).
-
-
-# License
-
-Manifold's promptui is released under the [BSD 3-Clause
-License](../LICENSE.md).
-
-
-# Contributor license agreement
-
-For legal purposes all contributors must sign a [contributor license
-agreement](https://cla-assistant.io/manifoldco/promptui), either for an
-individual or corporation, before a pull request can be accepted.
-
-You will be prompted to sign the agreement by CLA Assistant (bot) when you open
-a Pull Request for the first time.
diff --git a/vendor/github.com/manifoldco/promptui/.github/listbot.md b/vendor/github.com/manifoldco/promptui/.github/listbot.md
deleted file mode 100644
index 98cdc052..00000000
--- a/vendor/github.com/manifoldco/promptui/.github/listbot.md
+++ /dev/null
@@ -1,3 +0,0 @@
-**Author**
-
-- [ ] Changelog has been updated
diff --git a/vendor/github.com/manifoldco/promptui/.gitignore b/vendor/github.com/manifoldco/promptui/.gitignore
deleted file mode 100644
index 22d0d82f..00000000
--- a/vendor/github.com/manifoldco/promptui/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-vendor
diff --git a/vendor/github.com/manifoldco/promptui/.travis.yml b/vendor/github.com/manifoldco/promptui/.travis.yml
deleted file mode 100644
index 0496fc00..00000000
--- a/vendor/github.com/manifoldco/promptui/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-language: go
-go:
- - 1.8.x
- - 1.9.x
-
-branches:
- only:
- - master
-
-install: make bootstrap
diff --git a/vendor/github.com/manifoldco/promptui/CHANGELOG.md b/vendor/github.com/manifoldco/promptui/CHANGELOG.md
deleted file mode 100644
index 60b07161..00000000
--- a/vendor/github.com/manifoldco/promptui/CHANGELOG.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# CHANGELOG
-
-All notable changes to this project will be documented in this file.
-
-The format is based on [Keep a Changelog](http://keepachangelog.com/)
-and this project adheres to [Semantic Versioning](http://semver.org/).
-
-## Unreleased
-
-## [0.3.0] - 2018-05-22
-
-### Added
-
-- Background colors codes and template helpers
-- `AllowEdit` for prompt to prevent deletion of the default value by any key
-- Added `StartInSearchMode` to allow starting the prompt in search mode
-
-### Fixed
-
-- `` key press on Windows
-- `juju/ansiterm` dependency
-- `chzyer/readline#136` new api with ReadCloser
-- Deleting UTF-8 characters sequence
-
-## [0.2.1] - 2017-11-30
-
-### Fixed
-
-- `SelectWithAdd` panicking on `.Run` due to lack of keys setup
-- Backspace key on Windows
-
-## [0.2.0] - 2017-11-16
-
-### Added
-
-- `Select` items can now be searched
-
-## [0.1.0] - 2017-11-02
-
-### Added
-
-- extract `promptui` from [torus](https://github.com/manifoldco/torus-cli) as a
- standalone lib.
-- `promptui.Prompt` provides a single input line to capture user information.
-- `promptui.Select` provides a list of options to choose from. Users can
- navigate through the list either one item at time or by pagination
diff --git a/vendor/github.com/manifoldco/promptui/CODE_OF_CONDUCT.md b/vendor/github.com/manifoldco/promptui/CODE_OF_CONDUCT.md
deleted file mode 100644
index cc58cce0..00000000
--- a/vendor/github.com/manifoldco/promptui/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,73 +0,0 @@
-# Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age,
-body size, disability, ethnicity, gender identity and expression, level of
-experience, nationality, personal appearance, race, religion, or sexual
-identity and orientation.
-
-## Our Standards
-
-Examples of behaviour that contributes to creating a positive environment
-include:
-
-- Using welcoming and inclusive language
-- Being respectful of differing viewpoints and experiences
-- Gracefully accepting constructive criticism
-- Focusing on what is best for the community
-- Showing empathy towards other community members
-
-Examples of unacceptable behaviour by participants include:
-
-- The use of sexualized language or imagery and unwelcome sexual attention or
- advances
-- Trolling, insulting/derogatory comments, and personal or political attacks
-- Public or private harassment
-- Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-- Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behaviour and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behaviour.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviours that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an
-appointed representative at an online or offline event. Representation of a
-project may be further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at
-[hello@manifold.co](mailto:hello@manifold.co). All complaints will be reviewed
-and investigated and will result in a response that is deemed necessary and
-appropriate to the circumstances. The project team is obligated to maintain
-confidentiality with regard to the reporter of an incident. Further details of
-specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
-available at
-[http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4).
diff --git a/vendor/github.com/manifoldco/promptui/Gopkg.lock b/vendor/github.com/manifoldco/promptui/Gopkg.lock
deleted file mode 100644
index 3c03227c..00000000
--- a/vendor/github.com/manifoldco/promptui/Gopkg.lock
+++ /dev/null
@@ -1,129 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- name = "github.com/alecthomas/gometalinter"
- packages = ["."]
- revision = "bae2f1293d092fd8167939d5108d1b025eaef9de"
- version = "v1.2.1"
-
-[[projects]]
- branch = "master"
- name = "github.com/alecthomas/units"
- packages = ["."]
- revision = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a"
-
-[[projects]]
- branch = "master"
- name = "github.com/chzyer/readline"
- packages = ["."]
- revision = "6a4bc7b4feaeff8feb63f87d5fb2cf3e3610a559"
-
-[[projects]]
- name = "github.com/client9/misspell"
- packages = [".","cmd/misspell"]
- revision = "59894abde931a32630d4e884a09c682ed20c5c7c"
- version = "v0.3.0"
-
-[[projects]]
- branch = "master"
- name = "github.com/golang/lint"
- packages = [".","golint"]
- revision = "6aaf7c34af0f4c36a57e0c429bace4d706d8e931"
-
-[[projects]]
- branch = "master"
- name = "github.com/google/shlex"
- packages = ["."]
- revision = "6f45313302b9c56850fc17f99e40caebce98c716"
-
-[[projects]]
- branch = "master"
- name = "github.com/gordonklaus/ineffassign"
- packages = ["."]
- revision = "da3d65debb9bff70fcfb6f277a8db31e8200de20"
-
-[[projects]]
- branch = "master"
- name = "github.com/juju/ansiterm"
- packages = [".","tabwriter"]
- revision = "35c59b9e0fe275705a71bf5d58ee293f27efbbc4"
-
-[[projects]]
- branch = "master"
- name = "github.com/kisielk/gotool"
- packages = [".","internal/load"]
- revision = "d6ce6262d87e3a4e153e86023ff56ae771554a41"
-
-[[projects]]
- branch = "master"
- name = "github.com/lunixbochs/vtclean"
- packages = ["."]
- revision = "d14193dfc626125c831501c1c42340b4248e1f5a"
-
-[[projects]]
- name = "github.com/mattn/go-colorable"
- packages = ["."]
- revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
- version = "v0.0.9"
-
-[[projects]]
- name = "github.com/mattn/go-isatty"
- packages = ["."]
- revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
- version = "v0.0.3"
-
-[[projects]]
- name = "github.com/nicksnyder/go-i18n"
- packages = ["i18n","i18n/bundle","i18n/language","i18n/translation"]
- revision = "ca33e78c8a430e2df435b02f63a3944fa8e9ea11"
- version = "v1.9.0"
-
-[[projects]]
- name = "github.com/pelletier/go-toml"
- packages = ["."]
- revision = "16398bac157da96aa88f98a2df640c7f32af1da2"
- version = "v1.0.1"
-
-[[projects]]
- branch = "master"
- name = "github.com/tsenart/deadcode"
- packages = ["."]
- revision = "210d2dc333e90c7e3eedf4f2242507a8e83ed4ab"
-
-[[projects]]
- branch = "master"
- name = "golang.org/x/sys"
- packages = ["unix"]
- revision = "686000749eaec0b8855b8eef5336cf63899fe51d"
-
-[[projects]]
- branch = "master"
- name = "golang.org/x/tools"
- packages = ["go/ast/astutil","go/buildutil","go/gcexportdata","go/gcimporter15","go/loader","go/types/typeutil"]
- revision = "9bd2f442688b66c5289262d70f537c2ecf81d7de"
-
-[[projects]]
- branch = "v3-unstable"
- name = "gopkg.in/alecthomas/kingpin.v3-unstable"
- packages = ["."]
- revision = "63abe20a23e29e80bbef8089bd3dee3ac25e5306"
-
-[[projects]]
- branch = "v2"
- name = "gopkg.in/yaml.v2"
- packages = ["."]
- revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
-
-[[projects]]
- name = "honnef.co/go/tools"
- packages = ["cmd/gosimple","internal/sharedcheck","lint","lint/lintutil","simple","ssa","ssa/ssautil","version"]
- revision = "e5147431c7c056bd6ef33ad2f23c846f835571dd"
- version = "2017.1"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- inputs-digest = "b683f37352cca49de9eefac440a2fbc8d84e1946237577881122b2fe86c9d950"
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/vendor/github.com/manifoldco/promptui/Gopkg.toml b/vendor/github.com/manifoldco/promptui/Gopkg.toml
deleted file mode 100644
index 8b407fc6..00000000
--- a/vendor/github.com/manifoldco/promptui/Gopkg.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-required=[
- "honnef.co/go/tools/cmd/gosimple",
- "github.com/alecthomas/gometalinter",
- "github.com/client9/misspell/cmd/misspell",
- "github.com/golang/lint/golint",
- "github.com/gordonklaus/ineffassign",
- "github.com/tsenart/deadcode",
-]
-
-[[constraint]]
- name = "github.com/chzyer/readline"
- branch = "master"
-
-[[constraint]]
- name = "github.com/juju/ansiterm"
- branch = "master"
diff --git a/vendor/github.com/manifoldco/promptui/LICENSE.md b/vendor/github.com/manifoldco/promptui/LICENSE.md
deleted file mode 100644
index 3ae687b2..00000000
--- a/vendor/github.com/manifoldco/promptui/LICENSE.md
+++ /dev/null
@@ -1,29 +0,0 @@
-BSD 3-Clause License
-
-Copyright (c) 2017, Arigato Machine Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/manifoldco/promptui/Makefile b/vendor/github.com/manifoldco/promptui/Makefile
deleted file mode 100644
index e0ae1075..00000000
--- a/vendor/github.com/manifoldco/promptui/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-LINTERS=\
- gofmt \
- golint \
- gosimple \
- vet \
- misspell \
- ineffassign \
- deadcode
-
-ci: $(LINTERS) test
-
-.PHONY: ci
-
-#################################################
-# Bootstrapping for base golang package deps
-#################################################
-
-CMD_PKGS=\
- github.com/golang/lint/golint \
- honnef.co/go/tools/cmd/gosimple \
- github.com/client9/misspell/cmd/misspell \
- github.com/gordonklaus/ineffassign \
- github.com/tsenart/deadcode \
- github.com/alecthomas/gometalinter
-
-define VENDOR_BIN_TMPL
-vendor/bin/$(notdir $(1)): vendor
- go build -o $$@ ./vendor/$(1)
-VENDOR_BINS += vendor/bin/$(notdir $(1))
-endef
-
-$(foreach cmd_pkg,$(CMD_PKGS),$(eval $(call VENDOR_BIN_TMPL,$(cmd_pkg))))
-$(patsubst %,%-bin,$(filter-out gofmt vet,$(LINTERS))): %-bin: vendor/bin/%
-gofmt-bin vet-bin:
-
-bootstrap:
- which dep || go get -u github.com/golang/dep/cmd/dep
-
-vendor: Gopkg.lock
- dep ensure
-
-.PHONY: bootstrap $(CMD_PKGS)
-
-#################################################
-# Test and linting
-#################################################
-
-test: vendor
- @CGO_ENABLED=0 go test -v $$(go list ./... | grep -v vendor)
-
-$(LINTERS): %: vendor/bin/gometalinter %-bin vendor
- PATH=`pwd`/vendor/bin:$$PATH gometalinter --tests --disable-all --vendor \
- --deadline=5m -s data ./... --enable $@
-
-.PHONY: $(LINTERS) test
diff --git a/vendor/github.com/manifoldco/promptui/README.md b/vendor/github.com/manifoldco/promptui/README.md
deleted file mode 100644
index a0c32a4f..00000000
--- a/vendor/github.com/manifoldco/promptui/README.md
+++ /dev/null
@@ -1,106 +0,0 @@
-# promptui
-
-Interactive prompt for command-line applications.
-
-We built Promptui because we wanted to make it easy and fun to explore cloud services with [manifold cli](https://github.com/manifoldco/manifold-cli).
-
-[Code of Conduct](./CODE_OF_CONDUCT.md) |
-[Contribution Guidelines](./.github/CONTRIBUTING.md)
-
-[![GitHub release](https://img.shields.io/github/tag/manifoldco/promptui.svg?label=latest)](https://github.com/manifoldco/promptui/releases)
-[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/manifoldco/promptui)
-[![Travis](https://img.shields.io/travis/manifoldco/promptui/master.svg)](https://travis-ci.org/manifoldco/promptui)
-[![Go Report Card](https://goreportcard.com/badge/github.com/manifoldco/promptui)](https://goreportcard.com/report/github.com/manifoldco/promptui)
-[![License](https://img.shields.io/badge/license-BSD-blue.svg)](./LICENSE.md)
-
-## Overview
-
-![promptui](https://media.giphy.com/media/xUNda0Ngb5qsogLsBi/giphy.gif)
-
-Promptui is a library providing a simple interface to create command-line
-prompts for go. It can be easily integrated into
-[spf13/cobra](https://github.com/spf13/cobra),
-[urfave/cli](https://github.com/urfave/cli) or any cli go application.
-
-Promptui has two main input modes:
-
-- `Prompt` provides a single line for user input. Prompt supports
- optional live validation, confirmation and masking the input.
-
-- `Select` provides a list of options to choose from. Select supports
- pagination, search, detailed view and custom templates.
-
-For a full list of options check [GoDoc](https://godoc.org/github.com/manifoldco/promptui).
-
-## Basic Usage
-
-### Prompt
-
-```go
-package main
-
-import (
- "errors"
- "fmt"
- "strconv"
-
- "github.com/manifoldco/promptui"
-)
-
-func main() {
- validate := func(input string) error {
- _, err := strconv.ParseFloat(input, 64)
- if err != nil {
- return errors.New("Invalid number")
- }
- return nil
- }
-
- prompt := promptui.Prompt{
- Label: "Number",
- Validate: validate,
- }
-
- result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("You choose %q\n", result)
-}
-```
-
-### Select
-
-```go
-package main
-
-import (
- "fmt"
-
- "github.com/manifoldco/promptui"
-)
-
-func main() {
- prompt := promptui.Select{
- Label: "Select Day",
- Items: []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
- "Saturday", "Sunday"},
- }
-
- _, result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("You choose %q\n", result)
-}
-```
-
-### More Examples
-
-See full list of [examples](https://github.com/manifoldco/promptui/tree/master/_examples)
diff --git a/vendor/github.com/manifoldco/promptui/_examples/confirm/main.go b/vendor/github.com/manifoldco/promptui/_examples/confirm/main.go
deleted file mode 100644
index fe48cc99..00000000
--- a/vendor/github.com/manifoldco/promptui/_examples/confirm/main.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/manifoldco/promptui"
-)
-
-func main() {
- prompt := promptui.Prompt{
- Label: "Delete Resource",
- IsConfirm: true,
- }
-
- result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("You choose %q\n", result)
-}
diff --git a/vendor/github.com/manifoldco/promptui/_examples/custom_prompt/main.go b/vendor/github.com/manifoldco/promptui/_examples/custom_prompt/main.go
deleted file mode 100644
index 44aa08d7..00000000
--- a/vendor/github.com/manifoldco/promptui/_examples/custom_prompt/main.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package main
-
-import (
- "fmt"
- "strconv"
-
- "github.com/manifoldco/promptui"
-)
-
-type pepper struct {
- Name string
- HeatUnit int
- Peppers int
-}
-
-func main() {
- validate := func(input string) error {
- _, err := strconv.ParseFloat(input, 64)
- return err
- }
-
- templates := &promptui.PromptTemplates{
- Prompt: "{{ . }} ",
- Valid: "{{ . | green }} ",
- Invalid: "{{ . | red }} ",
- Success: "{{ . | bold }} ",
- }
-
- prompt := promptui.Prompt{
- Label: "Spicy Level",
- Templates: templates,
- Validate: validate,
- }
-
- result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("You answered %s\n", result)
-}
diff --git a/vendor/github.com/manifoldco/promptui/_examples/custom_select/main.go b/vendor/github.com/manifoldco/promptui/_examples/custom_select/main.go
deleted file mode 100644
index c2078bca..00000000
--- a/vendor/github.com/manifoldco/promptui/_examples/custom_select/main.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package main
-
-import (
- "fmt"
- "strings"
-
- "github.com/manifoldco/promptui"
-)
-
-type pepper struct {
- Name string
- HeatUnit int
- Peppers int
-}
-
-func main() {
- peppers := []pepper{
- {Name: "Bell Pepper", HeatUnit: 0, Peppers: 0},
- {Name: "Banana Pepper", HeatUnit: 100, Peppers: 1},
- {Name: "Poblano", HeatUnit: 1000, Peppers: 2},
- {Name: "Jalapeño", HeatUnit: 3500, Peppers: 3},
- {Name: "Aleppo", HeatUnit: 10000, Peppers: 4},
- {Name: "Tabasco", HeatUnit: 30000, Peppers: 5},
- {Name: "Malagueta", HeatUnit: 50000, Peppers: 6},
- {Name: "Habanero", HeatUnit: 100000, Peppers: 7},
- {Name: "Red Savina Habanero", HeatUnit: 350000, Peppers: 8},
- {Name: "Dragon’s Breath", HeatUnit: 855000, Peppers: 9},
- }
-
- templates := &promptui.SelectTemplates{
- Label: "{{ . }}?",
- Active: "\U0001F336 {{ .Name | cyan }} ({{ .HeatUnit | red }})",
- Inactive: " {{ .Name | cyan }} ({{ .HeatUnit | red }})",
- Selected: "\U0001F336 {{ .Name | red | cyan }}",
- Details: `
---------- Pepper ----------
-{{ "Name:" | faint }} {{ .Name }}
-{{ "Heat Unit:" | faint }} {{ .HeatUnit }}
-{{ "Peppers:" | faint }} {{ .Peppers }}`,
- }
-
- searcher := func(input string, index int) bool {
- pepper := peppers[index]
- name := strings.Replace(strings.ToLower(pepper.Name), " ", "", -1)
- input = strings.Replace(strings.ToLower(input), " ", "", -1)
-
- return strings.Contains(name, input)
- }
-
- prompt := promptui.Select{
- Label: "Spicy Level",
- Items: peppers,
- Templates: templates,
- Size: 4,
- Searcher: searcher,
- }
-
- i, _, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("You choose number %d: %s\n", i+1, peppers[i].Name)
-}
diff --git a/vendor/github.com/manifoldco/promptui/_examples/prompt/main.go b/vendor/github.com/manifoldco/promptui/_examples/prompt/main.go
deleted file mode 100644
index e7e75090..00000000
--- a/vendor/github.com/manifoldco/promptui/_examples/prompt/main.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package main
-
-import (
- "errors"
- "fmt"
- "strconv"
-
- "github.com/manifoldco/promptui"
-)
-
-func main() {
- validate := func(input string) error {
- _, err := strconv.ParseFloat(input, 64)
- if err != nil {
- return errors.New("Invalid number")
- }
- return nil
- }
-
- prompt := promptui.Prompt{
- Label: "Number",
- Validate: validate,
- }
-
- result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("You choose %q\n", result)
-}
diff --git a/vendor/github.com/manifoldco/promptui/_examples/prompt_default/main.go b/vendor/github.com/manifoldco/promptui/_examples/prompt_default/main.go
deleted file mode 100644
index 9ee3877b..00000000
--- a/vendor/github.com/manifoldco/promptui/_examples/prompt_default/main.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package main
-
-import (
- "errors"
- "fmt"
- "os/user"
-
- "github.com/manifoldco/promptui"
-)
-
-func main() {
- validate := func(input string) error {
- if len(input) < 3 {
- return errors.New("Username must have more than 3 characters")
- }
- return nil
- }
-
- var username string
- u, err := user.Current()
- if err == nil {
- username = u.Username
- }
-
- prompt := promptui.Prompt{
- Label: "Username",
- Validate: validate,
- Default: username,
- }
-
- result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("Your username is %q\n", result)
-}
diff --git a/vendor/github.com/manifoldco/promptui/_examples/prompt_password/main.go b/vendor/github.com/manifoldco/promptui/_examples/prompt_password/main.go
deleted file mode 100644
index d9e60b88..00000000
--- a/vendor/github.com/manifoldco/promptui/_examples/prompt_password/main.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package main
-
-import (
- "errors"
- "fmt"
-
- "github.com/manifoldco/promptui"
-)
-
-func main() {
- validate := func(input string) error {
- if len(input) < 6 {
- return errors.New("Password must have more than 6 characters")
- }
- return nil
- }
-
- prompt := promptui.Prompt{
- Label: "Password",
- Validate: validate,
- Mask: '*',
- }
-
- result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("Your password is %q\n", result)
-}
diff --git a/vendor/github.com/manifoldco/promptui/_examples/select/main.go b/vendor/github.com/manifoldco/promptui/_examples/select/main.go
deleted file mode 100644
index c25aff3c..00000000
--- a/vendor/github.com/manifoldco/promptui/_examples/select/main.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/manifoldco/promptui"
-)
-
-func main() {
- prompt := promptui.Select{
- Label: "Select Day",
- Items: []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
- "Saturday", "Sunday"},
- }
-
- _, result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("You choose %q\n", result)
-}
diff --git a/vendor/github.com/manifoldco/promptui/_examples/select_add/main.go b/vendor/github.com/manifoldco/promptui/_examples/select_add/main.go
deleted file mode 100644
index 7e2c04d3..00000000
--- a/vendor/github.com/manifoldco/promptui/_examples/select_add/main.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/manifoldco/promptui"
-)
-
-func main() {
- prompt := promptui.SelectWithAdd{
- Label: "What's your text editor",
- Items: []string{"Vim", "Emacs", "Sublime", "VSCode", "Atom"},
- AddLabel: "Other",
- }
-
- _, result, err := prompt.Run()
-
- if err != nil {
- fmt.Printf("Prompt failed %v\n", err)
- return
- }
-
- fmt.Printf("You choose %s\n", result)
-}
diff --git a/vendor/github.com/manifoldco/promptui/codes.go b/vendor/github.com/manifoldco/promptui/codes.go
deleted file mode 100644
index de3f086b..00000000
--- a/vendor/github.com/manifoldco/promptui/codes.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package promptui
-
-import (
- "fmt"
- "strconv"
- "strings"
- "text/template"
-)
-
-const esc = "\033["
-
-type attribute int
-
-// Foreground weight/decoration attributes.
-const (
- reset attribute = iota
-
- FGBold
- FGFaint
- FGItalic
- FGUnderline
-)
-
-// Foreground color attributes
-const (
- FGBlack attribute = iota + 30
- FGRed
- FGGreen
- FGYellow
- FGBlue
- FGMagenta
- FGCyan
- FGWhite
-)
-
-// Background color attributes
-const (
- BGBlack attribute = iota + 40
- BGRed
- BGGreen
- BGYellow
- BGBlue
- BGMagenta
- BGCyan
- BGWhite
-)
-
-// ResetCode is the character code used to reset the terminal formatting
-var ResetCode = fmt.Sprintf("%s%dm", esc, reset)
-
-const (
- hideCursor = esc + "?25l"
- showCursor = esc + "?25h"
- clearLine = esc + "2K"
-)
-
-// FuncMap defines template helpers for the output. It can be extended as a
-// regular map.
-var FuncMap = template.FuncMap{
- "black": Styler(FGBlack),
- "red": Styler(FGRed),
- "green": Styler(FGGreen),
- "yellow": Styler(FGYellow),
- "blue": Styler(FGBlue),
- "magenta": Styler(FGMagenta),
- "cyan": Styler(FGCyan),
- "white": Styler(FGWhite),
- "bgBlack": Styler(BGBlack),
- "bgRed": Styler(BGRed),
- "bgGreen": Styler(BGGreen),
- "bgYellow": Styler(BGYellow),
- "bgBlue": Styler(BGBlue),
- "bgMagenta": Styler(BGMagenta),
- "bgCyan": Styler(BGCyan),
- "bgWhite": Styler(BGWhite),
- "bold": Styler(FGBold),
- "faint": Styler(FGFaint),
- "italic": Styler(FGItalic),
- "underline": Styler(FGUnderline),
-}
-
-func upLine(n uint) string {
- return movementCode(n, 'A')
-}
-
-func movementCode(n uint, code rune) string {
- return esc + strconv.FormatUint(uint64(n), 10) + string(code)
-}
-
-// Styler returns a func that applies the attributes given in the Styler call
-// to the provided string.
-func Styler(attrs ...attribute) func(interface{}) string {
- attrstrs := make([]string, len(attrs))
- for i, v := range attrs {
- attrstrs[i] = strconv.Itoa(int(v))
- }
-
- seq := strings.Join(attrstrs, ";")
-
- return func(v interface{}) string {
- end := ""
- s, ok := v.(string)
- if !ok || !strings.HasSuffix(s, ResetCode) {
- end = ResetCode
- }
- return fmt.Sprintf("%s%sm%v%s", esc, seq, v, end)
- }
-}
diff --git a/vendor/github.com/manifoldco/promptui/codes_test.go b/vendor/github.com/manifoldco/promptui/codes_test.go
deleted file mode 100644
index 2dcd1316..00000000
--- a/vendor/github.com/manifoldco/promptui/codes_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package promptui
-
-import "testing"
-
-func TestStyler(t *testing.T) {
- t.Run("renders a single code", func(t *testing.T) {
- red := Styler(FGRed)("hi")
- expected := "\033[31mhi\033[0m"
- if red != expected {
- t.Errorf("style did not match: %s != %s", red, expected)
- }
- })
-
- t.Run("combines multiple codes", func(t *testing.T) {
- boldRed := Styler(FGRed, FGBold)("hi")
- expected := "\033[31;1mhi\033[0m"
- if boldRed != expected {
- t.Errorf("style did not match: %s != %s", boldRed, expected)
- }
- })
-
- t.Run("should not repeat reset codes for nested styles", func(t *testing.T) {
- red := Styler(FGRed)("hi")
- boldRed := Styler(FGBold)(red)
- expected := "\033[1m\033[31mhi\033[0m"
- if boldRed != expected {
- t.Errorf("style did not match: %s != %s", boldRed, expected)
- }
- })
-}
diff --git a/vendor/github.com/manifoldco/promptui/keycodes.go b/vendor/github.com/manifoldco/promptui/keycodes.go
deleted file mode 100644
index c1f84918..00000000
--- a/vendor/github.com/manifoldco/promptui/keycodes.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// +build !windows
-
-package promptui
-
-import "github.com/chzyer/readline"
-
-var (
- // KeyEnter is the default key for submission/selection
- KeyEnter rune = readline.CharEnter
-
- // KeyBackspace is the default key for deleting input text
- KeyBackspace rune = readline.CharBackspace
-
- // KeyPrev is the default key to go up during selection
- KeyPrev rune = readline.CharPrev
-
- // KeyNext is the default key to go down during selection
- KeyNext rune = readline.CharNext
-
- // KeyBackward is the default key to page up during selection
- KeyBackward rune = readline.CharBackward
-
- // KeyForward is the default key to page down during selection
- KeyForward rune = readline.CharForward
-)
diff --git a/vendor/github.com/manifoldco/promptui/keycodes_windows.go b/vendor/github.com/manifoldco/promptui/keycodes_windows.go
deleted file mode 100644
index fa4709cf..00000000
--- a/vendor/github.com/manifoldco/promptui/keycodes_windows.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package promptui
-
-// source: https://msdn.microsoft.com/en-us/library/aa243025(v=vs.60).aspx
-
-var (
- // KeyEnter is the default key for submission/selection
- KeyEnter rune = 13
-
- // KeyBackspace is the default key for deleting input text
- KeyBackspace rune = 8
-
- // FIXME: keys below are not triggered by readline, not working on Windows
-
- // KeyPrev is the default key to go up during selection
- KeyPrev rune = 38
-
- // KeyNext is the default key to go down during selection
- KeyNext rune = 40
-
- // KeyBackward is the default key to page up during selection
- KeyBackward rune = 37
-
- // KeyForward is the default key to page down during selection
- KeyForward rune = 39
-)
diff --git a/vendor/github.com/manifoldco/promptui/list/list.go b/vendor/github.com/manifoldco/promptui/list/list.go
deleted file mode 100644
index b1cc8be9..00000000
--- a/vendor/github.com/manifoldco/promptui/list/list.go
+++ /dev/null
@@ -1,197 +0,0 @@
-package list
-
-import (
- "fmt"
- "reflect"
- "strings"
-)
-
-// Searcher can be implemented to allow the list to search for results.
-type Searcher func(input string, index int) bool
-
-// NotFound is an index returned when no item was selected. This could
-// happen due to a search without results.
-const NotFound = -1
-
-// List holds a collection of items that can be displayed with an N number of
-// visible items. The list can be moved up, down by one item of time or an
-// entire page (ie: visible size). It keeps track of the current selected item.
-type List struct {
- items []*interface{}
- scope []*interface{}
- cursor int // cursor holds the index of the current selected item
- size int // size is the number of visible options
- start int
- Searcher Searcher
-}
-
-// New creates and initializes a list. Items must be a slice type and size must
-// be greater than 0.
-func New(items interface{}, size int) (*List, error) {
- if size < 1 {
- return nil, fmt.Errorf("list size %d must be greater than 0", size)
- }
-
- if items == nil || reflect.TypeOf(items).Kind() != reflect.Slice {
- return nil, fmt.Errorf("items %v is not a slice", items)
- }
-
- slice := reflect.ValueOf(items)
- values := make([]*interface{}, slice.Len())
-
- for i := range values {
- item := slice.Index(i).Interface()
- values[i] = &item
- }
-
- return &List{size: size, items: values, scope: values}, nil
-}
-
-// Prev moves the visible list back one item. If the selected item is out of
-// view, the new select item becomes the last visible item. If the list is
-// already at the top, nothing happens.
-func (l *List) Prev() {
- if l.cursor > 0 {
- l.cursor--
- }
-
- if l.start > l.cursor {
- l.start = l.cursor
- }
-}
-
-// Search allows the list to be filtered by a given term. The list must
-// implement the searcher method for that.
-func (l *List) Search(term string) {
- term = strings.Trim(term, " ")
- l.cursor = 0
- l.start = 0
- l.search(term)
-}
-
-// CancelSearch stops the current search and returns the list to its
-// original order.
-func (l *List) CancelSearch() {
- l.cursor = 0
- l.start = 0
- l.scope = l.items
-}
-
-func (l *List) search(term string) {
- var scope []*interface{}
-
- for i, item := range l.items {
- if l.Searcher(term, i) {
- scope = append(scope, item)
- }
- }
-
- l.scope = scope
-}
-
-// Next moves the visible list forward one item. If the selected item is out of
-// view, the new select item becomes the first visible item. If the list is
-// already at the bottom, nothing happens.
-func (l *List) Next() {
- max := len(l.scope) - 1
-
- if l.cursor < max {
- l.cursor++
- }
-
- if l.start+l.size <= l.cursor {
- l.start = l.cursor - l.size + 1
- }
-}
-
-// PageUp moves the visible list backward by x items. Where x is the size of the
-// visible items on the list. The selected item becomes the first visible item.
-// If the list is already at the bottom, the selected item becomes the last
-// visible item.
-func (l *List) PageUp() {
- start := l.start - l.size
- if start < 0 {
- l.start = 0
- } else {
- l.start = start
- }
-
- cursor := l.start
-
- if cursor < l.cursor {
- l.cursor = cursor
- }
-}
-
-// PageDown moves the visible list forward by x items. Where x is the size of
-// the visible items on the list. The selected item becomes the first visible
-// item.
-func (l *List) PageDown() {
- start := l.start + l.size
- max := len(l.scope) - l.size
-
- switch {
- case len(l.scope) < l.size:
- l.start = 0
- case start > max:
- l.start = max
- default:
- l.start = start
- }
-
- cursor := l.start
-
- if cursor == l.cursor {
- l.cursor = len(l.scope) - 1
- } else if cursor > l.cursor {
- l.cursor = cursor
- }
-}
-
-// CanPageDown returns whether a list can still PageDown().
-func (l *List) CanPageDown() bool {
- max := len(l.scope)
- return l.start+l.size < max
-}
-
-// CanPageUp returns whether a list can still PageUp().
-func (l *List) CanPageUp() bool {
- return l.start > 0
-}
-
-// Index returns the index of the item currently selected.
-func (l *List) Index() int {
- selected := l.scope[l.cursor]
-
- for i, item := range l.items {
- if item == selected {
- return i
- }
- }
-
- return NotFound
-}
-
-// Items returns a slice equal to the size of the list with the current visible
-// items and the index of the active item in this list.
-func (l *List) Items() ([]interface{}, int) {
- var result []interface{}
- max := len(l.scope)
- end := l.start + l.size
-
- if end > max {
- end = max
- }
-
- active := NotFound
-
- for i, j := l.start, 0; i < end; i, j = i+1, j+1 {
- if l.cursor == i {
- active = j
- }
-
- result = append(result, *l.scope[i])
- }
-
- return result, active
-}
diff --git a/vendor/github.com/manifoldco/promptui/list/list_test.go b/vendor/github.com/manifoldco/promptui/list/list_test.go
deleted file mode 100644
index 4dd6fde0..00000000
--- a/vendor/github.com/manifoldco/promptui/list/list_test.go
+++ /dev/null
@@ -1,164 +0,0 @@
-package list
-
-import (
- "fmt"
- "reflect"
- "testing"
-)
-
-func TestListNew(t *testing.T) {
- t.Run("when items a slice nil", func(t *testing.T) {
- _, err := New([]int{1, 2, 3}, 3)
- if err != nil {
- t.Errorf("Expected no errors, error %v", err)
- }
- })
-
- t.Run("when items is nil", func(t *testing.T) {
- _, err := New(nil, 3)
- if err == nil {
- t.Errorf("Expected error got none")
- }
- })
-
- t.Run("when items is not a slice", func(t *testing.T) {
- _, err := New("1,2,3", 3)
- if err == nil {
- t.Errorf("Expected error got none")
- }
- })
-}
-
-func TestListMovement(t *testing.T) {
- letters := []rune{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}
-
- l, err := New(letters, 4)
- if err != nil {
- t.Fatalf("Expected no error, got %v", err)
- }
-
- tcs := []struct {
- expect []rune
- move string
- selected rune
- }{
- {move: "next", selected: 'b', expect: []rune{'a', 'b', 'c', 'd'}},
- {move: "prev", selected: 'a', expect: []rune{'a', 'b', 'c', 'd'}},
- {move: "prev", selected: 'a', expect: []rune{'a', 'b', 'c', 'd'}},
- {move: "next", selected: 'b', expect: []rune{'a', 'b', 'c', 'd'}},
- {move: "next", selected: 'c', expect: []rune{'a', 'b', 'c', 'd'}},
- {move: "next", selected: 'd', expect: []rune{'a', 'b', 'c', 'd'}},
- {move: "next", selected: 'e', expect: []rune{'b', 'c', 'd', 'e'}},
- {move: "prev", selected: 'd', expect: []rune{'b', 'c', 'd', 'e'}},
- {move: "up", selected: 'a', expect: []rune{'a', 'b', 'c', 'd'}},
- {move: "up", selected: 'a', expect: []rune{'a', 'b', 'c', 'd'}},
- {move: "down", selected: 'e', expect: []rune{'e', 'f', 'g', 'h'}},
- {move: "down", selected: 'g', expect: []rune{'g', 'h', 'i', 'j'}},
- {move: "down", selected: 'j', expect: []rune{'g', 'h', 'i', 'j'}},
- }
-
- for _, tc := range tcs {
- t.Run(fmt.Sprintf("list %s", tc.move), func(t *testing.T) {
- switch tc.move {
- case "next":
- l.Next()
- case "prev":
- l.Prev()
- case "up":
- l.PageUp()
- case "down":
- l.PageDown()
- default:
- t.Fatalf("unknown move %q", tc.move)
- }
-
- list, idx := l.Items()
-
- got := castList(list)
-
- if !reflect.DeepEqual(tc.expect, got) {
- t.Errorf("expected %q, got %q", tc.expect, got)
- }
-
- selected := list[idx]
-
- if tc.selected != selected {
- t.Errorf("expected selected to be %q, got %q", tc.selected, selected)
- }
- })
- }
-}
-
-func TestListPageDown(t *testing.T) {
- t.Run("when list has fewer items than page size", func(t *testing.T) {
- letters := []rune{'a', 'b'}
- l, err := New(letters, 4)
- if err != nil {
- t.Fatalf("Expected no error, got %v", err)
- }
-
- l.PageDown()
- list, idx := l.Items()
-
- expected := 'b'
- selected := list[idx]
-
- if selected != expected {
- t.Errorf("expected selected to be %q, got %q", expected, selected)
- }
- })
-}
-
-func TestListComparion(t *testing.T) {
- t.Run("when item supports comparison", func(t *testing.T) {
- type comparable struct {
- Number int
- }
-
- structs := []comparable{
- {Number: 1},
- {Number: 2},
- }
-
- l, err := New(structs, 4)
- if err != nil {
- t.Fatalf("Expected no error, got %v", err)
- }
-
- idx := l.Index()
-
- if idx != 0 {
- t.Errorf("expected index to be first, got %d", idx)
- }
- })
-
- t.Run("when item doesn't support comparison", func(t *testing.T) {
- type uncomparable struct {
- Numbers []int
- }
-
- structs := []uncomparable{
- {Numbers: []int{1}},
- {Numbers: []int{2}},
- }
-
- l, err := New(structs, 4)
- if err != nil {
- t.Fatalf("Expected no error, got %v", err)
- }
-
- idx := l.Index()
-
- if idx != 0 {
- t.Errorf("expected index to be first, got %d", idx)
- }
- })
-}
-
-func castList(list []interface{}) []rune {
- result := make([]rune, len(list))
- for i, l := range list {
- result[i] = l.(rune)
- }
- return result
-}
diff --git a/vendor/github.com/manifoldco/promptui/prompt.go b/vendor/github.com/manifoldco/promptui/prompt.go
deleted file mode 100644
index 9fdfcb65..00000000
--- a/vendor/github.com/manifoldco/promptui/prompt.go
+++ /dev/null
@@ -1,338 +0,0 @@
-package promptui
-
-import (
- "fmt"
- "io"
- "strings"
- "text/template"
-
- "github.com/chzyer/readline"
- "github.com/manifoldco/promptui/screenbuf"
-)
-
-const cursor = "\u2588"
-
-// Prompt represents a single line text field input.
-type Prompt struct {
- // Label is the value displayed on the command line prompt. It can be any
- // value one would pass to a text/template Execute(), including just a string.
- Label interface{}
-
- Default string // Default is the initial value to populate in the prompt
-
- // AllowEdit lets the user edit the default value. If false, any key press
- // other than automatically clears the default value.
- AllowEdit bool
-
- // Validate is optional. If set, this function is used to validate the input
- // after each character entry.
- Validate ValidateFunc
-
- // If mask is set, this value is displayed instead of the actual input
- // characters.
- Mask rune
-
- // Templates can be used to customize the prompt output. If nil is passed, the
- // default templates are used.
- Templates *PromptTemplates
-
- // IsConfirm sets the prompt to be a [y/N] question.
- IsConfirm bool
-
- // IsVimMode enables vi-like movements (hjkl) and editing.
- IsVimMode bool
-
- stdin io.ReadCloser
- stdout io.WriteCloser
-}
-
-// PromptTemplates allow a prompt to be customized following stdlib
-// text/template syntax. If any field is blank a default template is used.
-type PromptTemplates struct {
- // Prompt is a text/template for the initial prompt question.
- Prompt string
-
- // Prompt is a text/template if the prompt is a confirmation.
- Confirm string
-
- // Valid is a text/template for when the current input is valid.
- Valid string
-
- // Invalid is a text/template for when the current input is invalid.
- Invalid string
-
- // Success is a text/template for the successful result.
- Success string
-
- // Prompt is a text/template when there is a validation error.
- ValidationError string
-
- // FuncMap is a map of helpers for the templates. If nil, the default helpers
- // are used.
- FuncMap template.FuncMap
-
- prompt *template.Template
- valid *template.Template
- invalid *template.Template
- validation *template.Template
- success *template.Template
-}
-
-// Run runs the prompt, returning the validated input.
-func (p *Prompt) Run() (string, error) {
- c := &readline.Config{}
- err := c.Init()
- if err != nil {
- return "", err
- }
-
- err = p.prepareTemplates()
- if err != nil {
- return "", err
- }
-
- if p.stdin != nil {
- c.Stdin = p.stdin
- }
-
- if p.stdout != nil {
- c.Stdout = p.stdout
- }
-
- if p.Mask != 0 {
- c.EnableMask = true
- c.MaskRune = p.Mask
- }
-
- if p.IsVimMode {
- c.VimMode = true
- }
-
- c.HistoryLimit = -1
- c.UniqueEditLine = true
-
- rl, err := readline.NewEx(c)
- if err != nil {
- return "", err
- }
-
- rl.Write([]byte(hideCursor))
- sb := screenbuf.New(rl)
-
- validFn := func(x string) error {
- return nil
- }
-
- if p.Validate != nil {
- validFn = p.Validate
- }
-
- var inputErr error
- input := p.Default
- if p.IsConfirm {
- input = ""
- }
- eraseDefault := input != "" && !p.AllowEdit
-
- c.SetListener(func(line []rune, pos int, key rune) ([]rune, int, bool) {
- if line != nil {
- input += string(line)
- }
-
- switch key {
- case 0: // empty
- case KeyEnter:
- return nil, 0, false
- case KeyBackspace:
- if eraseDefault {
- eraseDefault = false
- input = ""
- }
- if len(input) > 0 {
- r := []rune(input)
- input = string(r[:len(r)-1])
- }
- default:
- if eraseDefault {
- eraseDefault = false
- input = string(line)
- }
- }
-
- err := validFn(input)
- var prompt []byte
-
- if err != nil {
- prompt = render(p.Templates.invalid, p.Label)
- } else {
- prompt = render(p.Templates.valid, p.Label)
- if p.IsConfirm {
- prompt = render(p.Templates.prompt, p.Label)
- }
- }
-
- echo := input
- if p.Mask != 0 {
- echo = strings.Repeat(string(p.Mask), len(echo))
- }
-
- prompt = append(prompt, []byte(echo+cursor)...)
-
- sb.Reset()
- sb.Write(prompt)
-
- if inputErr != nil {
- validation := render(p.Templates.validation, inputErr)
- sb.Write(validation)
- inputErr = nil
- }
-
- sb.Flush()
-
- return nil, 0, true
- })
-
- for {
- _, err = rl.Readline()
-
- inputErr = validFn(input)
- if inputErr == nil {
- break
- }
-
- if err != nil {
- switch err {
- case readline.ErrInterrupt:
- err = ErrInterrupt
- case io.EOF:
- err = ErrEOF
- }
- break
- }
- }
-
- if err != nil {
- if err.Error() == "Interrupt" {
- err = ErrInterrupt
- }
- sb.Reset()
- sb.WriteString("")
- sb.Flush()
- rl.Write([]byte(showCursor))
- rl.Close()
- return "", err
- }
-
- echo := input
- if p.Mask != 0 {
- echo = strings.Repeat(string(p.Mask), len(echo))
- }
-
- prompt := render(p.Templates.valid, p.Label)
- prompt = append(prompt, []byte(echo)...)
-
- if p.IsConfirm {
- lowerDefault := strings.ToLower(p.Default)
- if strings.ToLower(echo) != "y" && (lowerDefault != "y" || (lowerDefault == "y" && echo != "")) {
- prompt = render(p.Templates.invalid, p.Label)
- err = ErrAbort
- }
- }
-
- sb.Reset()
- sb.Write(prompt)
- sb.Flush()
- rl.Write([]byte(showCursor))
- rl.Close()
-
- return input, err
-}
-
-func (p *Prompt) prepareTemplates() error {
- tpls := p.Templates
- if tpls == nil {
- tpls = &PromptTemplates{}
- }
-
- if tpls.FuncMap == nil {
- tpls.FuncMap = FuncMap
- }
-
- bold := Styler(FGBold)
-
- if p.IsConfirm {
- if tpls.Confirm == "" {
- confirm := "y/N"
- if strings.ToLower(p.Default) == "y" {
- confirm = "Y/n"
- }
- tpls.Confirm = fmt.Sprintf(`{{ "%s" | bold }} {{ . | bold }}? {{ "[%s]" | faint }} `, IconInitial, confirm)
- }
-
- tpl, err := template.New("").Funcs(tpls.FuncMap).Parse(tpls.Confirm)
- if err != nil {
- return err
- }
-
- tpls.prompt = tpl
- } else {
- if tpls.Prompt == "" {
- tpls.Prompt = fmt.Sprintf("%s {{ . | bold }}%s ", bold(IconInitial), bold(":"))
- }
-
- tpl, err := template.New("").Funcs(tpls.FuncMap).Parse(tpls.Prompt)
- if err != nil {
- return err
- }
-
- tpls.prompt = tpl
- }
-
- if tpls.Valid == "" {
- tpls.Valid = fmt.Sprintf("%s {{ . | bold }}%s ", bold(IconGood), bold(":"))
- }
-
- tpl, err := template.New("").Funcs(tpls.FuncMap).Parse(tpls.Valid)
- if err != nil {
- return err
- }
-
- tpls.valid = tpl
-
- if tpls.Invalid == "" {
- tpls.Invalid = fmt.Sprintf("%s {{ . | bold }}%s ", bold(IconBad), bold(":"))
- }
-
- tpl, err = template.New("").Funcs(tpls.FuncMap).Parse(tpls.Invalid)
- if err != nil {
- return err
- }
-
- tpls.invalid = tpl
-
- if tpls.ValidationError == "" {
- tpls.ValidationError = `{{ ">>" | red }} {{ . | red }}`
- }
-
- tpl, err = template.New("").Funcs(tpls.FuncMap).Parse(tpls.ValidationError)
- if err != nil {
- return err
- }
-
- tpls.validation = tpl
-
- if tpls.Success == "" {
- tpls.Success = `{{ . | faint }}`
- }
-
- tpl, err = template.New("").Funcs(tpls.FuncMap).Parse(tpls.Success)
- if err != nil {
- return err
- }
-
- tpls.success = tpl
-
- p.Templates = tpls
-
- return nil
-}
diff --git a/vendor/github.com/manifoldco/promptui/promptui.go b/vendor/github.com/manifoldco/promptui/promptui.go
deleted file mode 100644
index 4faa68d9..00000000
--- a/vendor/github.com/manifoldco/promptui/promptui.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Package promptui provides ui elements for the command line prompt.
-package promptui
-
-import "errors"
-
-// ErrEOF is returned from prompts when EOF is encountered.
-var ErrEOF = errors.New("^D")
-
-// ErrInterrupt is returned from prompts when an interrupt (ctrl-c) is
-// encountered.
-var ErrInterrupt = errors.New("^C")
-
-// ErrAbort is returned when confirm prompts are supplied "n"
-var ErrAbort = errors.New("")
-
-// ValidateFunc validates the given input. It should return a ValidationError
-// if the input is not valid.
-type ValidateFunc func(string) error
diff --git a/vendor/github.com/manifoldco/promptui/screenbuf/screenbuf.go b/vendor/github.com/manifoldco/promptui/screenbuf/screenbuf.go
deleted file mode 100644
index f9dd24ca..00000000
--- a/vendor/github.com/manifoldco/promptui/screenbuf/screenbuf.go
+++ /dev/null
@@ -1,138 +0,0 @@
-package screenbuf
-
-import (
- "bytes"
- "fmt"
- "io"
-)
-
-const esc = "\033["
-
-var (
- clearLine = []byte(esc + "2K\r")
- moveUp = []byte(esc + "1A")
- moveDown = []byte(esc + "1B")
-)
-
-// ScreenBuf is a convenient way to write to terminal screens. It creates,
-// clears and, moves up or down lines as needed to write the output to the
-// terminal using ANSI escape codes.
-type ScreenBuf struct {
- w io.Writer
- buf *bytes.Buffer
- reset bool
- flush bool
- cursor int
- height int
-}
-
-// New creates and initializes a new ScreenBuf.
-func New(w io.Writer) *ScreenBuf {
- return &ScreenBuf{buf: &bytes.Buffer{}, w: w}
-}
-
-// Reset truncates the underlining buffer and marks all its previous lines to be
-// cleared during the next Write.
-func (s *ScreenBuf) Reset() {
- s.buf.Reset()
- s.reset = true
-}
-
-// Write writes a single line to the underlining buffer. If the ScreenBuf was
-// previously reset, all previous lines are cleared and the output starts from
-// the top. Lines with \r or \n will fail since they can interfere with the
-// terminal ability to move between lines.
-func (s *ScreenBuf) Write(b []byte) (int, error) {
- if bytes.ContainsAny(b, "\r\n") {
- return 0, fmt.Errorf("%q should not contain either \\r or \\n", b)
- }
-
- if s.reset {
- for i := 0; i < s.height; i++ {
- _, err := s.buf.Write(moveUp)
- if err != nil {
- return 0, err
- }
- _, err = s.buf.Write(clearLine)
- if err != nil {
- return 0, err
- }
- }
- s.cursor = 0
- s.height = 0
- s.reset = false
- }
-
- switch {
- case s.cursor == s.height:
- n, err := s.buf.Write(clearLine)
- if err != nil {
- return n, err
- }
- line := append(b, []byte("\n")...)
- n, err = s.buf.Write(line)
- if err != nil {
- return n, err
- }
- s.height++
- s.cursor++
- return n, nil
- case s.cursor < s.height:
- n, err := s.buf.Write(clearLine)
- if err != nil {
- return n, err
- }
- n, err = s.buf.Write(b)
- if err != nil {
- return n, err
- }
- n, err = s.buf.Write(moveDown)
- if err != nil {
- return n, err
- }
- s.cursor++
- return n, nil
- default:
- return 0, fmt.Errorf("Invalid write cursor position (%d) exceeded line height: %d", s.cursor, s.height)
- }
-}
-
-// Flush writes any buffered data to the underlying io.Writer.
-func (s *ScreenBuf) Flush() error {
- for i := s.cursor; i < s.height; i++ {
- if i < s.height {
- _, err := s.buf.Write(clearLine)
- if err != nil {
- return err
- }
- }
- _, err := s.buf.Write(moveDown)
- if err != nil {
- return err
- }
- }
-
- _, err := s.buf.WriteTo(s.w)
- if err != nil {
- return err
- }
-
- s.buf.Reset()
-
- for i := 0; i < s.height; i++ {
- _, err := s.buf.Write(moveUp)
- if err != nil {
- return err
- }
- }
-
- s.cursor = 0
-
- return nil
-}
-
-// WriteString is a convenient function to write a new line passing a string.
-// Check ScreenBuf.Write() for a detailed explanation of the function behaviour.
-func (s *ScreenBuf) WriteString(str string) (int, error) {
- return s.Write([]byte(str))
-}
diff --git a/vendor/github.com/manifoldco/promptui/screenbuf/screenbuf_test.go b/vendor/github.com/manifoldco/promptui/screenbuf/screenbuf_test.go
deleted file mode 100644
index 5236358b..00000000
--- a/vendor/github.com/manifoldco/promptui/screenbuf/screenbuf_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package screenbuf
-
-import (
- "bytes"
- "testing"
-)
-
-func TestScreen(t *testing.T) {
- // overwrite regular movement codes for easier visualization
- clearLine = []byte("\\c")
- moveUp = []byte("\\u")
- moveDown = []byte("\\d")
-
- var buf bytes.Buffer
- s := New(&buf)
-
- tcs := []struct {
- scenario string
- lines []string
- expect string
- cursor int
- height int
- flush bool
- reset bool
- }{
- {
- scenario: "initial write",
- lines: []string{"Line One"},
- expect: "\\cLine One\n",
- cursor: 1,
- height: 1,
- },
- {
- scenario: "write of with same number of lines",
- lines: []string{"Line One"},
- expect: "\\u\\cLine One\\d",
- cursor: 1,
- height: 1,
- },
- {
- scenario: "write of with more lines",
- lines: []string{"Line One", "Line Two"},
- expect: "\\u\\cLine One\\d\\cLine Two\n",
- cursor: 2,
- height: 2,
- },
- {
- scenario: "write of with fewer lines",
- lines: []string{"line One"},
- expect: "\\u\\u\\cline One\\d\\c\\d",
- cursor: 1,
- height: 2,
- },
- {
- scenario: "write of way more lines",
- lines: []string{"line one", "line two", "line three", "line four", "line five"},
- expect: "\\u\\u\\cline one\\d\\cline two\\d\\cline three\n\\cline four\n\\cline five\n",
- cursor: 5,
- height: 5,
- },
- {
- scenario: "write of way less lines",
- lines: []string{"line one", "line two"},
- expect: "\\u\\u\\u\\u\\u\\cline one\\d\\cline two\\d\\c\\d\\c\\d\\c\\d",
- cursor: 2,
- height: 5,
- },
- {
- scenario: "write of way more lines",
- lines: []string{"line one", "line two", "line three", "line four", "line five"},
- expect: "\\u\\u\\u\\u\\u\\cline one\\d\\cline two\\d\\cline three\\d\\cline four\\d\\cline five\\d",
- cursor: 5,
- height: 5,
- },
- {
- scenario: "reset and write",
- lines: []string{"line one", "line two"},
- expect: "\\u\\c\\u\\c\\u\\c\\u\\c\\u\\c\\cline one\n\\cline two\n",
- cursor: 2,
- height: 2,
- reset: true,
- },
- }
-
- for _, tc := range tcs {
- t.Run(tc.scenario, func(t *testing.T) {
- buf.Reset()
- if tc.reset {
- s.Reset()
- }
-
- for _, line := range tc.lines {
- _, err := s.WriteString(line)
- if err != nil {
- t.Fatalf("expected no error, got %v", err)
- }
- }
-
- if tc.cursor != s.cursor {
- t.Errorf("expected cursor %d, got %d", tc.cursor, s.cursor)
- }
-
- err := s.Flush()
- if err != nil {
- t.Fatalf("expected no error, got %v", err)
- }
-
- got := buf.String()
-
- if tc.expect != got {
- t.Errorf("expected %q, got %q", tc.expect, got)
- }
-
- if tc.height != s.height {
- t.Errorf("expected height %d, got %d", tc.height, s.height)
- }
- })
- }
-}
diff --git a/vendor/github.com/manifoldco/promptui/select.go b/vendor/github.com/manifoldco/promptui/select.go
deleted file mode 100644
index 165b9699..00000000
--- a/vendor/github.com/manifoldco/promptui/select.go
+++ /dev/null
@@ -1,503 +0,0 @@
-package promptui
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "text/template"
-
- "github.com/chzyer/readline"
- "github.com/juju/ansiterm"
- "github.com/manifoldco/promptui/list"
- "github.com/manifoldco/promptui/screenbuf"
-)
-
-// SelectedAdd is returned from SelectWithAdd when add is selected.
-const SelectedAdd = -1
-
-// Select represents a list for selecting a single item
-type Select struct {
- // Label is the value displayed on the command line prompt. It can be any
- // value one would pass to a text/template Execute(), including just a string.
- Label interface{}
-
- // Items are the items to use in the list. It can be any slice type one would
- // pass to a text/template execute, including a string slice.
- Items interface{}
-
- // Size is the number of items that should appear on the select before
- // scrolling. If it is 0, defaults to 5.
- Size int
-
- // IsVimMode sets whether readline is using Vim mode.
- IsVimMode bool
-
- // Templates can be used to customize the select output. If nil is passed, the
- // default templates are used.
- Templates *SelectTemplates
-
- // Keys can be used to change movement and search keys.
- Keys *SelectKeys
-
- // Searcher can be implemented to teach the select how to search for items.
- Searcher list.Searcher
-
- // Starts the prompt in search mode.
- StartInSearchMode bool
-
- label string
-
- list *list.List
-}
-
-// SelectKeys defines which keys can be used for movement and search.
-type SelectKeys struct {
- Next Key // Next defaults to down arrow key
- Prev Key // Prev defaults to up arrow key
- PageUp Key // PageUp defaults to left arrow key
- PageDown Key // PageDown defaults to right arrow key
- Search Key // Search defaults to '/' key
-}
-
-// Key defines a keyboard code and a display representation for the help
-// Check https://github.com/chzyer/readline for a list of codes
-type Key struct {
- Code rune
- Display string
-}
-
-// SelectTemplates allow a select prompt to be customized following stdlib
-// text/template syntax. If any field is blank a default template is used.
-type SelectTemplates struct {
- // Active is a text/template for the label.
- Label string
-
- // Active is a text/template for when an item is current active.
- Active string
-
- // Inactive is a text/template for when an item is not current active.
- Inactive string
-
- // Selected is a text/template for when an item was successfully selected.
- Selected string
-
- // Details is a text/template for when an item current active to show
- // additional information. It can have multiple lines.
- Details string
-
- // Help is a text/template for displaying instructions at the top. By default
- // it shows keys for movement and search.
- Help string
-
- // FuncMap is a map of helpers for the templates. If nil, the default helpers
- // are used.
- FuncMap template.FuncMap
-
- label *template.Template
- active *template.Template
- inactive *template.Template
- selected *template.Template
- details *template.Template
- help *template.Template
-}
-
-// Run runs the Select list. It returns the index of the selected element,
-// and its value.
-func (s *Select) Run() (int, string, error) {
- if s.Size == 0 {
- s.Size = 5
- }
-
- l, err := list.New(s.Items, s.Size)
- if err != nil {
- return 0, "", err
- }
- l.Searcher = s.Searcher
-
- s.list = l
-
- s.setKeys()
-
- err = s.prepareTemplates()
- if err != nil {
- return 0, "", err
- }
- return s.innerRun(0, ' ')
-}
-
-func (s *Select) innerRun(starting int, top rune) (int, string, error) {
- stdin := readline.NewCancelableStdin(os.Stdin)
- c := &readline.Config{}
- err := c.Init()
- if err != nil {
- return 0, "", err
- }
-
- c.Stdin = stdin
-
- if s.IsVimMode {
- c.VimMode = true
- }
-
- c.HistoryLimit = -1
- c.UniqueEditLine = true
-
- rl, err := readline.NewEx(c)
- if err != nil {
- return 0, "", err
- }
-
- rl.Write([]byte(hideCursor))
- sb := screenbuf.New(rl)
-
- var searchInput []rune
- canSearch := s.Searcher != nil
- searchMode := s.StartInSearchMode
-
- c.SetListener(func(line []rune, pos int, key rune) ([]rune, int, bool) {
- switch {
- case key == KeyEnter:
- return nil, 0, true
- case key == s.Keys.Next.Code || (key == 'j' && !searchMode):
- s.list.Next()
- case key == s.Keys.Prev.Code || (key == 'k' && !searchMode):
- s.list.Prev()
- case key == s.Keys.Search.Code:
- if !canSearch {
- break
- }
-
- if searchMode {
- searchMode = false
- searchInput = nil
- s.list.CancelSearch()
- } else {
- searchMode = true
- }
- case key == KeyBackspace:
- if !canSearch || !searchMode {
- break
- }
-
- if len(searchInput) > 1 {
- searchInput = searchInput[:len(searchInput)-1]
- s.list.Search(string(searchInput))
- } else {
- searchInput = nil
- s.list.CancelSearch()
- }
- case key == s.Keys.PageUp.Code || (key == 'h' && !searchMode):
- s.list.PageUp()
- case key == s.Keys.PageDown.Code || (key == 'l' && !searchMode):
- s.list.PageDown()
- default:
- if canSearch && searchMode {
- searchInput = append(searchInput, line...)
- s.list.Search(string(searchInput))
- }
- }
-
- if searchMode {
- header := fmt.Sprintf("Search: %s%s", string(searchInput), cursor)
- sb.WriteString(header)
- } else {
- help := s.renderHelp(canSearch)
- sb.Write(help)
- }
-
- label := render(s.Templates.label, s.Label)
- sb.Write(label)
-
- items, idx := s.list.Items()
- last := len(items) - 1
-
- for i, item := range items {
- page := " "
-
- switch i {
- case 0:
- if s.list.CanPageUp() {
- page = "↑"
- } else {
- page = string(top)
- }
- case last:
- if s.list.CanPageDown() {
- page = "↓"
- }
- }
-
- output := []byte(page + " ")
-
- if i == idx {
- output = append(output, render(s.Templates.active, item)...)
- } else {
- output = append(output, render(s.Templates.inactive, item)...)
- }
-
- sb.Write(output)
- }
-
- if idx == list.NotFound {
- sb.WriteString("")
- sb.WriteString("No results")
- } else {
- active := items[idx]
-
- details := s.renderDetails(active)
- for _, d := range details {
- sb.Write(d)
- }
- }
-
- sb.Flush()
-
- return nil, 0, true
- })
-
- for {
- _, err = rl.Readline()
-
- if err != nil {
- switch {
- case err == readline.ErrInterrupt, err.Error() == "Interrupt":
- err = ErrInterrupt
- case err == io.EOF:
- err = ErrEOF
- }
- break
- }
-
- _, idx := s.list.Items()
- if idx != list.NotFound {
- break
- }
-
- }
-
- if err != nil {
- if err.Error() == "Interrupt" {
- err = ErrInterrupt
- }
- sb.Reset()
- sb.WriteString("")
- sb.Flush()
- rl.Write([]byte(showCursor))
- rl.Close()
- return 0, "", err
- }
-
- items, idx := s.list.Items()
- item := items[idx]
-
- output := render(s.Templates.selected, item)
-
- sb.Reset()
- sb.Write(output)
- sb.Flush()
- rl.Write([]byte(showCursor))
- rl.Close()
-
- return s.list.Index(), fmt.Sprintf("%v", item), err
-}
-
-func (s *Select) prepareTemplates() error {
- tpls := s.Templates
- if tpls == nil {
- tpls = &SelectTemplates{}
- }
-
- if tpls.FuncMap == nil {
- tpls.FuncMap = FuncMap
- }
-
- if tpls.Label == "" {
- tpls.Label = fmt.Sprintf("%s {{.}}: ", IconInitial)
- }
-
- tpl, err := template.New("").Funcs(tpls.FuncMap).Parse(tpls.Label)
- if err != nil {
- return err
- }
-
- tpls.label = tpl
-
- if tpls.Active == "" {
- tpls.Active = fmt.Sprintf("%s {{ . | underline }}", IconSelect)
- }
-
- tpl, err = template.New("").Funcs(tpls.FuncMap).Parse(tpls.Active)
- if err != nil {
- return err
- }
-
- tpls.active = tpl
-
- if tpls.Inactive == "" {
- tpls.Inactive = " {{.}}"
- }
-
- tpl, err = template.New("").Funcs(tpls.FuncMap).Parse(tpls.Inactive)
- if err != nil {
- return err
- }
-
- tpls.inactive = tpl
-
- if tpls.Selected == "" {
- tpls.Selected = fmt.Sprintf(`{{ "%s" | green }} {{ . | faint }}`, IconGood)
- }
-
- tpl, err = template.New("").Funcs(tpls.FuncMap).Parse(tpls.Selected)
- if err != nil {
- return err
- }
- tpls.selected = tpl
-
- if tpls.Details != "" {
- tpl, err = template.New("").Funcs(tpls.FuncMap).Parse(tpls.Details)
- if err != nil {
- return err
- }
-
- tpls.details = tpl
- }
-
- if tpls.Help == "" {
- tpls.Help = fmt.Sprintf(`{{ "Use the arrow keys to navigate:" | faint }} {{ .NextKey | faint }} ` +
- `{{ .PrevKey | faint }} {{ .PageDownKey | faint }} {{ .PageUpKey | faint }} ` +
- `{{ if .Search }} {{ "and" | faint }} {{ .SearchKey | faint }} {{ "toggles search" | faint }}{{ end }}`)
- }
-
- tpl, err = template.New("").Funcs(tpls.FuncMap).Parse(tpls.Help)
- if err != nil {
- return err
- }
-
- tpls.help = tpl
-
- s.Templates = tpls
-
- return nil
-}
-
-// SelectWithAdd represents a list for selecting a single item, or selecting
-// a newly created item.
-type SelectWithAdd struct {
- Label string // Label is the value displayed on the command line prompt.
- Items []string // Items are the items to use in the list.
-
- AddLabel string // The label used in the item list for creating a new item.
-
- // Validate is optional. If set, this function is used to validate the input
- // after each character entry.
- Validate ValidateFunc
-
- IsVimMode bool // Whether readline is using Vim mode.
-}
-
-// Run runs the Select list. It returns the index of the selected element,
-// and its value. If a new element is created, -1 is returned as the index.
-func (sa *SelectWithAdd) Run() (int, string, error) {
- if len(sa.Items) > 0 {
- newItems := append([]string{sa.AddLabel}, sa.Items...)
-
- list, err := list.New(newItems, 5)
- if err != nil {
- return 0, "", err
- }
-
- s := Select{
- Label: sa.Label,
- Items: newItems,
- IsVimMode: sa.IsVimMode,
- Size: 5,
- list: list,
- }
- s.setKeys()
-
- err = s.prepareTemplates()
- if err != nil {
- return 0, "", err
- }
-
- selected, value, err := s.innerRun(1, '+')
- if err != nil || selected != 0 {
- return selected - 1, value, err
- }
-
- // XXX run through terminal for windows
- os.Stdout.Write([]byte(upLine(1) + "\r" + clearLine))
- }
-
- p := Prompt{
- Label: sa.AddLabel,
- Validate: sa.Validate,
- IsVimMode: sa.IsVimMode,
- }
- value, err := p.Run()
- return SelectedAdd, value, err
-}
-
-func (s *Select) setKeys() {
- if s.Keys != nil {
- return
- }
- s.Keys = &SelectKeys{
- Prev: Key{Code: KeyPrev, Display: "↑"},
- Next: Key{Code: KeyNext, Display: "↓"},
- PageUp: Key{Code: KeyBackward, Display: "←"},
- PageDown: Key{Code: KeyForward, Display: "→"},
- Search: Key{Code: '/', Display: "/"},
- }
-}
-
-func (s *Select) renderDetails(item interface{}) [][]byte {
- if s.Templates.details == nil {
- return nil
- }
-
- var buf bytes.Buffer
- w := ansiterm.NewTabWriter(&buf, 0, 0, 8, ' ', 0)
-
- err := s.Templates.details.Execute(w, item)
- if err != nil {
- fmt.Fprintf(w, "%v", item)
- }
-
- w.Flush()
-
- output := buf.Bytes()
-
- return bytes.Split(output, []byte("\n"))
-}
-
-func (s *Select) renderHelp(b bool) []byte {
- keys := struct {
- NextKey string
- PrevKey string
- PageDownKey string
- PageUpKey string
- Search bool
- SearchKey string
- }{
- NextKey: s.Keys.Next.Display,
- PrevKey: s.Keys.Prev.Display,
- PageDownKey: s.Keys.PageDown.Display,
- PageUpKey: s.Keys.PageUp.Display,
- SearchKey: s.Keys.Search.Display,
- Search: b,
- }
-
- return render(s.Templates.help, keys)
-}
-
-func render(tpl *template.Template, data interface{}) []byte {
- var buf bytes.Buffer
- err := tpl.Execute(&buf, data)
- if err != nil {
- return []byte(fmt.Sprintf("%v", data))
- }
- return buf.Bytes()
-}
diff --git a/vendor/github.com/manifoldco/promptui/select_test.go b/vendor/github.com/manifoldco/promptui/select_test.go
deleted file mode 100644
index 399d5192..00000000
--- a/vendor/github.com/manifoldco/promptui/select_test.go
+++ /dev/null
@@ -1,150 +0,0 @@
-package promptui
-
-import (
- "testing"
-)
-
-func TestSelectTemplateRender(t *testing.T) {
- t.Run("when using default style", func(t *testing.T) {
- values := []string{"Zero"}
- s := Select{
- Label: "Select Number",
- Items: values,
- }
- err := s.prepareTemplates()
- if err != nil {
- t.Fatalf("Unexpected error preparing templates %v", err)
- }
-
- result := string(render(s.Templates.label, s.Label))
- exp := "\x1b[34m?\x1b[0m Select Number: "
- if result != exp {
- t.Errorf("Expected label to eq %q, got %q", exp, result)
- }
-
- result = string(render(s.Templates.active, values[0]))
- exp = "\x1b[1m▸\x1b[0m \x1b[4mZero\x1b[0m"
- if result != exp {
- t.Errorf("Expected active item to eq %q, got %q", exp, result)
- }
-
- result = string(render(s.Templates.inactive, values[0]))
- exp = " Zero"
- if result != exp {
- t.Errorf("Expected inactive item to eq %q, got %q", exp, result)
- }
-
- result = string(render(s.Templates.selected, values[0]))
- exp = "\x1b[32m\x1b[32m✔\x1b[0m \x1b[2mZero\x1b[0m"
- if result != exp {
- t.Errorf("Expected selected item to eq %q, got %q", exp, result)
- }
- })
-
- t.Run("when using custom style", func(t *testing.T) {
- type pepper struct {
- Name string
- HeatUnit int
- Peppers int
- Description string
- }
- peppers := []pepper{
- {
- Name: "Bell Pepper",
- HeatUnit: 0,
- Peppers: 1,
- Description: "Not very spicy!",
- },
- }
-
- templates := &SelectTemplates{
- Label: "{{ . }}?",
- Active: "\U0001F525 {{ .Name | bold }} ({{ .HeatUnit | red | italic }})",
- Inactive: " {{ .Name | bold }} ({{ .HeatUnit | red | italic }})",
- Selected: "\U0001F525 {{ .Name | red | bold }}",
- Details: `Name: {{.Name}}
-Peppers: {{.Peppers}}
-Description: {{.Description}}`,
- }
-
- s := Select{
- Label: "Spicy Level",
- Items: peppers,
- Templates: templates,
- }
-
- err := s.prepareTemplates()
- if err != nil {
- t.Fatalf("Unexpected error preparing templates %v", err)
- }
-
- result := string(render(s.Templates.label, s.Label))
- exp := "Spicy Level?"
- if result != exp {
- t.Errorf("Expected label to eq %q, got %q", exp, result)
- }
-
- result = string(render(s.Templates.active, peppers[0]))
- exp = "🔥 \x1b[1mBell Pepper\x1b[0m (\x1b[3m\x1b[31m0\x1b[0m)"
- if result != exp {
- t.Errorf("Expected active item to eq %q, got %q", exp, result)
- }
-
- result = string(render(s.Templates.inactive, peppers[0]))
- exp = " \x1b[1mBell Pepper\x1b[0m (\x1b[3m\x1b[31m0\x1b[0m)"
- if result != exp {
- t.Errorf("Expected inactive item to eq %q, got %q", exp, result)
- }
-
- result = string(render(s.Templates.selected, peppers[0]))
- exp = "🔥 \x1b[1m\x1b[31mBell Pepper\x1b[0m"
- if result != exp {
- t.Errorf("Expected selected item to eq %q, got %q", exp, result)
- }
-
- result = string(render(s.Templates.details, peppers[0]))
- exp = "Name: Bell Pepper\nPeppers: 1\nDescription: Not very spicy!"
- if result != exp {
- t.Errorf("Expected selected item to eq %q, got %q", exp, result)
- }
- })
-
- t.Run("when a template is invalid", func(t *testing.T) {
- templates := &SelectTemplates{
- Label: "{{ . ",
- }
-
- s := Select{
- Label: "Spicy Level",
- Templates: templates,
- }
-
- err := s.prepareTemplates()
- if err == nil {
- t.Fatalf("Expected error got none")
- }
- })
-
- t.Run("when a template render fails", func(t *testing.T) {
- templates := &SelectTemplates{
- Label: "{{ .InvalidName }}",
- }
-
- s := Select{
- Label: struct{ Name string }{Name: "Pepper"},
- Items: []string{},
- Templates: templates,
- }
-
- err := s.prepareTemplates()
- if err != nil {
- t.Fatalf("Unexpected error preparing templates %v", err)
- }
-
- result := string(render(s.Templates.label, s.Label))
- exp := "{Pepper}"
- if result != exp {
- t.Errorf("Expected label to eq %q, got %q", exp, result)
- }
- })
-}
diff --git a/vendor/github.com/manifoldco/promptui/styles.go b/vendor/github.com/manifoldco/promptui/styles.go
deleted file mode 100644
index 7decdd8d..00000000
--- a/vendor/github.com/manifoldco/promptui/styles.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build !windows
-
-package promptui
-
-// Icons used for displaying prompts or status
-var (
- IconInitial = Styler(FGBlue)("?")
- IconGood = Styler(FGGreen)("✔")
- IconWarn = Styler(FGYellow)("⚠")
- IconBad = Styler(FGRed)("✗")
- IconSelect = Styler(FGBold)("▸")
-)
diff --git a/vendor/github.com/manifoldco/promptui/styles_windows.go b/vendor/github.com/manifoldco/promptui/styles_windows.go
deleted file mode 100644
index d48dfdd6..00000000
--- a/vendor/github.com/manifoldco/promptui/styles_windows.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package promptui
-
-// Icons used for displaying prompts or status
-var (
- IconInitial = Styler(FGBlue)("?")
- IconGood = Styler(FGGreen)("v")
- IconWarn = Styler(FGYellow)("!")
- IconBad = Styler(FGRed)("x")
- IconSelect = Styler(FGBold)(">")
-)
diff --git a/vendor/github.com/mattn/go-colorable/.travis.yml b/vendor/github.com/mattn/go-colorable/.travis.yml
deleted file mode 100644
index 98db8f06..00000000
--- a/vendor/github.com/mattn/go-colorable/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-go:
- - tip
-
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken xnXqRGwgW3SXIguzxf90ZSK1GPYZPaGrw
diff --git a/vendor/github.com/mattn/go-colorable/LICENSE b/vendor/github.com/mattn/go-colorable/LICENSE
deleted file mode 100644
index 91b5cef3..00000000
--- a/vendor/github.com/mattn/go-colorable/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Yasuhiro Matsumoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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
-SOFTWARE.
diff --git a/vendor/github.com/mattn/go-colorable/README.md b/vendor/github.com/mattn/go-colorable/README.md
deleted file mode 100644
index 56729a92..00000000
--- a/vendor/github.com/mattn/go-colorable/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# go-colorable
-
-[![Godoc Reference](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable)
-[![Build Status](https://travis-ci.org/mattn/go-colorable.svg?branch=master)](https://travis-ci.org/mattn/go-colorable)
-[![Coverage Status](https://coveralls.io/repos/github/mattn/go-colorable/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-colorable?branch=master)
-[![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable)
-
-Colorable writer for windows.
-
-For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.)
-This package is possible to handle escape sequence for ansi color on windows.
-
-## Too Bad!
-
-![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png)
-
-
-## So Good!
-
-![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png)
-
-## Usage
-
-```go
-logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
-logrus.SetOutput(colorable.NewColorableStdout())
-
-logrus.Info("succeeded")
-logrus.Warn("not correct")
-logrus.Error("something error")
-logrus.Fatal("panic")
-```
-
-You can compile above code on non-windows OSs.
-
-## Installation
-
-```
-$ go get github.com/mattn/go-colorable
-```
-
-# License
-
-MIT
-
-# Author
-
-Yasuhiro Matsumoto (a.k.a mattn)
diff --git a/vendor/github.com/mattn/go-colorable/_example/escape-seq/main.go b/vendor/github.com/mattn/go-colorable/_example/escape-seq/main.go
deleted file mode 100644
index 8cbcb909..00000000
--- a/vendor/github.com/mattn/go-colorable/_example/escape-seq/main.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package main
-
-import (
- "bufio"
- "fmt"
-
- "github.com/mattn/go-colorable"
-)
-
-func main() {
- stdOut := bufio.NewWriter(colorable.NewColorableStdout())
-
- fmt.Fprint(stdOut, "\x1B[3GMove to 3rd Column\n")
- fmt.Fprint(stdOut, "\x1B[1;2HMove to 2nd Column on 1st Line\n")
- stdOut.Flush()
-}
diff --git a/vendor/github.com/mattn/go-colorable/_example/logrus/main.go b/vendor/github.com/mattn/go-colorable/_example/logrus/main.go
deleted file mode 100644
index c569164b..00000000
--- a/vendor/github.com/mattn/go-colorable/_example/logrus/main.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package main
-
-import (
- "github.com/mattn/go-colorable"
- "github.com/sirupsen/logrus"
-)
-
-func main() {
- logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
- logrus.SetOutput(colorable.NewColorableStdout())
-
- logrus.Info("succeeded")
- logrus.Warn("not correct")
- logrus.Error("something error")
- logrus.Fatal("panic")
-}
diff --git a/vendor/github.com/mattn/go-colorable/_example/title/main.go b/vendor/github.com/mattn/go-colorable/_example/title/main.go
deleted file mode 100644
index e208870e..00000000
--- a/vendor/github.com/mattn/go-colorable/_example/title/main.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package main
-
-import (
- "fmt"
- "os"
- . "github.com/mattn/go-colorable"
-)
-
-func main() {
- out := NewColorableStdout()
- fmt.Fprint(out, "\x1B]0;TITLE Changed\007(See title and hit any key)")
- var c [1]byte
- os.Stdin.Read(c[:])
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_appengine.go b/vendor/github.com/mattn/go-colorable/colorable_appengine.go
deleted file mode 100644
index 1f28d773..00000000
--- a/vendor/github.com/mattn/go-colorable/colorable_appengine.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// +build appengine
-
-package colorable
-
-import (
- "io"
- "os"
-
- _ "github.com/mattn/go-isatty"
-)
-
-// NewColorable return new instance of Writer which handle escape sequence.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return os.Stdout
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return os.Stderr
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_others.go b/vendor/github.com/mattn/go-colorable/colorable_others.go
deleted file mode 100644
index 887f203d..00000000
--- a/vendor/github.com/mattn/go-colorable/colorable_others.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build !windows
-// +build !appengine
-
-package colorable
-
-import (
- "io"
- "os"
-
- _ "github.com/mattn/go-isatty"
-)
-
-// NewColorable return new instance of Writer which handle escape sequence.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return os.Stdout
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return os.Stderr
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_test.go b/vendor/github.com/mattn/go-colorable/colorable_test.go
deleted file mode 100644
index 3069869a..00000000
--- a/vendor/github.com/mattn/go-colorable/colorable_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package colorable
-
-import (
- "bytes"
- "os"
- "runtime"
- "testing"
-)
-
-// checkEncoding checks that colorable is output encoding agnostic as long as
-// the encoding is a superset of ASCII. This implies that one byte not part of
-// an ANSI sequence must give exactly one byte in output
-func checkEncoding(t *testing.T, data []byte) {
- // Send non-UTF8 data to colorable
- b := bytes.NewBuffer(make([]byte, 0, 10))
- if b.Len() != 0 {
- t.FailNow()
- }
- // TODO move colorable wrapping outside the test
- c := NewNonColorable(b)
- c.Write(data)
- if b.Len() != len(data) {
- t.Fatalf("%d bytes expected, got %d", len(data), b.Len())
- }
-}
-
-func TestEncoding(t *testing.T) {
- checkEncoding(t, []byte{}) // Empty
- checkEncoding(t, []byte(`abc`)) // "abc"
- checkEncoding(t, []byte(`é`)) // "é" in UTF-8
- checkEncoding(t, []byte{233}) // 'é' in Latin-1
-}
-
-func TestNonColorable(t *testing.T) {
- var buf bytes.Buffer
- want := "hello"
- NewNonColorable(&buf).Write([]byte("\x1b[0m" + want + "\x1b[2J"))
- got := buf.String()
- if got != "hello" {
- t.Fatalf("want %q but %q", want, got)
- }
-
- buf.Reset()
- NewNonColorable(&buf).Write([]byte("\x1b["))
- got = buf.String()
- if got != "" {
- t.Fatalf("want %q but %q", "", got)
- }
-}
-
-func TestNonColorableNil(t *testing.T) {
- paniced := false
- func() {
- defer func() {
- recover()
- paniced = true
- }()
- NewNonColorable(nil)
- NewColorable(nil)
- }()
-
- if !paniced {
- t.Fatalf("should panic")
- }
-}
-
-func TestColorable(t *testing.T) {
- if runtime.GOOS == "windows" {
- t.Skipf("skip this test on windows")
- }
- _, ok := NewColorableStdout().(*os.File)
- if !ok {
- t.Fatalf("should os.Stdout on UNIX")
- }
- _, ok = NewColorableStderr().(*os.File)
- if !ok {
- t.Fatalf("should os.Stdout on UNIX")
- }
- _, ok = NewColorable(os.Stdout).(*os.File)
- if !ok {
- t.Fatalf("should os.Stdout on UNIX")
- }
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_windows.go b/vendor/github.com/mattn/go-colorable/colorable_windows.go
deleted file mode 100644
index e17a5474..00000000
--- a/vendor/github.com/mattn/go-colorable/colorable_windows.go
+++ /dev/null
@@ -1,884 +0,0 @@
-// +build windows
-// +build !appengine
-
-package colorable
-
-import (
- "bytes"
- "io"
- "math"
- "os"
- "strconv"
- "strings"
- "syscall"
- "unsafe"
-
- "github.com/mattn/go-isatty"
-)
-
-const (
- foregroundBlue = 0x1
- foregroundGreen = 0x2
- foregroundRed = 0x4
- foregroundIntensity = 0x8
- foregroundMask = (foregroundRed | foregroundBlue | foregroundGreen | foregroundIntensity)
- backgroundBlue = 0x10
- backgroundGreen = 0x20
- backgroundRed = 0x40
- backgroundIntensity = 0x80
- backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
-)
-
-type wchar uint16
-type short int16
-type dword uint32
-type word uint16
-
-type coord struct {
- x short
- y short
-}
-
-type smallRect struct {
- left short
- top short
- right short
- bottom short
-}
-
-type consoleScreenBufferInfo struct {
- size coord
- cursorPosition coord
- attributes word
- window smallRect
- maximumWindowSize coord
-}
-
-type consoleCursorInfo struct {
- size dword
- visible int32
-}
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32.dll")
- procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
- procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute")
- procSetConsoleCursorPosition = kernel32.NewProc("SetConsoleCursorPosition")
- procFillConsoleOutputCharacter = kernel32.NewProc("FillConsoleOutputCharacterW")
- procFillConsoleOutputAttribute = kernel32.NewProc("FillConsoleOutputAttribute")
- procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo")
- procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo")
- procSetConsoleTitle = kernel32.NewProc("SetConsoleTitleW")
-)
-
-// Writer provide colorable Writer to the console
-type Writer struct {
- out io.Writer
- handle syscall.Handle
- oldattr word
- oldpos coord
-}
-
-// NewColorable return new instance of Writer which handle escape sequence from File.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- if isatty.IsTerminal(file.Fd()) {
- var csbi consoleScreenBufferInfo
- handle := syscall.Handle(file.Fd())
- procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
- return &Writer{out: file, handle: handle, oldattr: csbi.attributes, oldpos: coord{0, 0}}
- }
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return NewColorable(os.Stdout)
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return NewColorable(os.Stderr)
-}
-
-var color256 = map[int]int{
- 0: 0x000000,
- 1: 0x800000,
- 2: 0x008000,
- 3: 0x808000,
- 4: 0x000080,
- 5: 0x800080,
- 6: 0x008080,
- 7: 0xc0c0c0,
- 8: 0x808080,
- 9: 0xff0000,
- 10: 0x00ff00,
- 11: 0xffff00,
- 12: 0x0000ff,
- 13: 0xff00ff,
- 14: 0x00ffff,
- 15: 0xffffff,
- 16: 0x000000,
- 17: 0x00005f,
- 18: 0x000087,
- 19: 0x0000af,
- 20: 0x0000d7,
- 21: 0x0000ff,
- 22: 0x005f00,
- 23: 0x005f5f,
- 24: 0x005f87,
- 25: 0x005faf,
- 26: 0x005fd7,
- 27: 0x005fff,
- 28: 0x008700,
- 29: 0x00875f,
- 30: 0x008787,
- 31: 0x0087af,
- 32: 0x0087d7,
- 33: 0x0087ff,
- 34: 0x00af00,
- 35: 0x00af5f,
- 36: 0x00af87,
- 37: 0x00afaf,
- 38: 0x00afd7,
- 39: 0x00afff,
- 40: 0x00d700,
- 41: 0x00d75f,
- 42: 0x00d787,
- 43: 0x00d7af,
- 44: 0x00d7d7,
- 45: 0x00d7ff,
- 46: 0x00ff00,
- 47: 0x00ff5f,
- 48: 0x00ff87,
- 49: 0x00ffaf,
- 50: 0x00ffd7,
- 51: 0x00ffff,
- 52: 0x5f0000,
- 53: 0x5f005f,
- 54: 0x5f0087,
- 55: 0x5f00af,
- 56: 0x5f00d7,
- 57: 0x5f00ff,
- 58: 0x5f5f00,
- 59: 0x5f5f5f,
- 60: 0x5f5f87,
- 61: 0x5f5faf,
- 62: 0x5f5fd7,
- 63: 0x5f5fff,
- 64: 0x5f8700,
- 65: 0x5f875f,
- 66: 0x5f8787,
- 67: 0x5f87af,
- 68: 0x5f87d7,
- 69: 0x5f87ff,
- 70: 0x5faf00,
- 71: 0x5faf5f,
- 72: 0x5faf87,
- 73: 0x5fafaf,
- 74: 0x5fafd7,
- 75: 0x5fafff,
- 76: 0x5fd700,
- 77: 0x5fd75f,
- 78: 0x5fd787,
- 79: 0x5fd7af,
- 80: 0x5fd7d7,
- 81: 0x5fd7ff,
- 82: 0x5fff00,
- 83: 0x5fff5f,
- 84: 0x5fff87,
- 85: 0x5fffaf,
- 86: 0x5fffd7,
- 87: 0x5fffff,
- 88: 0x870000,
- 89: 0x87005f,
- 90: 0x870087,
- 91: 0x8700af,
- 92: 0x8700d7,
- 93: 0x8700ff,
- 94: 0x875f00,
- 95: 0x875f5f,
- 96: 0x875f87,
- 97: 0x875faf,
- 98: 0x875fd7,
- 99: 0x875fff,
- 100: 0x878700,
- 101: 0x87875f,
- 102: 0x878787,
- 103: 0x8787af,
- 104: 0x8787d7,
- 105: 0x8787ff,
- 106: 0x87af00,
- 107: 0x87af5f,
- 108: 0x87af87,
- 109: 0x87afaf,
- 110: 0x87afd7,
- 111: 0x87afff,
- 112: 0x87d700,
- 113: 0x87d75f,
- 114: 0x87d787,
- 115: 0x87d7af,
- 116: 0x87d7d7,
- 117: 0x87d7ff,
- 118: 0x87ff00,
- 119: 0x87ff5f,
- 120: 0x87ff87,
- 121: 0x87ffaf,
- 122: 0x87ffd7,
- 123: 0x87ffff,
- 124: 0xaf0000,
- 125: 0xaf005f,
- 126: 0xaf0087,
- 127: 0xaf00af,
- 128: 0xaf00d7,
- 129: 0xaf00ff,
- 130: 0xaf5f00,
- 131: 0xaf5f5f,
- 132: 0xaf5f87,
- 133: 0xaf5faf,
- 134: 0xaf5fd7,
- 135: 0xaf5fff,
- 136: 0xaf8700,
- 137: 0xaf875f,
- 138: 0xaf8787,
- 139: 0xaf87af,
- 140: 0xaf87d7,
- 141: 0xaf87ff,
- 142: 0xafaf00,
- 143: 0xafaf5f,
- 144: 0xafaf87,
- 145: 0xafafaf,
- 146: 0xafafd7,
- 147: 0xafafff,
- 148: 0xafd700,
- 149: 0xafd75f,
- 150: 0xafd787,
- 151: 0xafd7af,
- 152: 0xafd7d7,
- 153: 0xafd7ff,
- 154: 0xafff00,
- 155: 0xafff5f,
- 156: 0xafff87,
- 157: 0xafffaf,
- 158: 0xafffd7,
- 159: 0xafffff,
- 160: 0xd70000,
- 161: 0xd7005f,
- 162: 0xd70087,
- 163: 0xd700af,
- 164: 0xd700d7,
- 165: 0xd700ff,
- 166: 0xd75f00,
- 167: 0xd75f5f,
- 168: 0xd75f87,
- 169: 0xd75faf,
- 170: 0xd75fd7,
- 171: 0xd75fff,
- 172: 0xd78700,
- 173: 0xd7875f,
- 174: 0xd78787,
- 175: 0xd787af,
- 176: 0xd787d7,
- 177: 0xd787ff,
- 178: 0xd7af00,
- 179: 0xd7af5f,
- 180: 0xd7af87,
- 181: 0xd7afaf,
- 182: 0xd7afd7,
- 183: 0xd7afff,
- 184: 0xd7d700,
- 185: 0xd7d75f,
- 186: 0xd7d787,
- 187: 0xd7d7af,
- 188: 0xd7d7d7,
- 189: 0xd7d7ff,
- 190: 0xd7ff00,
- 191: 0xd7ff5f,
- 192: 0xd7ff87,
- 193: 0xd7ffaf,
- 194: 0xd7ffd7,
- 195: 0xd7ffff,
- 196: 0xff0000,
- 197: 0xff005f,
- 198: 0xff0087,
- 199: 0xff00af,
- 200: 0xff00d7,
- 201: 0xff00ff,
- 202: 0xff5f00,
- 203: 0xff5f5f,
- 204: 0xff5f87,
- 205: 0xff5faf,
- 206: 0xff5fd7,
- 207: 0xff5fff,
- 208: 0xff8700,
- 209: 0xff875f,
- 210: 0xff8787,
- 211: 0xff87af,
- 212: 0xff87d7,
- 213: 0xff87ff,
- 214: 0xffaf00,
- 215: 0xffaf5f,
- 216: 0xffaf87,
- 217: 0xffafaf,
- 218: 0xffafd7,
- 219: 0xffafff,
- 220: 0xffd700,
- 221: 0xffd75f,
- 222: 0xffd787,
- 223: 0xffd7af,
- 224: 0xffd7d7,
- 225: 0xffd7ff,
- 226: 0xffff00,
- 227: 0xffff5f,
- 228: 0xffff87,
- 229: 0xffffaf,
- 230: 0xffffd7,
- 231: 0xffffff,
- 232: 0x080808,
- 233: 0x121212,
- 234: 0x1c1c1c,
- 235: 0x262626,
- 236: 0x303030,
- 237: 0x3a3a3a,
- 238: 0x444444,
- 239: 0x4e4e4e,
- 240: 0x585858,
- 241: 0x626262,
- 242: 0x6c6c6c,
- 243: 0x767676,
- 244: 0x808080,
- 245: 0x8a8a8a,
- 246: 0x949494,
- 247: 0x9e9e9e,
- 248: 0xa8a8a8,
- 249: 0xb2b2b2,
- 250: 0xbcbcbc,
- 251: 0xc6c6c6,
- 252: 0xd0d0d0,
- 253: 0xdadada,
- 254: 0xe4e4e4,
- 255: 0xeeeeee,
-}
-
-// `\033]0;TITLESTR\007`
-func doTitleSequence(er *bytes.Reader) error {
- var c byte
- var err error
-
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c != '0' && c != '2' {
- return nil
- }
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c != ';' {
- return nil
- }
- title := make([]byte, 0, 80)
- for {
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c == 0x07 || c == '\n' {
- break
- }
- title = append(title, c)
- }
- if len(title) > 0 {
- title8, err := syscall.UTF16PtrFromString(string(title))
- if err == nil {
- procSetConsoleTitle.Call(uintptr(unsafe.Pointer(title8)))
- }
- }
- return nil
-}
-
-// Write write data on console
-func (w *Writer) Write(data []byte) (n int, err error) {
- var csbi consoleScreenBufferInfo
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
-
- er := bytes.NewReader(data)
- var bw [1]byte
-loop:
- for {
- c1, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c1 != 0x1b {
- bw[0] = c1
- w.out.Write(bw[:])
- continue
- }
- c2, err := er.ReadByte()
- if err != nil {
- break loop
- }
-
- if c2 == ']' {
- if err := doTitleSequence(er); err != nil {
- break loop
- }
- continue
- }
- if c2 != 0x5b {
- continue
- }
-
- var buf bytes.Buffer
- var m byte
- for {
- c, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
- m = c
- break
- }
- buf.Write([]byte(string(c)))
- }
-
- switch m {
- case 'A':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.y -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'B':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.y += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'C':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'D':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'E':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = 0
- csbi.cursorPosition.y += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'F':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = 0
- csbi.cursorPosition.y -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'G':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = short(n - 1)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'H', 'f':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- if buf.Len() > 0 {
- token := strings.Split(buf.String(), ";")
- switch len(token) {
- case 1:
- n1, err := strconv.Atoi(token[0])
- if err != nil {
- continue
- }
- csbi.cursorPosition.y = short(n1 - 1)
- case 2:
- n1, err := strconv.Atoi(token[0])
- if err != nil {
- continue
- }
- n2, err := strconv.Atoi(token[1])
- if err != nil {
- continue
- }
- csbi.cursorPosition.x = short(n2 - 1)
- csbi.cursorPosition.y = short(n1 - 1)
- }
- } else {
- csbi.cursorPosition.y = 0
- }
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'J':
- n := 0
- if buf.Len() > 0 {
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- }
- var count, written dword
- var cursor coord
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- switch n {
- case 0:
- cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x)
- case 1:
- cursor = coord{x: csbi.window.left, y: csbi.window.top}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.window.top-csbi.cursorPosition.y)*csbi.size.x)
- case 2:
- cursor = coord{x: csbi.window.left, y: csbi.window.top}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x)
- }
- procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- case 'K':
- n := 0
- if buf.Len() > 0 {
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- var cursor coord
- var count, written dword
- switch n {
- case 0:
- cursor = coord{x: csbi.cursorPosition.x + 1, y: csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x - 1)
- case 1:
- cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x)
- case 2:
- cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y}
- count = dword(csbi.size.x)
- }
- procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- case 'm':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- attr := csbi.attributes
- cs := buf.String()
- if cs == "" {
- procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(w.oldattr))
- continue
- }
- token := strings.Split(cs, ";")
- for i := 0; i < len(token); i++ {
- ns := token[i]
- if n, err = strconv.Atoi(ns); err == nil {
- switch {
- case n == 0 || n == 100:
- attr = w.oldattr
- case 1 <= n && n <= 5:
- attr |= foregroundIntensity
- case n == 7:
- attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
- case n == 22 || n == 25:
- attr |= foregroundIntensity
- case n == 27:
- attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
- case 30 <= n && n <= 37:
- attr &= backgroundMask
- if (n-30)&1 != 0 {
- attr |= foregroundRed
- }
- if (n-30)&2 != 0 {
- attr |= foregroundGreen
- }
- if (n-30)&4 != 0 {
- attr |= foregroundBlue
- }
- case n == 38: // set foreground color.
- if i < len(token)-2 && (token[i+1] == "5" || token[i+1] == "05") {
- if n256, err := strconv.Atoi(token[i+2]); err == nil {
- if n256foreAttr == nil {
- n256setup()
- }
- attr &= backgroundMask
- attr |= n256foreAttr[n256]
- i += 2
- }
- } else {
- attr = attr & (w.oldattr & backgroundMask)
- }
- case n == 39: // reset foreground color.
- attr &= backgroundMask
- attr |= w.oldattr & foregroundMask
- case 40 <= n && n <= 47:
- attr &= foregroundMask
- if (n-40)&1 != 0 {
- attr |= backgroundRed
- }
- if (n-40)&2 != 0 {
- attr |= backgroundGreen
- }
- if (n-40)&4 != 0 {
- attr |= backgroundBlue
- }
- case n == 48: // set background color.
- if i < len(token)-2 && token[i+1] == "5" {
- if n256, err := strconv.Atoi(token[i+2]); err == nil {
- if n256backAttr == nil {
- n256setup()
- }
- attr &= foregroundMask
- attr |= n256backAttr[n256]
- i += 2
- }
- } else {
- attr = attr & (w.oldattr & foregroundMask)
- }
- case n == 49: // reset foreground color.
- attr &= foregroundMask
- attr |= w.oldattr & backgroundMask
- case 90 <= n && n <= 97:
- attr = (attr & backgroundMask)
- attr |= foregroundIntensity
- if (n-90)&1 != 0 {
- attr |= foregroundRed
- }
- if (n-90)&2 != 0 {
- attr |= foregroundGreen
- }
- if (n-90)&4 != 0 {
- attr |= foregroundBlue
- }
- case 100 <= n && n <= 107:
- attr = (attr & foregroundMask)
- attr |= backgroundIntensity
- if (n-100)&1 != 0 {
- attr |= backgroundRed
- }
- if (n-100)&2 != 0 {
- attr |= backgroundGreen
- }
- if (n-100)&4 != 0 {
- attr |= backgroundBlue
- }
- }
- procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr))
- }
- }
- case 'h':
- var ci consoleCursorInfo
- cs := buf.String()
- if cs == "5>" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 0
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- } else if cs == "?25" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 1
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- }
- case 'l':
- var ci consoleCursorInfo
- cs := buf.String()
- if cs == "5>" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 1
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- } else if cs == "?25" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 0
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- }
- case 's':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- w.oldpos = csbi.cursorPosition
- case 'u':
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&w.oldpos)))
- }
- }
-
- return len(data), nil
-}
-
-type consoleColor struct {
- rgb int
- red bool
- green bool
- blue bool
- intensity bool
-}
-
-func (c consoleColor) foregroundAttr() (attr word) {
- if c.red {
- attr |= foregroundRed
- }
- if c.green {
- attr |= foregroundGreen
- }
- if c.blue {
- attr |= foregroundBlue
- }
- if c.intensity {
- attr |= foregroundIntensity
- }
- return
-}
-
-func (c consoleColor) backgroundAttr() (attr word) {
- if c.red {
- attr |= backgroundRed
- }
- if c.green {
- attr |= backgroundGreen
- }
- if c.blue {
- attr |= backgroundBlue
- }
- if c.intensity {
- attr |= backgroundIntensity
- }
- return
-}
-
-var color16 = []consoleColor{
- {0x000000, false, false, false, false},
- {0x000080, false, false, true, false},
- {0x008000, false, true, false, false},
- {0x008080, false, true, true, false},
- {0x800000, true, false, false, false},
- {0x800080, true, false, true, false},
- {0x808000, true, true, false, false},
- {0xc0c0c0, true, true, true, false},
- {0x808080, false, false, false, true},
- {0x0000ff, false, false, true, true},
- {0x00ff00, false, true, false, true},
- {0x00ffff, false, true, true, true},
- {0xff0000, true, false, false, true},
- {0xff00ff, true, false, true, true},
- {0xffff00, true, true, false, true},
- {0xffffff, true, true, true, true},
-}
-
-type hsv struct {
- h, s, v float32
-}
-
-func (a hsv) dist(b hsv) float32 {
- dh := a.h - b.h
- switch {
- case dh > 0.5:
- dh = 1 - dh
- case dh < -0.5:
- dh = -1 - dh
- }
- ds := a.s - b.s
- dv := a.v - b.v
- return float32(math.Sqrt(float64(dh*dh + ds*ds + dv*dv)))
-}
-
-func toHSV(rgb int) hsv {
- r, g, b := float32((rgb&0xFF0000)>>16)/256.0,
- float32((rgb&0x00FF00)>>8)/256.0,
- float32(rgb&0x0000FF)/256.0
- min, max := minmax3f(r, g, b)
- h := max - min
- if h > 0 {
- if max == r {
- h = (g - b) / h
- if h < 0 {
- h += 6
- }
- } else if max == g {
- h = 2 + (b-r)/h
- } else {
- h = 4 + (r-g)/h
- }
- }
- h /= 6.0
- s := max - min
- if max != 0 {
- s /= max
- }
- v := max
- return hsv{h: h, s: s, v: v}
-}
-
-type hsvTable []hsv
-
-func toHSVTable(rgbTable []consoleColor) hsvTable {
- t := make(hsvTable, len(rgbTable))
- for i, c := range rgbTable {
- t[i] = toHSV(c.rgb)
- }
- return t
-}
-
-func (t hsvTable) find(rgb int) consoleColor {
- hsv := toHSV(rgb)
- n := 7
- l := float32(5.0)
- for i, p := range t {
- d := hsv.dist(p)
- if d < l {
- l, n = d, i
- }
- }
- return color16[n]
-}
-
-func minmax3f(a, b, c float32) (min, max float32) {
- if a < b {
- if b < c {
- return a, c
- } else if a < c {
- return a, b
- } else {
- return c, b
- }
- } else {
- if a < c {
- return b, c
- } else if b < c {
- return b, a
- } else {
- return c, a
- }
- }
-}
-
-var n256foreAttr []word
-var n256backAttr []word
-
-func n256setup() {
- n256foreAttr = make([]word, 256)
- n256backAttr = make([]word, 256)
- t := toHSVTable(color16)
- for i, rgb := range color256 {
- c := t.find(rgb)
- n256foreAttr[i] = c.foregroundAttr()
- n256backAttr[i] = c.backgroundAttr()
- }
-}
diff --git a/vendor/github.com/mattn/go-colorable/noncolorable.go b/vendor/github.com/mattn/go-colorable/noncolorable.go
deleted file mode 100644
index 9721e16f..00000000
--- a/vendor/github.com/mattn/go-colorable/noncolorable.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package colorable
-
-import (
- "bytes"
- "io"
-)
-
-// NonColorable hold writer but remove escape sequence.
-type NonColorable struct {
- out io.Writer
-}
-
-// NewNonColorable return new instance of Writer which remove escape sequence from Writer.
-func NewNonColorable(w io.Writer) io.Writer {
- return &NonColorable{out: w}
-}
-
-// Write write data on console
-func (w *NonColorable) Write(data []byte) (n int, err error) {
- er := bytes.NewReader(data)
- var bw [1]byte
-loop:
- for {
- c1, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c1 != 0x1b {
- bw[0] = c1
- w.out.Write(bw[:])
- continue
- }
- c2, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c2 != 0x5b {
- continue
- }
-
- var buf bytes.Buffer
- for {
- c, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
- break
- }
- buf.Write([]byte(string(c)))
- }
- }
-
- return len(data), nil
-}
diff --git a/vendor/github.com/mattn/go-isatty/.travis.yml b/vendor/github.com/mattn/go-isatty/.travis.yml
deleted file mode 100644
index b9f8b239..00000000
--- a/vendor/github.com/mattn/go-isatty/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-go:
- - tip
-
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken 3gHdORO5k5ziZcWMBxnd9LrMZaJs8m9x5
diff --git a/vendor/github.com/mattn/go-isatty/LICENSE b/vendor/github.com/mattn/go-isatty/LICENSE
deleted file mode 100644
index 65dc692b..00000000
--- a/vendor/github.com/mattn/go-isatty/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright (c) Yasuhiro MATSUMOTO
-
-MIT License (Expat)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 SOFTWARE.
diff --git a/vendor/github.com/mattn/go-isatty/README.md b/vendor/github.com/mattn/go-isatty/README.md
deleted file mode 100644
index 1e69004b..00000000
--- a/vendor/github.com/mattn/go-isatty/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# go-isatty
-
-[![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty)
-[![Build Status](https://travis-ci.org/mattn/go-isatty.svg?branch=master)](https://travis-ci.org/mattn/go-isatty)
-[![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master)
-[![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty)
-
-isatty for golang
-
-## Usage
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/mattn/go-isatty"
- "os"
-)
-
-func main() {
- if isatty.IsTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Terminal")
- } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Cygwin/MSYS2 Terminal")
- } else {
- fmt.Println("Is Not Terminal")
- }
-}
-```
-
-## Installation
-
-```
-$ go get github.com/mattn/go-isatty
-```
-
-## License
-
-MIT
-
-## Author
-
-Yasuhiro Matsumoto (a.k.a mattn)
-
-## Thanks
-
-* k-takata: base idea for IsCygwinTerminal
-
- https://github.com/k-takata/go-iscygpty
diff --git a/vendor/github.com/mattn/go-isatty/doc.go b/vendor/github.com/mattn/go-isatty/doc.go
deleted file mode 100644
index 17d4f90e..00000000
--- a/vendor/github.com/mattn/go-isatty/doc.go
+++ /dev/null
@@ -1,2 +0,0 @@
-// Package isatty implements interface to isatty
-package isatty
diff --git a/vendor/github.com/mattn/go-isatty/example_test.go b/vendor/github.com/mattn/go-isatty/example_test.go
deleted file mode 100644
index fa8f7e74..00000000
--- a/vendor/github.com/mattn/go-isatty/example_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package isatty_test
-
-import (
- "fmt"
- "os"
-
- "github.com/mattn/go-isatty"
-)
-
-func Example() {
- if isatty.IsTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Terminal")
- } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Cygwin/MSYS2 Terminal")
- } else {
- fmt.Println("Is Not Terminal")
- }
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_appengine.go b/vendor/github.com/mattn/go-isatty/isatty_appengine.go
deleted file mode 100644
index 9584a988..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_appengine.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build appengine
-
-package isatty
-
-// IsTerminal returns true if the file descriptor is terminal which
-// is always false on on appengine classic which is a sandboxed PaaS.
-func IsTerminal(fd uintptr) bool {
- return false
-}
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal. This is also always false on this environment.
-func IsCygwinTerminal(fd uintptr) bool {
- return false
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
deleted file mode 100644
index 42f2514d..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_bsd.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build darwin freebsd openbsd netbsd dragonfly
-// +build !appengine
-
-package isatty
-
-import (
- "syscall"
- "unsafe"
-)
-
-const ioctlReadTermios = syscall.TIOCGETA
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux.go b/vendor/github.com/mattn/go-isatty/isatty_linux.go
deleted file mode 100644
index 7384cf99..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_linux.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build linux
-// +build !appengine,!ppc64,!ppc64le
-
-package isatty
-
-import (
- "syscall"
- "unsafe"
-)
-
-const ioctlReadTermios = syscall.TCGETS
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go b/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
deleted file mode 100644
index 44e5d213..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build linux
-// +build ppc64 ppc64le
-
-package isatty
-
-import (
- "unsafe"
-
- syscall "golang.org/x/sys/unix"
-)
-
-const ioctlReadTermios = syscall.TCGETS
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_others.go b/vendor/github.com/mattn/go-isatty/isatty_others.go
deleted file mode 100644
index ff4de3d9..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_others.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build !windows
-// +build !appengine
-
-package isatty
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal. This is also always false on this environment.
-func IsCygwinTerminal(fd uintptr) bool {
- return false
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_others_test.go b/vendor/github.com/mattn/go-isatty/isatty_others_test.go
deleted file mode 100644
index a2091cf4..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_others_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build !windows
-
-package isatty
-
-import (
- "os"
- "testing"
-)
-
-func TestTerminal(t *testing.T) {
- // test for non-panic
- IsTerminal(os.Stdout.Fd())
-}
-
-func TestCygwinPipeName(t *testing.T) {
- if IsCygwinTerminal(os.Stdout.Fd()) {
- t.Fatal("should be false always")
- }
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_solaris.go b/vendor/github.com/mattn/go-isatty/isatty_solaris.go
deleted file mode 100644
index 1f0c6bf5..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_solaris.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build solaris
-// +build !appengine
-
-package isatty
-
-import (
- "golang.org/x/sys/unix"
-)
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-// see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
-func IsTerminal(fd uintptr) bool {
- var termio unix.Termio
- err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
- return err == nil
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_windows.go b/vendor/github.com/mattn/go-isatty/isatty_windows.go
deleted file mode 100644
index af51cbca..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_windows.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// +build windows
-// +build !appengine
-
-package isatty
-
-import (
- "strings"
- "syscall"
- "unicode/utf16"
- "unsafe"
-)
-
-const (
- fileNameInfo uintptr = 2
- fileTypePipe = 3
-)
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32.dll")
- procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
- procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx")
- procGetFileType = kernel32.NewProc("GetFileType")
-)
-
-func init() {
- // Check if GetFileInformationByHandleEx is available.
- if procGetFileInformationByHandleEx.Find() != nil {
- procGetFileInformationByHandleEx = nil
- }
-}
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var st uint32
- r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0)
- return r != 0 && e == 0
-}
-
-// Check pipe name is used for cygwin/msys2 pty.
-// Cygwin/MSYS2 PTY has a name like:
-// \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master
-func isCygwinPipeName(name string) bool {
- token := strings.Split(name, "-")
- if len(token) < 5 {
- return false
- }
-
- if token[0] != `\msys` && token[0] != `\cygwin` {
- return false
- }
-
- if token[1] == "" {
- return false
- }
-
- if !strings.HasPrefix(token[2], "pty") {
- return false
- }
-
- if token[3] != `from` && token[3] != `to` {
- return false
- }
-
- if token[4] != "master" {
- return false
- }
-
- return true
-}
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal.
-func IsCygwinTerminal(fd uintptr) bool {
- if procGetFileInformationByHandleEx == nil {
- return false
- }
-
- // Cygwin/msys's pty is a pipe.
- ft, _, e := syscall.Syscall(procGetFileType.Addr(), 1, fd, 0, 0)
- if ft != fileTypePipe || e != 0 {
- return false
- }
-
- var buf [2 + syscall.MAX_PATH]uint16
- r, _, e := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(),
- 4, fd, fileNameInfo, uintptr(unsafe.Pointer(&buf)),
- uintptr(len(buf)*2), 0, 0)
- if r == 0 || e != 0 {
- return false
- }
-
- l := *(*uint32)(unsafe.Pointer(&buf))
- return isCygwinPipeName(string(utf16.Decode(buf[2 : 2+l/2])))
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_windows_test.go b/vendor/github.com/mattn/go-isatty/isatty_windows_test.go
deleted file mode 100644
index 777e8a60..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_windows_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// +build windows
-
-package isatty
-
-import (
- "testing"
-)
-
-func TestCygwinPipeName(t *testing.T) {
- tests := []struct {
- name string
- result bool
- }{
- {``, false},
- {`\msys-`, false},
- {`\cygwin-----`, false},
- {`\msys-x-PTY5-pty1-from-master`, false},
- {`\cygwin-x-PTY5-from-master`, false},
- {`\cygwin-x-pty2-from-toaster`, false},
- {`\cygwin--pty2-from-master`, false},
- {`\\cygwin-x-pty2-from-master`, false},
- {`\cygwin-x-pty2-from-master-`, true}, // for the feature
- {`\cygwin-e022582115c10879-pty4-from-master`, true},
- {`\msys-e022582115c10879-pty4-to-master`, true},
- {`\cygwin-e022582115c10879-pty4-to-master`, true},
- }
-
- for _, test := range tests {
- want := test.result
- got := isCygwinPipeName(test.name)
- if want != got {
- t.Fatalf("isatty(%q): got %v, want %v:", test.name, got, want)
- }
- }
-}
diff --git a/vendor/github.com/mattn/go-runewidth/.travis.yml b/vendor/github.com/mattn/go-runewidth/.travis.yml
deleted file mode 100644
index 5c9c2a30..00000000
--- a/vendor/github.com/mattn/go-runewidth/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-go:
- - tip
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL
diff --git a/vendor/github.com/mattn/go-runewidth/LICENSE b/vendor/github.com/mattn/go-runewidth/LICENSE
deleted file mode 100644
index 91b5cef3..00000000
--- a/vendor/github.com/mattn/go-runewidth/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Yasuhiro Matsumoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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
-SOFTWARE.
diff --git a/vendor/github.com/mattn/go-runewidth/README.mkd b/vendor/github.com/mattn/go-runewidth/README.mkd
deleted file mode 100644
index 66663a94..00000000
--- a/vendor/github.com/mattn/go-runewidth/README.mkd
+++ /dev/null
@@ -1,27 +0,0 @@
-go-runewidth
-============
-
-[![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth)
-[![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD)
-[![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth)
-[![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth)
-
-Provides functions to get fixed width of the character or string.
-
-Usage
------
-
-```go
-runewidth.StringWidth("つのだ☆HIRO") == 12
-```
-
-
-Author
-------
-
-Yasuhiro Matsumoto
-
-License
--------
-
-under the MIT License: http://mattn.mit-license.org/2013
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go
deleted file mode 100644
index 2164497a..00000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth.go
+++ /dev/null
@@ -1,1223 +0,0 @@
-package runewidth
-
-var (
- // EastAsianWidth will be set true if the current locale is CJK
- EastAsianWidth = IsEastAsian()
-
- // DefaultCondition is a condition in current locale
- DefaultCondition = &Condition{EastAsianWidth}
-)
-
-type interval struct {
- first rune
- last rune
-}
-
-type table []interval
-
-func inTables(r rune, ts ...table) bool {
- for _, t := range ts {
- if inTable(r, t) {
- return true
- }
- }
- return false
-}
-
-func inTable(r rune, t table) bool {
- // func (t table) IncludesRune(r rune) bool {
- if r < t[0].first {
- return false
- }
-
- bot := 0
- top := len(t) - 1
- for top >= bot {
- mid := (bot + top) / 2
-
- switch {
- case t[mid].last < r:
- bot = mid + 1
- case t[mid].first > r:
- top = mid - 1
- default:
- return true
- }
- }
-
- return false
-}
-
-var private = table{
- {0x00E000, 0x00F8FF}, {0x0F0000, 0x0FFFFD}, {0x100000, 0x10FFFD},
-}
-
-var nonprint = table{
- {0x0000, 0x001F}, {0x007F, 0x009F}, {0x00AD, 0x00AD},
- {0x070F, 0x070F}, {0x180B, 0x180E}, {0x200B, 0x200F},
- {0x202A, 0x202E}, {0x206A, 0x206F}, {0xD800, 0xDFFF},
- {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFE, 0xFFFF},
-}
-
-var combining = table{
- {0x0300, 0x036F}, {0x0483, 0x0489}, {0x0591, 0x05BD},
- {0x05BF, 0x05BF}, {0x05C1, 0x05C2}, {0x05C4, 0x05C5},
- {0x05C7, 0x05C7}, {0x0610, 0x061A}, {0x064B, 0x065F},
- {0x0670, 0x0670}, {0x06D6, 0x06DC}, {0x06DF, 0x06E4},
- {0x06E7, 0x06E8}, {0x06EA, 0x06ED}, {0x0711, 0x0711},
- {0x0730, 0x074A}, {0x07A6, 0x07B0}, {0x07EB, 0x07F3},
- {0x0816, 0x0819}, {0x081B, 0x0823}, {0x0825, 0x0827},
- {0x0829, 0x082D}, {0x0859, 0x085B}, {0x08D4, 0x08E1},
- {0x08E3, 0x0903}, {0x093A, 0x093C}, {0x093E, 0x094F},
- {0x0951, 0x0957}, {0x0962, 0x0963}, {0x0981, 0x0983},
- {0x09BC, 0x09BC}, {0x09BE, 0x09C4}, {0x09C7, 0x09C8},
- {0x09CB, 0x09CD}, {0x09D7, 0x09D7}, {0x09E2, 0x09E3},
- {0x0A01, 0x0A03}, {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A42},
- {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51},
- {0x0A70, 0x0A71}, {0x0A75, 0x0A75}, {0x0A81, 0x0A83},
- {0x0ABC, 0x0ABC}, {0x0ABE, 0x0AC5}, {0x0AC7, 0x0AC9},
- {0x0ACB, 0x0ACD}, {0x0AE2, 0x0AE3}, {0x0B01, 0x0B03},
- {0x0B3C, 0x0B3C}, {0x0B3E, 0x0B44}, {0x0B47, 0x0B48},
- {0x0B4B, 0x0B4D}, {0x0B56, 0x0B57}, {0x0B62, 0x0B63},
- {0x0B82, 0x0B82}, {0x0BBE, 0x0BC2}, {0x0BC6, 0x0BC8},
- {0x0BCA, 0x0BCD}, {0x0BD7, 0x0BD7}, {0x0C00, 0x0C03},
- {0x0C3E, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D},
- {0x0C55, 0x0C56}, {0x0C62, 0x0C63}, {0x0C81, 0x0C83},
- {0x0CBC, 0x0CBC}, {0x0CBE, 0x0CC4}, {0x0CC6, 0x0CC8},
- {0x0CCA, 0x0CCD}, {0x0CD5, 0x0CD6}, {0x0CE2, 0x0CE3},
- {0x0D01, 0x0D03}, {0x0D3E, 0x0D44}, {0x0D46, 0x0D48},
- {0x0D4A, 0x0D4D}, {0x0D57, 0x0D57}, {0x0D62, 0x0D63},
- {0x0D82, 0x0D83}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD4},
- {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF}, {0x0DF2, 0x0DF3},
- {0x0E31, 0x0E31}, {0x0E34, 0x0E3A}, {0x0E47, 0x0E4E},
- {0x0EB1, 0x0EB1}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC},
- {0x0EC8, 0x0ECD}, {0x0F18, 0x0F19}, {0x0F35, 0x0F35},
- {0x0F37, 0x0F37}, {0x0F39, 0x0F39}, {0x0F3E, 0x0F3F},
- {0x0F71, 0x0F84}, {0x0F86, 0x0F87}, {0x0F8D, 0x0F97},
- {0x0F99, 0x0FBC}, {0x0FC6, 0x0FC6}, {0x102B, 0x103E},
- {0x1056, 0x1059}, {0x105E, 0x1060}, {0x1062, 0x1064},
- {0x1067, 0x106D}, {0x1071, 0x1074}, {0x1082, 0x108D},
- {0x108F, 0x108F}, {0x109A, 0x109D}, {0x135D, 0x135F},
- {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753},
- {0x1772, 0x1773}, {0x17B4, 0x17D3}, {0x17DD, 0x17DD},
- {0x180B, 0x180D}, {0x1885, 0x1886}, {0x18A9, 0x18A9},
- {0x1920, 0x192B}, {0x1930, 0x193B}, {0x1A17, 0x1A1B},
- {0x1A55, 0x1A5E}, {0x1A60, 0x1A7C}, {0x1A7F, 0x1A7F},
- {0x1AB0, 0x1ABE}, {0x1B00, 0x1B04}, {0x1B34, 0x1B44},
- {0x1B6B, 0x1B73}, {0x1B80, 0x1B82}, {0x1BA1, 0x1BAD},
- {0x1BE6, 0x1BF3}, {0x1C24, 0x1C37}, {0x1CD0, 0x1CD2},
- {0x1CD4, 0x1CE8}, {0x1CED, 0x1CED}, {0x1CF2, 0x1CF4},
- {0x1CF8, 0x1CF9}, {0x1DC0, 0x1DF5}, {0x1DFB, 0x1DFF},
- {0x20D0, 0x20F0}, {0x2CEF, 0x2CF1}, {0x2D7F, 0x2D7F},
- {0x2DE0, 0x2DFF}, {0x302A, 0x302F}, {0x3099, 0x309A},
- {0xA66F, 0xA672}, {0xA674, 0xA67D}, {0xA69E, 0xA69F},
- {0xA6F0, 0xA6F1}, {0xA802, 0xA802}, {0xA806, 0xA806},
- {0xA80B, 0xA80B}, {0xA823, 0xA827}, {0xA880, 0xA881},
- {0xA8B4, 0xA8C5}, {0xA8E0, 0xA8F1}, {0xA926, 0xA92D},
- {0xA947, 0xA953}, {0xA980, 0xA983}, {0xA9B3, 0xA9C0},
- {0xA9E5, 0xA9E5}, {0xAA29, 0xAA36}, {0xAA43, 0xAA43},
- {0xAA4C, 0xAA4D}, {0xAA7B, 0xAA7D}, {0xAAB0, 0xAAB0},
- {0xAAB2, 0xAAB4}, {0xAAB7, 0xAAB8}, {0xAABE, 0xAABF},
- {0xAAC1, 0xAAC1}, {0xAAEB, 0xAAEF}, {0xAAF5, 0xAAF6},
- {0xABE3, 0xABEA}, {0xABEC, 0xABED}, {0xFB1E, 0xFB1E},
- {0xFE00, 0xFE0F}, {0xFE20, 0xFE2F}, {0x101FD, 0x101FD},
- {0x102E0, 0x102E0}, {0x10376, 0x1037A}, {0x10A01, 0x10A03},
- {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F}, {0x10A38, 0x10A3A},
- {0x10A3F, 0x10A3F}, {0x10AE5, 0x10AE6}, {0x11000, 0x11002},
- {0x11038, 0x11046}, {0x1107F, 0x11082}, {0x110B0, 0x110BA},
- {0x11100, 0x11102}, {0x11127, 0x11134}, {0x11173, 0x11173},
- {0x11180, 0x11182}, {0x111B3, 0x111C0}, {0x111CA, 0x111CC},
- {0x1122C, 0x11237}, {0x1123E, 0x1123E}, {0x112DF, 0x112EA},
- {0x11300, 0x11303}, {0x1133C, 0x1133C}, {0x1133E, 0x11344},
- {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11357, 0x11357},
- {0x11362, 0x11363}, {0x11366, 0x1136C}, {0x11370, 0x11374},
- {0x11435, 0x11446}, {0x114B0, 0x114C3}, {0x115AF, 0x115B5},
- {0x115B8, 0x115C0}, {0x115DC, 0x115DD}, {0x11630, 0x11640},
- {0x116AB, 0x116B7}, {0x1171D, 0x1172B}, {0x11C2F, 0x11C36},
- {0x11C38, 0x11C3F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CB6},
- {0x16AF0, 0x16AF4}, {0x16B30, 0x16B36}, {0x16F51, 0x16F7E},
- {0x16F8F, 0x16F92}, {0x1BC9D, 0x1BC9E}, {0x1D165, 0x1D169},
- {0x1D16D, 0x1D172}, {0x1D17B, 0x1D182}, {0x1D185, 0x1D18B},
- {0x1D1AA, 0x1D1AD}, {0x1D242, 0x1D244}, {0x1DA00, 0x1DA36},
- {0x1DA3B, 0x1DA6C}, {0x1DA75, 0x1DA75}, {0x1DA84, 0x1DA84},
- {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, {0x1E000, 0x1E006},
- {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024},
- {0x1E026, 0x1E02A}, {0x1E8D0, 0x1E8D6}, {0x1E944, 0x1E94A},
- {0xE0100, 0xE01EF},
-}
-
-var doublewidth = table{
- {0x1100, 0x115F}, {0x231A, 0x231B}, {0x2329, 0x232A},
- {0x23E9, 0x23EC}, {0x23F0, 0x23F0}, {0x23F3, 0x23F3},
- {0x25FD, 0x25FE}, {0x2614, 0x2615}, {0x2648, 0x2653},
- {0x267F, 0x267F}, {0x2693, 0x2693}, {0x26A1, 0x26A1},
- {0x26AA, 0x26AB}, {0x26BD, 0x26BE}, {0x26C4, 0x26C5},
- {0x26CE, 0x26CE}, {0x26D4, 0x26D4}, {0x26EA, 0x26EA},
- {0x26F2, 0x26F3}, {0x26F5, 0x26F5}, {0x26FA, 0x26FA},
- {0x26FD, 0x26FD}, {0x2705, 0x2705}, {0x270A, 0x270B},
- {0x2728, 0x2728}, {0x274C, 0x274C}, {0x274E, 0x274E},
- {0x2753, 0x2755}, {0x2757, 0x2757}, {0x2795, 0x2797},
- {0x27B0, 0x27B0}, {0x27BF, 0x27BF}, {0x2B1B, 0x2B1C},
- {0x2B50, 0x2B50}, {0x2B55, 0x2B55}, {0x2E80, 0x2E99},
- {0x2E9B, 0x2EF3}, {0x2F00, 0x2FD5}, {0x2FF0, 0x2FFB},
- {0x3000, 0x303E}, {0x3041, 0x3096}, {0x3099, 0x30FF},
- {0x3105, 0x312D}, {0x3131, 0x318E}, {0x3190, 0x31BA},
- {0x31C0, 0x31E3}, {0x31F0, 0x321E}, {0x3220, 0x3247},
- {0x3250, 0x32FE}, {0x3300, 0x4DBF}, {0x4E00, 0xA48C},
- {0xA490, 0xA4C6}, {0xA960, 0xA97C}, {0xAC00, 0xD7A3},
- {0xF900, 0xFAFF}, {0xFE10, 0xFE19}, {0xFE30, 0xFE52},
- {0xFE54, 0xFE66}, {0xFE68, 0xFE6B}, {0xFF01, 0xFF60},
- {0xFFE0, 0xFFE6}, {0x16FE0, 0x16FE0}, {0x17000, 0x187EC},
- {0x18800, 0x18AF2}, {0x1B000, 0x1B001}, {0x1F004, 0x1F004},
- {0x1F0CF, 0x1F0CF}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A},
- {0x1F200, 0x1F202}, {0x1F210, 0x1F23B}, {0x1F240, 0x1F248},
- {0x1F250, 0x1F251}, {0x1F300, 0x1F320}, {0x1F32D, 0x1F335},
- {0x1F337, 0x1F37C}, {0x1F37E, 0x1F393}, {0x1F3A0, 0x1F3CA},
- {0x1F3CF, 0x1F3D3}, {0x1F3E0, 0x1F3F0}, {0x1F3F4, 0x1F3F4},
- {0x1F3F8, 0x1F43E}, {0x1F440, 0x1F440}, {0x1F442, 0x1F4FC},
- {0x1F4FF, 0x1F53D}, {0x1F54B, 0x1F54E}, {0x1F550, 0x1F567},
- {0x1F57A, 0x1F57A}, {0x1F595, 0x1F596}, {0x1F5A4, 0x1F5A4},
- {0x1F5FB, 0x1F64F}, {0x1F680, 0x1F6C5}, {0x1F6CC, 0x1F6CC},
- {0x1F6D0, 0x1F6D2}, {0x1F6EB, 0x1F6EC}, {0x1F6F4, 0x1F6F6},
- {0x1F910, 0x1F91E}, {0x1F920, 0x1F927}, {0x1F930, 0x1F930},
- {0x1F933, 0x1F93E}, {0x1F940, 0x1F94B}, {0x1F950, 0x1F95E},
- {0x1F980, 0x1F991}, {0x1F9C0, 0x1F9C0}, {0x20000, 0x2FFFD},
- {0x30000, 0x3FFFD},
-}
-
-var ambiguous = table{
- {0x00A1, 0x00A1}, {0x00A4, 0x00A4}, {0x00A7, 0x00A8},
- {0x00AA, 0x00AA}, {0x00AD, 0x00AE}, {0x00B0, 0x00B4},
- {0x00B6, 0x00BA}, {0x00BC, 0x00BF}, {0x00C6, 0x00C6},
- {0x00D0, 0x00D0}, {0x00D7, 0x00D8}, {0x00DE, 0x00E1},
- {0x00E6, 0x00E6}, {0x00E8, 0x00EA}, {0x00EC, 0x00ED},
- {0x00F0, 0x00F0}, {0x00F2, 0x00F3}, {0x00F7, 0x00FA},
- {0x00FC, 0x00FC}, {0x00FE, 0x00FE}, {0x0101, 0x0101},
- {0x0111, 0x0111}, {0x0113, 0x0113}, {0x011B, 0x011B},
- {0x0126, 0x0127}, {0x012B, 0x012B}, {0x0131, 0x0133},
- {0x0138, 0x0138}, {0x013F, 0x0142}, {0x0144, 0x0144},
- {0x0148, 0x014B}, {0x014D, 0x014D}, {0x0152, 0x0153},
- {0x0166, 0x0167}, {0x016B, 0x016B}, {0x01CE, 0x01CE},
- {0x01D0, 0x01D0}, {0x01D2, 0x01D2}, {0x01D4, 0x01D4},
- {0x01D6, 0x01D6}, {0x01D8, 0x01D8}, {0x01DA, 0x01DA},
- {0x01DC, 0x01DC}, {0x0251, 0x0251}, {0x0261, 0x0261},
- {0x02C4, 0x02C4}, {0x02C7, 0x02C7}, {0x02C9, 0x02CB},
- {0x02CD, 0x02CD}, {0x02D0, 0x02D0}, {0x02D8, 0x02DB},
- {0x02DD, 0x02DD}, {0x02DF, 0x02DF}, {0x0300, 0x036F},
- {0x0391, 0x03A1}, {0x03A3, 0x03A9}, {0x03B1, 0x03C1},
- {0x03C3, 0x03C9}, {0x0401, 0x0401}, {0x0410, 0x044F},
- {0x0451, 0x0451}, {0x2010, 0x2010}, {0x2013, 0x2016},
- {0x2018, 0x2019}, {0x201C, 0x201D}, {0x2020, 0x2022},
- {0x2024, 0x2027}, {0x2030, 0x2030}, {0x2032, 0x2033},
- {0x2035, 0x2035}, {0x203B, 0x203B}, {0x203E, 0x203E},
- {0x2074, 0x2074}, {0x207F, 0x207F}, {0x2081, 0x2084},
- {0x20AC, 0x20AC}, {0x2103, 0x2103}, {0x2105, 0x2105},
- {0x2109, 0x2109}, {0x2113, 0x2113}, {0x2116, 0x2116},
- {0x2121, 0x2122}, {0x2126, 0x2126}, {0x212B, 0x212B},
- {0x2153, 0x2154}, {0x215B, 0x215E}, {0x2160, 0x216B},
- {0x2170, 0x2179}, {0x2189, 0x2189}, {0x2190, 0x2199},
- {0x21B8, 0x21B9}, {0x21D2, 0x21D2}, {0x21D4, 0x21D4},
- {0x21E7, 0x21E7}, {0x2200, 0x2200}, {0x2202, 0x2203},
- {0x2207, 0x2208}, {0x220B, 0x220B}, {0x220F, 0x220F},
- {0x2211, 0x2211}, {0x2215, 0x2215}, {0x221A, 0x221A},
- {0x221D, 0x2220}, {0x2223, 0x2223}, {0x2225, 0x2225},
- {0x2227, 0x222C}, {0x222E, 0x222E}, {0x2234, 0x2237},
- {0x223C, 0x223D}, {0x2248, 0x2248}, {0x224C, 0x224C},
- {0x2252, 0x2252}, {0x2260, 0x2261}, {0x2264, 0x2267},
- {0x226A, 0x226B}, {0x226E, 0x226F}, {0x2282, 0x2283},
- {0x2286, 0x2287}, {0x2295, 0x2295}, {0x2299, 0x2299},
- {0x22A5, 0x22A5}, {0x22BF, 0x22BF}, {0x2312, 0x2312},
- {0x2460, 0x24E9}, {0x24EB, 0x254B}, {0x2550, 0x2573},
- {0x2580, 0x258F}, {0x2592, 0x2595}, {0x25A0, 0x25A1},
- {0x25A3, 0x25A9}, {0x25B2, 0x25B3}, {0x25B6, 0x25B7},
- {0x25BC, 0x25BD}, {0x25C0, 0x25C1}, {0x25C6, 0x25C8},
- {0x25CB, 0x25CB}, {0x25CE, 0x25D1}, {0x25E2, 0x25E5},
- {0x25EF, 0x25EF}, {0x2605, 0x2606}, {0x2609, 0x2609},
- {0x260E, 0x260F}, {0x261C, 0x261C}, {0x261E, 0x261E},
- {0x2640, 0x2640}, {0x2642, 0x2642}, {0x2660, 0x2661},
- {0x2663, 0x2665}, {0x2667, 0x266A}, {0x266C, 0x266D},
- {0x266F, 0x266F}, {0x269E, 0x269F}, {0x26BF, 0x26BF},
- {0x26C6, 0x26CD}, {0x26CF, 0x26D3}, {0x26D5, 0x26E1},
- {0x26E3, 0x26E3}, {0x26E8, 0x26E9}, {0x26EB, 0x26F1},
- {0x26F4, 0x26F4}, {0x26F6, 0x26F9}, {0x26FB, 0x26FC},
- {0x26FE, 0x26FF}, {0x273D, 0x273D}, {0x2776, 0x277F},
- {0x2B56, 0x2B59}, {0x3248, 0x324F}, {0xE000, 0xF8FF},
- {0xFE00, 0xFE0F}, {0xFFFD, 0xFFFD}, {0x1F100, 0x1F10A},
- {0x1F110, 0x1F12D}, {0x1F130, 0x1F169}, {0x1F170, 0x1F18D},
- {0x1F18F, 0x1F190}, {0x1F19B, 0x1F1AC}, {0xE0100, 0xE01EF},
- {0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD},
-}
-
-var emoji = table{
- {0x1F1E6, 0x1F1FF}, {0x1F321, 0x1F321}, {0x1F324, 0x1F32C},
- {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D}, {0x1F396, 0x1F397},
- {0x1F399, 0x1F39B}, {0x1F39E, 0x1F39F}, {0x1F3CB, 0x1F3CE},
- {0x1F3D4, 0x1F3DF}, {0x1F3F3, 0x1F3F5}, {0x1F3F7, 0x1F3F7},
- {0x1F43F, 0x1F43F}, {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FD},
- {0x1F549, 0x1F54A}, {0x1F56F, 0x1F570}, {0x1F573, 0x1F579},
- {0x1F587, 0x1F587}, {0x1F58A, 0x1F58D}, {0x1F590, 0x1F590},
- {0x1F5A5, 0x1F5A5}, {0x1F5A8, 0x1F5A8}, {0x1F5B1, 0x1F5B2},
- {0x1F5BC, 0x1F5BC}, {0x1F5C2, 0x1F5C4}, {0x1F5D1, 0x1F5D3},
- {0x1F5DC, 0x1F5DE}, {0x1F5E1, 0x1F5E1}, {0x1F5E3, 0x1F5E3},
- {0x1F5E8, 0x1F5E8}, {0x1F5EF, 0x1F5EF}, {0x1F5F3, 0x1F5F3},
- {0x1F5FA, 0x1F5FA}, {0x1F6CB, 0x1F6CF}, {0x1F6E0, 0x1F6E5},
- {0x1F6E9, 0x1F6E9}, {0x1F6F0, 0x1F6F0}, {0x1F6F3, 0x1F6F3},
-}
-
-var notassigned = table{
- {0x0378, 0x0379}, {0x0380, 0x0383}, {0x038B, 0x038B},
- {0x038D, 0x038D}, {0x03A2, 0x03A2}, {0x0530, 0x0530},
- {0x0557, 0x0558}, {0x0560, 0x0560}, {0x0588, 0x0588},
- {0x058B, 0x058C}, {0x0590, 0x0590}, {0x05C8, 0x05CF},
- {0x05EB, 0x05EF}, {0x05F5, 0x05FF}, {0x061D, 0x061D},
- {0x070E, 0x070E}, {0x074B, 0x074C}, {0x07B2, 0x07BF},
- {0x07FB, 0x07FF}, {0x082E, 0x082F}, {0x083F, 0x083F},
- {0x085C, 0x085D}, {0x085F, 0x089F}, {0x08B5, 0x08B5},
- {0x08BE, 0x08D3}, {0x0984, 0x0984}, {0x098D, 0x098E},
- {0x0991, 0x0992}, {0x09A9, 0x09A9}, {0x09B1, 0x09B1},
- {0x09B3, 0x09B5}, {0x09BA, 0x09BB}, {0x09C5, 0x09C6},
- {0x09C9, 0x09CA}, {0x09CF, 0x09D6}, {0x09D8, 0x09DB},
- {0x09DE, 0x09DE}, {0x09E4, 0x09E5}, {0x09FC, 0x0A00},
- {0x0A04, 0x0A04}, {0x0A0B, 0x0A0E}, {0x0A11, 0x0A12},
- {0x0A29, 0x0A29}, {0x0A31, 0x0A31}, {0x0A34, 0x0A34},
- {0x0A37, 0x0A37}, {0x0A3A, 0x0A3B}, {0x0A3D, 0x0A3D},
- {0x0A43, 0x0A46}, {0x0A49, 0x0A4A}, {0x0A4E, 0x0A50},
- {0x0A52, 0x0A58}, {0x0A5D, 0x0A5D}, {0x0A5F, 0x0A65},
- {0x0A76, 0x0A80}, {0x0A84, 0x0A84}, {0x0A8E, 0x0A8E},
- {0x0A92, 0x0A92}, {0x0AA9, 0x0AA9}, {0x0AB1, 0x0AB1},
- {0x0AB4, 0x0AB4}, {0x0ABA, 0x0ABB}, {0x0AC6, 0x0AC6},
- {0x0ACA, 0x0ACA}, {0x0ACE, 0x0ACF}, {0x0AD1, 0x0ADF},
- {0x0AE4, 0x0AE5}, {0x0AF2, 0x0AF8}, {0x0AFA, 0x0B00},
- {0x0B04, 0x0B04}, {0x0B0D, 0x0B0E}, {0x0B11, 0x0B12},
- {0x0B29, 0x0B29}, {0x0B31, 0x0B31}, {0x0B34, 0x0B34},
- {0x0B3A, 0x0B3B}, {0x0B45, 0x0B46}, {0x0B49, 0x0B4A},
- {0x0B4E, 0x0B55}, {0x0B58, 0x0B5B}, {0x0B5E, 0x0B5E},
- {0x0B64, 0x0B65}, {0x0B78, 0x0B81}, {0x0B84, 0x0B84},
- {0x0B8B, 0x0B8D}, {0x0B91, 0x0B91}, {0x0B96, 0x0B98},
- {0x0B9B, 0x0B9B}, {0x0B9D, 0x0B9D}, {0x0BA0, 0x0BA2},
- {0x0BA5, 0x0BA7}, {0x0BAB, 0x0BAD}, {0x0BBA, 0x0BBD},
- {0x0BC3, 0x0BC5}, {0x0BC9, 0x0BC9}, {0x0BCE, 0x0BCF},
- {0x0BD1, 0x0BD6}, {0x0BD8, 0x0BE5}, {0x0BFB, 0x0BFF},
- {0x0C04, 0x0C04}, {0x0C0D, 0x0C0D}, {0x0C11, 0x0C11},
- {0x0C29, 0x0C29}, {0x0C3A, 0x0C3C}, {0x0C45, 0x0C45},
- {0x0C49, 0x0C49}, {0x0C4E, 0x0C54}, {0x0C57, 0x0C57},
- {0x0C5B, 0x0C5F}, {0x0C64, 0x0C65}, {0x0C70, 0x0C77},
- {0x0C84, 0x0C84}, {0x0C8D, 0x0C8D}, {0x0C91, 0x0C91},
- {0x0CA9, 0x0CA9}, {0x0CB4, 0x0CB4}, {0x0CBA, 0x0CBB},
- {0x0CC5, 0x0CC5}, {0x0CC9, 0x0CC9}, {0x0CCE, 0x0CD4},
- {0x0CD7, 0x0CDD}, {0x0CDF, 0x0CDF}, {0x0CE4, 0x0CE5},
- {0x0CF0, 0x0CF0}, {0x0CF3, 0x0D00}, {0x0D04, 0x0D04},
- {0x0D0D, 0x0D0D}, {0x0D11, 0x0D11}, {0x0D3B, 0x0D3C},
- {0x0D45, 0x0D45}, {0x0D49, 0x0D49}, {0x0D50, 0x0D53},
- {0x0D64, 0x0D65}, {0x0D80, 0x0D81}, {0x0D84, 0x0D84},
- {0x0D97, 0x0D99}, {0x0DB2, 0x0DB2}, {0x0DBC, 0x0DBC},
- {0x0DBE, 0x0DBF}, {0x0DC7, 0x0DC9}, {0x0DCB, 0x0DCE},
- {0x0DD5, 0x0DD5}, {0x0DD7, 0x0DD7}, {0x0DE0, 0x0DE5},
- {0x0DF0, 0x0DF1}, {0x0DF5, 0x0E00}, {0x0E3B, 0x0E3E},
- {0x0E5C, 0x0E80}, {0x0E83, 0x0E83}, {0x0E85, 0x0E86},
- {0x0E89, 0x0E89}, {0x0E8B, 0x0E8C}, {0x0E8E, 0x0E93},
- {0x0E98, 0x0E98}, {0x0EA0, 0x0EA0}, {0x0EA4, 0x0EA4},
- {0x0EA6, 0x0EA6}, {0x0EA8, 0x0EA9}, {0x0EAC, 0x0EAC},
- {0x0EBA, 0x0EBA}, {0x0EBE, 0x0EBF}, {0x0EC5, 0x0EC5},
- {0x0EC7, 0x0EC7}, {0x0ECE, 0x0ECF}, {0x0EDA, 0x0EDB},
- {0x0EE0, 0x0EFF}, {0x0F48, 0x0F48}, {0x0F6D, 0x0F70},
- {0x0F98, 0x0F98}, {0x0FBD, 0x0FBD}, {0x0FCD, 0x0FCD},
- {0x0FDB, 0x0FFF}, {0x10C6, 0x10C6}, {0x10C8, 0x10CC},
- {0x10CE, 0x10CF}, {0x1249, 0x1249}, {0x124E, 0x124F},
- {0x1257, 0x1257}, {0x1259, 0x1259}, {0x125E, 0x125F},
- {0x1289, 0x1289}, {0x128E, 0x128F}, {0x12B1, 0x12B1},
- {0x12B6, 0x12B7}, {0x12BF, 0x12BF}, {0x12C1, 0x12C1},
- {0x12C6, 0x12C7}, {0x12D7, 0x12D7}, {0x1311, 0x1311},
- {0x1316, 0x1317}, {0x135B, 0x135C}, {0x137D, 0x137F},
- {0x139A, 0x139F}, {0x13F6, 0x13F7}, {0x13FE, 0x13FF},
- {0x169D, 0x169F}, {0x16F9, 0x16FF}, {0x170D, 0x170D},
- {0x1715, 0x171F}, {0x1737, 0x173F}, {0x1754, 0x175F},
- {0x176D, 0x176D}, {0x1771, 0x1771}, {0x1774, 0x177F},
- {0x17DE, 0x17DF}, {0x17EA, 0x17EF}, {0x17FA, 0x17FF},
- {0x180F, 0x180F}, {0x181A, 0x181F}, {0x1878, 0x187F},
- {0x18AB, 0x18AF}, {0x18F6, 0x18FF}, {0x191F, 0x191F},
- {0x192C, 0x192F}, {0x193C, 0x193F}, {0x1941, 0x1943},
- {0x196E, 0x196F}, {0x1975, 0x197F}, {0x19AC, 0x19AF},
- {0x19CA, 0x19CF}, {0x19DB, 0x19DD}, {0x1A1C, 0x1A1D},
- {0x1A5F, 0x1A5F}, {0x1A7D, 0x1A7E}, {0x1A8A, 0x1A8F},
- {0x1A9A, 0x1A9F}, {0x1AAE, 0x1AAF}, {0x1ABF, 0x1AFF},
- {0x1B4C, 0x1B4F}, {0x1B7D, 0x1B7F}, {0x1BF4, 0x1BFB},
- {0x1C38, 0x1C3A}, {0x1C4A, 0x1C4C}, {0x1C89, 0x1CBF},
- {0x1CC8, 0x1CCF}, {0x1CF7, 0x1CF7}, {0x1CFA, 0x1CFF},
- {0x1DF6, 0x1DFA}, {0x1F16, 0x1F17}, {0x1F1E, 0x1F1F},
- {0x1F46, 0x1F47}, {0x1F4E, 0x1F4F}, {0x1F58, 0x1F58},
- {0x1F5A, 0x1F5A}, {0x1F5C, 0x1F5C}, {0x1F5E, 0x1F5E},
- {0x1F7E, 0x1F7F}, {0x1FB5, 0x1FB5}, {0x1FC5, 0x1FC5},
- {0x1FD4, 0x1FD5}, {0x1FDC, 0x1FDC}, {0x1FF0, 0x1FF1},
- {0x1FF5, 0x1FF5}, {0x1FFF, 0x1FFF}, {0x2065, 0x2065},
- {0x2072, 0x2073}, {0x208F, 0x208F}, {0x209D, 0x209F},
- {0x20BF, 0x20CF}, {0x20F1, 0x20FF}, {0x218C, 0x218F},
- {0x23FF, 0x23FF}, {0x2427, 0x243F}, {0x244B, 0x245F},
- {0x2B74, 0x2B75}, {0x2B96, 0x2B97}, {0x2BBA, 0x2BBC},
- {0x2BC9, 0x2BC9}, {0x2BD2, 0x2BEB}, {0x2BF0, 0x2BFF},
- {0x2C2F, 0x2C2F}, {0x2C5F, 0x2C5F}, {0x2CF4, 0x2CF8},
- {0x2D26, 0x2D26}, {0x2D28, 0x2D2C}, {0x2D2E, 0x2D2F},
- {0x2D68, 0x2D6E}, {0x2D71, 0x2D7E}, {0x2D97, 0x2D9F},
- {0x2DA7, 0x2DA7}, {0x2DAF, 0x2DAF}, {0x2DB7, 0x2DB7},
- {0x2DBF, 0x2DBF}, {0x2DC7, 0x2DC7}, {0x2DCF, 0x2DCF},
- {0x2DD7, 0x2DD7}, {0x2DDF, 0x2DDF}, {0x2E45, 0x2E7F},
- {0x2E9A, 0x2E9A}, {0x2EF4, 0x2EFF}, {0x2FD6, 0x2FEF},
- {0x2FFC, 0x2FFF}, {0x3040, 0x3040}, {0x3097, 0x3098},
- {0x3100, 0x3104}, {0x312E, 0x3130}, {0x318F, 0x318F},
- {0x31BB, 0x31BF}, {0x31E4, 0x31EF}, {0x321F, 0x321F},
- {0x32FF, 0x32FF}, {0x4DB6, 0x4DBF}, {0x9FD6, 0x9FFF},
- {0xA48D, 0xA48F}, {0xA4C7, 0xA4CF}, {0xA62C, 0xA63F},
- {0xA6F8, 0xA6FF}, {0xA7AF, 0xA7AF}, {0xA7B8, 0xA7F6},
- {0xA82C, 0xA82F}, {0xA83A, 0xA83F}, {0xA878, 0xA87F},
- {0xA8C6, 0xA8CD}, {0xA8DA, 0xA8DF}, {0xA8FE, 0xA8FF},
- {0xA954, 0xA95E}, {0xA97D, 0xA97F}, {0xA9CE, 0xA9CE},
- {0xA9DA, 0xA9DD}, {0xA9FF, 0xA9FF}, {0xAA37, 0xAA3F},
- {0xAA4E, 0xAA4F}, {0xAA5A, 0xAA5B}, {0xAAC3, 0xAADA},
- {0xAAF7, 0xAB00}, {0xAB07, 0xAB08}, {0xAB0F, 0xAB10},
- {0xAB17, 0xAB1F}, {0xAB27, 0xAB27}, {0xAB2F, 0xAB2F},
- {0xAB66, 0xAB6F}, {0xABEE, 0xABEF}, {0xABFA, 0xABFF},
- {0xD7A4, 0xD7AF}, {0xD7C7, 0xD7CA}, {0xD7FC, 0xD7FF},
- {0xFA6E, 0xFA6F}, {0xFADA, 0xFAFF}, {0xFB07, 0xFB12},
- {0xFB18, 0xFB1C}, {0xFB37, 0xFB37}, {0xFB3D, 0xFB3D},
- {0xFB3F, 0xFB3F}, {0xFB42, 0xFB42}, {0xFB45, 0xFB45},
- {0xFBC2, 0xFBD2}, {0xFD40, 0xFD4F}, {0xFD90, 0xFD91},
- {0xFDC8, 0xFDEF}, {0xFDFE, 0xFDFF}, {0xFE1A, 0xFE1F},
- {0xFE53, 0xFE53}, {0xFE67, 0xFE67}, {0xFE6C, 0xFE6F},
- {0xFE75, 0xFE75}, {0xFEFD, 0xFEFE}, {0xFF00, 0xFF00},
- {0xFFBF, 0xFFC1}, {0xFFC8, 0xFFC9}, {0xFFD0, 0xFFD1},
- {0xFFD8, 0xFFD9}, {0xFFDD, 0xFFDF}, {0xFFE7, 0xFFE7},
- {0xFFEF, 0xFFF8}, {0xFFFE, 0xFFFF}, {0x1000C, 0x1000C},
- {0x10027, 0x10027}, {0x1003B, 0x1003B}, {0x1003E, 0x1003E},
- {0x1004E, 0x1004F}, {0x1005E, 0x1007F}, {0x100FB, 0x100FF},
- {0x10103, 0x10106}, {0x10134, 0x10136}, {0x1018F, 0x1018F},
- {0x1019C, 0x1019F}, {0x101A1, 0x101CF}, {0x101FE, 0x1027F},
- {0x1029D, 0x1029F}, {0x102D1, 0x102DF}, {0x102FC, 0x102FF},
- {0x10324, 0x1032F}, {0x1034B, 0x1034F}, {0x1037B, 0x1037F},
- {0x1039E, 0x1039E}, {0x103C4, 0x103C7}, {0x103D6, 0x103FF},
- {0x1049E, 0x1049F}, {0x104AA, 0x104AF}, {0x104D4, 0x104D7},
- {0x104FC, 0x104FF}, {0x10528, 0x1052F}, {0x10564, 0x1056E},
- {0x10570, 0x105FF}, {0x10737, 0x1073F}, {0x10756, 0x1075F},
- {0x10768, 0x107FF}, {0x10806, 0x10807}, {0x10809, 0x10809},
- {0x10836, 0x10836}, {0x10839, 0x1083B}, {0x1083D, 0x1083E},
- {0x10856, 0x10856}, {0x1089F, 0x108A6}, {0x108B0, 0x108DF},
- {0x108F3, 0x108F3}, {0x108F6, 0x108FA}, {0x1091C, 0x1091E},
- {0x1093A, 0x1093E}, {0x10940, 0x1097F}, {0x109B8, 0x109BB},
- {0x109D0, 0x109D1}, {0x10A04, 0x10A04}, {0x10A07, 0x10A0B},
- {0x10A14, 0x10A14}, {0x10A18, 0x10A18}, {0x10A34, 0x10A37},
- {0x10A3B, 0x10A3E}, {0x10A48, 0x10A4F}, {0x10A59, 0x10A5F},
- {0x10AA0, 0x10ABF}, {0x10AE7, 0x10AEA}, {0x10AF7, 0x10AFF},
- {0x10B36, 0x10B38}, {0x10B56, 0x10B57}, {0x10B73, 0x10B77},
- {0x10B92, 0x10B98}, {0x10B9D, 0x10BA8}, {0x10BB0, 0x10BFF},
- {0x10C49, 0x10C7F}, {0x10CB3, 0x10CBF}, {0x10CF3, 0x10CF9},
- {0x10D00, 0x10E5F}, {0x10E7F, 0x10FFF}, {0x1104E, 0x11051},
- {0x11070, 0x1107E}, {0x110C2, 0x110CF}, {0x110E9, 0x110EF},
- {0x110FA, 0x110FF}, {0x11135, 0x11135}, {0x11144, 0x1114F},
- {0x11177, 0x1117F}, {0x111CE, 0x111CF}, {0x111E0, 0x111E0},
- {0x111F5, 0x111FF}, {0x11212, 0x11212}, {0x1123F, 0x1127F},
- {0x11287, 0x11287}, {0x11289, 0x11289}, {0x1128E, 0x1128E},
- {0x1129E, 0x1129E}, {0x112AA, 0x112AF}, {0x112EB, 0x112EF},
- {0x112FA, 0x112FF}, {0x11304, 0x11304}, {0x1130D, 0x1130E},
- {0x11311, 0x11312}, {0x11329, 0x11329}, {0x11331, 0x11331},
- {0x11334, 0x11334}, {0x1133A, 0x1133B}, {0x11345, 0x11346},
- {0x11349, 0x1134A}, {0x1134E, 0x1134F}, {0x11351, 0x11356},
- {0x11358, 0x1135C}, {0x11364, 0x11365}, {0x1136D, 0x1136F},
- {0x11375, 0x113FF}, {0x1145A, 0x1145A}, {0x1145C, 0x1145C},
- {0x1145E, 0x1147F}, {0x114C8, 0x114CF}, {0x114DA, 0x1157F},
- {0x115B6, 0x115B7}, {0x115DE, 0x115FF}, {0x11645, 0x1164F},
- {0x1165A, 0x1165F}, {0x1166D, 0x1167F}, {0x116B8, 0x116BF},
- {0x116CA, 0x116FF}, {0x1171A, 0x1171C}, {0x1172C, 0x1172F},
- {0x11740, 0x1189F}, {0x118F3, 0x118FE}, {0x11900, 0x11ABF},
- {0x11AF9, 0x11BFF}, {0x11C09, 0x11C09}, {0x11C37, 0x11C37},
- {0x11C46, 0x11C4F}, {0x11C6D, 0x11C6F}, {0x11C90, 0x11C91},
- {0x11CA8, 0x11CA8}, {0x11CB7, 0x11FFF}, {0x1239A, 0x123FF},
- {0x1246F, 0x1246F}, {0x12475, 0x1247F}, {0x12544, 0x12FFF},
- {0x1342F, 0x143FF}, {0x14647, 0x167FF}, {0x16A39, 0x16A3F},
- {0x16A5F, 0x16A5F}, {0x16A6A, 0x16A6D}, {0x16A70, 0x16ACF},
- {0x16AEE, 0x16AEF}, {0x16AF6, 0x16AFF}, {0x16B46, 0x16B4F},
- {0x16B5A, 0x16B5A}, {0x16B62, 0x16B62}, {0x16B78, 0x16B7C},
- {0x16B90, 0x16EFF}, {0x16F45, 0x16F4F}, {0x16F7F, 0x16F8E},
- {0x16FA0, 0x16FDF}, {0x16FE1, 0x16FFF}, {0x187ED, 0x187FF},
- {0x18AF3, 0x1AFFF}, {0x1B002, 0x1BBFF}, {0x1BC6B, 0x1BC6F},
- {0x1BC7D, 0x1BC7F}, {0x1BC89, 0x1BC8F}, {0x1BC9A, 0x1BC9B},
- {0x1BCA4, 0x1CFFF}, {0x1D0F6, 0x1D0FF}, {0x1D127, 0x1D128},
- {0x1D1E9, 0x1D1FF}, {0x1D246, 0x1D2FF}, {0x1D357, 0x1D35F},
- {0x1D372, 0x1D3FF}, {0x1D455, 0x1D455}, {0x1D49D, 0x1D49D},
- {0x1D4A0, 0x1D4A1}, {0x1D4A3, 0x1D4A4}, {0x1D4A7, 0x1D4A8},
- {0x1D4AD, 0x1D4AD}, {0x1D4BA, 0x1D4BA}, {0x1D4BC, 0x1D4BC},
- {0x1D4C4, 0x1D4C4}, {0x1D506, 0x1D506}, {0x1D50B, 0x1D50C},
- {0x1D515, 0x1D515}, {0x1D51D, 0x1D51D}, {0x1D53A, 0x1D53A},
- {0x1D53F, 0x1D53F}, {0x1D545, 0x1D545}, {0x1D547, 0x1D549},
- {0x1D551, 0x1D551}, {0x1D6A6, 0x1D6A7}, {0x1D7CC, 0x1D7CD},
- {0x1DA8C, 0x1DA9A}, {0x1DAA0, 0x1DAA0}, {0x1DAB0, 0x1DFFF},
- {0x1E007, 0x1E007}, {0x1E019, 0x1E01A}, {0x1E022, 0x1E022},
- {0x1E025, 0x1E025}, {0x1E02B, 0x1E7FF}, {0x1E8C5, 0x1E8C6},
- {0x1E8D7, 0x1E8FF}, {0x1E94B, 0x1E94F}, {0x1E95A, 0x1E95D},
- {0x1E960, 0x1EDFF}, {0x1EE04, 0x1EE04}, {0x1EE20, 0x1EE20},
- {0x1EE23, 0x1EE23}, {0x1EE25, 0x1EE26}, {0x1EE28, 0x1EE28},
- {0x1EE33, 0x1EE33}, {0x1EE38, 0x1EE38}, {0x1EE3A, 0x1EE3A},
- {0x1EE3C, 0x1EE41}, {0x1EE43, 0x1EE46}, {0x1EE48, 0x1EE48},
- {0x1EE4A, 0x1EE4A}, {0x1EE4C, 0x1EE4C}, {0x1EE50, 0x1EE50},
- {0x1EE53, 0x1EE53}, {0x1EE55, 0x1EE56}, {0x1EE58, 0x1EE58},
- {0x1EE5A, 0x1EE5A}, {0x1EE5C, 0x1EE5C}, {0x1EE5E, 0x1EE5E},
- {0x1EE60, 0x1EE60}, {0x1EE63, 0x1EE63}, {0x1EE65, 0x1EE66},
- {0x1EE6B, 0x1EE6B}, {0x1EE73, 0x1EE73}, {0x1EE78, 0x1EE78},
- {0x1EE7D, 0x1EE7D}, {0x1EE7F, 0x1EE7F}, {0x1EE8A, 0x1EE8A},
- {0x1EE9C, 0x1EEA0}, {0x1EEA4, 0x1EEA4}, {0x1EEAA, 0x1EEAA},
- {0x1EEBC, 0x1EEEF}, {0x1EEF2, 0x1EFFF}, {0x1F02C, 0x1F02F},
- {0x1F094, 0x1F09F}, {0x1F0AF, 0x1F0B0}, {0x1F0C0, 0x1F0C0},
- {0x1F0D0, 0x1F0D0}, {0x1F0F6, 0x1F0FF}, {0x1F10D, 0x1F10F},
- {0x1F12F, 0x1F12F}, {0x1F16C, 0x1F16F}, {0x1F1AD, 0x1F1E5},
- {0x1F203, 0x1F20F}, {0x1F23C, 0x1F23F}, {0x1F249, 0x1F24F},
- {0x1F252, 0x1F2FF}, {0x1F6D3, 0x1F6DF}, {0x1F6ED, 0x1F6EF},
- {0x1F6F7, 0x1F6FF}, {0x1F774, 0x1F77F}, {0x1F7D5, 0x1F7FF},
- {0x1F80C, 0x1F80F}, {0x1F848, 0x1F84F}, {0x1F85A, 0x1F85F},
- {0x1F888, 0x1F88F}, {0x1F8AE, 0x1F90F}, {0x1F91F, 0x1F91F},
- {0x1F928, 0x1F92F}, {0x1F931, 0x1F932}, {0x1F93F, 0x1F93F},
- {0x1F94C, 0x1F94F}, {0x1F95F, 0x1F97F}, {0x1F992, 0x1F9BF},
- {0x1F9C1, 0x1FFFF}, {0x2A6D7, 0x2A6FF}, {0x2B735, 0x2B73F},
- {0x2B81E, 0x2B81F}, {0x2CEA2, 0x2F7FF}, {0x2FA1E, 0xE0000},
- {0xE0002, 0xE001F}, {0xE0080, 0xE00FF}, {0xE01F0, 0xEFFFF},
- {0xFFFFE, 0xFFFFF},
-}
-
-var neutral = table{
- {0x0000, 0x001F}, {0x007F, 0x007F}, {0x0080, 0x009F},
- {0x00A0, 0x00A0}, {0x00A9, 0x00A9}, {0x00AB, 0x00AB},
- {0x00B5, 0x00B5}, {0x00BB, 0x00BB}, {0x00C0, 0x00C5},
- {0x00C7, 0x00CF}, {0x00D1, 0x00D6}, {0x00D9, 0x00DD},
- {0x00E2, 0x00E5}, {0x00E7, 0x00E7}, {0x00EB, 0x00EB},
- {0x00EE, 0x00EF}, {0x00F1, 0x00F1}, {0x00F4, 0x00F6},
- {0x00FB, 0x00FB}, {0x00FD, 0x00FD}, {0x00FF, 0x00FF},
- {0x0100, 0x0100}, {0x0102, 0x0110}, {0x0112, 0x0112},
- {0x0114, 0x011A}, {0x011C, 0x0125}, {0x0128, 0x012A},
- {0x012C, 0x0130}, {0x0134, 0x0137}, {0x0139, 0x013E},
- {0x0143, 0x0143}, {0x0145, 0x0147}, {0x014C, 0x014C},
- {0x014E, 0x0151}, {0x0154, 0x0165}, {0x0168, 0x016A},
- {0x016C, 0x017F}, {0x0180, 0x01BA}, {0x01BB, 0x01BB},
- {0x01BC, 0x01BF}, {0x01C0, 0x01C3}, {0x01C4, 0x01CD},
- {0x01CF, 0x01CF}, {0x01D1, 0x01D1}, {0x01D3, 0x01D3},
- {0x01D5, 0x01D5}, {0x01D7, 0x01D7}, {0x01D9, 0x01D9},
- {0x01DB, 0x01DB}, {0x01DD, 0x024F}, {0x0250, 0x0250},
- {0x0252, 0x0260}, {0x0262, 0x0293}, {0x0294, 0x0294},
- {0x0295, 0x02AF}, {0x02B0, 0x02C1}, {0x02C2, 0x02C3},
- {0x02C5, 0x02C5}, {0x02C6, 0x02C6}, {0x02C8, 0x02C8},
- {0x02CC, 0x02CC}, {0x02CE, 0x02CF}, {0x02D1, 0x02D1},
- {0x02D2, 0x02D7}, {0x02DC, 0x02DC}, {0x02DE, 0x02DE},
- {0x02E0, 0x02E4}, {0x02E5, 0x02EB}, {0x02EC, 0x02EC},
- {0x02ED, 0x02ED}, {0x02EE, 0x02EE}, {0x02EF, 0x02FF},
- {0x0370, 0x0373}, {0x0374, 0x0374}, {0x0375, 0x0375},
- {0x0376, 0x0377}, {0x037A, 0x037A}, {0x037B, 0x037D},
- {0x037E, 0x037E}, {0x037F, 0x037F}, {0x0384, 0x0385},
- {0x0386, 0x0386}, {0x0387, 0x0387}, {0x0388, 0x038A},
- {0x038C, 0x038C}, {0x038E, 0x0390}, {0x03AA, 0x03B0},
- {0x03C2, 0x03C2}, {0x03CA, 0x03F5}, {0x03F6, 0x03F6},
- {0x03F7, 0x03FF}, {0x0400, 0x0400}, {0x0402, 0x040F},
- {0x0450, 0x0450}, {0x0452, 0x0481}, {0x0482, 0x0482},
- {0x0483, 0x0487}, {0x0488, 0x0489}, {0x048A, 0x04FF},
- {0x0500, 0x052F}, {0x0531, 0x0556}, {0x0559, 0x0559},
- {0x055A, 0x055F}, {0x0561, 0x0587}, {0x0589, 0x0589},
- {0x058A, 0x058A}, {0x058D, 0x058E}, {0x058F, 0x058F},
- {0x0591, 0x05BD}, {0x05BE, 0x05BE}, {0x05BF, 0x05BF},
- {0x05C0, 0x05C0}, {0x05C1, 0x05C2}, {0x05C3, 0x05C3},
- {0x05C4, 0x05C5}, {0x05C6, 0x05C6}, {0x05C7, 0x05C7},
- {0x05D0, 0x05EA}, {0x05F0, 0x05F2}, {0x05F3, 0x05F4},
- {0x0600, 0x0605}, {0x0606, 0x0608}, {0x0609, 0x060A},
- {0x060B, 0x060B}, {0x060C, 0x060D}, {0x060E, 0x060F},
- {0x0610, 0x061A}, {0x061B, 0x061B}, {0x061C, 0x061C},
- {0x061E, 0x061F}, {0x0620, 0x063F}, {0x0640, 0x0640},
- {0x0641, 0x064A}, {0x064B, 0x065F}, {0x0660, 0x0669},
- {0x066A, 0x066D}, {0x066E, 0x066F}, {0x0670, 0x0670},
- {0x0671, 0x06D3}, {0x06D4, 0x06D4}, {0x06D5, 0x06D5},
- {0x06D6, 0x06DC}, {0x06DD, 0x06DD}, {0x06DE, 0x06DE},
- {0x06DF, 0x06E4}, {0x06E5, 0x06E6}, {0x06E7, 0x06E8},
- {0x06E9, 0x06E9}, {0x06EA, 0x06ED}, {0x06EE, 0x06EF},
- {0x06F0, 0x06F9}, {0x06FA, 0x06FC}, {0x06FD, 0x06FE},
- {0x06FF, 0x06FF}, {0x0700, 0x070D}, {0x070F, 0x070F},
- {0x0710, 0x0710}, {0x0711, 0x0711}, {0x0712, 0x072F},
- {0x0730, 0x074A}, {0x074D, 0x074F}, {0x0750, 0x077F},
- {0x0780, 0x07A5}, {0x07A6, 0x07B0}, {0x07B1, 0x07B1},
- {0x07C0, 0x07C9}, {0x07CA, 0x07EA}, {0x07EB, 0x07F3},
- {0x07F4, 0x07F5}, {0x07F6, 0x07F6}, {0x07F7, 0x07F9},
- {0x07FA, 0x07FA}, {0x0800, 0x0815}, {0x0816, 0x0819},
- {0x081A, 0x081A}, {0x081B, 0x0823}, {0x0824, 0x0824},
- {0x0825, 0x0827}, {0x0828, 0x0828}, {0x0829, 0x082D},
- {0x0830, 0x083E}, {0x0840, 0x0858}, {0x0859, 0x085B},
- {0x085E, 0x085E}, {0x08A0, 0x08B4}, {0x08B6, 0x08BD},
- {0x08D4, 0x08E1}, {0x08E2, 0x08E2}, {0x08E3, 0x08FF},
- {0x0900, 0x0902}, {0x0903, 0x0903}, {0x0904, 0x0939},
- {0x093A, 0x093A}, {0x093B, 0x093B}, {0x093C, 0x093C},
- {0x093D, 0x093D}, {0x093E, 0x0940}, {0x0941, 0x0948},
- {0x0949, 0x094C}, {0x094D, 0x094D}, {0x094E, 0x094F},
- {0x0950, 0x0950}, {0x0951, 0x0957}, {0x0958, 0x0961},
- {0x0962, 0x0963}, {0x0964, 0x0965}, {0x0966, 0x096F},
- {0x0970, 0x0970}, {0x0971, 0x0971}, {0x0972, 0x097F},
- {0x0980, 0x0980}, {0x0981, 0x0981}, {0x0982, 0x0983},
- {0x0985, 0x098C}, {0x098F, 0x0990}, {0x0993, 0x09A8},
- {0x09AA, 0x09B0}, {0x09B2, 0x09B2}, {0x09B6, 0x09B9},
- {0x09BC, 0x09BC}, {0x09BD, 0x09BD}, {0x09BE, 0x09C0},
- {0x09C1, 0x09C4}, {0x09C7, 0x09C8}, {0x09CB, 0x09CC},
- {0x09CD, 0x09CD}, {0x09CE, 0x09CE}, {0x09D7, 0x09D7},
- {0x09DC, 0x09DD}, {0x09DF, 0x09E1}, {0x09E2, 0x09E3},
- {0x09E6, 0x09EF}, {0x09F0, 0x09F1}, {0x09F2, 0x09F3},
- {0x09F4, 0x09F9}, {0x09FA, 0x09FA}, {0x09FB, 0x09FB},
- {0x0A01, 0x0A02}, {0x0A03, 0x0A03}, {0x0A05, 0x0A0A},
- {0x0A0F, 0x0A10}, {0x0A13, 0x0A28}, {0x0A2A, 0x0A30},
- {0x0A32, 0x0A33}, {0x0A35, 0x0A36}, {0x0A38, 0x0A39},
- {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A40}, {0x0A41, 0x0A42},
- {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51},
- {0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E}, {0x0A66, 0x0A6F},
- {0x0A70, 0x0A71}, {0x0A72, 0x0A74}, {0x0A75, 0x0A75},
- {0x0A81, 0x0A82}, {0x0A83, 0x0A83}, {0x0A85, 0x0A8D},
- {0x0A8F, 0x0A91}, {0x0A93, 0x0AA8}, {0x0AAA, 0x0AB0},
- {0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, {0x0ABC, 0x0ABC},
- {0x0ABD, 0x0ABD}, {0x0ABE, 0x0AC0}, {0x0AC1, 0x0AC5},
- {0x0AC7, 0x0AC8}, {0x0AC9, 0x0AC9}, {0x0ACB, 0x0ACC},
- {0x0ACD, 0x0ACD}, {0x0AD0, 0x0AD0}, {0x0AE0, 0x0AE1},
- {0x0AE2, 0x0AE3}, {0x0AE6, 0x0AEF}, {0x0AF0, 0x0AF0},
- {0x0AF1, 0x0AF1}, {0x0AF9, 0x0AF9}, {0x0B01, 0x0B01},
- {0x0B02, 0x0B03}, {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10},
- {0x0B13, 0x0B28}, {0x0B2A, 0x0B30}, {0x0B32, 0x0B33},
- {0x0B35, 0x0B39}, {0x0B3C, 0x0B3C}, {0x0B3D, 0x0B3D},
- {0x0B3E, 0x0B3E}, {0x0B3F, 0x0B3F}, {0x0B40, 0x0B40},
- {0x0B41, 0x0B44}, {0x0B47, 0x0B48}, {0x0B4B, 0x0B4C},
- {0x0B4D, 0x0B4D}, {0x0B56, 0x0B56}, {0x0B57, 0x0B57},
- {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B61}, {0x0B62, 0x0B63},
- {0x0B66, 0x0B6F}, {0x0B70, 0x0B70}, {0x0B71, 0x0B71},
- {0x0B72, 0x0B77}, {0x0B82, 0x0B82}, {0x0B83, 0x0B83},
- {0x0B85, 0x0B8A}, {0x0B8E, 0x0B90}, {0x0B92, 0x0B95},
- {0x0B99, 0x0B9A}, {0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F},
- {0x0BA3, 0x0BA4}, {0x0BA8, 0x0BAA}, {0x0BAE, 0x0BB9},
- {0x0BBE, 0x0BBF}, {0x0BC0, 0x0BC0}, {0x0BC1, 0x0BC2},
- {0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCC}, {0x0BCD, 0x0BCD},
- {0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, {0x0BE6, 0x0BEF},
- {0x0BF0, 0x0BF2}, {0x0BF3, 0x0BF8}, {0x0BF9, 0x0BF9},
- {0x0BFA, 0x0BFA}, {0x0C00, 0x0C00}, {0x0C01, 0x0C03},
- {0x0C05, 0x0C0C}, {0x0C0E, 0x0C10}, {0x0C12, 0x0C28},
- {0x0C2A, 0x0C39}, {0x0C3D, 0x0C3D}, {0x0C3E, 0x0C40},
- {0x0C41, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D},
- {0x0C55, 0x0C56}, {0x0C58, 0x0C5A}, {0x0C60, 0x0C61},
- {0x0C62, 0x0C63}, {0x0C66, 0x0C6F}, {0x0C78, 0x0C7E},
- {0x0C7F, 0x0C7F}, {0x0C80, 0x0C80}, {0x0C81, 0x0C81},
- {0x0C82, 0x0C83}, {0x0C85, 0x0C8C}, {0x0C8E, 0x0C90},
- {0x0C92, 0x0CA8}, {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9},
- {0x0CBC, 0x0CBC}, {0x0CBD, 0x0CBD}, {0x0CBE, 0x0CBE},
- {0x0CBF, 0x0CBF}, {0x0CC0, 0x0CC4}, {0x0CC6, 0x0CC6},
- {0x0CC7, 0x0CC8}, {0x0CCA, 0x0CCB}, {0x0CCC, 0x0CCD},
- {0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE1},
- {0x0CE2, 0x0CE3}, {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2},
- {0x0D01, 0x0D01}, {0x0D02, 0x0D03}, {0x0D05, 0x0D0C},
- {0x0D0E, 0x0D10}, {0x0D12, 0x0D3A}, {0x0D3D, 0x0D3D},
- {0x0D3E, 0x0D40}, {0x0D41, 0x0D44}, {0x0D46, 0x0D48},
- {0x0D4A, 0x0D4C}, {0x0D4D, 0x0D4D}, {0x0D4E, 0x0D4E},
- {0x0D4F, 0x0D4F}, {0x0D54, 0x0D56}, {0x0D57, 0x0D57},
- {0x0D58, 0x0D5E}, {0x0D5F, 0x0D61}, {0x0D62, 0x0D63},
- {0x0D66, 0x0D6F}, {0x0D70, 0x0D78}, {0x0D79, 0x0D79},
- {0x0D7A, 0x0D7F}, {0x0D82, 0x0D83}, {0x0D85, 0x0D96},
- {0x0D9A, 0x0DB1}, {0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD},
- {0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD1},
- {0x0DD2, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF},
- {0x0DE6, 0x0DEF}, {0x0DF2, 0x0DF3}, {0x0DF4, 0x0DF4},
- {0x0E01, 0x0E30}, {0x0E31, 0x0E31}, {0x0E32, 0x0E33},
- {0x0E34, 0x0E3A}, {0x0E3F, 0x0E3F}, {0x0E40, 0x0E45},
- {0x0E46, 0x0E46}, {0x0E47, 0x0E4E}, {0x0E4F, 0x0E4F},
- {0x0E50, 0x0E59}, {0x0E5A, 0x0E5B}, {0x0E81, 0x0E82},
- {0x0E84, 0x0E84}, {0x0E87, 0x0E88}, {0x0E8A, 0x0E8A},
- {0x0E8D, 0x0E8D}, {0x0E94, 0x0E97}, {0x0E99, 0x0E9F},
- {0x0EA1, 0x0EA3}, {0x0EA5, 0x0EA5}, {0x0EA7, 0x0EA7},
- {0x0EAA, 0x0EAB}, {0x0EAD, 0x0EB0}, {0x0EB1, 0x0EB1},
- {0x0EB2, 0x0EB3}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC},
- {0x0EBD, 0x0EBD}, {0x0EC0, 0x0EC4}, {0x0EC6, 0x0EC6},
- {0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF},
- {0x0F00, 0x0F00}, {0x0F01, 0x0F03}, {0x0F04, 0x0F12},
- {0x0F13, 0x0F13}, {0x0F14, 0x0F14}, {0x0F15, 0x0F17},
- {0x0F18, 0x0F19}, {0x0F1A, 0x0F1F}, {0x0F20, 0x0F29},
- {0x0F2A, 0x0F33}, {0x0F34, 0x0F34}, {0x0F35, 0x0F35},
- {0x0F36, 0x0F36}, {0x0F37, 0x0F37}, {0x0F38, 0x0F38},
- {0x0F39, 0x0F39}, {0x0F3A, 0x0F3A}, {0x0F3B, 0x0F3B},
- {0x0F3C, 0x0F3C}, {0x0F3D, 0x0F3D}, {0x0F3E, 0x0F3F},
- {0x0F40, 0x0F47}, {0x0F49, 0x0F6C}, {0x0F71, 0x0F7E},
- {0x0F7F, 0x0F7F}, {0x0F80, 0x0F84}, {0x0F85, 0x0F85},
- {0x0F86, 0x0F87}, {0x0F88, 0x0F8C}, {0x0F8D, 0x0F97},
- {0x0F99, 0x0FBC}, {0x0FBE, 0x0FC5}, {0x0FC6, 0x0FC6},
- {0x0FC7, 0x0FCC}, {0x0FCE, 0x0FCF}, {0x0FD0, 0x0FD4},
- {0x0FD5, 0x0FD8}, {0x0FD9, 0x0FDA}, {0x1000, 0x102A},
- {0x102B, 0x102C}, {0x102D, 0x1030}, {0x1031, 0x1031},
- {0x1032, 0x1037}, {0x1038, 0x1038}, {0x1039, 0x103A},
- {0x103B, 0x103C}, {0x103D, 0x103E}, {0x103F, 0x103F},
- {0x1040, 0x1049}, {0x104A, 0x104F}, {0x1050, 0x1055},
- {0x1056, 0x1057}, {0x1058, 0x1059}, {0x105A, 0x105D},
- {0x105E, 0x1060}, {0x1061, 0x1061}, {0x1062, 0x1064},
- {0x1065, 0x1066}, {0x1067, 0x106D}, {0x106E, 0x1070},
- {0x1071, 0x1074}, {0x1075, 0x1081}, {0x1082, 0x1082},
- {0x1083, 0x1084}, {0x1085, 0x1086}, {0x1087, 0x108C},
- {0x108D, 0x108D}, {0x108E, 0x108E}, {0x108F, 0x108F},
- {0x1090, 0x1099}, {0x109A, 0x109C}, {0x109D, 0x109D},
- {0x109E, 0x109F}, {0x10A0, 0x10C5}, {0x10C7, 0x10C7},
- {0x10CD, 0x10CD}, {0x10D0, 0x10FA}, {0x10FB, 0x10FB},
- {0x10FC, 0x10FC}, {0x10FD, 0x10FF}, {0x1160, 0x11FF},
- {0x1200, 0x1248}, {0x124A, 0x124D}, {0x1250, 0x1256},
- {0x1258, 0x1258}, {0x125A, 0x125D}, {0x1260, 0x1288},
- {0x128A, 0x128D}, {0x1290, 0x12B0}, {0x12B2, 0x12B5},
- {0x12B8, 0x12BE}, {0x12C0, 0x12C0}, {0x12C2, 0x12C5},
- {0x12C8, 0x12D6}, {0x12D8, 0x1310}, {0x1312, 0x1315},
- {0x1318, 0x135A}, {0x135D, 0x135F}, {0x1360, 0x1368},
- {0x1369, 0x137C}, {0x1380, 0x138F}, {0x1390, 0x1399},
- {0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x1400},
- {0x1401, 0x166C}, {0x166D, 0x166E}, {0x166F, 0x167F},
- {0x1680, 0x1680}, {0x1681, 0x169A}, {0x169B, 0x169B},
- {0x169C, 0x169C}, {0x16A0, 0x16EA}, {0x16EB, 0x16ED},
- {0x16EE, 0x16F0}, {0x16F1, 0x16F8}, {0x1700, 0x170C},
- {0x170E, 0x1711}, {0x1712, 0x1714}, {0x1720, 0x1731},
- {0x1732, 0x1734}, {0x1735, 0x1736}, {0x1740, 0x1751},
- {0x1752, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770},
- {0x1772, 0x1773}, {0x1780, 0x17B3}, {0x17B4, 0x17B5},
- {0x17B6, 0x17B6}, {0x17B7, 0x17BD}, {0x17BE, 0x17C5},
- {0x17C6, 0x17C6}, {0x17C7, 0x17C8}, {0x17C9, 0x17D3},
- {0x17D4, 0x17D6}, {0x17D7, 0x17D7}, {0x17D8, 0x17DA},
- {0x17DB, 0x17DB}, {0x17DC, 0x17DC}, {0x17DD, 0x17DD},
- {0x17E0, 0x17E9}, {0x17F0, 0x17F9}, {0x1800, 0x1805},
- {0x1806, 0x1806}, {0x1807, 0x180A}, {0x180B, 0x180D},
- {0x180E, 0x180E}, {0x1810, 0x1819}, {0x1820, 0x1842},
- {0x1843, 0x1843}, {0x1844, 0x1877}, {0x1880, 0x1884},
- {0x1885, 0x1886}, {0x1887, 0x18A8}, {0x18A9, 0x18A9},
- {0x18AA, 0x18AA}, {0x18B0, 0x18F5}, {0x1900, 0x191E},
- {0x1920, 0x1922}, {0x1923, 0x1926}, {0x1927, 0x1928},
- {0x1929, 0x192B}, {0x1930, 0x1931}, {0x1932, 0x1932},
- {0x1933, 0x1938}, {0x1939, 0x193B}, {0x1940, 0x1940},
- {0x1944, 0x1945}, {0x1946, 0x194F}, {0x1950, 0x196D},
- {0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9},
- {0x19D0, 0x19D9}, {0x19DA, 0x19DA}, {0x19DE, 0x19DF},
- {0x19E0, 0x19FF}, {0x1A00, 0x1A16}, {0x1A17, 0x1A18},
- {0x1A19, 0x1A1A}, {0x1A1B, 0x1A1B}, {0x1A1E, 0x1A1F},
- {0x1A20, 0x1A54}, {0x1A55, 0x1A55}, {0x1A56, 0x1A56},
- {0x1A57, 0x1A57}, {0x1A58, 0x1A5E}, {0x1A60, 0x1A60},
- {0x1A61, 0x1A61}, {0x1A62, 0x1A62}, {0x1A63, 0x1A64},
- {0x1A65, 0x1A6C}, {0x1A6D, 0x1A72}, {0x1A73, 0x1A7C},
- {0x1A7F, 0x1A7F}, {0x1A80, 0x1A89}, {0x1A90, 0x1A99},
- {0x1AA0, 0x1AA6}, {0x1AA7, 0x1AA7}, {0x1AA8, 0x1AAD},
- {0x1AB0, 0x1ABD}, {0x1ABE, 0x1ABE}, {0x1B00, 0x1B03},
- {0x1B04, 0x1B04}, {0x1B05, 0x1B33}, {0x1B34, 0x1B34},
- {0x1B35, 0x1B35}, {0x1B36, 0x1B3A}, {0x1B3B, 0x1B3B},
- {0x1B3C, 0x1B3C}, {0x1B3D, 0x1B41}, {0x1B42, 0x1B42},
- {0x1B43, 0x1B44}, {0x1B45, 0x1B4B}, {0x1B50, 0x1B59},
- {0x1B5A, 0x1B60}, {0x1B61, 0x1B6A}, {0x1B6B, 0x1B73},
- {0x1B74, 0x1B7C}, {0x1B80, 0x1B81}, {0x1B82, 0x1B82},
- {0x1B83, 0x1BA0}, {0x1BA1, 0x1BA1}, {0x1BA2, 0x1BA5},
- {0x1BA6, 0x1BA7}, {0x1BA8, 0x1BA9}, {0x1BAA, 0x1BAA},
- {0x1BAB, 0x1BAD}, {0x1BAE, 0x1BAF}, {0x1BB0, 0x1BB9},
- {0x1BBA, 0x1BBF}, {0x1BC0, 0x1BE5}, {0x1BE6, 0x1BE6},
- {0x1BE7, 0x1BE7}, {0x1BE8, 0x1BE9}, {0x1BEA, 0x1BEC},
- {0x1BED, 0x1BED}, {0x1BEE, 0x1BEE}, {0x1BEF, 0x1BF1},
- {0x1BF2, 0x1BF3}, {0x1BFC, 0x1BFF}, {0x1C00, 0x1C23},
- {0x1C24, 0x1C2B}, {0x1C2C, 0x1C33}, {0x1C34, 0x1C35},
- {0x1C36, 0x1C37}, {0x1C3B, 0x1C3F}, {0x1C40, 0x1C49},
- {0x1C4D, 0x1C4F}, {0x1C50, 0x1C59}, {0x1C5A, 0x1C77},
- {0x1C78, 0x1C7D}, {0x1C7E, 0x1C7F}, {0x1C80, 0x1C88},
- {0x1CC0, 0x1CC7}, {0x1CD0, 0x1CD2}, {0x1CD3, 0x1CD3},
- {0x1CD4, 0x1CE0}, {0x1CE1, 0x1CE1}, {0x1CE2, 0x1CE8},
- {0x1CE9, 0x1CEC}, {0x1CED, 0x1CED}, {0x1CEE, 0x1CF1},
- {0x1CF2, 0x1CF3}, {0x1CF4, 0x1CF4}, {0x1CF5, 0x1CF6},
- {0x1CF8, 0x1CF9}, {0x1D00, 0x1D2B}, {0x1D2C, 0x1D6A},
- {0x1D6B, 0x1D77}, {0x1D78, 0x1D78}, {0x1D79, 0x1D7F},
- {0x1D80, 0x1D9A}, {0x1D9B, 0x1DBF}, {0x1DC0, 0x1DF5},
- {0x1DFB, 0x1DFF}, {0x1E00, 0x1EFF}, {0x1F00, 0x1F15},
- {0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D},
- {0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B},
- {0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4},
- {0x1FB6, 0x1FBC}, {0x1FBD, 0x1FBD}, {0x1FBE, 0x1FBE},
- {0x1FBF, 0x1FC1}, {0x1FC2, 0x1FC4}, {0x1FC6, 0x1FCC},
- {0x1FCD, 0x1FCF}, {0x1FD0, 0x1FD3}, {0x1FD6, 0x1FDB},
- {0x1FDD, 0x1FDF}, {0x1FE0, 0x1FEC}, {0x1FED, 0x1FEF},
- {0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFC}, {0x1FFD, 0x1FFE},
- {0x2000, 0x200A}, {0x200B, 0x200F}, {0x2011, 0x2012},
- {0x2017, 0x2017}, {0x201A, 0x201A}, {0x201B, 0x201B},
- {0x201E, 0x201E}, {0x201F, 0x201F}, {0x2023, 0x2023},
- {0x2028, 0x2028}, {0x2029, 0x2029}, {0x202A, 0x202E},
- {0x202F, 0x202F}, {0x2031, 0x2031}, {0x2034, 0x2034},
- {0x2036, 0x2038}, {0x2039, 0x2039}, {0x203A, 0x203A},
- {0x203C, 0x203D}, {0x203F, 0x2040}, {0x2041, 0x2043},
- {0x2044, 0x2044}, {0x2045, 0x2045}, {0x2046, 0x2046},
- {0x2047, 0x2051}, {0x2052, 0x2052}, {0x2053, 0x2053},
- {0x2054, 0x2054}, {0x2055, 0x205E}, {0x205F, 0x205F},
- {0x2060, 0x2064}, {0x2066, 0x206F}, {0x2070, 0x2070},
- {0x2071, 0x2071}, {0x2075, 0x2079}, {0x207A, 0x207C},
- {0x207D, 0x207D}, {0x207E, 0x207E}, {0x2080, 0x2080},
- {0x2085, 0x2089}, {0x208A, 0x208C}, {0x208D, 0x208D},
- {0x208E, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8},
- {0x20AA, 0x20AB}, {0x20AD, 0x20BE}, {0x20D0, 0x20DC},
- {0x20DD, 0x20E0}, {0x20E1, 0x20E1}, {0x20E2, 0x20E4},
- {0x20E5, 0x20F0}, {0x2100, 0x2101}, {0x2102, 0x2102},
- {0x2104, 0x2104}, {0x2106, 0x2106}, {0x2107, 0x2107},
- {0x2108, 0x2108}, {0x210A, 0x2112}, {0x2114, 0x2114},
- {0x2115, 0x2115}, {0x2117, 0x2117}, {0x2118, 0x2118},
- {0x2119, 0x211D}, {0x211E, 0x2120}, {0x2123, 0x2123},
- {0x2124, 0x2124}, {0x2125, 0x2125}, {0x2127, 0x2127},
- {0x2128, 0x2128}, {0x2129, 0x2129}, {0x212A, 0x212A},
- {0x212C, 0x212D}, {0x212E, 0x212E}, {0x212F, 0x2134},
- {0x2135, 0x2138}, {0x2139, 0x2139}, {0x213A, 0x213B},
- {0x213C, 0x213F}, {0x2140, 0x2144}, {0x2145, 0x2149},
- {0x214A, 0x214A}, {0x214B, 0x214B}, {0x214C, 0x214D},
- {0x214E, 0x214E}, {0x214F, 0x214F}, {0x2150, 0x2152},
- {0x2155, 0x215A}, {0x215F, 0x215F}, {0x216C, 0x216F},
- {0x217A, 0x2182}, {0x2183, 0x2184}, {0x2185, 0x2188},
- {0x218A, 0x218B}, {0x219A, 0x219B}, {0x219C, 0x219F},
- {0x21A0, 0x21A0}, {0x21A1, 0x21A2}, {0x21A3, 0x21A3},
- {0x21A4, 0x21A5}, {0x21A6, 0x21A6}, {0x21A7, 0x21AD},
- {0x21AE, 0x21AE}, {0x21AF, 0x21B7}, {0x21BA, 0x21CD},
- {0x21CE, 0x21CF}, {0x21D0, 0x21D1}, {0x21D3, 0x21D3},
- {0x21D5, 0x21E6}, {0x21E8, 0x21F3}, {0x21F4, 0x21FF},
- {0x2201, 0x2201}, {0x2204, 0x2206}, {0x2209, 0x220A},
- {0x220C, 0x220E}, {0x2210, 0x2210}, {0x2212, 0x2214},
- {0x2216, 0x2219}, {0x221B, 0x221C}, {0x2221, 0x2222},
- {0x2224, 0x2224}, {0x2226, 0x2226}, {0x222D, 0x222D},
- {0x222F, 0x2233}, {0x2238, 0x223B}, {0x223E, 0x2247},
- {0x2249, 0x224B}, {0x224D, 0x2251}, {0x2253, 0x225F},
- {0x2262, 0x2263}, {0x2268, 0x2269}, {0x226C, 0x226D},
- {0x2270, 0x2281}, {0x2284, 0x2285}, {0x2288, 0x2294},
- {0x2296, 0x2298}, {0x229A, 0x22A4}, {0x22A6, 0x22BE},
- {0x22C0, 0x22FF}, {0x2300, 0x2307}, {0x2308, 0x2308},
- {0x2309, 0x2309}, {0x230A, 0x230A}, {0x230B, 0x230B},
- {0x230C, 0x2311}, {0x2313, 0x2319}, {0x231C, 0x231F},
- {0x2320, 0x2321}, {0x2322, 0x2328}, {0x232B, 0x237B},
- {0x237C, 0x237C}, {0x237D, 0x239A}, {0x239B, 0x23B3},
- {0x23B4, 0x23DB}, {0x23DC, 0x23E1}, {0x23E2, 0x23E8},
- {0x23ED, 0x23EF}, {0x23F1, 0x23F2}, {0x23F4, 0x23FE},
- {0x2400, 0x2426}, {0x2440, 0x244A}, {0x24EA, 0x24EA},
- {0x254C, 0x254F}, {0x2574, 0x257F}, {0x2590, 0x2591},
- {0x2596, 0x259F}, {0x25A2, 0x25A2}, {0x25AA, 0x25B1},
- {0x25B4, 0x25B5}, {0x25B8, 0x25BB}, {0x25BE, 0x25BF},
- {0x25C2, 0x25C5}, {0x25C9, 0x25CA}, {0x25CC, 0x25CD},
- {0x25D2, 0x25E1}, {0x25E6, 0x25EE}, {0x25F0, 0x25F7},
- {0x25F8, 0x25FC}, {0x25FF, 0x25FF}, {0x2600, 0x2604},
- {0x2607, 0x2608}, {0x260A, 0x260D}, {0x2610, 0x2613},
- {0x2616, 0x261B}, {0x261D, 0x261D}, {0x261F, 0x263F},
- {0x2641, 0x2641}, {0x2643, 0x2647}, {0x2654, 0x265F},
- {0x2662, 0x2662}, {0x2666, 0x2666}, {0x266B, 0x266B},
- {0x266E, 0x266E}, {0x2670, 0x267E}, {0x2680, 0x2692},
- {0x2694, 0x269D}, {0x26A0, 0x26A0}, {0x26A2, 0x26A9},
- {0x26AC, 0x26BC}, {0x26C0, 0x26C3}, {0x26E2, 0x26E2},
- {0x26E4, 0x26E7}, {0x2700, 0x2704}, {0x2706, 0x2709},
- {0x270C, 0x2727}, {0x2729, 0x273C}, {0x273E, 0x274B},
- {0x274D, 0x274D}, {0x274F, 0x2752}, {0x2756, 0x2756},
- {0x2758, 0x2767}, {0x2768, 0x2768}, {0x2769, 0x2769},
- {0x276A, 0x276A}, {0x276B, 0x276B}, {0x276C, 0x276C},
- {0x276D, 0x276D}, {0x276E, 0x276E}, {0x276F, 0x276F},
- {0x2770, 0x2770}, {0x2771, 0x2771}, {0x2772, 0x2772},
- {0x2773, 0x2773}, {0x2774, 0x2774}, {0x2775, 0x2775},
- {0x2780, 0x2793}, {0x2794, 0x2794}, {0x2798, 0x27AF},
- {0x27B1, 0x27BE}, {0x27C0, 0x27C4}, {0x27C5, 0x27C5},
- {0x27C6, 0x27C6}, {0x27C7, 0x27E5}, {0x27EE, 0x27EE},
- {0x27EF, 0x27EF}, {0x27F0, 0x27FF}, {0x2800, 0x28FF},
- {0x2900, 0x297F}, {0x2980, 0x2982}, {0x2983, 0x2983},
- {0x2984, 0x2984}, {0x2987, 0x2987}, {0x2988, 0x2988},
- {0x2989, 0x2989}, {0x298A, 0x298A}, {0x298B, 0x298B},
- {0x298C, 0x298C}, {0x298D, 0x298D}, {0x298E, 0x298E},
- {0x298F, 0x298F}, {0x2990, 0x2990}, {0x2991, 0x2991},
- {0x2992, 0x2992}, {0x2993, 0x2993}, {0x2994, 0x2994},
- {0x2995, 0x2995}, {0x2996, 0x2996}, {0x2997, 0x2997},
- {0x2998, 0x2998}, {0x2999, 0x29D7}, {0x29D8, 0x29D8},
- {0x29D9, 0x29D9}, {0x29DA, 0x29DA}, {0x29DB, 0x29DB},
- {0x29DC, 0x29FB}, {0x29FC, 0x29FC}, {0x29FD, 0x29FD},
- {0x29FE, 0x29FF}, {0x2A00, 0x2AFF}, {0x2B00, 0x2B1A},
- {0x2B1D, 0x2B2F}, {0x2B30, 0x2B44}, {0x2B45, 0x2B46},
- {0x2B47, 0x2B4C}, {0x2B4D, 0x2B4F}, {0x2B51, 0x2B54},
- {0x2B5A, 0x2B73}, {0x2B76, 0x2B95}, {0x2B98, 0x2BB9},
- {0x2BBD, 0x2BC8}, {0x2BCA, 0x2BD1}, {0x2BEC, 0x2BEF},
- {0x2C00, 0x2C2E}, {0x2C30, 0x2C5E}, {0x2C60, 0x2C7B},
- {0x2C7C, 0x2C7D}, {0x2C7E, 0x2C7F}, {0x2C80, 0x2CE4},
- {0x2CE5, 0x2CEA}, {0x2CEB, 0x2CEE}, {0x2CEF, 0x2CF1},
- {0x2CF2, 0x2CF3}, {0x2CF9, 0x2CFC}, {0x2CFD, 0x2CFD},
- {0x2CFE, 0x2CFF}, {0x2D00, 0x2D25}, {0x2D27, 0x2D27},
- {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D6F},
- {0x2D70, 0x2D70}, {0x2D7F, 0x2D7F}, {0x2D80, 0x2D96},
- {0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6},
- {0x2DB8, 0x2DBE}, {0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE},
- {0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, {0x2DE0, 0x2DFF},
- {0x2E00, 0x2E01}, {0x2E02, 0x2E02}, {0x2E03, 0x2E03},
- {0x2E04, 0x2E04}, {0x2E05, 0x2E05}, {0x2E06, 0x2E08},
- {0x2E09, 0x2E09}, {0x2E0A, 0x2E0A}, {0x2E0B, 0x2E0B},
- {0x2E0C, 0x2E0C}, {0x2E0D, 0x2E0D}, {0x2E0E, 0x2E16},
- {0x2E17, 0x2E17}, {0x2E18, 0x2E19}, {0x2E1A, 0x2E1A},
- {0x2E1B, 0x2E1B}, {0x2E1C, 0x2E1C}, {0x2E1D, 0x2E1D},
- {0x2E1E, 0x2E1F}, {0x2E20, 0x2E20}, {0x2E21, 0x2E21},
- {0x2E22, 0x2E22}, {0x2E23, 0x2E23}, {0x2E24, 0x2E24},
- {0x2E25, 0x2E25}, {0x2E26, 0x2E26}, {0x2E27, 0x2E27},
- {0x2E28, 0x2E28}, {0x2E29, 0x2E29}, {0x2E2A, 0x2E2E},
- {0x2E2F, 0x2E2F}, {0x2E30, 0x2E39}, {0x2E3A, 0x2E3B},
- {0x2E3C, 0x2E3F}, {0x2E40, 0x2E40}, {0x2E41, 0x2E41},
- {0x2E42, 0x2E42}, {0x2E43, 0x2E44}, {0x303F, 0x303F},
- {0x4DC0, 0x4DFF}, {0xA4D0, 0xA4F7}, {0xA4F8, 0xA4FD},
- {0xA4FE, 0xA4FF}, {0xA500, 0xA60B}, {0xA60C, 0xA60C},
- {0xA60D, 0xA60F}, {0xA610, 0xA61F}, {0xA620, 0xA629},
- {0xA62A, 0xA62B}, {0xA640, 0xA66D}, {0xA66E, 0xA66E},
- {0xA66F, 0xA66F}, {0xA670, 0xA672}, {0xA673, 0xA673},
- {0xA674, 0xA67D}, {0xA67E, 0xA67E}, {0xA67F, 0xA67F},
- {0xA680, 0xA69B}, {0xA69C, 0xA69D}, {0xA69E, 0xA69F},
- {0xA6A0, 0xA6E5}, {0xA6E6, 0xA6EF}, {0xA6F0, 0xA6F1},
- {0xA6F2, 0xA6F7}, {0xA700, 0xA716}, {0xA717, 0xA71F},
- {0xA720, 0xA721}, {0xA722, 0xA76F}, {0xA770, 0xA770},
- {0xA771, 0xA787}, {0xA788, 0xA788}, {0xA789, 0xA78A},
- {0xA78B, 0xA78E}, {0xA78F, 0xA78F}, {0xA790, 0xA7AE},
- {0xA7B0, 0xA7B7}, {0xA7F7, 0xA7F7}, {0xA7F8, 0xA7F9},
- {0xA7FA, 0xA7FA}, {0xA7FB, 0xA7FF}, {0xA800, 0xA801},
- {0xA802, 0xA802}, {0xA803, 0xA805}, {0xA806, 0xA806},
- {0xA807, 0xA80A}, {0xA80B, 0xA80B}, {0xA80C, 0xA822},
- {0xA823, 0xA824}, {0xA825, 0xA826}, {0xA827, 0xA827},
- {0xA828, 0xA82B}, {0xA830, 0xA835}, {0xA836, 0xA837},
- {0xA838, 0xA838}, {0xA839, 0xA839}, {0xA840, 0xA873},
- {0xA874, 0xA877}, {0xA880, 0xA881}, {0xA882, 0xA8B3},
- {0xA8B4, 0xA8C3}, {0xA8C4, 0xA8C5}, {0xA8CE, 0xA8CF},
- {0xA8D0, 0xA8D9}, {0xA8E0, 0xA8F1}, {0xA8F2, 0xA8F7},
- {0xA8F8, 0xA8FA}, {0xA8FB, 0xA8FB}, {0xA8FC, 0xA8FC},
- {0xA8FD, 0xA8FD}, {0xA900, 0xA909}, {0xA90A, 0xA925},
- {0xA926, 0xA92D}, {0xA92E, 0xA92F}, {0xA930, 0xA946},
- {0xA947, 0xA951}, {0xA952, 0xA953}, {0xA95F, 0xA95F},
- {0xA980, 0xA982}, {0xA983, 0xA983}, {0xA984, 0xA9B2},
- {0xA9B3, 0xA9B3}, {0xA9B4, 0xA9B5}, {0xA9B6, 0xA9B9},
- {0xA9BA, 0xA9BB}, {0xA9BC, 0xA9BC}, {0xA9BD, 0xA9C0},
- {0xA9C1, 0xA9CD}, {0xA9CF, 0xA9CF}, {0xA9D0, 0xA9D9},
- {0xA9DE, 0xA9DF}, {0xA9E0, 0xA9E4}, {0xA9E5, 0xA9E5},
- {0xA9E6, 0xA9E6}, {0xA9E7, 0xA9EF}, {0xA9F0, 0xA9F9},
- {0xA9FA, 0xA9FE}, {0xAA00, 0xAA28}, {0xAA29, 0xAA2E},
- {0xAA2F, 0xAA30}, {0xAA31, 0xAA32}, {0xAA33, 0xAA34},
- {0xAA35, 0xAA36}, {0xAA40, 0xAA42}, {0xAA43, 0xAA43},
- {0xAA44, 0xAA4B}, {0xAA4C, 0xAA4C}, {0xAA4D, 0xAA4D},
- {0xAA50, 0xAA59}, {0xAA5C, 0xAA5F}, {0xAA60, 0xAA6F},
- {0xAA70, 0xAA70}, {0xAA71, 0xAA76}, {0xAA77, 0xAA79},
- {0xAA7A, 0xAA7A}, {0xAA7B, 0xAA7B}, {0xAA7C, 0xAA7C},
- {0xAA7D, 0xAA7D}, {0xAA7E, 0xAA7F}, {0xAA80, 0xAAAF},
- {0xAAB0, 0xAAB0}, {0xAAB1, 0xAAB1}, {0xAAB2, 0xAAB4},
- {0xAAB5, 0xAAB6}, {0xAAB7, 0xAAB8}, {0xAAB9, 0xAABD},
- {0xAABE, 0xAABF}, {0xAAC0, 0xAAC0}, {0xAAC1, 0xAAC1},
- {0xAAC2, 0xAAC2}, {0xAADB, 0xAADC}, {0xAADD, 0xAADD},
- {0xAADE, 0xAADF}, {0xAAE0, 0xAAEA}, {0xAAEB, 0xAAEB},
- {0xAAEC, 0xAAED}, {0xAAEE, 0xAAEF}, {0xAAF0, 0xAAF1},
- {0xAAF2, 0xAAF2}, {0xAAF3, 0xAAF4}, {0xAAF5, 0xAAF5},
- {0xAAF6, 0xAAF6}, {0xAB01, 0xAB06}, {0xAB09, 0xAB0E},
- {0xAB11, 0xAB16}, {0xAB20, 0xAB26}, {0xAB28, 0xAB2E},
- {0xAB30, 0xAB5A}, {0xAB5B, 0xAB5B}, {0xAB5C, 0xAB5F},
- {0xAB60, 0xAB65}, {0xAB70, 0xABBF}, {0xABC0, 0xABE2},
- {0xABE3, 0xABE4}, {0xABE5, 0xABE5}, {0xABE6, 0xABE7},
- {0xABE8, 0xABE8}, {0xABE9, 0xABEA}, {0xABEB, 0xABEB},
- {0xABEC, 0xABEC}, {0xABED, 0xABED}, {0xABF0, 0xABF9},
- {0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDB7F},
- {0xDB80, 0xDBFF}, {0xDC00, 0xDFFF}, {0xFB00, 0xFB06},
- {0xFB13, 0xFB17}, {0xFB1D, 0xFB1D}, {0xFB1E, 0xFB1E},
- {0xFB1F, 0xFB28}, {0xFB29, 0xFB29}, {0xFB2A, 0xFB36},
- {0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41},
- {0xFB43, 0xFB44}, {0xFB46, 0xFB4F}, {0xFB50, 0xFBB1},
- {0xFBB2, 0xFBC1}, {0xFBD3, 0xFD3D}, {0xFD3E, 0xFD3E},
- {0xFD3F, 0xFD3F}, {0xFD50, 0xFD8F}, {0xFD92, 0xFDC7},
- {0xFDF0, 0xFDFB}, {0xFDFC, 0xFDFC}, {0xFDFD, 0xFDFD},
- {0xFE20, 0xFE2F}, {0xFE70, 0xFE74}, {0xFE76, 0xFEFC},
- {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFC, 0xFFFC},
- {0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A},
- {0x1003C, 0x1003D}, {0x1003F, 0x1004D}, {0x10050, 0x1005D},
- {0x10080, 0x100FA}, {0x10100, 0x10102}, {0x10107, 0x10133},
- {0x10137, 0x1013F}, {0x10140, 0x10174}, {0x10175, 0x10178},
- {0x10179, 0x10189}, {0x1018A, 0x1018B}, {0x1018C, 0x1018E},
- {0x10190, 0x1019B}, {0x101A0, 0x101A0}, {0x101D0, 0x101FC},
- {0x101FD, 0x101FD}, {0x10280, 0x1029C}, {0x102A0, 0x102D0},
- {0x102E0, 0x102E0}, {0x102E1, 0x102FB}, {0x10300, 0x1031F},
- {0x10320, 0x10323}, {0x10330, 0x10340}, {0x10341, 0x10341},
- {0x10342, 0x10349}, {0x1034A, 0x1034A}, {0x10350, 0x10375},
- {0x10376, 0x1037A}, {0x10380, 0x1039D}, {0x1039F, 0x1039F},
- {0x103A0, 0x103C3}, {0x103C8, 0x103CF}, {0x103D0, 0x103D0},
- {0x103D1, 0x103D5}, {0x10400, 0x1044F}, {0x10450, 0x1047F},
- {0x10480, 0x1049D}, {0x104A0, 0x104A9}, {0x104B0, 0x104D3},
- {0x104D8, 0x104FB}, {0x10500, 0x10527}, {0x10530, 0x10563},
- {0x1056F, 0x1056F}, {0x10600, 0x10736}, {0x10740, 0x10755},
- {0x10760, 0x10767}, {0x10800, 0x10805}, {0x10808, 0x10808},
- {0x1080A, 0x10835}, {0x10837, 0x10838}, {0x1083C, 0x1083C},
- {0x1083F, 0x1083F}, {0x10840, 0x10855}, {0x10857, 0x10857},
- {0x10858, 0x1085F}, {0x10860, 0x10876}, {0x10877, 0x10878},
- {0x10879, 0x1087F}, {0x10880, 0x1089E}, {0x108A7, 0x108AF},
- {0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x108FF},
- {0x10900, 0x10915}, {0x10916, 0x1091B}, {0x1091F, 0x1091F},
- {0x10920, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x1099F},
- {0x109A0, 0x109B7}, {0x109BC, 0x109BD}, {0x109BE, 0x109BF},
- {0x109C0, 0x109CF}, {0x109D2, 0x109FF}, {0x10A00, 0x10A00},
- {0x10A01, 0x10A03}, {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F},
- {0x10A10, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A33},
- {0x10A38, 0x10A3A}, {0x10A3F, 0x10A3F}, {0x10A40, 0x10A47},
- {0x10A50, 0x10A58}, {0x10A60, 0x10A7C}, {0x10A7D, 0x10A7E},
- {0x10A7F, 0x10A7F}, {0x10A80, 0x10A9C}, {0x10A9D, 0x10A9F},
- {0x10AC0, 0x10AC7}, {0x10AC8, 0x10AC8}, {0x10AC9, 0x10AE4},
- {0x10AE5, 0x10AE6}, {0x10AEB, 0x10AEF}, {0x10AF0, 0x10AF6},
- {0x10B00, 0x10B35}, {0x10B39, 0x10B3F}, {0x10B40, 0x10B55},
- {0x10B58, 0x10B5F}, {0x10B60, 0x10B72}, {0x10B78, 0x10B7F},
- {0x10B80, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF},
- {0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2},
- {0x10CFA, 0x10CFF}, {0x10E60, 0x10E7E}, {0x11000, 0x11000},
- {0x11001, 0x11001}, {0x11002, 0x11002}, {0x11003, 0x11037},
- {0x11038, 0x11046}, {0x11047, 0x1104D}, {0x11052, 0x11065},
- {0x11066, 0x1106F}, {0x1107F, 0x1107F}, {0x11080, 0x11081},
- {0x11082, 0x11082}, {0x11083, 0x110AF}, {0x110B0, 0x110B2},
- {0x110B3, 0x110B6}, {0x110B7, 0x110B8}, {0x110B9, 0x110BA},
- {0x110BB, 0x110BC}, {0x110BD, 0x110BD}, {0x110BE, 0x110C1},
- {0x110D0, 0x110E8}, {0x110F0, 0x110F9}, {0x11100, 0x11102},
- {0x11103, 0x11126}, {0x11127, 0x1112B}, {0x1112C, 0x1112C},
- {0x1112D, 0x11134}, {0x11136, 0x1113F}, {0x11140, 0x11143},
- {0x11150, 0x11172}, {0x11173, 0x11173}, {0x11174, 0x11175},
- {0x11176, 0x11176}, {0x11180, 0x11181}, {0x11182, 0x11182},
- {0x11183, 0x111B2}, {0x111B3, 0x111B5}, {0x111B6, 0x111BE},
- {0x111BF, 0x111C0}, {0x111C1, 0x111C4}, {0x111C5, 0x111C9},
- {0x111CA, 0x111CC}, {0x111CD, 0x111CD}, {0x111D0, 0x111D9},
- {0x111DA, 0x111DA}, {0x111DB, 0x111DB}, {0x111DC, 0x111DC},
- {0x111DD, 0x111DF}, {0x111E1, 0x111F4}, {0x11200, 0x11211},
- {0x11213, 0x1122B}, {0x1122C, 0x1122E}, {0x1122F, 0x11231},
- {0x11232, 0x11233}, {0x11234, 0x11234}, {0x11235, 0x11235},
- {0x11236, 0x11237}, {0x11238, 0x1123D}, {0x1123E, 0x1123E},
- {0x11280, 0x11286}, {0x11288, 0x11288}, {0x1128A, 0x1128D},
- {0x1128F, 0x1129D}, {0x1129F, 0x112A8}, {0x112A9, 0x112A9},
- {0x112B0, 0x112DE}, {0x112DF, 0x112DF}, {0x112E0, 0x112E2},
- {0x112E3, 0x112EA}, {0x112F0, 0x112F9}, {0x11300, 0x11301},
- {0x11302, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310},
- {0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333},
- {0x11335, 0x11339}, {0x1133C, 0x1133C}, {0x1133D, 0x1133D},
- {0x1133E, 0x1133F}, {0x11340, 0x11340}, {0x11341, 0x11344},
- {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11350, 0x11350},
- {0x11357, 0x11357}, {0x1135D, 0x11361}, {0x11362, 0x11363},
- {0x11366, 0x1136C}, {0x11370, 0x11374}, {0x11400, 0x11434},
- {0x11435, 0x11437}, {0x11438, 0x1143F}, {0x11440, 0x11441},
- {0x11442, 0x11444}, {0x11445, 0x11445}, {0x11446, 0x11446},
- {0x11447, 0x1144A}, {0x1144B, 0x1144F}, {0x11450, 0x11459},
- {0x1145B, 0x1145B}, {0x1145D, 0x1145D}, {0x11480, 0x114AF},
- {0x114B0, 0x114B2}, {0x114B3, 0x114B8}, {0x114B9, 0x114B9},
- {0x114BA, 0x114BA}, {0x114BB, 0x114BE}, {0x114BF, 0x114C0},
- {0x114C1, 0x114C1}, {0x114C2, 0x114C3}, {0x114C4, 0x114C5},
- {0x114C6, 0x114C6}, {0x114C7, 0x114C7}, {0x114D0, 0x114D9},
- {0x11580, 0x115AE}, {0x115AF, 0x115B1}, {0x115B2, 0x115B5},
- {0x115B8, 0x115BB}, {0x115BC, 0x115BD}, {0x115BE, 0x115BE},
- {0x115BF, 0x115C0}, {0x115C1, 0x115D7}, {0x115D8, 0x115DB},
- {0x115DC, 0x115DD}, {0x11600, 0x1162F}, {0x11630, 0x11632},
- {0x11633, 0x1163A}, {0x1163B, 0x1163C}, {0x1163D, 0x1163D},
- {0x1163E, 0x1163E}, {0x1163F, 0x11640}, {0x11641, 0x11643},
- {0x11644, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166C},
- {0x11680, 0x116AA}, {0x116AB, 0x116AB}, {0x116AC, 0x116AC},
- {0x116AD, 0x116AD}, {0x116AE, 0x116AF}, {0x116B0, 0x116B5},
- {0x116B6, 0x116B6}, {0x116B7, 0x116B7}, {0x116C0, 0x116C9},
- {0x11700, 0x11719}, {0x1171D, 0x1171F}, {0x11720, 0x11721},
- {0x11722, 0x11725}, {0x11726, 0x11726}, {0x11727, 0x1172B},
- {0x11730, 0x11739}, {0x1173A, 0x1173B}, {0x1173C, 0x1173E},
- {0x1173F, 0x1173F}, {0x118A0, 0x118DF}, {0x118E0, 0x118E9},
- {0x118EA, 0x118F2}, {0x118FF, 0x118FF}, {0x11AC0, 0x11AF8},
- {0x11C00, 0x11C08}, {0x11C0A, 0x11C2E}, {0x11C2F, 0x11C2F},
- {0x11C30, 0x11C36}, {0x11C38, 0x11C3D}, {0x11C3E, 0x11C3E},
- {0x11C3F, 0x11C3F}, {0x11C40, 0x11C40}, {0x11C41, 0x11C45},
- {0x11C50, 0x11C59}, {0x11C5A, 0x11C6C}, {0x11C70, 0x11C71},
- {0x11C72, 0x11C8F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CA9},
- {0x11CAA, 0x11CB0}, {0x11CB1, 0x11CB1}, {0x11CB2, 0x11CB3},
- {0x11CB4, 0x11CB4}, {0x11CB5, 0x11CB6}, {0x12000, 0x12399},
- {0x12400, 0x1246E}, {0x12470, 0x12474}, {0x12480, 0x12543},
- {0x13000, 0x1342E}, {0x14400, 0x14646}, {0x16800, 0x16A38},
- {0x16A40, 0x16A5E}, {0x16A60, 0x16A69}, {0x16A6E, 0x16A6F},
- {0x16AD0, 0x16AED}, {0x16AF0, 0x16AF4}, {0x16AF5, 0x16AF5},
- {0x16B00, 0x16B2F}, {0x16B30, 0x16B36}, {0x16B37, 0x16B3B},
- {0x16B3C, 0x16B3F}, {0x16B40, 0x16B43}, {0x16B44, 0x16B44},
- {0x16B45, 0x16B45}, {0x16B50, 0x16B59}, {0x16B5B, 0x16B61},
- {0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, {0x16F00, 0x16F44},
- {0x16F50, 0x16F50}, {0x16F51, 0x16F7E}, {0x16F8F, 0x16F92},
- {0x16F93, 0x16F9F}, {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C},
- {0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BC9C},
- {0x1BC9D, 0x1BC9E}, {0x1BC9F, 0x1BC9F}, {0x1BCA0, 0x1BCA3},
- {0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D164},
- {0x1D165, 0x1D166}, {0x1D167, 0x1D169}, {0x1D16A, 0x1D16C},
- {0x1D16D, 0x1D172}, {0x1D173, 0x1D17A}, {0x1D17B, 0x1D182},
- {0x1D183, 0x1D184}, {0x1D185, 0x1D18B}, {0x1D18C, 0x1D1A9},
- {0x1D1AA, 0x1D1AD}, {0x1D1AE, 0x1D1E8}, {0x1D200, 0x1D241},
- {0x1D242, 0x1D244}, {0x1D245, 0x1D245}, {0x1D300, 0x1D356},
- {0x1D360, 0x1D371}, {0x1D400, 0x1D454}, {0x1D456, 0x1D49C},
- {0x1D49E, 0x1D49F}, {0x1D4A2, 0x1D4A2}, {0x1D4A5, 0x1D4A6},
- {0x1D4A9, 0x1D4AC}, {0x1D4AE, 0x1D4B9}, {0x1D4BB, 0x1D4BB},
- {0x1D4BD, 0x1D4C3}, {0x1D4C5, 0x1D505}, {0x1D507, 0x1D50A},
- {0x1D50D, 0x1D514}, {0x1D516, 0x1D51C}, {0x1D51E, 0x1D539},
- {0x1D53B, 0x1D53E}, {0x1D540, 0x1D544}, {0x1D546, 0x1D546},
- {0x1D54A, 0x1D550}, {0x1D552, 0x1D6A5}, {0x1D6A8, 0x1D6C0},
- {0x1D6C1, 0x1D6C1}, {0x1D6C2, 0x1D6DA}, {0x1D6DB, 0x1D6DB},
- {0x1D6DC, 0x1D6FA}, {0x1D6FB, 0x1D6FB}, {0x1D6FC, 0x1D714},
- {0x1D715, 0x1D715}, {0x1D716, 0x1D734}, {0x1D735, 0x1D735},
- {0x1D736, 0x1D74E}, {0x1D74F, 0x1D74F}, {0x1D750, 0x1D76E},
- {0x1D76F, 0x1D76F}, {0x1D770, 0x1D788}, {0x1D789, 0x1D789},
- {0x1D78A, 0x1D7A8}, {0x1D7A9, 0x1D7A9}, {0x1D7AA, 0x1D7C2},
- {0x1D7C3, 0x1D7C3}, {0x1D7C4, 0x1D7CB}, {0x1D7CE, 0x1D7FF},
- {0x1D800, 0x1D9FF}, {0x1DA00, 0x1DA36}, {0x1DA37, 0x1DA3A},
- {0x1DA3B, 0x1DA6C}, {0x1DA6D, 0x1DA74}, {0x1DA75, 0x1DA75},
- {0x1DA76, 0x1DA83}, {0x1DA84, 0x1DA84}, {0x1DA85, 0x1DA86},
- {0x1DA87, 0x1DA8B}, {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF},
- {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021},
- {0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E800, 0x1E8C4},
- {0x1E8C7, 0x1E8CF}, {0x1E8D0, 0x1E8D6}, {0x1E900, 0x1E943},
- {0x1E944, 0x1E94A}, {0x1E950, 0x1E959}, {0x1E95E, 0x1E95F},
- {0x1EE00, 0x1EE03}, {0x1EE05, 0x1EE1F}, {0x1EE21, 0x1EE22},
- {0x1EE24, 0x1EE24}, {0x1EE27, 0x1EE27}, {0x1EE29, 0x1EE32},
- {0x1EE34, 0x1EE37}, {0x1EE39, 0x1EE39}, {0x1EE3B, 0x1EE3B},
- {0x1EE42, 0x1EE42}, {0x1EE47, 0x1EE47}, {0x1EE49, 0x1EE49},
- {0x1EE4B, 0x1EE4B}, {0x1EE4D, 0x1EE4F}, {0x1EE51, 0x1EE52},
- {0x1EE54, 0x1EE54}, {0x1EE57, 0x1EE57}, {0x1EE59, 0x1EE59},
- {0x1EE5B, 0x1EE5B}, {0x1EE5D, 0x1EE5D}, {0x1EE5F, 0x1EE5F},
- {0x1EE61, 0x1EE62}, {0x1EE64, 0x1EE64}, {0x1EE67, 0x1EE6A},
- {0x1EE6C, 0x1EE72}, {0x1EE74, 0x1EE77}, {0x1EE79, 0x1EE7C},
- {0x1EE7E, 0x1EE7E}, {0x1EE80, 0x1EE89}, {0x1EE8B, 0x1EE9B},
- {0x1EEA1, 0x1EEA3}, {0x1EEA5, 0x1EEA9}, {0x1EEAB, 0x1EEBB},
- {0x1EEF0, 0x1EEF1}, {0x1F000, 0x1F003}, {0x1F005, 0x1F02B},
- {0x1F030, 0x1F093}, {0x1F0A0, 0x1F0AE}, {0x1F0B1, 0x1F0BF},
- {0x1F0C1, 0x1F0CE}, {0x1F0D1, 0x1F0F5}, {0x1F10B, 0x1F10C},
- {0x1F12E, 0x1F12E}, {0x1F16A, 0x1F16B}, {0x1F1E6, 0x1F1FF},
- {0x1F321, 0x1F32C}, {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D},
- {0x1F394, 0x1F39F}, {0x1F3CB, 0x1F3CE}, {0x1F3D4, 0x1F3DF},
- {0x1F3F1, 0x1F3F3}, {0x1F3F5, 0x1F3F7}, {0x1F43F, 0x1F43F},
- {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FE}, {0x1F53E, 0x1F54A},
- {0x1F54F, 0x1F54F}, {0x1F568, 0x1F579}, {0x1F57B, 0x1F594},
- {0x1F597, 0x1F5A3}, {0x1F5A5, 0x1F5FA}, {0x1F650, 0x1F67F},
- {0x1F6C6, 0x1F6CB}, {0x1F6CD, 0x1F6CF}, {0x1F6E0, 0x1F6EA},
- {0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F773}, {0x1F780, 0x1F7D4},
- {0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, {0x1F850, 0x1F859},
- {0x1F860, 0x1F887}, {0x1F890, 0x1F8AD}, {0xE0001, 0xE0001},
- {0xE0020, 0xE007F},
-}
-
-// Condition have flag EastAsianWidth whether the current locale is CJK or not.
-type Condition struct {
- EastAsianWidth bool
-}
-
-// NewCondition return new instance of Condition which is current locale.
-func NewCondition() *Condition {
- return &Condition{EastAsianWidth}
-}
-
-// RuneWidth returns the number of cells in r.
-// See http://www.unicode.org/reports/tr11/
-func (c *Condition) RuneWidth(r rune) int {
- switch {
- case r < 0 || r > 0x10FFFF ||
- inTables(r, nonprint, combining, notassigned):
- return 0
- case (c.EastAsianWidth && IsAmbiguousWidth(r)) ||
- inTables(r, doublewidth, emoji):
- return 2
- default:
- return 1
- }
-}
-
-// StringWidth return width as you can see
-func (c *Condition) StringWidth(s string) (width int) {
- for _, r := range []rune(s) {
- width += c.RuneWidth(r)
- }
- return width
-}
-
-// Truncate return string truncated with w cells
-func (c *Condition) Truncate(s string, w int, tail string) string {
- if c.StringWidth(s) <= w {
- return s
- }
- r := []rune(s)
- tw := c.StringWidth(tail)
- w -= tw
- width := 0
- i := 0
- for ; i < len(r); i++ {
- cw := c.RuneWidth(r[i])
- if width+cw > w {
- break
- }
- width += cw
- }
- return string(r[0:i]) + tail
-}
-
-// Wrap return string wrapped with w cells
-func (c *Condition) Wrap(s string, w int) string {
- width := 0
- out := ""
- for _, r := range []rune(s) {
- cw := RuneWidth(r)
- if r == '\n' {
- out += string(r)
- width = 0
- continue
- } else if width+cw > w {
- out += "\n"
- width = 0
- out += string(r)
- width += cw
- continue
- }
- out += string(r)
- width += cw
- }
- return out
-}
-
-// FillLeft return string filled in left by spaces in w cells
-func (c *Condition) FillLeft(s string, w int) string {
- width := c.StringWidth(s)
- count := w - width
- if count > 0 {
- b := make([]byte, count)
- for i := range b {
- b[i] = ' '
- }
- return string(b) + s
- }
- return s
-}
-
-// FillRight return string filled in left by spaces in w cells
-func (c *Condition) FillRight(s string, w int) string {
- width := c.StringWidth(s)
- count := w - width
- if count > 0 {
- b := make([]byte, count)
- for i := range b {
- b[i] = ' '
- }
- return s + string(b)
- }
- return s
-}
-
-// RuneWidth returns the number of cells in r.
-// See http://www.unicode.org/reports/tr11/
-func RuneWidth(r rune) int {
- return DefaultCondition.RuneWidth(r)
-}
-
-// IsAmbiguousWidth returns whether is ambiguous width or not.
-func IsAmbiguousWidth(r rune) bool {
- return inTables(r, private, ambiguous)
-}
-
-// IsNeutralWidth returns whether is neutral width or not.
-func IsNeutralWidth(r rune) bool {
- return inTable(r, neutral)
-}
-
-// StringWidth return width as you can see
-func StringWidth(s string) (width int) {
- return DefaultCondition.StringWidth(s)
-}
-
-// Truncate return string truncated with w cells
-func Truncate(s string, w int, tail string) string {
- return DefaultCondition.Truncate(s, w, tail)
-}
-
-// Wrap return string wrapped with w cells
-func Wrap(s string, w int) string {
- return DefaultCondition.Wrap(s, w)
-}
-
-// FillLeft return string filled in left by spaces in w cells
-func FillLeft(s string, w int) string {
- return DefaultCondition.FillLeft(s, w)
-}
-
-// FillRight return string filled in left by spaces in w cells
-func FillRight(s string, w int) string {
- return DefaultCondition.FillRight(s, w)
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_js.go b/vendor/github.com/mattn/go-runewidth/runewidth_js.go
deleted file mode 100644
index 0ce32c5e..00000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_js.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// +build js
-
-package runewidth
-
-func IsEastAsian() bool {
- // TODO: Implement this for the web. Detect east asian in a compatible way, and return true.
- return false
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go
deleted file mode 100644
index c579e9a3..00000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// +build !windows,!js
-
-package runewidth
-
-import (
- "os"
- "regexp"
- "strings"
-)
-
-var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`)
-
-var mblenTable = map[string]int{
- "utf-8": 6,
- "utf8": 6,
- "jis": 8,
- "eucjp": 3,
- "euckr": 2,
- "euccn": 2,
- "sjis": 2,
- "cp932": 2,
- "cp51932": 2,
- "cp936": 2,
- "cp949": 2,
- "cp950": 2,
- "big5": 2,
- "gbk": 2,
- "gb2312": 2,
-}
-
-func isEastAsian(locale string) bool {
- charset := strings.ToLower(locale)
- r := reLoc.FindStringSubmatch(locale)
- if len(r) == 2 {
- charset = strings.ToLower(r[1])
- }
-
- if strings.HasSuffix(charset, "@cjk_narrow") {
- return false
- }
-
- for pos, b := range []byte(charset) {
- if b == '@' {
- charset = charset[:pos]
- break
- }
- }
- max := 1
- if m, ok := mblenTable[charset]; ok {
- max = m
- }
- if max > 1 && (charset[0] != 'u' ||
- strings.HasPrefix(locale, "ja") ||
- strings.HasPrefix(locale, "ko") ||
- strings.HasPrefix(locale, "zh")) {
- return true
- }
- return false
-}
-
-// IsEastAsian return true if the current locale is CJK
-func IsEastAsian() bool {
- locale := os.Getenv("LC_CTYPE")
- if locale == "" {
- locale = os.Getenv("LANG")
- }
-
- // ignore C locale
- if locale == "POSIX" || locale == "C" {
- return false
- }
- if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') {
- return false
- }
-
- return isEastAsian(locale)
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_test.go b/vendor/github.com/mattn/go-runewidth/runewidth_test.go
deleted file mode 100644
index b0378a19..00000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_test.go
+++ /dev/null
@@ -1,275 +0,0 @@
-package runewidth
-
-import (
- "sort"
- "testing"
-)
-
-var _ sort.Interface = (*table)(nil)
-
-func (t table) Len() int {
- return len(t)
-}
-
-func (t table) Less(i, j int) bool {
- return t[i].first < t[j].first
-}
-
-func (t *table) Swap(i, j int) {
- (*t)[i], (*t)[j] = (*t)[j], (*t)[i]
-}
-
-var tables = []table{
- private,
- nonprint,
- combining,
- doublewidth,
- ambiguous,
- emoji,
- notassigned,
- neutral,
-}
-
-func TestSorted(t *testing.T) {
- for _, tbl := range tables {
- if !sort.IsSorted(&tbl) {
- t.Errorf("not sorted")
- }
- }
-}
-
-var runewidthtests = []struct {
- in rune
- out int
- eaout int
-}{
- {'世', 2, 2},
- {'界', 2, 2},
- {'セ', 1, 1},
- {'カ', 1, 1},
- {'イ', 1, 1},
- {'☆', 1, 2}, // double width in ambiguous
- {'\x00', 0, 0},
- {'\x01', 0, 0},
- {'\u0300', 0, 0},
-}
-
-func TestRuneWidth(t *testing.T) {
- c := NewCondition()
- for _, tt := range runewidthtests {
- if out := c.RuneWidth(tt.in); out != tt.out {
- t.Errorf("RuneWidth(%q) = %d, want %d", tt.in, out, tt.out)
- }
- }
- c.EastAsianWidth = true
- for _, tt := range runewidthtests {
- if out := c.RuneWidth(tt.in); out != tt.eaout {
- t.Errorf("RuneWidth(%q) = %d, want %d", tt.in, out, tt.eaout)
- }
- }
-}
-
-var isambiguouswidthtests = []struct {
- in rune
- out bool
-}{
- {'世', false},
- {'■', true},
- {'界', false},
- {'○', true},
- {'㈱', false},
- {'①', true},
- {'②', true},
- {'③', true},
- {'④', true},
- {'⑤', true},
- {'⑥', true},
- {'⑦', true},
- {'⑧', true},
- {'⑨', true},
- {'⑩', true},
- {'⑪', true},
- {'⑫', true},
- {'⑬', true},
- {'⑭', true},
- {'⑮', true},
- {'⑯', true},
- {'⑰', true},
- {'⑱', true},
- {'⑲', true},
- {'⑳', true},
- {'☆', true},
-}
-
-func TestIsAmbiguousWidth(t *testing.T) {
- for _, tt := range isambiguouswidthtests {
- if out := IsAmbiguousWidth(tt.in); out != tt.out {
- t.Errorf("IsAmbiguousWidth(%q) = %v, want %v", tt.in, out, tt.out)
- }
- }
-}
-
-var stringwidthtests = []struct {
- in string
- out int
- eaout int
-}{
- {"■㈱の世界①", 10, 12},
- {"スター☆", 7, 8},
- {"つのだ☆HIRO", 11, 12},
-}
-
-func TestStringWidth(t *testing.T) {
- c := NewCondition()
- for _, tt := range stringwidthtests {
- if out := c.StringWidth(tt.in); out != tt.out {
- t.Errorf("StringWidth(%q) = %q, want %q", tt.in, out, tt.out)
- }
- }
- c.EastAsianWidth = true
- for _, tt := range stringwidthtests {
- if out := c.StringWidth(tt.in); out != tt.eaout {
- t.Errorf("StringWidth(%q) = %q, want %q", tt.in, out, tt.eaout)
- }
- }
-}
-
-func TestStringWidthInvalid(t *testing.T) {
- s := "こんにちわ\x00世界"
- if out := StringWidth(s); out != 14 {
- t.Errorf("StringWidth(%q) = %q, want %q", s, out, 14)
- }
-}
-
-func TestTruncateSmaller(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := Truncate(s, 10, "..."); out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestTruncate(t *testing.T) {
- s := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおお..."
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 79 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 79, width)
- }
-}
-
-func TestTruncateFit(t *testing.T) {
- s := "aあいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "aあいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおお..."
-
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 80 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 80, width)
- }
-}
-
-func TestTruncateJustFit(t *testing.T) {
- s := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
-
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 80 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 80, width)
- }
-}
-
-func TestWrap(t *testing.T) {
- s := `東京特許許可局局長はよく柿喰う客だ/東京特許許可局局長はよく柿喰う客だ
-123456789012345678901234567890
-
-END`
- expected := `東京特許許可局局長はよく柿喰う
-客だ/東京特許許可局局長はよく
-柿喰う客だ
-123456789012345678901234567890
-
-END`
-
- if out := Wrap(s, 30); out != expected {
- t.Errorf("Wrap(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestTruncateNoNeeded(t *testing.T) {
- s := "あいうえおあい"
- expected := "あいうえおあい"
-
- if out := Truncate(s, 80, "..."); out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
-}
-
-var isneutralwidthtests = []struct {
- in rune
- out bool
-}{
- {'→', false},
- {'┊', false},
- {'┈', false},
- {'~', false},
- {'└', false},
- {'⣀', true},
- {'⣀', true},
-}
-
-func TestIsNeutralWidth(t *testing.T) {
- for _, tt := range isneutralwidthtests {
- if out := IsNeutralWidth(tt.in); out != tt.out {
- t.Errorf("IsNeutralWidth(%q) = %v, want %v", tt.in, out, tt.out)
- }
- }
-}
-
-func TestFillLeft(t *testing.T) {
- s := "あxいうえお"
- expected := " あxいうえお"
-
- if out := FillLeft(s, 15); out != expected {
- t.Errorf("FillLeft(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillLeftFit(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := FillLeft(s, 10); out != expected {
- t.Errorf("FillLeft(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillRight(t *testing.T) {
- s := "あxいうえお"
- expected := "あxいうえお "
-
- if out := FillRight(s, 15); out != expected {
- t.Errorf("FillRight(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillRightFit(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := FillRight(s, 10); out != expected {
- t.Errorf("FillRight(%q) = %q, want %q", s, out, expected)
- }
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go
deleted file mode 100644
index 0258876b..00000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package runewidth
-
-import (
- "syscall"
-)
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32")
- procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP")
-)
-
-// IsEastAsian return true if the current locale is CJK
-func IsEastAsian() bool {
- r1, _, _ := procGetConsoleOutputCP.Call()
- if r1 == 0 {
- return false
- }
-
- switch int(r1) {
- case 932, 51932, 936, 949, 950:
- return true
- }
-
- return false
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/.travis.yml b/vendor/github.com/mitchellh/mapstructure/.travis.yml
deleted file mode 100644
index d9deadb8..00000000
--- a/vendor/github.com/mitchellh/mapstructure/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-
-go:
- - 1.9.x
- - tip
-
-script:
- - go test
diff --git a/vendor/github.com/mitchellh/mapstructure/LICENSE b/vendor/github.com/mitchellh/mapstructure/LICENSE
deleted file mode 100644
index f9c841a5..00000000
--- a/vendor/github.com/mitchellh/mapstructure/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Mitchell Hashimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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 SOFTWARE.
diff --git a/vendor/github.com/mitchellh/mapstructure/README.md b/vendor/github.com/mitchellh/mapstructure/README.md
deleted file mode 100644
index 0018dc7d..00000000
--- a/vendor/github.com/mitchellh/mapstructure/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# mapstructure [![Godoc](https://godoc.org/github.com/mitchellh/mapstructure?status.svg)](https://godoc.org/github.com/mitchellh/mapstructure)
-
-mapstructure is a Go library for decoding generic map values to structures
-and vice versa, while providing helpful error handling.
-
-This library is most useful when decoding values from some data stream (JSON,
-Gob, etc.) where you don't _quite_ know the structure of the underlying data
-until you read a part of it. You can therefore read a `map[string]interface{}`
-and use this library to decode it into the proper underlying native Go
-structure.
-
-## Installation
-
-Standard `go get`:
-
-```
-$ go get github.com/mitchellh/mapstructure
-```
-
-## Usage & Example
-
-For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/mapstructure).
-
-The `Decode` function has examples associated with it there.
-
-## But Why?!
-
-Go offers fantastic standard libraries for decoding formats such as JSON.
-The standard method is to have a struct pre-created, and populate that struct
-from the bytes of the encoded format. This is great, but the problem is if
-you have configuration or an encoding that changes slightly depending on
-specific fields. For example, consider this JSON:
-
-```json
-{
- "type": "person",
- "name": "Mitchell"
-}
-```
-
-Perhaps we can't populate a specific structure without first reading
-the "type" field from the JSON. We could always do two passes over the
-decoding of the JSON (reading the "type" first, and the rest later).
-However, it is much simpler to just decode this into a `map[string]interface{}`
-structure, read the "type" key, then use something like this library
-to decode it into the proper structure.
diff --git a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go b/vendor/github.com/mitchellh/mapstructure/decode_hooks.go
deleted file mode 100644
index 2a727575..00000000
--- a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package mapstructure
-
-import (
- "errors"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-// typedDecodeHook takes a raw DecodeHookFunc (an interface{}) and turns
-// it into the proper DecodeHookFunc type, such as DecodeHookFuncType.
-func typedDecodeHook(h DecodeHookFunc) DecodeHookFunc {
- // Create variables here so we can reference them with the reflect pkg
- var f1 DecodeHookFuncType
- var f2 DecodeHookFuncKind
-
- // Fill in the variables into this interface and the rest is done
- // automatically using the reflect package.
- potential := []interface{}{f1, f2}
-
- v := reflect.ValueOf(h)
- vt := v.Type()
- for _, raw := range potential {
- pt := reflect.ValueOf(raw).Type()
- if vt.ConvertibleTo(pt) {
- return v.Convert(pt).Interface()
- }
- }
-
- return nil
-}
-
-// DecodeHookExec executes the given decode hook. This should be used
-// since it'll naturally degrade to the older backwards compatible DecodeHookFunc
-// that took reflect.Kind instead of reflect.Type.
-func DecodeHookExec(
- raw DecodeHookFunc,
- from reflect.Type, to reflect.Type,
- data interface{}) (interface{}, error) {
- switch f := typedDecodeHook(raw).(type) {
- case DecodeHookFuncType:
- return f(from, to, data)
- case DecodeHookFuncKind:
- return f(from.Kind(), to.Kind(), data)
- default:
- return nil, errors.New("invalid decode hook signature")
- }
-}
-
-// ComposeDecodeHookFunc creates a single DecodeHookFunc that
-// automatically composes multiple DecodeHookFuncs.
-//
-// The composed funcs are called in order, with the result of the
-// previous transformation.
-func ComposeDecodeHookFunc(fs ...DecodeHookFunc) DecodeHookFunc {
- return func(
- f reflect.Type,
- t reflect.Type,
- data interface{}) (interface{}, error) {
- var err error
- for _, f1 := range fs {
- data, err = DecodeHookExec(f1, f, t, data)
- if err != nil {
- return nil, err
- }
-
- // Modify the from kind to be correct with the new data
- f = nil
- if val := reflect.ValueOf(data); val.IsValid() {
- f = val.Type()
- }
- }
-
- return data, nil
- }
-}
-
-// StringToSliceHookFunc returns a DecodeHookFunc that converts
-// string to []string by splitting on the given sep.
-func StringToSliceHookFunc(sep string) DecodeHookFunc {
- return func(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- if f != reflect.String || t != reflect.Slice {
- return data, nil
- }
-
- raw := data.(string)
- if raw == "" {
- return []string{}, nil
- }
-
- return strings.Split(raw, sep), nil
- }
-}
-
-// StringToTimeDurationHookFunc returns a DecodeHookFunc that converts
-// strings to time.Duration.
-func StringToTimeDurationHookFunc() DecodeHookFunc {
- return func(
- f reflect.Type,
- t reflect.Type,
- data interface{}) (interface{}, error) {
- if f.Kind() != reflect.String {
- return data, nil
- }
- if t != reflect.TypeOf(time.Duration(5)) {
- return data, nil
- }
-
- // Convert it by parsing
- return time.ParseDuration(data.(string))
- }
-}
-
-// StringToTimeHookFunc returns a DecodeHookFunc that converts
-// strings to time.Time.
-func StringToTimeHookFunc(layout string) DecodeHookFunc {
- return func(
- f reflect.Type,
- t reflect.Type,
- data interface{}) (interface{}, error) {
- if f.Kind() != reflect.String {
- return data, nil
- }
- if t != reflect.TypeOf(time.Time{}) {
- return data, nil
- }
-
- // Convert it by parsing
- return time.Parse(layout, data.(string))
- }
-}
-
-// WeaklyTypedHook is a DecodeHookFunc which adds support for weak typing to
-// the decoder.
-//
-// Note that this is significantly different from the WeaklyTypedInput option
-// of the DecoderConfig.
-func WeaklyTypedHook(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- dataVal := reflect.ValueOf(data)
- switch t {
- case reflect.String:
- switch f {
- case reflect.Bool:
- if dataVal.Bool() {
- return "1", nil
- }
- return "0", nil
- case reflect.Float32:
- return strconv.FormatFloat(dataVal.Float(), 'f', -1, 64), nil
- case reflect.Int:
- return strconv.FormatInt(dataVal.Int(), 10), nil
- case reflect.Slice:
- dataType := dataVal.Type()
- elemKind := dataType.Elem().Kind()
- if elemKind == reflect.Uint8 {
- return string(dataVal.Interface().([]uint8)), nil
- }
- case reflect.Uint:
- return strconv.FormatUint(dataVal.Uint(), 10), nil
- }
- }
-
- return data, nil
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/decode_hooks_test.go b/vendor/github.com/mitchellh/mapstructure/decode_hooks_test.go
deleted file mode 100644
index a81728e7..00000000
--- a/vendor/github.com/mitchellh/mapstructure/decode_hooks_test.go
+++ /dev/null
@@ -1,259 +0,0 @@
-package mapstructure
-
-import (
- "errors"
- "reflect"
- "testing"
- "time"
-)
-
-func TestComposeDecodeHookFunc(t *testing.T) {
- f1 := func(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- return data.(string) + "foo", nil
- }
-
- f2 := func(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- return data.(string) + "bar", nil
- }
-
- f := ComposeDecodeHookFunc(f1, f2)
-
- result, err := DecodeHookExec(
- f, reflect.TypeOf(""), reflect.TypeOf([]byte("")), "")
- if err != nil {
- t.Fatalf("bad: %s", err)
- }
- if result.(string) != "foobar" {
- t.Fatalf("bad: %#v", result)
- }
-}
-
-func TestComposeDecodeHookFunc_err(t *testing.T) {
- f1 := func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) {
- return nil, errors.New("foo")
- }
-
- f2 := func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) {
- panic("NOPE")
- }
-
- f := ComposeDecodeHookFunc(f1, f2)
-
- _, err := DecodeHookExec(
- f, reflect.TypeOf(""), reflect.TypeOf([]byte("")), 42)
- if err.Error() != "foo" {
- t.Fatalf("bad: %s", err)
- }
-}
-
-func TestComposeDecodeHookFunc_kinds(t *testing.T) {
- var f2From reflect.Kind
-
- f1 := func(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- return int(42), nil
- }
-
- f2 := func(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- f2From = f
- return data, nil
- }
-
- f := ComposeDecodeHookFunc(f1, f2)
-
- _, err := DecodeHookExec(
- f, reflect.TypeOf(""), reflect.TypeOf([]byte("")), "")
- if err != nil {
- t.Fatalf("bad: %s", err)
- }
- if f2From != reflect.Int {
- t.Fatalf("bad: %#v", f2From)
- }
-}
-
-func TestStringToSliceHookFunc(t *testing.T) {
- f := StringToSliceHookFunc(",")
-
- strType := reflect.TypeOf("")
- sliceType := reflect.TypeOf([]byte(""))
- cases := []struct {
- f, t reflect.Type
- data interface{}
- result interface{}
- err bool
- }{
- {sliceType, sliceType, 42, 42, false},
- {strType, strType, 42, 42, false},
- {
- strType,
- sliceType,
- "foo,bar,baz",
- []string{"foo", "bar", "baz"},
- false,
- },
- {
- strType,
- sliceType,
- "",
- []string{},
- false,
- },
- }
-
- for i, tc := range cases {
- actual, err := DecodeHookExec(f, tc.f, tc.t, tc.data)
- if tc.err != (err != nil) {
- t.Fatalf("case %d: expected err %#v", i, tc.err)
- }
- if !reflect.DeepEqual(actual, tc.result) {
- t.Fatalf(
- "case %d: expected %#v, got %#v",
- i, tc.result, actual)
- }
- }
-}
-
-func TestStringToTimeDurationHookFunc(t *testing.T) {
- f := StringToTimeDurationHookFunc()
-
- strType := reflect.TypeOf("")
- timeType := reflect.TypeOf(time.Duration(5))
- cases := []struct {
- f, t reflect.Type
- data interface{}
- result interface{}
- err bool
- }{
- {strType, timeType, "5s", 5 * time.Second, false},
- {strType, timeType, "5", time.Duration(0), true},
- {strType, strType, "5", "5", false},
- }
-
- for i, tc := range cases {
- actual, err := DecodeHookExec(f, tc.f, tc.t, tc.data)
- if tc.err != (err != nil) {
- t.Fatalf("case %d: expected err %#v", i, tc.err)
- }
- if !reflect.DeepEqual(actual, tc.result) {
- t.Fatalf(
- "case %d: expected %#v, got %#v",
- i, tc.result, actual)
- }
- }
-}
-
-func TestStringToTimeHookFunc(t *testing.T) {
- strType := reflect.TypeOf("")
- timeType := reflect.TypeOf(time.Time{})
- cases := []struct {
- f, t reflect.Type
- layout string
- data interface{}
- result interface{}
- err bool
- }{
- {strType, timeType, time.RFC3339, "2006-01-02T15:04:05Z",
- time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC), false},
- {strType, timeType, time.RFC3339, "5", time.Time{}, true},
- {strType, strType, time.RFC3339, "5", "5", false},
- }
-
- for i, tc := range cases {
- f := StringToTimeHookFunc(tc.layout)
- actual, err := DecodeHookExec(f, tc.f, tc.t, tc.data)
- if tc.err != (err != nil) {
- t.Fatalf("case %d: expected err %#v", i, tc.err)
- }
- if !reflect.DeepEqual(actual, tc.result) {
- t.Fatalf(
- "case %d: expected %#v, got %#v",
- i, tc.result, actual)
- }
- }
-}
-
-func TestWeaklyTypedHook(t *testing.T) {
- var f DecodeHookFunc = WeaklyTypedHook
-
- boolType := reflect.TypeOf(true)
- strType := reflect.TypeOf("")
- sliceType := reflect.TypeOf([]byte(""))
- cases := []struct {
- f, t reflect.Type
- data interface{}
- result interface{}
- err bool
- }{
- // TO STRING
- {
- boolType,
- strType,
- false,
- "0",
- false,
- },
-
- {
- boolType,
- strType,
- true,
- "1",
- false,
- },
-
- {
- reflect.TypeOf(float32(1)),
- strType,
- float32(7),
- "7",
- false,
- },
-
- {
- reflect.TypeOf(int(1)),
- strType,
- int(7),
- "7",
- false,
- },
-
- {
- sliceType,
- strType,
- []uint8("foo"),
- "foo",
- false,
- },
-
- {
- reflect.TypeOf(uint(1)),
- strType,
- uint(7),
- "7",
- false,
- },
- }
-
- for i, tc := range cases {
- actual, err := DecodeHookExec(f, tc.f, tc.t, tc.data)
- if tc.err != (err != nil) {
- t.Fatalf("case %d: expected err %#v", i, tc.err)
- }
- if !reflect.DeepEqual(actual, tc.result) {
- t.Fatalf(
- "case %d: expected %#v, got %#v",
- i, tc.result, actual)
- }
- }
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/error.go b/vendor/github.com/mitchellh/mapstructure/error.go
deleted file mode 100644
index 47a99e5a..00000000
--- a/vendor/github.com/mitchellh/mapstructure/error.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package mapstructure
-
-import (
- "errors"
- "fmt"
- "sort"
- "strings"
-)
-
-// Error implements the error interface and can represents multiple
-// errors that occur in the course of a single decode.
-type Error struct {
- Errors []string
-}
-
-func (e *Error) Error() string {
- points := make([]string, len(e.Errors))
- for i, err := range e.Errors {
- points[i] = fmt.Sprintf("* %s", err)
- }
-
- sort.Strings(points)
- return fmt.Sprintf(
- "%d error(s) decoding:\n\n%s",
- len(e.Errors), strings.Join(points, "\n"))
-}
-
-// WrappedErrors implements the errwrap.Wrapper interface to make this
-// return value more useful with the errwrap and go-multierror libraries.
-func (e *Error) WrappedErrors() []error {
- if e == nil {
- return nil
- }
-
- result := make([]error, len(e.Errors))
- for i, e := range e.Errors {
- result[i] = errors.New(e)
- }
-
- return result
-}
-
-func appendErrors(errors []string, err error) []string {
- switch e := err.(type) {
- case *Error:
- return append(errors, e.Errors...)
- default:
- return append(errors, e.Error())
- }
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/vendor/github.com/mitchellh/mapstructure/mapstructure.go
deleted file mode 100644
index 13cc5e3d..00000000
--- a/vendor/github.com/mitchellh/mapstructure/mapstructure.go
+++ /dev/null
@@ -1,1061 +0,0 @@
-// Package mapstructure exposes functionality to convert an arbitrary
-// map[string]interface{} into a native Go structure.
-//
-// The Go structure can be arbitrarily complex, containing slices,
-// other structs, etc. and the decoder will properly decode nested
-// maps and so on into the proper structures in the native Go struct.
-// See the examples to see what the decoder is capable of.
-package mapstructure
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "reflect"
- "sort"
- "strconv"
- "strings"
-)
-
-// DecodeHookFunc is the callback function that can be used for
-// data transformations. See "DecodeHook" in the DecoderConfig
-// struct.
-//
-// The type should be DecodeHookFuncType or DecodeHookFuncKind.
-// Either is accepted. Types are a superset of Kinds (Types can return
-// Kinds) and are generally a richer thing to use, but Kinds are simpler
-// if you only need those.
-//
-// The reason DecodeHookFunc is multi-typed is for backwards compatibility:
-// we started with Kinds and then realized Types were the better solution,
-// but have a promise to not break backwards compat so we now support
-// both.
-type DecodeHookFunc interface{}
-
-// DecodeHookFuncType is a DecodeHookFunc which has complete information about
-// the source and target types.
-type DecodeHookFuncType func(reflect.Type, reflect.Type, interface{}) (interface{}, error)
-
-// DecodeHookFuncKind is a DecodeHookFunc which knows only the Kinds of the
-// source and target types.
-type DecodeHookFuncKind func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error)
-
-// DecoderConfig is the configuration that is used to create a new decoder
-// and allows customization of various aspects of decoding.
-type DecoderConfig struct {
- // DecodeHook, if set, will be called before any decoding and any
- // type conversion (if WeaklyTypedInput is on). This lets you modify
- // the values before they're set down onto the resulting struct.
- //
- // If an error is returned, the entire decode will fail with that
- // error.
- DecodeHook DecodeHookFunc
-
- // If ErrorUnused is true, then it is an error for there to exist
- // keys in the original map that were unused in the decoding process
- // (extra keys).
- ErrorUnused bool
-
- // ZeroFields, if set to true, will zero fields before writing them.
- // For example, a map will be emptied before decoded values are put in
- // it. If this is false, a map will be merged.
- ZeroFields bool
-
- // If WeaklyTypedInput is true, the decoder will make the following
- // "weak" conversions:
- //
- // - bools to string (true = "1", false = "0")
- // - numbers to string (base 10)
- // - bools to int/uint (true = 1, false = 0)
- // - strings to int/uint (base implied by prefix)
- // - int to bool (true if value != 0)
- // - string to bool (accepts: 1, t, T, TRUE, true, True, 0, f, F,
- // FALSE, false, False. Anything else is an error)
- // - empty array = empty map and vice versa
- // - negative numbers to overflowed uint values (base 10)
- // - slice of maps to a merged map
- // - single values are converted to slices if required. Each
- // element is weakly decoded. For example: "4" can become []int{4}
- // if the target type is an int slice.
- //
- WeaklyTypedInput bool
-
- // Metadata is the struct that will contain extra metadata about
- // the decoding. If this is nil, then no metadata will be tracked.
- Metadata *Metadata
-
- // Result is a pointer to the struct that will contain the decoded
- // value.
- Result interface{}
-
- // The tag name that mapstructure reads for field names. This
- // defaults to "mapstructure"
- TagName string
-}
-
-// A Decoder takes a raw interface value and turns it into structured
-// data, keeping track of rich error information along the way in case
-// anything goes wrong. Unlike the basic top-level Decode method, you can
-// more finely control how the Decoder behaves using the DecoderConfig
-// structure. The top-level Decode method is just a convenience that sets
-// up the most basic Decoder.
-type Decoder struct {
- config *DecoderConfig
-}
-
-// Metadata contains information about decoding a structure that
-// is tedious or difficult to get otherwise.
-type Metadata struct {
- // Keys are the keys of the structure which were successfully decoded
- Keys []string
-
- // Unused is a slice of keys that were found in the raw value but
- // weren't decoded since there was no matching field in the result interface
- Unused []string
-}
-
-// Decode takes an input structure and uses reflection to translate it to
-// the output structure. output must be a pointer to a map or struct.
-func Decode(input interface{}, output interface{}) error {
- config := &DecoderConfig{
- Metadata: nil,
- Result: output,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// WeakDecode is the same as Decode but is shorthand to enable
-// WeaklyTypedInput. See DecoderConfig for more info.
-func WeakDecode(input, output interface{}) error {
- config := &DecoderConfig{
- Metadata: nil,
- Result: output,
- WeaklyTypedInput: true,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// DecodeMetadata is the same as Decode, but is shorthand to
-// enable metadata collection. See DecoderConfig for more info.
-func DecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error {
- config := &DecoderConfig{
- Metadata: metadata,
- Result: output,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// WeakDecodeMetadata is the same as Decode, but is shorthand to
-// enable both WeaklyTypedInput and metadata collection. See
-// DecoderConfig for more info.
-func WeakDecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error {
- config := &DecoderConfig{
- Metadata: metadata,
- Result: output,
- WeaklyTypedInput: true,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// NewDecoder returns a new decoder for the given configuration. Once
-// a decoder has been returned, the same configuration must not be used
-// again.
-func NewDecoder(config *DecoderConfig) (*Decoder, error) {
- val := reflect.ValueOf(config.Result)
- if val.Kind() != reflect.Ptr {
- return nil, errors.New("result must be a pointer")
- }
-
- val = val.Elem()
- if !val.CanAddr() {
- return nil, errors.New("result must be addressable (a pointer)")
- }
-
- if config.Metadata != nil {
- if config.Metadata.Keys == nil {
- config.Metadata.Keys = make([]string, 0)
- }
-
- if config.Metadata.Unused == nil {
- config.Metadata.Unused = make([]string, 0)
- }
- }
-
- if config.TagName == "" {
- config.TagName = "mapstructure"
- }
-
- result := &Decoder{
- config: config,
- }
-
- return result, nil
-}
-
-// Decode decodes the given raw interface to the target pointer specified
-// by the configuration.
-func (d *Decoder) Decode(input interface{}) error {
- return d.decode("", input, reflect.ValueOf(d.config.Result).Elem())
-}
-
-// Decodes an unknown data type into a specific reflection value.
-func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) error {
- if input == nil {
- // If the data is nil, then we don't set anything, unless ZeroFields is set
- // to true.
- if d.config.ZeroFields {
- outVal.Set(reflect.Zero(outVal.Type()))
-
- if d.config.Metadata != nil && name != "" {
- d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
- }
- }
- return nil
- }
-
- inputVal := reflect.ValueOf(input)
- if !inputVal.IsValid() {
- // If the input value is invalid, then we just set the value
- // to be the zero value.
- outVal.Set(reflect.Zero(outVal.Type()))
- if d.config.Metadata != nil && name != "" {
- d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
- }
- return nil
- }
-
- if d.config.DecodeHook != nil {
- // We have a DecodeHook, so let's pre-process the input.
- var err error
- input, err = DecodeHookExec(
- d.config.DecodeHook,
- inputVal.Type(), outVal.Type(), input)
- if err != nil {
- return fmt.Errorf("error decoding '%s': %s", name, err)
- }
- }
-
- var err error
- inputKind := getKind(outVal)
- switch inputKind {
- case reflect.Bool:
- err = d.decodeBool(name, input, outVal)
- case reflect.Interface:
- err = d.decodeBasic(name, input, outVal)
- case reflect.String:
- err = d.decodeString(name, input, outVal)
- case reflect.Int:
- err = d.decodeInt(name, input, outVal)
- case reflect.Uint:
- err = d.decodeUint(name, input, outVal)
- case reflect.Float32:
- err = d.decodeFloat(name, input, outVal)
- case reflect.Struct:
- err = d.decodeStruct(name, input, outVal)
- case reflect.Map:
- err = d.decodeMap(name, input, outVal)
- case reflect.Ptr:
- err = d.decodePtr(name, input, outVal)
- case reflect.Slice:
- err = d.decodeSlice(name, input, outVal)
- case reflect.Array:
- err = d.decodeArray(name, input, outVal)
- case reflect.Func:
- err = d.decodeFunc(name, input, outVal)
- default:
- // If we reached this point then we weren't able to decode it
- return fmt.Errorf("%s: unsupported type: %s", name, inputKind)
- }
-
- // If we reached here, then we successfully decoded SOMETHING, so
- // mark the key as used if we're tracking metainput.
- if d.config.Metadata != nil && name != "" {
- d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
- }
-
- return err
-}
-
-// This decodes a basic type (bool, int, string, etc.) and sets the
-// value to "data" of that type.
-func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error {
- if val.IsValid() && val.Elem().IsValid() {
- return d.decode(name, data, val.Elem())
- }
- dataVal := reflect.ValueOf(data)
- if !dataVal.IsValid() {
- dataVal = reflect.Zero(val.Type())
- }
-
- dataValType := dataVal.Type()
- if !dataValType.AssignableTo(val.Type()) {
- return fmt.Errorf(
- "'%s' expected type '%s', got '%s'",
- name, val.Type(), dataValType)
- }
-
- val.Set(dataVal)
- return nil
-}
-
-func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- converted := true
- switch {
- case dataKind == reflect.String:
- val.SetString(dataVal.String())
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetString("1")
- } else {
- val.SetString("0")
- }
- case dataKind == reflect.Int && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatInt(dataVal.Int(), 10))
- case dataKind == reflect.Uint && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatUint(dataVal.Uint(), 10))
- case dataKind == reflect.Float32 && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatFloat(dataVal.Float(), 'f', -1, 64))
- case dataKind == reflect.Slice && d.config.WeaklyTypedInput,
- dataKind == reflect.Array && d.config.WeaklyTypedInput:
- dataType := dataVal.Type()
- elemKind := dataType.Elem().Kind()
- switch elemKind {
- case reflect.Uint8:
- var uints []uint8
- if dataKind == reflect.Array {
- uints = make([]uint8, dataVal.Len(), dataVal.Len())
- for i := range uints {
- uints[i] = dataVal.Index(i).Interface().(uint8)
- }
- } else {
- uints = dataVal.Interface().([]uint8)
- }
- val.SetString(string(uints))
- default:
- converted = false
- }
- default:
- converted = false
- }
-
- if !converted {
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
- dataType := dataVal.Type()
-
- switch {
- case dataKind == reflect.Int:
- val.SetInt(dataVal.Int())
- case dataKind == reflect.Uint:
- val.SetInt(int64(dataVal.Uint()))
- case dataKind == reflect.Float32:
- val.SetInt(int64(dataVal.Float()))
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetInt(1)
- } else {
- val.SetInt(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- i, err := strconv.ParseInt(dataVal.String(), 0, val.Type().Bits())
- if err == nil {
- val.SetInt(i)
- } else {
- return fmt.Errorf("cannot parse '%s' as int: %s", name, err)
- }
- case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
- jn := data.(json.Number)
- i, err := jn.Int64()
- if err != nil {
- return fmt.Errorf(
- "error decoding json.Number into %s: %s", name, err)
- }
- val.SetInt(i)
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- switch {
- case dataKind == reflect.Int:
- i := dataVal.Int()
- if i < 0 && !d.config.WeaklyTypedInput {
- return fmt.Errorf("cannot parse '%s', %d overflows uint",
- name, i)
- }
- val.SetUint(uint64(i))
- case dataKind == reflect.Uint:
- val.SetUint(dataVal.Uint())
- case dataKind == reflect.Float32:
- f := dataVal.Float()
- if f < 0 && !d.config.WeaklyTypedInput {
- return fmt.Errorf("cannot parse '%s', %f overflows uint",
- name, f)
- }
- val.SetUint(uint64(f))
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetUint(1)
- } else {
- val.SetUint(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- i, err := strconv.ParseUint(dataVal.String(), 0, val.Type().Bits())
- if err == nil {
- val.SetUint(i)
- } else {
- return fmt.Errorf("cannot parse '%s' as uint: %s", name, err)
- }
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- switch {
- case dataKind == reflect.Bool:
- val.SetBool(dataVal.Bool())
- case dataKind == reflect.Int && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Int() != 0)
- case dataKind == reflect.Uint && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Uint() != 0)
- case dataKind == reflect.Float32 && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Float() != 0)
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- b, err := strconv.ParseBool(dataVal.String())
- if err == nil {
- val.SetBool(b)
- } else if dataVal.String() == "" {
- val.SetBool(false)
- } else {
- return fmt.Errorf("cannot parse '%s' as bool: %s", name, err)
- }
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
- dataType := dataVal.Type()
-
- switch {
- case dataKind == reflect.Int:
- val.SetFloat(float64(dataVal.Int()))
- case dataKind == reflect.Uint:
- val.SetFloat(float64(dataVal.Uint()))
- case dataKind == reflect.Float32:
- val.SetFloat(dataVal.Float())
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetFloat(1)
- } else {
- val.SetFloat(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- f, err := strconv.ParseFloat(dataVal.String(), val.Type().Bits())
- if err == nil {
- val.SetFloat(f)
- } else {
- return fmt.Errorf("cannot parse '%s' as float: %s", name, err)
- }
- case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
- jn := data.(json.Number)
- i, err := jn.Float64()
- if err != nil {
- return fmt.Errorf(
- "error decoding json.Number into %s: %s", name, err)
- }
- val.SetFloat(i)
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeMap(name string, data interface{}, val reflect.Value) error {
- valType := val.Type()
- valKeyType := valType.Key()
- valElemType := valType.Elem()
-
- // By default we overwrite keys in the current map
- valMap := val
-
- // If the map is nil or we're purposely zeroing fields, make a new map
- if valMap.IsNil() || d.config.ZeroFields {
- // Make a new map to hold our result
- mapType := reflect.MapOf(valKeyType, valElemType)
- valMap = reflect.MakeMap(mapType)
- }
-
- // Check input type and based on the input type jump to the proper func
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- switch dataVal.Kind() {
- case reflect.Map:
- return d.decodeMapFromMap(name, dataVal, val, valMap)
-
- case reflect.Struct:
- return d.decodeMapFromStruct(name, dataVal, val, valMap)
-
- case reflect.Array, reflect.Slice:
- if d.config.WeaklyTypedInput {
- return d.decodeMapFromSlice(name, dataVal, val, valMap)
- }
-
- fallthrough
-
- default:
- return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind())
- }
-}
-
-func (d *Decoder) decodeMapFromSlice(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
- // Special case for BC reasons (covered by tests)
- if dataVal.Len() == 0 {
- val.Set(valMap)
- return nil
- }
-
- for i := 0; i < dataVal.Len(); i++ {
- err := d.decode(
- fmt.Sprintf("%s[%d]", name, i),
- dataVal.Index(i).Interface(), val)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
- valType := val.Type()
- valKeyType := valType.Key()
- valElemType := valType.Elem()
-
- // Accumulate errors
- errors := make([]string, 0)
-
- for _, k := range dataVal.MapKeys() {
- fieldName := fmt.Sprintf("%s[%s]", name, k)
-
- // First decode the key into the proper type
- currentKey := reflect.Indirect(reflect.New(valKeyType))
- if err := d.decode(fieldName, k.Interface(), currentKey); err != nil {
- errors = appendErrors(errors, err)
- continue
- }
-
- // Next decode the data into the proper type
- v := dataVal.MapIndex(k).Interface()
- currentVal := reflect.Indirect(reflect.New(valElemType))
- if err := d.decode(fieldName, v, currentVal); err != nil {
- errors = appendErrors(errors, err)
- continue
- }
-
- valMap.SetMapIndex(currentKey, currentVal)
- }
-
- // Set the built up map to the value
- val.Set(valMap)
-
- // If we had errors, return those
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- return nil
-}
-
-func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
- typ := dataVal.Type()
- for i := 0; i < typ.NumField(); i++ {
- // Get the StructField first since this is a cheap operation. If the
- // field is unexported, then ignore it.
- f := typ.Field(i)
- if f.PkgPath != "" {
- continue
- }
-
- // Next get the actual value of this field and verify it is assignable
- // to the map value.
- v := dataVal.Field(i)
- if !v.Type().AssignableTo(valMap.Type().Elem()) {
- return fmt.Errorf("cannot assign type '%s' to map value field of type '%s'", v.Type(), valMap.Type().Elem())
- }
-
- tagValue := f.Tag.Get(d.config.TagName)
- tagParts := strings.Split(tagValue, ",")
-
- // Determine the name of the key in the map
- keyName := f.Name
- if tagParts[0] != "" {
- if tagParts[0] == "-" {
- continue
- }
- keyName = tagParts[0]
- }
-
- // If "squash" is specified in the tag, we squash the field down.
- squash := false
- for _, tag := range tagParts[1:] {
- if tag == "squash" {
- squash = true
- break
- }
- }
- if squash && v.Kind() != reflect.Struct {
- return fmt.Errorf("cannot squash non-struct type '%s'", v.Type())
- }
-
- switch v.Kind() {
- // this is an embedded struct, so handle it differently
- case reflect.Struct:
- x := reflect.New(v.Type())
- x.Elem().Set(v)
-
- vType := valMap.Type()
- vKeyType := vType.Key()
- vElemType := vType.Elem()
- mType := reflect.MapOf(vKeyType, vElemType)
- vMap := reflect.MakeMap(mType)
-
- err := d.decode(keyName, x.Interface(), vMap)
- if err != nil {
- return err
- }
-
- if squash {
- for _, k := range vMap.MapKeys() {
- valMap.SetMapIndex(k, vMap.MapIndex(k))
- }
- } else {
- valMap.SetMapIndex(reflect.ValueOf(keyName), vMap)
- }
-
- default:
- valMap.SetMapIndex(reflect.ValueOf(keyName), v)
- }
- }
-
- if val.CanAddr() {
- val.Set(valMap)
- }
-
- return nil
-}
-
-func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) error {
- // Create an element of the concrete (non pointer) type and decode
- // into that. Then set the value of the pointer to this type.
- valType := val.Type()
- valElemType := valType.Elem()
-
- if val.CanSet() {
- realVal := val
- if realVal.IsNil() || d.config.ZeroFields {
- realVal = reflect.New(valElemType)
- }
-
- if err := d.decode(name, data, reflect.Indirect(realVal)); err != nil {
- return err
- }
-
- val.Set(realVal)
- } else {
- if err := d.decode(name, data, reflect.Indirect(val)); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (d *Decoder) decodeFunc(name string, data interface{}, val reflect.Value) error {
- // Create an element of the concrete (non pointer) type and decode
- // into that. Then set the value of the pointer to this type.
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- if val.Type() != dataVal.Type() {
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
- val.Set(dataVal)
- return nil
-}
-
-func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- dataValKind := dataVal.Kind()
- valType := val.Type()
- valElemType := valType.Elem()
- sliceType := reflect.SliceOf(valElemType)
-
- valSlice := val
- if valSlice.IsNil() || d.config.ZeroFields {
- // Check input type
- if dataValKind != reflect.Array && dataValKind != reflect.Slice {
- if d.config.WeaklyTypedInput {
- switch {
- // Empty maps turn into empty slices
- case dataValKind == reflect.Map:
- if dataVal.Len() == 0 {
- val.Set(reflect.MakeSlice(sliceType, 0, 0))
- return nil
- }
- case dataValKind == reflect.String && valElemType.Kind() == reflect.Uint8:
- return d.decodeSlice(name, []byte(dataVal.String()), val)
- // All other types we try to convert to the slice type
- // and "lift" it into it. i.e. a string becomes a string slice.
- default:
- // Just re-try this function with data as a slice.
- return d.decodeSlice(name, []interface{}{data}, val)
- }
- }
- return fmt.Errorf(
- "'%s': source data must be an array or slice, got %s", name, dataValKind)
-
- }
-
- // Make a new slice to hold our result, same size as the original data.
- valSlice = reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len())
- }
-
- // Accumulate any errors
- errors := make([]string, 0)
-
- for i := 0; i < dataVal.Len(); i++ {
- currentData := dataVal.Index(i).Interface()
- for valSlice.Len() <= i {
- valSlice = reflect.Append(valSlice, reflect.Zero(valElemType))
- }
- currentField := valSlice.Index(i)
-
- fieldName := fmt.Sprintf("%s[%d]", name, i)
- if err := d.decode(fieldName, currentData, currentField); err != nil {
- errors = appendErrors(errors, err)
- }
- }
-
- // Finally, set the value to the slice we built up
- val.Set(valSlice)
-
- // If there were errors, we return those
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- return nil
-}
-
-func (d *Decoder) decodeArray(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- dataValKind := dataVal.Kind()
- valType := val.Type()
- valElemType := valType.Elem()
- arrayType := reflect.ArrayOf(valType.Len(), valElemType)
-
- valArray := val
-
- if valArray.Interface() == reflect.Zero(valArray.Type()).Interface() || d.config.ZeroFields {
- // Check input type
- if dataValKind != reflect.Array && dataValKind != reflect.Slice {
- if d.config.WeaklyTypedInput {
- switch {
- // Empty maps turn into empty arrays
- case dataValKind == reflect.Map:
- if dataVal.Len() == 0 {
- val.Set(reflect.Zero(arrayType))
- return nil
- }
-
- // All other types we try to convert to the array type
- // and "lift" it into it. i.e. a string becomes a string array.
- default:
- // Just re-try this function with data as a slice.
- return d.decodeArray(name, []interface{}{data}, val)
- }
- }
-
- return fmt.Errorf(
- "'%s': source data must be an array or slice, got %s", name, dataValKind)
-
- }
- if dataVal.Len() > arrayType.Len() {
- return fmt.Errorf(
- "'%s': expected source data to have length less or equal to %d, got %d", name, arrayType.Len(), dataVal.Len())
-
- }
-
- // Make a new array to hold our result, same size as the original data.
- valArray = reflect.New(arrayType).Elem()
- }
-
- // Accumulate any errors
- errors := make([]string, 0)
-
- for i := 0; i < dataVal.Len(); i++ {
- currentData := dataVal.Index(i).Interface()
- currentField := valArray.Index(i)
-
- fieldName := fmt.Sprintf("%s[%d]", name, i)
- if err := d.decode(fieldName, currentData, currentField); err != nil {
- errors = appendErrors(errors, err)
- }
- }
-
- // Finally, set the value to the array we built up
- val.Set(valArray)
-
- // If there were errors, we return those
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- return nil
-}
-
-func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.Indirect(reflect.ValueOf(data))
-
- // If the type of the value to write to and the data match directly,
- // then we just set it directly instead of recursing into the structure.
- if dataVal.Type() == val.Type() {
- val.Set(dataVal)
- return nil
- }
-
- dataValKind := dataVal.Kind()
- if dataValKind != reflect.Map {
- return fmt.Errorf("'%s' expected a map, got '%s'", name, dataValKind)
- }
-
- dataValType := dataVal.Type()
- if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface {
- return fmt.Errorf(
- "'%s' needs a map with string keys, has '%s' keys",
- name, dataValType.Key().Kind())
- }
-
- dataValKeys := make(map[reflect.Value]struct{})
- dataValKeysUnused := make(map[interface{}]struct{})
- for _, dataValKey := range dataVal.MapKeys() {
- dataValKeys[dataValKey] = struct{}{}
- dataValKeysUnused[dataValKey.Interface()] = struct{}{}
- }
-
- errors := make([]string, 0)
-
- // This slice will keep track of all the structs we'll be decoding.
- // There can be more than one struct if there are embedded structs
- // that are squashed.
- structs := make([]reflect.Value, 1, 5)
- structs[0] = val
-
- // Compile the list of all the fields that we're going to be decoding
- // from all the structs.
- type field struct {
- field reflect.StructField
- val reflect.Value
- }
- fields := []field{}
- for len(structs) > 0 {
- structVal := structs[0]
- structs = structs[1:]
-
- structType := structVal.Type()
-
- for i := 0; i < structType.NumField(); i++ {
- fieldType := structType.Field(i)
- fieldKind := fieldType.Type.Kind()
-
- // If "squash" is specified in the tag, we squash the field down.
- squash := false
- tagParts := strings.Split(fieldType.Tag.Get(d.config.TagName), ",")
- for _, tag := range tagParts[1:] {
- if tag == "squash" {
- squash = true
- break
- }
- }
-
- if squash {
- if fieldKind != reflect.Struct {
- errors = appendErrors(errors,
- fmt.Errorf("%s: unsupported type for squash: %s", fieldType.Name, fieldKind))
- } else {
- structs = append(structs, structVal.FieldByName(fieldType.Name))
- }
- continue
- }
-
- // Normal struct field, store it away
- fields = append(fields, field{fieldType, structVal.Field(i)})
- }
- }
-
- // for fieldType, field := range fields {
- for _, f := range fields {
- field, fieldValue := f.field, f.val
- fieldName := field.Name
-
- tagValue := field.Tag.Get(d.config.TagName)
- tagValue = strings.SplitN(tagValue, ",", 2)[0]
- if tagValue != "" {
- fieldName = tagValue
- }
-
- rawMapKey := reflect.ValueOf(fieldName)
- rawMapVal := dataVal.MapIndex(rawMapKey)
- if !rawMapVal.IsValid() {
- // Do a slower search by iterating over each key and
- // doing case-insensitive search.
- for dataValKey := range dataValKeys {
- mK, ok := dataValKey.Interface().(string)
- if !ok {
- // Not a string key
- continue
- }
-
- if strings.EqualFold(mK, fieldName) {
- rawMapKey = dataValKey
- rawMapVal = dataVal.MapIndex(dataValKey)
- break
- }
- }
-
- if !rawMapVal.IsValid() {
- // There was no matching key in the map for the value in
- // the struct. Just ignore.
- continue
- }
- }
-
- // Delete the key we're using from the unused map so we stop tracking
- delete(dataValKeysUnused, rawMapKey.Interface())
-
- if !fieldValue.IsValid() {
- // This should never happen
- panic("field is not valid")
- }
-
- // If we can't set the field, then it is unexported or something,
- // and we just continue onwards.
- if !fieldValue.CanSet() {
- continue
- }
-
- // If the name is empty string, then we're at the root, and we
- // don't dot-join the fields.
- if name != "" {
- fieldName = fmt.Sprintf("%s.%s", name, fieldName)
- }
-
- if err := d.decode(fieldName, rawMapVal.Interface(), fieldValue); err != nil {
- errors = appendErrors(errors, err)
- }
- }
-
- if d.config.ErrorUnused && len(dataValKeysUnused) > 0 {
- keys := make([]string, 0, len(dataValKeysUnused))
- for rawKey := range dataValKeysUnused {
- keys = append(keys, rawKey.(string))
- }
- sort.Strings(keys)
-
- err := fmt.Errorf("'%s' has invalid keys: %s", name, strings.Join(keys, ", "))
- errors = appendErrors(errors, err)
- }
-
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- // Add the unused keys to the list of unused keys if we're tracking metadata
- if d.config.Metadata != nil {
- for rawKey := range dataValKeysUnused {
- key := rawKey.(string)
- if name != "" {
- key = fmt.Sprintf("%s.%s", name, key)
- }
-
- d.config.Metadata.Unused = append(d.config.Metadata.Unused, key)
- }
- }
-
- return nil
-}
-
-func getKind(val reflect.Value) reflect.Kind {
- kind := val.Kind()
-
- switch {
- case kind >= reflect.Int && kind <= reflect.Int64:
- return reflect.Int
- case kind >= reflect.Uint && kind <= reflect.Uint64:
- return reflect.Uint
- case kind >= reflect.Float32 && kind <= reflect.Float64:
- return reflect.Float32
- default:
- return kind
- }
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go b/vendor/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go
deleted file mode 100644
index 41d2a41f..00000000
--- a/vendor/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go
+++ /dev/null
@@ -1,279 +0,0 @@
-package mapstructure
-
-import (
- "encoding/json"
- "testing"
-)
-
-func Benchmark_Decode(b *testing.B) {
- type Person struct {
- Name string
- Age int
- Emails []string
- Extra map[string]string
- }
-
- input := map[string]interface{}{
- "name": "Mitchell",
- "age": 91,
- "emails": []string{"one", "two", "three"},
- "extra": map[string]string{
- "twitter": "mitchellh",
- },
- }
-
- var result Person
- for i := 0; i < b.N; i++ {
- Decode(input, &result)
- }
-}
-
-// decodeViaJSON takes the map data and passes it through encoding/json to convert it into the
-// given Go native structure pointed to by v. v must be a pointer to a struct.
-func decodeViaJSON(data interface{}, v interface{}) error {
- // Perform the task by simply marshalling the input into JSON,
- // then unmarshalling it into target native Go struct.
- b, err := json.Marshal(data)
- if err != nil {
- return err
- }
- return json.Unmarshal(b, v)
-}
-
-func Benchmark_DecodeViaJSON(b *testing.B) {
- type Person struct {
- Name string
- Age int
- Emails []string
- Extra map[string]string
- }
-
- input := map[string]interface{}{
- "name": "Mitchell",
- "age": 91,
- "emails": []string{"one", "two", "three"},
- "extra": map[string]string{
- "twitter": "mitchellh",
- },
- }
-
- var result Person
- for i := 0; i < b.N; i++ {
- decodeViaJSON(input, &result)
- }
-}
-
-func Benchmark_DecodeBasic(b *testing.B) {
- input := map[string]interface{}{
- "vstring": "foo",
- "vint": 42,
- "Vuint": 42,
- "vbool": true,
- "Vfloat": 42.42,
- "vsilent": true,
- "vdata": 42,
- }
-
- var result Basic
- for i := 0; i < b.N; i++ {
- Decode(input, &result)
- }
-}
-
-func Benchmark_DecodeEmbedded(b *testing.B) {
- input := map[string]interface{}{
- "vstring": "foo",
- "Basic": map[string]interface{}{
- "vstring": "innerfoo",
- },
- "vunique": "bar",
- }
-
- var result Embedded
- for i := 0; i < b.N; i++ {
- Decode(input, &result)
- }
-}
-
-func Benchmark_DecodeTypeConversion(b *testing.B) {
- input := map[string]interface{}{
- "IntToFloat": 42,
- "IntToUint": 42,
- "IntToBool": 1,
- "IntToString": 42,
- "UintToInt": 42,
- "UintToFloat": 42,
- "UintToBool": 42,
- "UintToString": 42,
- "BoolToInt": true,
- "BoolToUint": true,
- "BoolToFloat": true,
- "BoolToString": true,
- "FloatToInt": 42.42,
- "FloatToUint": 42.42,
- "FloatToBool": 42.42,
- "FloatToString": 42.42,
- "StringToInt": "42",
- "StringToUint": "42",
- "StringToBool": "1",
- "StringToFloat": "42.42",
- "SliceToMap": []interface{}{},
- "MapToSlice": map[string]interface{}{},
- }
-
- var resultStrict TypeConversionResult
- for i := 0; i < b.N; i++ {
- Decode(input, &resultStrict)
- }
-}
-
-func Benchmark_DecodeMap(b *testing.B) {
- input := map[string]interface{}{
- "vfoo": "foo",
- "vother": map[interface{}]interface{}{
- "foo": "foo",
- "bar": "bar",
- },
- }
-
- var result Map
- for i := 0; i < b.N; i++ {
- Decode(input, &result)
- }
-}
-
-func Benchmark_DecodeMapOfStruct(b *testing.B) {
- input := map[string]interface{}{
- "value": map[string]interface{}{
- "foo": map[string]string{"vstring": "one"},
- "bar": map[string]string{"vstring": "two"},
- },
- }
-
- var result MapOfStruct
- for i := 0; i < b.N; i++ {
- Decode(input, &result)
- }
-}
-
-func Benchmark_DecodeSlice(b *testing.B) {
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": []string{"foo", "bar", "baz"},
- }
-
- var result Slice
- for i := 0; i < b.N; i++ {
- Decode(input, &result)
- }
-}
-
-func Benchmark_DecodeSliceOfStruct(b *testing.B) {
- input := map[string]interface{}{
- "value": []map[string]interface{}{
- {"vstring": "one"},
- {"vstring": "two"},
- },
- }
-
- var result SliceOfStruct
- for i := 0; i < b.N; i++ {
- Decode(input, &result)
- }
-}
-
-func Benchmark_DecodeWeaklyTypedInput(b *testing.B) {
- type Person struct {
- Name string
- Age int
- Emails []string
- }
-
- // This input can come from anywhere, but typically comes from
- // something like decoding JSON, generated by a weakly typed language
- // such as PHP.
- input := map[string]interface{}{
- "name": 123, // number => string
- "age": "42", // string => number
- "emails": map[string]interface{}{}, // empty map => empty array
- }
-
- var result Person
- config := &DecoderConfig{
- WeaklyTypedInput: true,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- panic(err)
- }
-
- for i := 0; i < b.N; i++ {
- decoder.Decode(input)
- }
-}
-
-func Benchmark_DecodeMetadata(b *testing.B) {
- type Person struct {
- Name string
- Age int
- }
-
- input := map[string]interface{}{
- "name": "Mitchell",
- "age": 91,
- "email": "foo@bar.com",
- }
-
- var md Metadata
- var result Person
- config := &DecoderConfig{
- Metadata: &md,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- panic(err)
- }
-
- for i := 0; i < b.N; i++ {
- decoder.Decode(input)
- }
-}
-
-func Benchmark_DecodeMetadataEmbedded(b *testing.B) {
- input := map[string]interface{}{
- "vstring": "foo",
- "vunique": "bar",
- }
-
- var md Metadata
- var result EmbeddedSquash
- config := &DecoderConfig{
- Metadata: &md,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- b.Fatalf("err: %s", err)
- }
-
- for i := 0; i < b.N; i++ {
- decoder.Decode(input)
- }
-}
-
-func Benchmark_DecodeTagged(b *testing.B) {
- input := map[string]interface{}{
- "foo": "bar",
- "bar": "value",
- }
-
- var result Tagged
- for i := 0; i < b.N; i++ {
- Decode(input, &result)
- }
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go b/vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go
deleted file mode 100644
index 1319da56..00000000
--- a/vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go
+++ /dev/null
@@ -1,372 +0,0 @@
-package mapstructure
-
-import (
- "reflect"
- "testing"
-)
-
-// GH-1, GH-10, GH-96
-func TestDecode_NilValue(t *testing.T) {
- t.Parallel()
-
- tests := []struct {
- name string
- in interface{}
- target interface{}
- out interface{}
- metaKeys []string
- metaUnused []string
- }{
- {
- "all nil",
- &map[string]interface{}{
- "vfoo": nil,
- "vother": nil,
- },
- &Map{Vfoo: "foo", Vother: map[string]string{"foo": "bar"}},
- &Map{Vfoo: "", Vother: nil},
- []string{"Vfoo", "Vother"},
- []string{},
- },
- {
- "partial nil",
- &map[string]interface{}{
- "vfoo": "baz",
- "vother": nil,
- },
- &Map{Vfoo: "foo", Vother: map[string]string{"foo": "bar"}},
- &Map{Vfoo: "baz", Vother: nil},
- []string{"Vfoo", "Vother"},
- []string{},
- },
- {
- "partial decode",
- &map[string]interface{}{
- "vother": nil,
- },
- &Map{Vfoo: "foo", Vother: map[string]string{"foo": "bar"}},
- &Map{Vfoo: "foo", Vother: nil},
- []string{"Vother"},
- []string{},
- },
- {
- "unused values",
- &map[string]interface{}{
- "vbar": "bar",
- "vfoo": nil,
- "vother": nil,
- },
- &Map{Vfoo: "foo", Vother: map[string]string{"foo": "bar"}},
- &Map{Vfoo: "", Vother: nil},
- []string{"Vfoo", "Vother"},
- []string{"vbar"},
- },
- {
- "map interface all nil",
- &map[interface{}]interface{}{
- "vfoo": nil,
- "vother": nil,
- },
- &Map{Vfoo: "foo", Vother: map[string]string{"foo": "bar"}},
- &Map{Vfoo: "", Vother: nil},
- []string{"Vfoo", "Vother"},
- []string{},
- },
- {
- "map interface partial nil",
- &map[interface{}]interface{}{
- "vfoo": "baz",
- "vother": nil,
- },
- &Map{Vfoo: "foo", Vother: map[string]string{"foo": "bar"}},
- &Map{Vfoo: "baz", Vother: nil},
- []string{"Vfoo", "Vother"},
- []string{},
- },
- {
- "map interface partial decode",
- &map[interface{}]interface{}{
- "vother": nil,
- },
- &Map{Vfoo: "foo", Vother: map[string]string{"foo": "bar"}},
- &Map{Vfoo: "foo", Vother: nil},
- []string{"Vother"},
- []string{},
- },
- {
- "map interface unused values",
- &map[interface{}]interface{}{
- "vbar": "bar",
- "vfoo": nil,
- "vother": nil,
- },
- &Map{Vfoo: "foo", Vother: map[string]string{"foo": "bar"}},
- &Map{Vfoo: "", Vother: nil},
- []string{"Vfoo", "Vother"},
- []string{"vbar"},
- },
- }
-
- for _, tc := range tests {
- t.Run(tc.name, func(t *testing.T) {
- config := &DecoderConfig{
- Metadata: new(Metadata),
- Result: tc.target,
- ZeroFields: true,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- t.Fatalf("should not error: %s", err)
- }
-
- err = decoder.Decode(tc.in)
- if err != nil {
- t.Fatalf("should not error: %s", err)
- }
-
- if !reflect.DeepEqual(tc.out, tc.target) {
- t.Fatalf("%q: TestDecode_NilValue() expected: %#v, got: %#v", tc.name, tc.out, tc.target)
- }
-
- if !reflect.DeepEqual(tc.metaKeys, config.Metadata.Keys) {
- t.Fatalf("%q: Metadata.Keys mismatch expected: %#v, got: %#v", tc.name, tc.metaKeys, config.Metadata.Keys)
- }
-
- if !reflect.DeepEqual(tc.metaUnused, config.Metadata.Unused) {
- t.Fatalf("%q: Metadata.Unused mismatch expected: %#v, got: %#v", tc.name, tc.metaUnused, config.Metadata.Unused)
- }
- })
- }
-}
-
-// #48
-func TestNestedTypePointerWithDefaults(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": map[string]interface{}{
- "vstring": "foo",
- "vint": 42,
- "vbool": true,
- },
- }
-
- result := NestedPointer{
- Vbar: &Basic{
- Vuint: 42,
- },
- }
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vfoo != "foo" {
- t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo)
- }
-
- if result.Vbar.Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Vbar.Vstring)
- }
-
- if result.Vbar.Vint != 42 {
- t.Errorf("vint value should be 42: %#v", result.Vbar.Vint)
- }
-
- if result.Vbar.Vbool != true {
- t.Errorf("vbool value should be true: %#v", result.Vbar.Vbool)
- }
-
- if result.Vbar.Vextra != "" {
- t.Errorf("vextra value should be empty: %#v", result.Vbar.Vextra)
- }
-
- // this is the error
- if result.Vbar.Vuint != 42 {
- t.Errorf("vuint value should be 42: %#v", result.Vbar.Vuint)
- }
-
-}
-
-type NestedSlice struct {
- Vfoo string
- Vbars []Basic
- Vempty []Basic
-}
-
-// #48
-func TestNestedTypeSliceWithDefaults(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbars": []map[string]interface{}{
- {"vstring": "foo", "vint": 42, "vbool": true},
- {"vint": 42, "vbool": true},
- },
- "vempty": []map[string]interface{}{
- {"vstring": "foo", "vint": 42, "vbool": true},
- {"vint": 42, "vbool": true},
- },
- }
-
- result := NestedSlice{
- Vbars: []Basic{
- {Vuint: 42},
- {Vstring: "foo"},
- },
- }
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vfoo != "foo" {
- t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo)
- }
-
- if result.Vbars[0].Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Vbars[0].Vstring)
- }
- // this is the error
- if result.Vbars[0].Vuint != 42 {
- t.Errorf("vuint value should be 42: %#v", result.Vbars[0].Vuint)
- }
-}
-
-// #48 workaround
-func TestNestedTypeWithDefaults(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": map[string]interface{}{
- "vstring": "foo",
- "vint": 42,
- "vbool": true,
- },
- }
-
- result := Nested{
- Vbar: Basic{
- Vuint: 42,
- },
- }
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vfoo != "foo" {
- t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo)
- }
-
- if result.Vbar.Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Vbar.Vstring)
- }
-
- if result.Vbar.Vint != 42 {
- t.Errorf("vint value should be 42: %#v", result.Vbar.Vint)
- }
-
- if result.Vbar.Vbool != true {
- t.Errorf("vbool value should be true: %#v", result.Vbar.Vbool)
- }
-
- if result.Vbar.Vextra != "" {
- t.Errorf("vextra value should be empty: %#v", result.Vbar.Vextra)
- }
-
- // this is the error
- if result.Vbar.Vuint != 42 {
- t.Errorf("vuint value should be 42: %#v", result.Vbar.Vuint)
- }
-
-}
-
-// #67 panic() on extending slices (decodeSlice with disabled ZeroValues)
-func TestDecodeSliceToEmptySliceWOZeroing(t *testing.T) {
- t.Parallel()
-
- type TestStruct struct {
- Vfoo []string
- }
-
- decode := func(m interface{}, rawVal interface{}) error {
- config := &DecoderConfig{
- Metadata: nil,
- Result: rawVal,
- ZeroFields: false,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(m)
- }
-
- {
- input := map[string]interface{}{
- "vfoo": []string{"1"},
- }
-
- result := &TestStruct{}
-
- err := decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
- }
-
- {
- input := map[string]interface{}{
- "vfoo": []string{"1"},
- }
-
- result := &TestStruct{
- Vfoo: []string{},
- }
-
- err := decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
- }
-
- {
- input := map[string]interface{}{
- "vfoo": []string{"2", "3"},
- }
-
- result := &TestStruct{
- Vfoo: []string{"1"},
- }
-
- err := decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
- }
-}
-
-// #70
-func TestNextSquashMapstructure(t *testing.T) {
- data := &struct {
- Level1 struct {
- Level2 struct {
- Foo string
- } `mapstructure:",squash"`
- } `mapstructure:",squash"`
- }{}
- err := Decode(map[interface{}]interface{}{"foo": "baz"}, &data)
- if err != nil {
- t.Fatalf("should not error: %s", err)
- }
- if data.Level1.Level2.Foo != "baz" {
- t.Fatal("value should be baz")
- }
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure_examples_test.go b/vendor/github.com/mitchellh/mapstructure/mapstructure_examples_test.go
deleted file mode 100644
index f17c214a..00000000
--- a/vendor/github.com/mitchellh/mapstructure/mapstructure_examples_test.go
+++ /dev/null
@@ -1,203 +0,0 @@
-package mapstructure
-
-import (
- "fmt"
-)
-
-func ExampleDecode() {
- type Person struct {
- Name string
- Age int
- Emails []string
- Extra map[string]string
- }
-
- // This input can come from anywhere, but typically comes from
- // something like decoding JSON where we're not quite sure of the
- // struct initially.
- input := map[string]interface{}{
- "name": "Mitchell",
- "age": 91,
- "emails": []string{"one", "two", "three"},
- "extra": map[string]string{
- "twitter": "mitchellh",
- },
- }
-
- var result Person
- err := Decode(input, &result)
- if err != nil {
- panic(err)
- }
-
- fmt.Printf("%#v", result)
- // Output:
- // mapstructure.Person{Name:"Mitchell", Age:91, Emails:[]string{"one", "two", "three"}, Extra:map[string]string{"twitter":"mitchellh"}}
-}
-
-func ExampleDecode_errors() {
- type Person struct {
- Name string
- Age int
- Emails []string
- Extra map[string]string
- }
-
- // This input can come from anywhere, but typically comes from
- // something like decoding JSON where we're not quite sure of the
- // struct initially.
- input := map[string]interface{}{
- "name": 123,
- "age": "bad value",
- "emails": []int{1, 2, 3},
- }
-
- var result Person
- err := Decode(input, &result)
- if err == nil {
- panic("should have an error")
- }
-
- fmt.Println(err.Error())
- // Output:
- // 5 error(s) decoding:
- //
- // * 'Age' expected type 'int', got unconvertible type 'string'
- // * 'Emails[0]' expected type 'string', got unconvertible type 'int'
- // * 'Emails[1]' expected type 'string', got unconvertible type 'int'
- // * 'Emails[2]' expected type 'string', got unconvertible type 'int'
- // * 'Name' expected type 'string', got unconvertible type 'int'
-}
-
-func ExampleDecode_metadata() {
- type Person struct {
- Name string
- Age int
- }
-
- // This input can come from anywhere, but typically comes from
- // something like decoding JSON where we're not quite sure of the
- // struct initially.
- input := map[string]interface{}{
- "name": "Mitchell",
- "age": 91,
- "email": "foo@bar.com",
- }
-
- // For metadata, we make a more advanced DecoderConfig so we can
- // more finely configure the decoder that is used. In this case, we
- // just tell the decoder we want to track metadata.
- var md Metadata
- var result Person
- config := &DecoderConfig{
- Metadata: &md,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- panic(err)
- }
-
- if err := decoder.Decode(input); err != nil {
- panic(err)
- }
-
- fmt.Printf("Unused keys: %#v", md.Unused)
- // Output:
- // Unused keys: []string{"email"}
-}
-
-func ExampleDecode_weaklyTypedInput() {
- type Person struct {
- Name string
- Age int
- Emails []string
- }
-
- // This input can come from anywhere, but typically comes from
- // something like decoding JSON, generated by a weakly typed language
- // such as PHP.
- input := map[string]interface{}{
- "name": 123, // number => string
- "age": "42", // string => number
- "emails": map[string]interface{}{}, // empty map => empty array
- }
-
- var result Person
- config := &DecoderConfig{
- WeaklyTypedInput: true,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- panic(err)
- }
-
- err = decoder.Decode(input)
- if err != nil {
- panic(err)
- }
-
- fmt.Printf("%#v", result)
- // Output: mapstructure.Person{Name:"123", Age:42, Emails:[]string{}}
-}
-
-func ExampleDecode_tags() {
- // Note that the mapstructure tags defined in the struct type
- // can indicate which fields the values are mapped to.
- type Person struct {
- Name string `mapstructure:"person_name"`
- Age int `mapstructure:"person_age"`
- }
-
- input := map[string]interface{}{
- "person_name": "Mitchell",
- "person_age": 91,
- }
-
- var result Person
- err := Decode(input, &result)
- if err != nil {
- panic(err)
- }
-
- fmt.Printf("%#v", result)
- // Output:
- // mapstructure.Person{Name:"Mitchell", Age:91}
-}
-
-func ExampleDecode_embeddedStruct() {
- // Squashing multiple embedded structs is allowed using the squash tag.
- // This is demonstrated by creating a composite struct of multiple types
- // and decoding into it. In this case, a person can carry with it both
- // a Family and a Location, as well as their own FirstName.
- type Family struct {
- LastName string
- }
- type Location struct {
- City string
- }
- type Person struct {
- Family `mapstructure:",squash"`
- Location `mapstructure:",squash"`
- FirstName string
- }
-
- input := map[string]interface{}{
- "FirstName": "Mitchell",
- "LastName": "Hashimoto",
- "City": "San Francisco",
- }
-
- var result Person
- err := Decode(input, &result)
- if err != nil {
- panic(err)
- }
-
- fmt.Printf("%s %s, %s", result.FirstName, result.LastName, result.City)
- // Output:
- // Mitchell Hashimoto, San Francisco
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure_test.go b/vendor/github.com/mitchellh/mapstructure/mapstructure_test.go
deleted file mode 100644
index 12b2772a..00000000
--- a/vendor/github.com/mitchellh/mapstructure/mapstructure_test.go
+++ /dev/null
@@ -1,1776 +0,0 @@
-package mapstructure
-
-import (
- "encoding/json"
- "io"
- "reflect"
- "sort"
- "strings"
- "testing"
-)
-
-type Basic struct {
- Vstring string
- Vint int
- Vuint uint
- Vbool bool
- Vfloat float64
- Vextra string
- vsilent bool
- Vdata interface{}
- VjsonInt int
- VjsonFloat float64
- VjsonNumber json.Number
-}
-
-type BasicSquash struct {
- Test Basic `mapstructure:",squash"`
-}
-
-type Embedded struct {
- Basic
- Vunique string
-}
-
-type EmbeddedPointer struct {
- *Basic
- Vunique string
-}
-
-type EmbeddedSquash struct {
- Basic `mapstructure:",squash"`
- Vunique string
-}
-
-type SliceAlias []string
-
-type EmbeddedSlice struct {
- SliceAlias `mapstructure:"slice_alias"`
- Vunique string
-}
-
-type ArrayAlias [2]string
-
-type EmbeddedArray struct {
- ArrayAlias `mapstructure:"array_alias"`
- Vunique string
-}
-
-type SquashOnNonStructType struct {
- InvalidSquashType int `mapstructure:",squash"`
-}
-
-type Map struct {
- Vfoo string
- Vother map[string]string
-}
-
-type MapOfStruct struct {
- Value map[string]Basic
-}
-
-type Nested struct {
- Vfoo string
- Vbar Basic
-}
-
-type NestedPointer struct {
- Vfoo string
- Vbar *Basic
-}
-
-type NilInterface struct {
- W io.Writer
-}
-
-type Slice struct {
- Vfoo string
- Vbar []string
-}
-
-type SliceOfStruct struct {
- Value []Basic
-}
-
-type Array struct {
- Vfoo string
- Vbar [2]string
-}
-
-type ArrayOfStruct struct {
- Value [2]Basic
-}
-
-type Func struct {
- Foo func() string
-}
-
-type Tagged struct {
- Extra string `mapstructure:"bar,what,what"`
- Value string `mapstructure:"foo"`
-}
-
-type TypeConversionResult struct {
- IntToFloat float32
- IntToUint uint
- IntToBool bool
- IntToString string
- UintToInt int
- UintToFloat float32
- UintToBool bool
- UintToString string
- BoolToInt int
- BoolToUint uint
- BoolToFloat float32
- BoolToString string
- FloatToInt int
- FloatToUint uint
- FloatToBool bool
- FloatToString string
- SliceUint8ToString string
- StringToSliceUint8 []byte
- ArrayUint8ToString string
- StringToInt int
- StringToUint uint
- StringToBool bool
- StringToFloat float32
- StringToStrSlice []string
- StringToIntSlice []int
- StringToStrArray [1]string
- StringToIntArray [1]int
- SliceToMap map[string]interface{}
- MapToSlice []interface{}
- ArrayToMap map[string]interface{}
- MapToArray [1]interface{}
-}
-
-func TestBasicTypes(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vstring": "foo",
- "vint": 42,
- "Vuint": 42,
- "vbool": true,
- "Vfloat": 42.42,
- "vsilent": true,
- "vdata": 42,
- "vjsonInt": json.Number("1234"),
- "vjsonFloat": json.Number("1234.5"),
- "vjsonNumber": json.Number("1234.5"),
- }
-
- var result Basic
- err := Decode(input, &result)
- if err != nil {
- t.Errorf("got an err: %s", err.Error())
- t.FailNow()
- }
-
- if result.Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Vstring)
- }
-
- if result.Vint != 42 {
- t.Errorf("vint value should be 42: %#v", result.Vint)
- }
-
- if result.Vuint != 42 {
- t.Errorf("vuint value should be 42: %#v", result.Vuint)
- }
-
- if result.Vbool != true {
- t.Errorf("vbool value should be true: %#v", result.Vbool)
- }
-
- if result.Vfloat != 42.42 {
- t.Errorf("vfloat value should be 42.42: %#v", result.Vfloat)
- }
-
- if result.Vextra != "" {
- t.Errorf("vextra value should be empty: %#v", result.Vextra)
- }
-
- if result.vsilent != false {
- t.Error("vsilent should not be set, it is unexported")
- }
-
- if result.Vdata != 42 {
- t.Error("vdata should be valid")
- }
-
- if result.VjsonInt != 1234 {
- t.Errorf("vjsonint value should be 1234: %#v", result.VjsonInt)
- }
-
- if result.VjsonFloat != 1234.5 {
- t.Errorf("vjsonfloat value should be 1234.5: %#v", result.VjsonFloat)
- }
-
- if !reflect.DeepEqual(result.VjsonNumber, json.Number("1234.5")) {
- t.Errorf("vjsonnumber value should be '1234.5': %T, %#v", result.VjsonNumber, result.VjsonNumber)
- }
-}
-
-func TestBasic_IntWithFloat(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vint": float64(42),
- }
-
- var result Basic
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
-}
-
-func TestBasic_Merge(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vint": 42,
- }
-
- var result Basic
- result.Vuint = 100
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
-
- expected := Basic{
- Vint: 42,
- Vuint: 100,
- }
- if !reflect.DeepEqual(result, expected) {
- t.Fatalf("bad: %#v", result)
- }
-}
-
-// Test for issue #46.
-func TestBasic_Struct(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vdata": map[string]interface{}{
- "vstring": "foo",
- },
- }
-
- var result, inner Basic
- result.Vdata = &inner
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
- expected := Basic{
- Vdata: &Basic{
- Vstring: "foo",
- },
- }
- if !reflect.DeepEqual(result, expected) {
- t.Fatalf("bad: %#v", result)
- }
-}
-
-func TestDecode_BasicSquash(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vstring": "foo",
- }
-
- var result BasicSquash
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Test.Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Test.Vstring)
- }
-}
-
-func TestDecodeFrom_BasicSquash(t *testing.T) {
- t.Parallel()
-
- var v interface{}
- var ok bool
-
- input := BasicSquash{
- Test: Basic{
- Vstring: "foo",
- },
- }
-
- var result map[string]interface{}
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if _, ok = result["Test"]; ok {
- t.Error("test should not be present in map")
- }
-
- v, ok = result["Vstring"]
- if !ok {
- t.Error("vstring should be present in map")
- } else if !reflect.DeepEqual(v, "foo") {
- t.Errorf("vstring value should be 'foo': %#v", v)
- }
-}
-
-func TestDecode_Embedded(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vstring": "foo",
- "Basic": map[string]interface{}{
- "vstring": "innerfoo",
- },
- "vunique": "bar",
- }
-
- var result Embedded
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vstring != "innerfoo" {
- t.Errorf("vstring value should be 'innerfoo': %#v", result.Vstring)
- }
-
- if result.Vunique != "bar" {
- t.Errorf("vunique value should be 'bar': %#v", result.Vunique)
- }
-}
-
-func TestDecode_EmbeddedPointer(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vstring": "foo",
- "Basic": map[string]interface{}{
- "vstring": "innerfoo",
- },
- "vunique": "bar",
- }
-
- var result EmbeddedPointer
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- expected := EmbeddedPointer{
- Basic: &Basic{
- Vstring: "innerfoo",
- },
- Vunique: "bar",
- }
- if !reflect.DeepEqual(result, expected) {
- t.Fatalf("bad: %#v", result)
- }
-}
-
-func TestDecode_EmbeddedSlice(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "slice_alias": []string{"foo", "bar"},
- "vunique": "bar",
- }
-
- var result EmbeddedSlice
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if !reflect.DeepEqual(result.SliceAlias, SliceAlias([]string{"foo", "bar"})) {
- t.Errorf("slice value: %#v", result.SliceAlias)
- }
-
- if result.Vunique != "bar" {
- t.Errorf("vunique value should be 'bar': %#v", result.Vunique)
- }
-}
-
-func TestDecode_EmbeddedArray(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "array_alias": [2]string{"foo", "bar"},
- "vunique": "bar",
- }
-
- var result EmbeddedArray
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if !reflect.DeepEqual(result.ArrayAlias, ArrayAlias([2]string{"foo", "bar"})) {
- t.Errorf("array value: %#v", result.ArrayAlias)
- }
-
- if result.Vunique != "bar" {
- t.Errorf("vunique value should be 'bar': %#v", result.Vunique)
- }
-}
-
-func TestDecode_EmbeddedSquash(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vstring": "foo",
- "vunique": "bar",
- }
-
- var result EmbeddedSquash
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Vstring)
- }
-
- if result.Vunique != "bar" {
- t.Errorf("vunique value should be 'bar': %#v", result.Vunique)
- }
-}
-
-func TestDecodeFrom_EmbeddedSquash(t *testing.T) {
- t.Parallel()
-
- var v interface{}
- var ok bool
-
- input := EmbeddedSquash{
- Basic: Basic{
- Vstring: "foo",
- },
- Vunique: "bar",
- }
-
- var result map[string]interface{}
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if _, ok = result["Basic"]; ok {
- t.Error("basic should not be present in map")
- }
-
- v, ok = result["Vstring"]
- if !ok {
- t.Error("vstring should be present in map")
- } else if !reflect.DeepEqual(v, "foo") {
- t.Errorf("vstring value should be 'foo': %#v", v)
- }
-
- v, ok = result["Vunique"]
- if !ok {
- t.Error("vunique should be present in map")
- } else if !reflect.DeepEqual(v, "bar") {
- t.Errorf("vunique value should be 'bar': %#v", v)
- }
-}
-
-func TestDecode_SquashOnNonStructType(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "InvalidSquashType": 42,
- }
-
- var result SquashOnNonStructType
- err := Decode(input, &result)
- if err == nil {
- t.Fatal("unexpected success decoding invalid squash field type")
- } else if !strings.Contains(err.Error(), "unsupported type for squash") {
- t.Fatalf("unexpected error message for invalid squash field type: %s", err)
- }
-}
-
-func TestDecode_DecodeHook(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vint": "WHAT",
- }
-
- decodeHook := func(from reflect.Kind, to reflect.Kind, v interface{}) (interface{}, error) {
- if from == reflect.String && to != reflect.String {
- return 5, nil
- }
-
- return v, nil
- }
-
- var result Basic
- config := &DecoderConfig{
- DecodeHook: decodeHook,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = decoder.Decode(input)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
-
- if result.Vint != 5 {
- t.Errorf("vint should be 5: %#v", result.Vint)
- }
-}
-
-func TestDecode_DecodeHookType(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vint": "WHAT",
- }
-
- decodeHook := func(from reflect.Type, to reflect.Type, v interface{}) (interface{}, error) {
- if from.Kind() == reflect.String &&
- to.Kind() != reflect.String {
- return 5, nil
- }
-
- return v, nil
- }
-
- var result Basic
- config := &DecoderConfig{
- DecodeHook: decodeHook,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = decoder.Decode(input)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
-
- if result.Vint != 5 {
- t.Errorf("vint should be 5: %#v", result.Vint)
- }
-}
-
-func TestDecode_Nil(t *testing.T) {
- t.Parallel()
-
- var input interface{}
- result := Basic{
- Vstring: "foo",
- }
-
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if result.Vstring != "foo" {
- t.Fatalf("bad: %#v", result.Vstring)
- }
-}
-
-func TestDecode_NilInterfaceHook(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "w": "",
- }
-
- decodeHook := func(f, t reflect.Type, v interface{}) (interface{}, error) {
- if t.String() == "io.Writer" {
- return nil, nil
- }
-
- return v, nil
- }
-
- var result NilInterface
- config := &DecoderConfig{
- DecodeHook: decodeHook,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = decoder.Decode(input)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
-
- if result.W != nil {
- t.Errorf("W should be nil: %#v", result.W)
- }
-}
-
-func TestDecode_FuncHook(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "foo": "baz",
- }
-
- decodeHook := func(f, t reflect.Type, v interface{}) (interface{}, error) {
- if t.Kind() != reflect.Func {
- return v, nil
- }
- val := v.(string)
- return func() string { return val }, nil
- }
-
- var result Func
- config := &DecoderConfig{
- DecodeHook: decodeHook,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = decoder.Decode(input)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
-
- if result.Foo() != "baz" {
- t.Errorf("Foo call result should be 'baz': %s", result.Foo())
- }
-}
-
-func TestDecode_NonStruct(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "foo": "bar",
- "bar": "baz",
- }
-
- var result map[string]string
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if result["foo"] != "bar" {
- t.Fatal("foo is not bar")
- }
-}
-
-func TestDecode_StructMatch(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vbar": Basic{
- Vstring: "foo",
- },
- }
-
- var result Nested
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vbar.Vstring != "foo" {
- t.Errorf("bad: %#v", result)
- }
-}
-
-func TestDecode_TypeConversion(t *testing.T) {
- input := map[string]interface{}{
- "IntToFloat": 42,
- "IntToUint": 42,
- "IntToBool": 1,
- "IntToString": 42,
- "UintToInt": 42,
- "UintToFloat": 42,
- "UintToBool": 42,
- "UintToString": 42,
- "BoolToInt": true,
- "BoolToUint": true,
- "BoolToFloat": true,
- "BoolToString": true,
- "FloatToInt": 42.42,
- "FloatToUint": 42.42,
- "FloatToBool": 42.42,
- "FloatToString": 42.42,
- "SliceUint8ToString": []uint8("foo"),
- "StringToSliceUint8": "foo",
- "ArrayUint8ToString": [3]uint8{'f', 'o', 'o'},
- "StringToInt": "42",
- "StringToUint": "42",
- "StringToBool": "1",
- "StringToFloat": "42.42",
- "StringToStrSlice": "A",
- "StringToIntSlice": "42",
- "StringToStrArray": "A",
- "StringToIntArray": "42",
- "SliceToMap": []interface{}{},
- "MapToSlice": map[string]interface{}{},
- "ArrayToMap": []interface{}{},
- "MapToArray": map[string]interface{}{},
- }
-
- expectedResultStrict := TypeConversionResult{
- IntToFloat: 42.0,
- IntToUint: 42,
- UintToInt: 42,
- UintToFloat: 42,
- BoolToInt: 0,
- BoolToUint: 0,
- BoolToFloat: 0,
- FloatToInt: 42,
- FloatToUint: 42,
- }
-
- expectedResultWeak := TypeConversionResult{
- IntToFloat: 42.0,
- IntToUint: 42,
- IntToBool: true,
- IntToString: "42",
- UintToInt: 42,
- UintToFloat: 42,
- UintToBool: true,
- UintToString: "42",
- BoolToInt: 1,
- BoolToUint: 1,
- BoolToFloat: 1,
- BoolToString: "1",
- FloatToInt: 42,
- FloatToUint: 42,
- FloatToBool: true,
- FloatToString: "42.42",
- SliceUint8ToString: "foo",
- StringToSliceUint8: []byte("foo"),
- ArrayUint8ToString: "foo",
- StringToInt: 42,
- StringToUint: 42,
- StringToBool: true,
- StringToFloat: 42.42,
- StringToStrSlice: []string{"A"},
- StringToIntSlice: []int{42},
- StringToStrArray: [1]string{"A"},
- StringToIntArray: [1]int{42},
- SliceToMap: map[string]interface{}{},
- MapToSlice: []interface{}{},
- ArrayToMap: map[string]interface{}{},
- MapToArray: [1]interface{}{},
- }
-
- // Test strict type conversion
- var resultStrict TypeConversionResult
- err := Decode(input, &resultStrict)
- if err == nil {
- t.Errorf("should return an error")
- }
- if !reflect.DeepEqual(resultStrict, expectedResultStrict) {
- t.Errorf("expected %v, got: %v", expectedResultStrict, resultStrict)
- }
-
- // Test weak type conversion
- var decoder *Decoder
- var resultWeak TypeConversionResult
-
- config := &DecoderConfig{
- WeaklyTypedInput: true,
- Result: &resultWeak,
- }
-
- decoder, err = NewDecoder(config)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = decoder.Decode(input)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
-
- if !reflect.DeepEqual(resultWeak, expectedResultWeak) {
- t.Errorf("expected \n%#v, got: \n%#v", expectedResultWeak, resultWeak)
- }
-}
-
-func TestDecoder_ErrorUnused(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vstring": "hello",
- "foo": "bar",
- }
-
- var result Basic
- config := &DecoderConfig{
- ErrorUnused: true,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = decoder.Decode(input)
- if err == nil {
- t.Fatal("expected error")
- }
-}
-
-func TestMap(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vother": map[interface{}]interface{}{
- "foo": "foo",
- "bar": "bar",
- },
- }
-
- var result Map
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an error: %s", err)
- }
-
- if result.Vfoo != "foo" {
- t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo)
- }
-
- if result.Vother == nil {
- t.Fatal("vother should not be nil")
- }
-
- if len(result.Vother) != 2 {
- t.Error("vother should have two items")
- }
-
- if result.Vother["foo"] != "foo" {
- t.Errorf("'foo' key should be foo, got: %#v", result.Vother["foo"])
- }
-
- if result.Vother["bar"] != "bar" {
- t.Errorf("'bar' key should be bar, got: %#v", result.Vother["bar"])
- }
-}
-
-func TestMapMerge(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vother": map[interface{}]interface{}{
- "foo": "foo",
- "bar": "bar",
- },
- }
-
- var result Map
- result.Vother = map[string]string{"hello": "world"}
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an error: %s", err)
- }
-
- if result.Vfoo != "foo" {
- t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo)
- }
-
- expected := map[string]string{
- "foo": "foo",
- "bar": "bar",
- "hello": "world",
- }
- if !reflect.DeepEqual(result.Vother, expected) {
- t.Errorf("bad: %#v", result.Vother)
- }
-}
-
-func TestMapOfStruct(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "value": map[string]interface{}{
- "foo": map[string]string{"vstring": "one"},
- "bar": map[string]string{"vstring": "two"},
- },
- }
-
- var result MapOfStruct
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err)
- }
-
- if result.Value == nil {
- t.Fatal("value should not be nil")
- }
-
- if len(result.Value) != 2 {
- t.Error("value should have two items")
- }
-
- if result.Value["foo"].Vstring != "one" {
- t.Errorf("foo value should be 'one', got: %s", result.Value["foo"].Vstring)
- }
-
- if result.Value["bar"].Vstring != "two" {
- t.Errorf("bar value should be 'two', got: %s", result.Value["bar"].Vstring)
- }
-}
-
-func TestNestedType(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": map[string]interface{}{
- "vstring": "foo",
- "vint": 42,
- "vbool": true,
- },
- }
-
- var result Nested
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vfoo != "foo" {
- t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo)
- }
-
- if result.Vbar.Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Vbar.Vstring)
- }
-
- if result.Vbar.Vint != 42 {
- t.Errorf("vint value should be 42: %#v", result.Vbar.Vint)
- }
-
- if result.Vbar.Vbool != true {
- t.Errorf("vbool value should be true: %#v", result.Vbar.Vbool)
- }
-
- if result.Vbar.Vextra != "" {
- t.Errorf("vextra value should be empty: %#v", result.Vbar.Vextra)
- }
-}
-
-func TestNestedTypePointer(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": &map[string]interface{}{
- "vstring": "foo",
- "vint": 42,
- "vbool": true,
- },
- }
-
- var result NestedPointer
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vfoo != "foo" {
- t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo)
- }
-
- if result.Vbar.Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Vbar.Vstring)
- }
-
- if result.Vbar.Vint != 42 {
- t.Errorf("vint value should be 42: %#v", result.Vbar.Vint)
- }
-
- if result.Vbar.Vbool != true {
- t.Errorf("vbool value should be true: %#v", result.Vbar.Vbool)
- }
-
- if result.Vbar.Vextra != "" {
- t.Errorf("vextra value should be empty: %#v", result.Vbar.Vextra)
- }
-}
-
-// Test for issue #46.
-func TestNestedTypeInterface(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": &map[string]interface{}{
- "vstring": "foo",
- "vint": 42,
- "vbool": true,
-
- "vdata": map[string]interface{}{
- "vstring": "bar",
- },
- },
- }
-
- var result NestedPointer
- result.Vbar = new(Basic)
- result.Vbar.Vdata = new(Basic)
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got an err: %s", err.Error())
- }
-
- if result.Vfoo != "foo" {
- t.Errorf("vfoo value should be 'foo': %#v", result.Vfoo)
- }
-
- if result.Vbar.Vstring != "foo" {
- t.Errorf("vstring value should be 'foo': %#v", result.Vbar.Vstring)
- }
-
- if result.Vbar.Vint != 42 {
- t.Errorf("vint value should be 42: %#v", result.Vbar.Vint)
- }
-
- if result.Vbar.Vbool != true {
- t.Errorf("vbool value should be true: %#v", result.Vbar.Vbool)
- }
-
- if result.Vbar.Vextra != "" {
- t.Errorf("vextra value should be empty: %#v", result.Vbar.Vextra)
- }
-
- if result.Vbar.Vdata.(*Basic).Vstring != "bar" {
- t.Errorf("vstring value should be 'bar': %#v", result.Vbar.Vdata.(*Basic).Vstring)
- }
-}
-
-func TestSlice(t *testing.T) {
- t.Parallel()
-
- inputStringSlice := map[string]interface{}{
- "vfoo": "foo",
- "vbar": []string{"foo", "bar", "baz"},
- }
-
- inputStringSlicePointer := map[string]interface{}{
- "vfoo": "foo",
- "vbar": &[]string{"foo", "bar", "baz"},
- }
-
- outputStringSlice := &Slice{
- "foo",
- []string{"foo", "bar", "baz"},
- }
-
- testSliceInput(t, inputStringSlice, outputStringSlice)
- testSliceInput(t, inputStringSlicePointer, outputStringSlice)
-}
-
-func TestInvalidSlice(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": 42,
- }
-
- result := Slice{}
- err := Decode(input, &result)
- if err == nil {
- t.Errorf("expected failure")
- }
-}
-
-func TestSliceOfStruct(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "value": []map[string]interface{}{
- {"vstring": "one"},
- {"vstring": "two"},
- },
- }
-
- var result SliceOfStruct
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got unexpected error: %s", err)
- }
-
- if len(result.Value) != 2 {
- t.Fatalf("expected two values, got %d", len(result.Value))
- }
-
- if result.Value[0].Vstring != "one" {
- t.Errorf("first value should be 'one', got: %s", result.Value[0].Vstring)
- }
-
- if result.Value[1].Vstring != "two" {
- t.Errorf("second value should be 'two', got: %s", result.Value[1].Vstring)
- }
-}
-
-func TestSliceToMap(t *testing.T) {
- t.Parallel()
-
- input := []map[string]interface{}{
- {
- "foo": "bar",
- },
- {
- "bar": "baz",
- },
- }
-
- var result map[string]interface{}
- err := WeakDecode(input, &result)
- if err != nil {
- t.Fatalf("got an error: %s", err)
- }
-
- expected := map[string]interface{}{
- "foo": "bar",
- "bar": "baz",
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("bad: %#v", result)
- }
-}
-
-func TestArray(t *testing.T) {
- t.Parallel()
-
- inputStringArray := map[string]interface{}{
- "vfoo": "foo",
- "vbar": [2]string{"foo", "bar"},
- }
-
- inputStringArrayPointer := map[string]interface{}{
- "vfoo": "foo",
- "vbar": &[2]string{"foo", "bar"},
- }
-
- outputStringArray := &Array{
- "foo",
- [2]string{"foo", "bar"},
- }
-
- testArrayInput(t, inputStringArray, outputStringArray)
- testArrayInput(t, inputStringArrayPointer, outputStringArray)
-}
-
-func TestInvalidArray(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": 42,
- }
-
- result := Array{}
- err := Decode(input, &result)
- if err == nil {
- t.Errorf("expected failure")
- }
-}
-
-func TestArrayOfStruct(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "value": []map[string]interface{}{
- {"vstring": "one"},
- {"vstring": "two"},
- },
- }
-
- var result ArrayOfStruct
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got unexpected error: %s", err)
- }
-
- if len(result.Value) != 2 {
- t.Fatalf("expected two values, got %d", len(result.Value))
- }
-
- if result.Value[0].Vstring != "one" {
- t.Errorf("first value should be 'one', got: %s", result.Value[0].Vstring)
- }
-
- if result.Value[1].Vstring != "two" {
- t.Errorf("second value should be 'two', got: %s", result.Value[1].Vstring)
- }
-}
-
-func TestArrayToMap(t *testing.T) {
- t.Parallel()
-
- input := []map[string]interface{}{
- {
- "foo": "bar",
- },
- {
- "bar": "baz",
- },
- }
-
- var result map[string]interface{}
- err := WeakDecode(input, &result)
- if err != nil {
- t.Fatalf("got an error: %s", err)
- }
-
- expected := map[string]interface{}{
- "foo": "bar",
- "bar": "baz",
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("bad: %#v", result)
- }
-}
-
-func TestMapOutputForStructuredInputs(t *testing.T) {
- t.Parallel()
-
- tests := []struct {
- name string
- in interface{}
- target interface{}
- out interface{}
- wantErr bool
- }{
- {
- "basic struct input",
- &Basic{
- Vstring: "vstring",
- Vint: 2,
- Vuint: 3,
- Vbool: true,
- Vfloat: 4.56,
- Vextra: "vextra",
- vsilent: true,
- Vdata: []byte("data"),
- },
- &map[string]interface{}{},
- &map[string]interface{}{
- "Vstring": "vstring",
- "Vint": 2,
- "Vuint": uint(3),
- "Vbool": true,
- "Vfloat": 4.56,
- "Vextra": "vextra",
- "Vdata": []byte("data"),
- "VjsonInt": 0,
- "VjsonFloat": 0.0,
- "VjsonNumber": json.Number(""),
- },
- false,
- },
- {
- "embedded struct input",
- &Embedded{
- Vunique: "vunique",
- Basic: Basic{
- Vstring: "vstring",
- Vint: 2,
- Vuint: 3,
- Vbool: true,
- Vfloat: 4.56,
- Vextra: "vextra",
- vsilent: true,
- Vdata: []byte("data"),
- },
- },
- &map[string]interface{}{},
- &map[string]interface{}{
- "Vunique": "vunique",
- "Basic": map[string]interface{}{
- "Vstring": "vstring",
- "Vint": 2,
- "Vuint": uint(3),
- "Vbool": true,
- "Vfloat": 4.56,
- "Vextra": "vextra",
- "Vdata": []byte("data"),
- "VjsonInt": 0,
- "VjsonFloat": 0.0,
- "VjsonNumber": json.Number(""),
- },
- },
- false,
- },
- {
- "slice input - should error",
- []string{"foo", "bar"},
- &map[string]interface{}{},
- &map[string]interface{}{},
- true,
- },
- {
- "struct with slice property",
- &Slice{
- Vfoo: "vfoo",
- Vbar: []string{"foo", "bar"},
- },
- &map[string]interface{}{},
- &map[string]interface{}{
- "Vfoo": "vfoo",
- "Vbar": []string{"foo", "bar"},
- },
- false,
- },
- {
- "struct with slice of struct property",
- &SliceOfStruct{
- Value: []Basic{
- Basic{
- Vstring: "vstring",
- Vint: 2,
- Vuint: 3,
- Vbool: true,
- Vfloat: 4.56,
- Vextra: "vextra",
- vsilent: true,
- Vdata: []byte("data"),
- },
- },
- },
- &map[string]interface{}{},
- &map[string]interface{}{
- "Value": []Basic{
- Basic{
- Vstring: "vstring",
- Vint: 2,
- Vuint: 3,
- Vbool: true,
- Vfloat: 4.56,
- Vextra: "vextra",
- vsilent: true,
- Vdata: []byte("data"),
- },
- },
- },
- false,
- },
- {
- "struct with map property",
- &Map{
- Vfoo: "vfoo",
- Vother: map[string]string{"vother": "vother"},
- },
- &map[string]interface{}{},
- &map[string]interface{}{
- "Vfoo": "vfoo",
- "Vother": map[string]string{
- "vother": "vother",
- }},
- false,
- },
- {
- "tagged struct",
- &Tagged{
- Extra: "extra",
- Value: "value",
- },
- &map[string]string{},
- &map[string]string{
- "bar": "extra",
- "foo": "value",
- },
- false,
- },
- {
- "omit tag struct",
- &struct {
- Value string `mapstructure:"value"`
- Omit string `mapstructure:"-"`
- }{
- Value: "value",
- Omit: "omit",
- },
- &map[string]string{},
- &map[string]string{
- "value": "value",
- },
- false,
- },
- {
- "decode to wrong map type",
- &struct {
- Value string
- }{
- Value: "string",
- },
- &map[string]int{},
- &map[string]int{},
- true,
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if err := Decode(tt.in, tt.target); (err != nil) != tt.wantErr {
- t.Fatalf("%q: TestMapOutputForStructuredInputs() unexpected error: %s", tt.name, err)
- }
-
- if !reflect.DeepEqual(tt.out, tt.target) {
- t.Fatalf("%q: TestMapOutputForStructuredInputs() expected: %#v, got: %#v", tt.name, tt.out, tt.target)
- }
- })
- }
-}
-
-func TestInvalidType(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vstring": 42,
- }
-
- var result Basic
- err := Decode(input, &result)
- if err == nil {
- t.Fatal("error should exist")
- }
-
- derr, ok := err.(*Error)
- if !ok {
- t.Fatalf("error should be kind of Error, instead: %#v", err)
- }
-
- if derr.Errors[0] != "'Vstring' expected type 'string', got unconvertible type 'int'" {
- t.Errorf("got unexpected error: %s", err)
- }
-
- inputNegIntUint := map[string]interface{}{
- "vuint": -42,
- }
-
- err = Decode(inputNegIntUint, &result)
- if err == nil {
- t.Fatal("error should exist")
- }
-
- derr, ok = err.(*Error)
- if !ok {
- t.Fatalf("error should be kind of Error, instead: %#v", err)
- }
-
- if derr.Errors[0] != "cannot parse 'Vuint', -42 overflows uint" {
- t.Errorf("got unexpected error: %s", err)
- }
-
- inputNegFloatUint := map[string]interface{}{
- "vuint": -42.0,
- }
-
- err = Decode(inputNegFloatUint, &result)
- if err == nil {
- t.Fatal("error should exist")
- }
-
- derr, ok = err.(*Error)
- if !ok {
- t.Fatalf("error should be kind of Error, instead: %#v", err)
- }
-
- if derr.Errors[0] != "cannot parse 'Vuint', -42.000000 overflows uint" {
- t.Errorf("got unexpected error: %s", err)
- }
-}
-
-func TestDecodeMetadata(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": map[string]interface{}{
- "vstring": "foo",
- "Vuint": 42,
- "foo": "bar",
- },
- "bar": "nil",
- }
-
- var md Metadata
- var result Nested
-
- err := DecodeMetadata(input, &result, &md)
- if err != nil {
- t.Fatalf("err: %s", err.Error())
- }
-
- expectedKeys := []string{"Vbar", "Vbar.Vstring", "Vbar.Vuint", "Vfoo"}
- sort.Strings(md.Keys)
- if !reflect.DeepEqual(md.Keys, expectedKeys) {
- t.Fatalf("bad keys: %#v", md.Keys)
- }
-
- expectedUnused := []string{"Vbar.foo", "bar"}
- if !reflect.DeepEqual(md.Unused, expectedUnused) {
- t.Fatalf("bad unused: %#v", md.Unused)
- }
-}
-
-func TestMetadata(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vfoo": "foo",
- "vbar": map[string]interface{}{
- "vstring": "foo",
- "Vuint": 42,
- "foo": "bar",
- },
- "bar": "nil",
- }
-
- var md Metadata
- var result Nested
- config := &DecoderConfig{
- Metadata: &md,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = decoder.Decode(input)
- if err != nil {
- t.Fatalf("err: %s", err.Error())
- }
-
- expectedKeys := []string{"Vbar", "Vbar.Vstring", "Vbar.Vuint", "Vfoo"}
- sort.Strings(md.Keys)
- if !reflect.DeepEqual(md.Keys, expectedKeys) {
- t.Fatalf("bad keys: %#v", md.Keys)
- }
-
- expectedUnused := []string{"Vbar.foo", "bar"}
- if !reflect.DeepEqual(md.Unused, expectedUnused) {
- t.Fatalf("bad unused: %#v", md.Unused)
- }
-}
-
-func TestMetadata_Embedded(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "vstring": "foo",
- "vunique": "bar",
- }
-
- var md Metadata
- var result EmbeddedSquash
- config := &DecoderConfig{
- Metadata: &md,
- Result: &result,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = decoder.Decode(input)
- if err != nil {
- t.Fatalf("err: %s", err.Error())
- }
-
- expectedKeys := []string{"Vstring", "Vunique"}
-
- sort.Strings(md.Keys)
- if !reflect.DeepEqual(md.Keys, expectedKeys) {
- t.Fatalf("bad keys: %#v", md.Keys)
- }
-
- expectedUnused := []string{}
- if !reflect.DeepEqual(md.Unused, expectedUnused) {
- t.Fatalf("bad unused: %#v", md.Unused)
- }
-}
-
-func TestNonPtrValue(t *testing.T) {
- t.Parallel()
-
- err := Decode(map[string]interface{}{}, Basic{})
- if err == nil {
- t.Fatal("error should exist")
- }
-
- if err.Error() != "result must be a pointer" {
- t.Errorf("got unexpected error: %s", err)
- }
-}
-
-func TestTagged(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "foo": "bar",
- "bar": "value",
- }
-
- var result Tagged
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("unexpected error: %s", err)
- }
-
- if result.Value != "bar" {
- t.Errorf("value should be 'bar', got: %#v", result.Value)
- }
-
- if result.Extra != "value" {
- t.Errorf("extra should be 'value', got: %#v", result.Extra)
- }
-}
-
-func TestWeakDecode(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "foo": "4",
- "bar": "value",
- }
-
- var result struct {
- Foo int
- Bar string
- }
-
- if err := WeakDecode(input, &result); err != nil {
- t.Fatalf("err: %s", err)
- }
- if result.Foo != 4 {
- t.Fatalf("bad: %#v", result)
- }
- if result.Bar != "value" {
- t.Fatalf("bad: %#v", result)
- }
-}
-
-func TestWeakDecodeMetadata(t *testing.T) {
- t.Parallel()
-
- input := map[string]interface{}{
- "foo": "4",
- "bar": "value",
- "unused": "value",
- }
-
- var md Metadata
- var result struct {
- Foo int
- Bar string
- }
-
- if err := WeakDecodeMetadata(input, &result, &md); err != nil {
- t.Fatalf("err: %s", err)
- }
- if result.Foo != 4 {
- t.Fatalf("bad: %#v", result)
- }
- if result.Bar != "value" {
- t.Fatalf("bad: %#v", result)
- }
-
- expectedKeys := []string{"Bar", "Foo"}
- sort.Strings(md.Keys)
- if !reflect.DeepEqual(md.Keys, expectedKeys) {
- t.Fatalf("bad keys: %#v", md.Keys)
- }
-
- expectedUnused := []string{"unused"}
- if !reflect.DeepEqual(md.Unused, expectedUnused) {
- t.Fatalf("bad unused: %#v", md.Unused)
- }
-}
-
-func testSliceInput(t *testing.T, input map[string]interface{}, expected *Slice) {
- var result Slice
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got error: %s", err)
- }
-
- if result.Vfoo != expected.Vfoo {
- t.Errorf("Vfoo expected '%s', got '%s'", expected.Vfoo, result.Vfoo)
- }
-
- if result.Vbar == nil {
- t.Fatalf("Vbar a slice, got '%#v'", result.Vbar)
- }
-
- if len(result.Vbar) != len(expected.Vbar) {
- t.Errorf("Vbar length should be %d, got %d", len(expected.Vbar), len(result.Vbar))
- }
-
- for i, v := range result.Vbar {
- if v != expected.Vbar[i] {
- t.Errorf(
- "Vbar[%d] should be '%#v', got '%#v'",
- i, expected.Vbar[i], v)
- }
- }
-}
-
-func testArrayInput(t *testing.T, input map[string]interface{}, expected *Array) {
- var result Array
- err := Decode(input, &result)
- if err != nil {
- t.Fatalf("got error: %s", err)
- }
-
- if result.Vfoo != expected.Vfoo {
- t.Errorf("Vfoo expected '%s', got '%s'", expected.Vfoo, result.Vfoo)
- }
-
- if result.Vbar == [2]string{} {
- t.Fatalf("Vbar a slice, got '%#v'", result.Vbar)
- }
-
- if len(result.Vbar) != len(expected.Vbar) {
- t.Errorf("Vbar length should be %d, got %d", len(expected.Vbar), len(result.Vbar))
- }
-
- for i, v := range result.Vbar {
- if v != expected.Vbar[i] {
- t.Errorf(
- "Vbar[%d] should be '%#v', got '%#v'",
- i, expected.Vbar[i], v)
- }
- }
-}
diff --git a/vendor/github.com/olekukonko/tablewriter/.gitignore b/vendor/github.com/olekukonko/tablewriter/.gitignore
deleted file mode 100644
index b66cec63..00000000
--- a/vendor/github.com/olekukonko/tablewriter/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-# Created by .ignore support plugin (hsz.mobi)
-### Go template
-# Binaries for programs and plugins
-*.exe
-*.exe~
-*.dll
-*.so
-*.dylib
-
-# Test binary, build with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
-
diff --git a/vendor/github.com/olekukonko/tablewriter/.travis.yml b/vendor/github.com/olekukonko/tablewriter/.travis.yml
deleted file mode 100644
index f156b3b8..00000000
--- a/vendor/github.com/olekukonko/tablewriter/.travis.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-language: go
-
-go:
- - 1.1
- - 1.2
- - 1.3
- - 1.4
- - 1.5
- - 1.6
- - 1.7
- - 1.8
- - tip
diff --git a/vendor/github.com/olekukonko/tablewriter/LICENCE.md b/vendor/github.com/olekukonko/tablewriter/LICENCE.md
deleted file mode 100644
index 1fd84842..00000000
--- a/vendor/github.com/olekukonko/tablewriter/LICENCE.md
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (C) 2014 by Oleku Konko
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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 SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/olekukonko/tablewriter/README.md b/vendor/github.com/olekukonko/tablewriter/README.md
deleted file mode 100644
index 59cb86c0..00000000
--- a/vendor/github.com/olekukonko/tablewriter/README.md
+++ /dev/null
@@ -1,277 +0,0 @@
-ASCII Table Writer
-=========
-
-[![Build Status](https://travis-ci.org/olekukonko/tablewriter.png?branch=master)](https://travis-ci.org/olekukonko/tablewriter)
-[![Total views](https://img.shields.io/sourcegraph/rrc/github.com/olekukonko/tablewriter.svg)](https://sourcegraph.com/github.com/olekukonko/tablewriter)
-[![Godoc](https://godoc.org/github.com/olekukonko/tablewriter?status.svg)](https://godoc.org/github.com/olekukonko/tablewriter)
-
-Generate ASCII table on the fly ... Installation is simple as
-
- go get github.com/olekukonko/tablewriter
-
-
-#### Features
-- Automatic Padding
-- Support Multiple Lines
-- Supports Alignment
-- Support Custom Separators
-- Automatic Alignment of numbers & percentage
-- Write directly to http , file etc via `io.Writer`
-- Read directly from CSV file
-- Optional row line via `SetRowLine`
-- Normalise table header
-- Make CSV Headers optional
-- Enable or disable table border
-- Set custom footer support
-- Optional identical cells merging
-- Set custom caption
-- Optional reflowing of paragrpahs in multi-line cells.
-
-#### Example 1 - Basic
-```go
-data := [][]string{
- []string{"A", "The Good", "500"},
- []string{"B", "The Very very Bad Man", "288"},
- []string{"C", "The Ugly", "120"},
- []string{"D", "The Gopher", "800"},
-}
-
-table := tablewriter.NewWriter(os.Stdout)
-table.SetHeader([]string{"Name", "Sign", "Rating"})
-
-for _, v := range data {
- table.Append(v)
-}
-table.Render() // Send output
-```
-
-##### Output 1
-```
-+------+-----------------------+--------+
-| NAME | SIGN | RATING |
-+------+-----------------------+--------+
-| A | The Good | 500 |
-| B | The Very very Bad Man | 288 |
-| C | The Ugly | 120 |
-| D | The Gopher | 800 |
-+------+-----------------------+--------+
-```
-
-#### Example 2 - Without Border / Footer / Bulk Append
-```go
-data := [][]string{
- []string{"1/1/2014", "Domain name", "2233", "$10.98"},
- []string{"1/1/2014", "January Hosting", "2233", "$54.95"},
- []string{"1/4/2014", "February Hosting", "2233", "$51.00"},
- []string{"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
-}
-
-table := tablewriter.NewWriter(os.Stdout)
-table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
-table.SetFooter([]string{"", "", "Total", "$146.93"}) // Add Footer
-table.SetBorder(false) // Set Border to false
-table.AppendBulk(data) // Add Bulk Data
-table.Render()
-```
-
-##### Output 2
-```
-
- DATE | DESCRIPTION | CV2 | AMOUNT
-+----------+--------------------------+-------+---------+
- 1/1/2014 | Domain name | 2233 | $10.98
- 1/1/2014 | January Hosting | 2233 | $54.95
- 1/4/2014 | February Hosting | 2233 | $51.00
- 1/4/2014 | February Extra Bandwidth | 2233 | $30.00
-+----------+--------------------------+-------+---------+
- TOTAL | $146 93
- +-------+---------+
-
-```
-
-
-#### Example 3 - CSV
-```go
-table, _ := tablewriter.NewCSV(os.Stdout, "testdata/test_info.csv", true)
-table.SetAlignment(tablewriter.ALIGN_LEFT) // Set Alignment
-table.Render()
-```
-
-##### Output 3
-```
-+----------+--------------+------+-----+---------+----------------+
-| FIELD | TYPE | NULL | KEY | DEFAULT | EXTRA |
-+----------+--------------+------+-----+---------+----------------+
-| user_id | smallint(5) | NO | PRI | NULL | auto_increment |
-| username | varchar(10) | NO | | NULL | |
-| password | varchar(100) | NO | | NULL | |
-+----------+--------------+------+-----+---------+----------------+
-```
-
-#### Example 4 - Custom Separator
-```go
-table, _ := tablewriter.NewCSV(os.Stdout, "testdata/test.csv", true)
-table.SetRowLine(true) // Enable row line
-
-// Change table lines
-table.SetCenterSeparator("*")
-table.SetColumnSeparator("‡")
-table.SetRowSeparator("-")
-
-table.SetAlignment(tablewriter.ALIGN_LEFT)
-table.Render()
-```
-
-##### Output 4
-```
-*------------*-----------*---------*
-╪ FIRST NAME ╪ LAST NAME ╪ SSN ╪
-*------------*-----------*---------*
-╪ John ╪ Barry ╪ 123456 ╪
-*------------*-----------*---------*
-╪ Kathy ╪ Smith ╪ 687987 ╪
-*------------*-----------*---------*
-╪ Bob ╪ McCornick ╪ 3979870 ╪
-*------------*-----------*---------*
-```
-
-#### Example 5 - Markdown Format
-```go
-data := [][]string{
- []string{"1/1/2014", "Domain name", "2233", "$10.98"},
- []string{"1/1/2014", "January Hosting", "2233", "$54.95"},
- []string{"1/4/2014", "February Hosting", "2233", "$51.00"},
- []string{"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
-}
-
-table := tablewriter.NewWriter(os.Stdout)
-table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
-table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
-table.SetCenterSeparator("|")
-table.AppendBulk(data) // Add Bulk Data
-table.Render()
-```
-
-##### Output 5
-```
-| DATE | DESCRIPTION | CV2 | AMOUNT |
-|----------|--------------------------|------|--------|
-| 1/1/2014 | Domain name | 2233 | $10.98 |
-| 1/1/2014 | January Hosting | 2233 | $54.95 |
-| 1/4/2014 | February Hosting | 2233 | $51.00 |
-| 1/4/2014 | February Extra Bandwidth | 2233 | $30.00 |
-```
-
-#### Example 6 - Identical cells merging
-```go
-data := [][]string{
- []string{"1/1/2014", "Domain name", "1234", "$10.98"},
- []string{"1/1/2014", "January Hosting", "2345", "$54.95"},
- []string{"1/4/2014", "February Hosting", "3456", "$51.00"},
- []string{"1/4/2014", "February Extra Bandwidth", "4567", "$30.00"},
-}
-
-table := tablewriter.NewWriter(os.Stdout)
-table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
-table.SetFooter([]string{"", "", "Total", "$146.93"})
-table.SetAutoMergeCells(true)
-table.SetRowLine(true)
-table.AppendBulk(data)
-table.Render()
-```
-
-##### Output 6
-```
-+----------+--------------------------+-------+---------+
-| DATE | DESCRIPTION | CV2 | AMOUNT |
-+----------+--------------------------+-------+---------+
-| 1/1/2014 | Domain name | 1234 | $10.98 |
-+ +--------------------------+-------+---------+
-| | January Hosting | 2345 | $54.95 |
-+----------+--------------------------+-------+---------+
-| 1/4/2014 | February Hosting | 3456 | $51.00 |
-+ +--------------------------+-------+---------+
-| | February Extra Bandwidth | 4567 | $30.00 |
-+----------+--------------------------+-------+---------+
-| TOTAL | $146 93 |
-+----------+--------------------------+-------+---------+
-```
-
-
-#### Table with color
-```go
-data := [][]string{
- []string{"1/1/2014", "Domain name", "2233", "$10.98"},
- []string{"1/1/2014", "January Hosting", "2233", "$54.95"},
- []string{"1/4/2014", "February Hosting", "2233", "$51.00"},
- []string{"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
-}
-
-table := tablewriter.NewWriter(os.Stdout)
-table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
-table.SetFooter([]string{"", "", "Total", "$146.93"}) // Add Footer
-table.SetBorder(false) // Set Border to false
-
-table.SetHeaderColor(tablewriter.Colors{tablewriter.Bold, tablewriter.BgGreenColor},
- tablewriter.Colors{tablewriter.FgHiRedColor, tablewriter.Bold, tablewriter.BgBlackColor},
- tablewriter.Colors{tablewriter.BgRedColor, tablewriter.FgWhiteColor},
- tablewriter.Colors{tablewriter.BgCyanColor, tablewriter.FgWhiteColor})
-
-table.SetColumnColor(tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiBlackColor},
- tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiRedColor},
- tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiBlackColor},
- tablewriter.Colors{tablewriter.Bold, tablewriter.FgBlackColor})
-
-table.SetFooterColor(tablewriter.Colors{}, tablewriter.Colors{},
- tablewriter.Colors{tablewriter.Bold},
- tablewriter.Colors{tablewriter.FgHiRedColor})
-
-table.AppendBulk(data)
-table.Render()
-```
-
-#### Table with color Output
-![Table with Color](https://cloud.githubusercontent.com/assets/6460392/21101956/bbc7b356-c0a1-11e6-9f36-dba694746efc.png)
-
-#### Example 6 - Set table caption
-```go
-data := [][]string{
- []string{"A", "The Good", "500"},
- []string{"B", "The Very very Bad Man", "288"},
- []string{"C", "The Ugly", "120"},
- []string{"D", "The Gopher", "800"},
-}
-
-table := tablewriter.NewWriter(os.Stdout)
-table.SetHeader([]string{"Name", "Sign", "Rating"})
-table.SetCaption(true, "Movie ratings.")
-
-for _, v := range data {
- table.Append(v)
-}
-table.Render() // Send output
-```
-
-Note: Caption text will wrap with total width of rendered table.
-
-##### Output 6
-```
-+------+-----------------------+--------+
-| NAME | SIGN | RATING |
-+------+-----------------------+--------+
-| A | The Good | 500 |
-| B | The Very very Bad Man | 288 |
-| C | The Ugly | 120 |
-| D | The Gopher | 800 |
-+------+-----------------------+--------+
-Movie ratings.
-```
-
-#### TODO
-- ~~Import Directly from CSV~~ - `done`
-- ~~Support for `SetFooter`~~ - `done`
-- ~~Support for `SetBorder`~~ - `done`
-- ~~Support table with uneven rows~~ - `done`
-- ~~Support custom alignment~~
-- General Improvement & Optimisation
-- `NewHTML` Parse table from HTML
diff --git a/vendor/github.com/olekukonko/tablewriter/csv.go b/vendor/github.com/olekukonko/tablewriter/csv.go
deleted file mode 100644
index 98878303..00000000
--- a/vendor/github.com/olekukonko/tablewriter/csv.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2014 Oleku Konko All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
-
-// This module is a Table Writer API for the Go Programming Language.
-// The protocols were written in pure Go and works on windows and unix systems
-
-package tablewriter
-
-import (
- "encoding/csv"
- "io"
- "os"
-)
-
-// Start A new table by importing from a CSV file
-// Takes io.Writer and csv File name
-func NewCSV(writer io.Writer, fileName string, hasHeader bool) (*Table, error) {
- file, err := os.Open(fileName)
- if err != nil {
- return &Table{}, err
- }
- defer file.Close()
- csvReader := csv.NewReader(file)
- t, err := NewCSVReader(writer, csvReader, hasHeader)
- return t, err
-}
-
-// Start a New Table Writer with csv.Reader
-// This enables customisation such as reader.Comma = ';'
-// See http://golang.org/src/pkg/encoding/csv/reader.go?s=3213:3671#L94
-func NewCSVReader(writer io.Writer, csvReader *csv.Reader, hasHeader bool) (*Table, error) {
- t := NewWriter(writer)
- if hasHeader {
- // Read the first row
- headers, err := csvReader.Read()
- if err != nil {
- return &Table{}, err
- }
- t.SetHeader(headers)
- }
- for {
- record, err := csvReader.Read()
- if err == io.EOF {
- break
- } else if err != nil {
- return &Table{}, err
- }
- t.Append(record)
- }
- return t, nil
-}
diff --git a/vendor/github.com/olekukonko/tablewriter/csv2table/README.md b/vendor/github.com/olekukonko/tablewriter/csv2table/README.md
deleted file mode 100644
index 6cf5628a..00000000
--- a/vendor/github.com/olekukonko/tablewriter/csv2table/README.md
+++ /dev/null
@@ -1,43 +0,0 @@
-ASCII Table Writer Tool
-=========
-
-Generate ASCII table on the fly via command line ... Installation is simple as
-
-#### Get Tool
-
- go get github.com/olekukonko/tablewriter/csv2table
-
-#### Install Tool
-
- go install github.com/olekukonko/tablewriter/csv2table
-
-
-#### Usage
-
- csv2table -f test.csv
-
-#### Support for Piping
-
- cat test.csv | csv2table -p=true
-
-#### Output
-
-```
-+------------+-----------+---------+
-| FIRST NAME | LAST NAME | SSN |
-+------------+-----------+---------+
-| John | Barry | 123456 |
-| Kathy | Smith | 687987 |
-| Bob | McCornick | 3979870 |
-+------------+-----------+---------+
-```
-
-#### Another Piping with Header set to `false`
-
- echo dance,with,me | csv2table -p=true -h=false
-
-#### Output
-
- +-------+------+-----+
- | dance | with | me |
- +-------+------+-----+
diff --git a/vendor/github.com/olekukonko/tablewriter/csv2table/csv2table.go b/vendor/github.com/olekukonko/tablewriter/csv2table/csv2table.go
deleted file mode 100644
index 5e1d7f24..00000000
--- a/vendor/github.com/olekukonko/tablewriter/csv2table/csv2table.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package main
-
-import (
- "encoding/csv"
- "flag"
- "fmt"
- "io"
- "os"
- "unicode/utf8"
-
- "github.com/olekukonko/tablewriter"
-)
-
-var (
- fileName = flag.String("f", "", "Set file with eg. sample.csv")
- delimiter = flag.String("d", ",", "Set CSV File delimiter eg. ,|;|\t ")
- header = flag.Bool("h", true, "Set header options eg. true|false ")
- align = flag.String("a", "none", "Set aligmement with eg. none|left|right|center")
- pipe = flag.Bool("p", false, "Suport for Piping from STDIN")
- border = flag.Bool("b", true, "Enable / disable table border")
-)
-
-func main() {
- flag.Parse()
- fmt.Println()
- if *pipe || hasArg("-p") {
- process(os.Stdin)
- } else {
- if *fileName == "" {
- fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
- flag.PrintDefaults()
- fmt.Println()
- os.Exit(1)
- }
- processFile()
- }
- fmt.Println()
-}
-
-func hasArg(name string) bool {
- for _, v := range os.Args {
- if name == v {
- return true
- }
- }
- return false
-}
-func processFile() {
- r, err := os.Open(*fileName)
- if err != nil {
- exit(err)
- }
- defer r.Close()
- process(r)
-}
-func process(r io.Reader) {
- csvReader := csv.NewReader(r)
- rune, size := utf8.DecodeRuneInString(*delimiter)
- if size == 0 {
- rune = ','
- }
- csvReader.Comma = rune
-
- table, err := tablewriter.NewCSVReader(os.Stdout, csvReader, *header)
-
- if err != nil {
- exit(err)
- }
-
- switch *align {
- case "left":
- table.SetAlignment(tablewriter.ALIGN_LEFT)
- case "right":
- table.SetAlignment(tablewriter.ALIGN_RIGHT)
- case "center":
- table.SetAlignment(tablewriter.ALIGN_CENTER)
- }
- table.SetBorder(*border)
- table.Render()
-}
-
-func exit(err error) {
- fmt.Fprintf(os.Stderr, "#Error : %s", err)
- os.Exit(1)
-}
diff --git a/vendor/github.com/olekukonko/tablewriter/table.go b/vendor/github.com/olekukonko/tablewriter/table.go
deleted file mode 100644
index 6bbef96a..00000000
--- a/vendor/github.com/olekukonko/tablewriter/table.go
+++ /dev/null
@@ -1,839 +0,0 @@
-// Copyright 2014 Oleku Konko All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
-
-// This module is a Table Writer API for the Go Programming Language.
-// The protocols were written in pure Go and works on windows and unix systems
-
-// Create & Generate text based table
-package tablewriter
-
-import (
- "bytes"
- "fmt"
- "io"
- "regexp"
- "strings"
-)
-
-const (
- MAX_ROW_WIDTH = 30
-)
-
-const (
- CENTER = "+"
- ROW = "-"
- COLUMN = "|"
- SPACE = " "
- NEWLINE = "\n"
-)
-
-const (
- ALIGN_DEFAULT = iota
- ALIGN_CENTER
- ALIGN_RIGHT
- ALIGN_LEFT
-)
-
-var (
- decimal = regexp.MustCompile(`^-*\d*\.?\d*$`)
- percent = regexp.MustCompile(`^-*\d*\.?\d*$%$`)
-)
-
-type Border struct {
- Left bool
- Right bool
- Top bool
- Bottom bool
-}
-
-type Table struct {
- out io.Writer
- rows [][]string
- lines [][][]string
- cs map[int]int
- rs map[int]int
- headers [][]string
- footers [][]string
- caption bool
- captionText string
- autoFmt bool
- autoWrap bool
- reflowText bool
- mW int
- pCenter string
- pRow string
- pColumn string
- tColumn int
- tRow int
- hAlign int
- fAlign int
- align int
- newLine string
- rowLine bool
- autoMergeCells bool
- hdrLine bool
- borders Border
- colSize int
- headerParams []string
- columnsParams []string
- footerParams []string
- columnsAlign []int
-}
-
-// Start New Table
-// Take io.Writer Directly
-func NewWriter(writer io.Writer) *Table {
- t := &Table{
- out: writer,
- rows: [][]string{},
- lines: [][][]string{},
- cs: make(map[int]int),
- rs: make(map[int]int),
- headers: [][]string{},
- footers: [][]string{},
- caption: false,
- captionText: "Table caption.",
- autoFmt: true,
- autoWrap: true,
- reflowText: true,
- mW: MAX_ROW_WIDTH,
- pCenter: CENTER,
- pRow: ROW,
- pColumn: COLUMN,
- tColumn: -1,
- tRow: -1,
- hAlign: ALIGN_DEFAULT,
- fAlign: ALIGN_DEFAULT,
- align: ALIGN_DEFAULT,
- newLine: NEWLINE,
- rowLine: false,
- hdrLine: true,
- borders: Border{Left: true, Right: true, Bottom: true, Top: true},
- colSize: -1,
- headerParams: []string{},
- columnsParams: []string{},
- footerParams: []string{},
- columnsAlign: []int{}}
- return t
-}
-
-// Render table output
-func (t *Table) Render() {
- if t.borders.Top {
- t.printLine(true)
- }
- t.printHeading()
- if t.autoMergeCells {
- t.printRowsMergeCells()
- } else {
- t.printRows()
- }
- if !t.rowLine && t.borders.Bottom {
- t.printLine(true)
- }
- t.printFooter()
-
- if t.caption {
- t.printCaption()
- }
-}
-
-const (
- headerRowIdx = -1
- footerRowIdx = -2
-)
-
-// Set table header
-func (t *Table) SetHeader(keys []string) {
- t.colSize = len(keys)
- for i, v := range keys {
- lines := t.parseDimension(v, i, headerRowIdx)
- t.headers = append(t.headers, lines)
- }
-}
-
-// Set table Footer
-func (t *Table) SetFooter(keys []string) {
- //t.colSize = len(keys)
- for i, v := range keys {
- lines := t.parseDimension(v, i, footerRowIdx)
- t.footers = append(t.footers, lines)
- }
-}
-
-// Set table Caption
-func (t *Table) SetCaption(caption bool, captionText ...string) {
- t.caption = caption
- if len(captionText) == 1 {
- t.captionText = captionText[0]
- }
-}
-
-// Turn header autoformatting on/off. Default is on (true).
-func (t *Table) SetAutoFormatHeaders(auto bool) {
- t.autoFmt = auto
-}
-
-// Turn automatic multiline text adjustment on/off. Default is on (true).
-func (t *Table) SetAutoWrapText(auto bool) {
- t.autoWrap = auto
-}
-
-// Turn automatic reflowing of multiline text when rewrapping. Default is on (true).
-func (t *Table) SetReflowDuringAutoWrap(auto bool) {
- t.reflowText = auto
-}
-
-// Set the Default column width
-func (t *Table) SetColWidth(width int) {
- t.mW = width
-}
-
-// Set the minimal width for a column
-func (t *Table) SetColMinWidth(column int, width int) {
- t.cs[column] = width
-}
-
-// Set the Column Separator
-func (t *Table) SetColumnSeparator(sep string) {
- t.pColumn = sep
-}
-
-// Set the Row Separator
-func (t *Table) SetRowSeparator(sep string) {
- t.pRow = sep
-}
-
-// Set the center Separator
-func (t *Table) SetCenterSeparator(sep string) {
- t.pCenter = sep
-}
-
-// Set Header Alignment
-func (t *Table) SetHeaderAlignment(hAlign int) {
- t.hAlign = hAlign
-}
-
-// Set Footer Alignment
-func (t *Table) SetFooterAlignment(fAlign int) {
- t.fAlign = fAlign
-}
-
-// Set Table Alignment
-func (t *Table) SetAlignment(align int) {
- t.align = align
-}
-
-func (t *Table) SetColumnAlignment(keys []int) {
- for _, v := range keys {
- switch v {
- case ALIGN_CENTER:
- break
- case ALIGN_LEFT:
- break
- case ALIGN_RIGHT:
- break
- default:
- v = ALIGN_DEFAULT
- }
- t.columnsAlign = append(t.columnsAlign, v)
- }
-}
-
-// Set New Line
-func (t *Table) SetNewLine(nl string) {
- t.newLine = nl
-}
-
-// Set Header Line
-// This would enable / disable a line after the header
-func (t *Table) SetHeaderLine(line bool) {
- t.hdrLine = line
-}
-
-// Set Row Line
-// This would enable / disable a line on each row of the table
-func (t *Table) SetRowLine(line bool) {
- t.rowLine = line
-}
-
-// Set Auto Merge Cells
-// This would enable / disable the merge of cells with identical values
-func (t *Table) SetAutoMergeCells(auto bool) {
- t.autoMergeCells = auto
-}
-
-// Set Table Border
-// This would enable / disable line around the table
-func (t *Table) SetBorder(border bool) {
- t.SetBorders(Border{border, border, border, border})
-}
-
-func (t *Table) SetBorders(border Border) {
- t.borders = border
-}
-
-// Append row to table
-func (t *Table) Append(row []string) {
- rowSize := len(t.headers)
- if rowSize > t.colSize {
- t.colSize = rowSize
- }
-
- n := len(t.lines)
- line := [][]string{}
- for i, v := range row {
-
- // Detect string width
- // Detect String height
- // Break strings into words
- out := t.parseDimension(v, i, n)
-
- // Append broken words
- line = append(line, out)
- }
- t.lines = append(t.lines, line)
-}
-
-// Allow Support for Bulk Append
-// Eliminates repeated for loops
-func (t *Table) AppendBulk(rows [][]string) {
- for _, row := range rows {
- t.Append(row)
- }
-}
-
-// NumLines to get the number of lines
-func (t *Table) NumLines() int {
- return len(t.lines)
-}
-
-// Clear rows
-func (t *Table) ClearRows() {
- t.lines = [][][]string{}
-}
-
-// Clear footer
-func (t *Table) ClearFooter() {
- t.footers = [][]string{}
-}
-
-// Print line based on row width
-func (t *Table) printLine(nl bool) {
- fmt.Fprint(t.out, t.pCenter)
- for i := 0; i < len(t.cs); i++ {
- v := t.cs[i]
- fmt.Fprintf(t.out, "%s%s%s%s",
- t.pRow,
- strings.Repeat(string(t.pRow), v),
- t.pRow,
- t.pCenter)
- }
- if nl {
- fmt.Fprint(t.out, t.newLine)
- }
-}
-
-// Print line based on row width with our without cell separator
-func (t *Table) printLineOptionalCellSeparators(nl bool, displayCellSeparator []bool) {
- fmt.Fprint(t.out, t.pCenter)
- for i := 0; i < len(t.cs); i++ {
- v := t.cs[i]
- if i > len(displayCellSeparator) || displayCellSeparator[i] {
- // Display the cell separator
- fmt.Fprintf(t.out, "%s%s%s%s",
- t.pRow,
- strings.Repeat(string(t.pRow), v),
- t.pRow,
- t.pCenter)
- } else {
- // Don't display the cell separator for this cell
- fmt.Fprintf(t.out, "%s%s",
- strings.Repeat(" ", v+2),
- t.pCenter)
- }
- }
- if nl {
- fmt.Fprint(t.out, t.newLine)
- }
-}
-
-// Return the PadRight function if align is left, PadLeft if align is right,
-// and Pad by default
-func pad(align int) func(string, string, int) string {
- padFunc := Pad
- switch align {
- case ALIGN_LEFT:
- padFunc = PadRight
- case ALIGN_RIGHT:
- padFunc = PadLeft
- }
- return padFunc
-}
-
-// Print heading information
-func (t *Table) printHeading() {
- // Check if headers is available
- if len(t.headers) < 1 {
- return
- }
-
- // Identify last column
- end := len(t.cs) - 1
-
- // Get pad function
- padFunc := pad(t.hAlign)
-
- // Checking for ANSI escape sequences for header
- is_esc_seq := false
- if len(t.headerParams) > 0 {
- is_esc_seq = true
- }
-
- // Maximum height.
- max := t.rs[headerRowIdx]
-
- // Print Heading
- for x := 0; x < max; x++ {
- // Check if border is set
- // Replace with space if not set
- fmt.Fprint(t.out, ConditionString(t.borders.Left, t.pColumn, SPACE))
-
- for y := 0; y <= end; y++ {
- v := t.cs[y]
- h := ""
- if y < len(t.headers) && x < len(t.headers[y]) {
- h = t.headers[y][x]
- }
- if t.autoFmt {
- h = Title(h)
- }
- pad := ConditionString((y == end && !t.borders.Left), SPACE, t.pColumn)
-
- if is_esc_seq {
- fmt.Fprintf(t.out, " %s %s",
- format(padFunc(h, SPACE, v),
- t.headerParams[y]), pad)
- } else {
- fmt.Fprintf(t.out, " %s %s",
- padFunc(h, SPACE, v),
- pad)
- }
- }
- // Next line
- fmt.Fprint(t.out, t.newLine)
- }
- if t.hdrLine {
- t.printLine(true)
- }
-}
-
-// Print heading information
-func (t *Table) printFooter() {
- // Check if headers is available
- if len(t.footers) < 1 {
- return
- }
-
- // Only print line if border is not set
- if !t.borders.Bottom {
- t.printLine(true)
- }
-
- // Identify last column
- end := len(t.cs) - 1
-
- // Get pad function
- padFunc := pad(t.fAlign)
-
- // Checking for ANSI escape sequences for header
- is_esc_seq := false
- if len(t.footerParams) > 0 {
- is_esc_seq = true
- }
-
- // Maximum height.
- max := t.rs[footerRowIdx]
-
- // Print Footer
- erasePad := make([]bool, len(t.footers))
- for x := 0; x < max; x++ {
- // Check if border is set
- // Replace with space if not set
- fmt.Fprint(t.out, ConditionString(t.borders.Bottom, t.pColumn, SPACE))
-
- for y := 0; y <= end; y++ {
- v := t.cs[y]
- f := ""
- if y < len(t.footers) && x < len(t.footers[y]) {
- f = t.footers[y][x]
- }
- if t.autoFmt {
- f = Title(f)
- }
- pad := ConditionString((y == end && !t.borders.Top), SPACE, t.pColumn)
-
- if erasePad[y] || (x == 0 && len(f) == 0) {
- pad = SPACE
- erasePad[y] = true
- }
-
- if is_esc_seq {
- fmt.Fprintf(t.out, " %s %s",
- format(padFunc(f, SPACE, v),
- t.footerParams[y]), pad)
- } else {
- fmt.Fprintf(t.out, " %s %s",
- padFunc(f, SPACE, v),
- pad)
- }
-
- //fmt.Fprintf(t.out, " %s %s",
- // padFunc(f, SPACE, v),
- // pad)
- }
- // Next line
- fmt.Fprint(t.out, t.newLine)
- //t.printLine(true)
- }
-
- hasPrinted := false
-
- for i := 0; i <= end; i++ {
- v := t.cs[i]
- pad := t.pRow
- center := t.pCenter
- length := len(t.footers[i][0])
-
- if length > 0 {
- hasPrinted = true
- }
-
- // Set center to be space if length is 0
- if length == 0 && !t.borders.Right {
- center = SPACE
- }
-
- // Print first junction
- if i == 0 {
- fmt.Fprint(t.out, center)
- }
-
- // Pad With space of length is 0
- if length == 0 {
- pad = SPACE
- }
- // Ignore left space of it has printed before
- if hasPrinted || t.borders.Left {
- pad = t.pRow
- center = t.pCenter
- }
-
- // Change Center start position
- if center == SPACE {
- if i < end && len(t.footers[i+1][0]) != 0 {
- center = t.pCenter
- }
- }
-
- // Print the footer
- fmt.Fprintf(t.out, "%s%s%s%s",
- pad,
- strings.Repeat(string(pad), v),
- pad,
- center)
-
- }
-
- fmt.Fprint(t.out, t.newLine)
-}
-
-// Print caption text
-func (t Table) printCaption() {
- width := t.getTableWidth()
- paragraph, _ := WrapString(t.captionText, width)
- for linecount := 0; linecount < len(paragraph); linecount++ {
- fmt.Fprintln(t.out, paragraph[linecount])
- }
-}
-
-// Calculate the total number of characters in a row
-func (t Table) getTableWidth() int {
- var chars int
- for _, v := range t.cs {
- chars += v
- }
-
- // Add chars, spaces, seperators to calculate the total width of the table.
- // ncols := t.colSize
- // spaces := ncols * 2
- // seps := ncols + 1
-
- return (chars + (3 * t.colSize) + 2)
-}
-
-func (t Table) printRows() {
- for i, lines := range t.lines {
- t.printRow(lines, i)
- }
-}
-
-func (t *Table) fillAlignment(num int) {
- if len(t.columnsAlign) < num {
- t.columnsAlign = make([]int, num)
- for i := range t.columnsAlign {
- t.columnsAlign[i] = t.align
- }
- }
-}
-
-// Print Row Information
-// Adjust column alignment based on type
-
-func (t *Table) printRow(columns [][]string, rowIdx int) {
- // Get Maximum Height
- max := t.rs[rowIdx]
- total := len(columns)
-
- // TODO Fix uneven col size
- // if total < t.colSize {
- // for n := t.colSize - total; n < t.colSize ; n++ {
- // columns = append(columns, []string{SPACE})
- // t.cs[n] = t.mW
- // }
- //}
-
- // Pad Each Height
- pads := []int{}
-
- // Checking for ANSI escape sequences for columns
- is_esc_seq := false
- if len(t.columnsParams) > 0 {
- is_esc_seq = true
- }
- t.fillAlignment(total)
-
- for i, line := range columns {
- length := len(line)
- pad := max - length
- pads = append(pads, pad)
- for n := 0; n < pad; n++ {
- columns[i] = append(columns[i], " ")
- }
- }
- //fmt.Println(max, "\n")
- for x := 0; x < max; x++ {
- for y := 0; y < total; y++ {
-
- // Check if border is set
- fmt.Fprint(t.out, ConditionString((!t.borders.Left && y == 0), SPACE, t.pColumn))
-
- fmt.Fprintf(t.out, SPACE)
- str := columns[y][x]
-
- // Embedding escape sequence with column value
- if is_esc_seq {
- str = format(str, t.columnsParams[y])
- }
-
- // This would print alignment
- // Default alignment would use multiple configuration
- switch t.columnsAlign[y] {
- case ALIGN_CENTER: //
- fmt.Fprintf(t.out, "%s", Pad(str, SPACE, t.cs[y]))
- case ALIGN_RIGHT:
- fmt.Fprintf(t.out, "%s", PadLeft(str, SPACE, t.cs[y]))
- case ALIGN_LEFT:
- fmt.Fprintf(t.out, "%s", PadRight(str, SPACE, t.cs[y]))
- default:
- if decimal.MatchString(strings.TrimSpace(str)) || percent.MatchString(strings.TrimSpace(str)) {
- fmt.Fprintf(t.out, "%s", PadLeft(str, SPACE, t.cs[y]))
- } else {
- fmt.Fprintf(t.out, "%s", PadRight(str, SPACE, t.cs[y]))
-
- // TODO Custom alignment per column
- //if max == 1 || pads[y] > 0 {
- // fmt.Fprintf(t.out, "%s", Pad(str, SPACE, t.cs[y]))
- //} else {
- // fmt.Fprintf(t.out, "%s", PadRight(str, SPACE, t.cs[y]))
- //}
-
- }
- }
- fmt.Fprintf(t.out, SPACE)
- }
- // Check if border is set
- // Replace with space if not set
- fmt.Fprint(t.out, ConditionString(t.borders.Left, t.pColumn, SPACE))
- fmt.Fprint(t.out, t.newLine)
- }
-
- if t.rowLine {
- t.printLine(true)
- }
-}
-
-// Print the rows of the table and merge the cells that are identical
-func (t *Table) printRowsMergeCells() {
- var previousLine []string
- var displayCellBorder []bool
- var tmpWriter bytes.Buffer
- for i, lines := range t.lines {
- // We store the display of the current line in a tmp writer, as we need to know which border needs to be print above
- previousLine, displayCellBorder = t.printRowMergeCells(&tmpWriter, lines, i, previousLine)
- if i > 0 { //We don't need to print borders above first line
- if t.rowLine {
- t.printLineOptionalCellSeparators(true, displayCellBorder)
- }
- }
- tmpWriter.WriteTo(t.out)
- }
- //Print the end of the table
- if t.rowLine {
- t.printLine(true)
- }
-}
-
-// Print Row Information to a writer and merge identical cells.
-// Adjust column alignment based on type
-
-func (t *Table) printRowMergeCells(writer io.Writer, columns [][]string, rowIdx int, previousLine []string) ([]string, []bool) {
- // Get Maximum Height
- max := t.rs[rowIdx]
- total := len(columns)
-
- // Pad Each Height
- pads := []int{}
-
- for i, line := range columns {
- length := len(line)
- pad := max - length
- pads = append(pads, pad)
- for n := 0; n < pad; n++ {
- columns[i] = append(columns[i], " ")
- }
- }
-
- var displayCellBorder []bool
- t.fillAlignment(total)
- for x := 0; x < max; x++ {
- for y := 0; y < total; y++ {
-
- // Check if border is set
- fmt.Fprint(writer, ConditionString((!t.borders.Left && y == 0), SPACE, t.pColumn))
-
- fmt.Fprintf(writer, SPACE)
-
- str := columns[y][x]
-
- if t.autoMergeCells {
- //Store the full line to merge mutli-lines cells
- fullLine := strings.Join(columns[y], " ")
- if len(previousLine) > y && fullLine == previousLine[y] && fullLine != "" {
- // If this cell is identical to the one above but not empty, we don't display the border and keep the cell empty.
- displayCellBorder = append(displayCellBorder, false)
- str = ""
- } else {
- // First line or different content, keep the content and print the cell border
- displayCellBorder = append(displayCellBorder, true)
- }
- }
-
- // This would print alignment
- // Default alignment would use multiple configuration
- switch t.columnsAlign[y] {
- case ALIGN_CENTER: //
- fmt.Fprintf(writer, "%s", Pad(str, SPACE, t.cs[y]))
- case ALIGN_RIGHT:
- fmt.Fprintf(writer, "%s", PadLeft(str, SPACE, t.cs[y]))
- case ALIGN_LEFT:
- fmt.Fprintf(writer, "%s", PadRight(str, SPACE, t.cs[y]))
- default:
- if decimal.MatchString(strings.TrimSpace(str)) || percent.MatchString(strings.TrimSpace(str)) {
- fmt.Fprintf(writer, "%s", PadLeft(str, SPACE, t.cs[y]))
- } else {
- fmt.Fprintf(writer, "%s", PadRight(str, SPACE, t.cs[y]))
- }
- }
- fmt.Fprintf(writer, SPACE)
- }
- // Check if border is set
- // Replace with space if not set
- fmt.Fprint(writer, ConditionString(t.borders.Left, t.pColumn, SPACE))
- fmt.Fprint(writer, t.newLine)
- }
-
- //The new previous line is the current one
- previousLine = make([]string, total)
- for y := 0; y < total; y++ {
- previousLine[y] = strings.Join(columns[y], " ") //Store the full line for multi-lines cells
- }
- //Returns the newly added line and wether or not a border should be displayed above.
- return previousLine, displayCellBorder
-}
-
-func (t *Table) parseDimension(str string, colKey, rowKey int) []string {
- var (
- raw []string
- maxWidth int
- )
-
- raw = getLines(str)
- maxWidth = 0
- for _, line := range raw {
- if w := DisplayWidth(line); w > maxWidth {
- maxWidth = w
- }
- }
-
- // If wrapping, ensure that all paragraphs in the cell fit in the
- // specified width.
- if t.autoWrap {
- // If there's a maximum allowed width for wrapping, use that.
- if maxWidth > t.mW {
- maxWidth = t.mW
- }
-
- // In the process of doing so, we need to recompute maxWidth. This
- // is because perhaps a word in the cell is longer than the
- // allowed maximum width in t.mW.
- newMaxWidth := maxWidth
- newRaw := make([]string, 0, len(raw))
-
- if t.reflowText {
- // Make a single paragraph of everything.
- raw = []string{strings.Join(raw, " ")}
- }
- for i, para := range raw {
- paraLines, _ := WrapString(para, maxWidth)
- for _, line := range paraLines {
- if w := DisplayWidth(line); w > newMaxWidth {
- newMaxWidth = w
- }
- }
- if i > 0 {
- newRaw = append(newRaw, " ")
- }
- newRaw = append(newRaw, paraLines...)
- }
- raw = newRaw
- maxWidth = newMaxWidth
- }
-
- // Store the new known maximum width.
- v, ok := t.cs[colKey]
- if !ok || v < maxWidth || v == 0 {
- t.cs[colKey] = maxWidth
- }
-
- // Remember the number of lines for the row printer.
- h := len(raw)
- v, ok = t.rs[rowKey]
-
- if !ok || v < h || v == 0 {
- t.rs[rowKey] = h
- }
- //fmt.Printf("Raw %+v %d\n", raw, len(raw))
- return raw
-}
diff --git a/vendor/github.com/olekukonko/tablewriter/table_test.go b/vendor/github.com/olekukonko/tablewriter/table_test.go
deleted file mode 100644
index 94f7be48..00000000
--- a/vendor/github.com/olekukonko/tablewriter/table_test.go
+++ /dev/null
@@ -1,1093 +0,0 @@
-// Copyright 2014 Oleku Konko All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
-
-// This module is a Table Writer API for the Go Programming Language.
-// The protocols were written in pure Go and works on windows and unix systems
-
-package tablewriter
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "reflect"
- "strings"
- "testing"
-)
-
-func checkEqual(t *testing.T, got, want interface{}, msgs ...interface{}) {
- if !reflect.DeepEqual(got, want) {
- buf := bytes.Buffer{}
- buf.WriteString("got:\n[%v]\nwant:\n[%v]\n")
- for _, v := range msgs {
- buf.WriteString(v.(string))
- }
- t.Errorf(buf.String(), got, want)
- }
-}
-
-func ExampleShort() {
- data := [][]string{
- {"A", "The Good", "500"},
- {"B", "The Very very Bad Man", "288"},
- {"C", "The Ugly", "120"},
- {"D", "The Gopher", "800"},
- }
-
- table := NewWriter(os.Stdout)
- table.SetHeader([]string{"Name", "Sign", "Rating"})
-
- for _, v := range data {
- table.Append(v)
- }
- table.Render()
-
- // Output: +------+-----------------------+--------+
- // | NAME | SIGN | RATING |
- // +------+-----------------------+--------+
- // | A | The Good | 500 |
- // | B | The Very very Bad Man | 288 |
- // | C | The Ugly | 120 |
- // | D | The Gopher | 800 |
- // +------+-----------------------+--------+
-}
-
-func ExampleLong() {
- data := [][]string{
- {"Learn East has computers with adapted keyboards with enlarged print etc", " Some Data ", " Another Data"},
- {"Instead of lining up the letters all ", "the way across, he splits the keyboard in two", "Like most ergonomic keyboards", "See Data"},
- }
-
- table := NewWriter(os.Stdout)
- table.SetHeader([]string{"Name", "Sign", "Rating"})
- table.SetCenterSeparator("*")
- table.SetRowSeparator("=")
-
- for _, v := range data {
- table.Append(v)
- }
- table.Render()
-
- // Output: *================================*================================*===============================*==========*
- // | NAME | SIGN | RATING | |
- // *================================*================================*===============================*==========*
- // | Learn East has computers | Some Data | Another Data |
- // | with adapted keyboards with | | |
- // | enlarged print etc | | |
- // | Instead of lining up the | the way across, he splits the | Like most ergonomic keyboards | See Data |
- // | letters all | keyboard in two | | |
- // *================================*================================*===============================*==========*
-}
-
-func ExampleCSV() {
- table, _ := NewCSV(os.Stdout, "testdata/test.csv", true)
- table.SetCenterSeparator("*")
- table.SetRowSeparator("=")
-
- table.Render()
-
- // Output: *============*===========*=========*
- // | FIRST NAME | LAST NAME | SSN |
- // *============*===========*=========*
- // | John | Barry | 123456 |
- // | Kathy | Smith | 687987 |
- // | Bob | McCornick | 3979870 |
- // *============*===========*=========*
-}
-
-// TestNumLines to test the numbers of lines
-func TestNumLines(t *testing.T) {
- data := [][]string{
- {"A", "The Good", "500"},
- {"B", "The Very very Bad Man", "288"},
- {"C", "The Ugly", "120"},
- {"D", "The Gopher", "800"},
- }
-
- buf := &bytes.Buffer{}
- table := NewWriter(buf)
- table.SetHeader([]string{"Name", "Sign", "Rating"})
-
- for i, v := range data {
- table.Append(v)
- checkEqual(t, table.NumLines(), i+1, "Number of lines failed")
- }
-
- checkEqual(t, table.NumLines(), len(data), "Number of lines failed")
-}
-
-func TestCSVInfo(t *testing.T) {
- buf := &bytes.Buffer{}
- table, err := NewCSV(buf, "testdata/test_info.csv", true)
- if err != nil {
- t.Error(err)
- return
- }
- table.SetAlignment(ALIGN_LEFT)
- table.SetBorder(false)
- table.Render()
-
- got := buf.String()
- want := ` FIELD | TYPE | NULL | KEY | DEFAULT | EXTRA
-+----------+--------------+------+-----+---------+----------------+
- user_id | smallint(5) | NO | PRI | NULL | auto_increment
- username | varchar(10) | NO | | NULL |
- password | varchar(100) | NO | | NULL |
-`
- checkEqual(t, got, want, "CSV info failed")
-}
-
-func TestCSVSeparator(t *testing.T) {
- buf := &bytes.Buffer{}
- table, err := NewCSV(buf, "testdata/test.csv", true)
- if err != nil {
- t.Error(err)
- return
- }
- table.SetRowLine(true)
- table.SetCenterSeparator("+")
- table.SetColumnSeparator("|")
- table.SetRowSeparator("-")
- table.SetAlignment(ALIGN_LEFT)
- table.Render()
-
- want := `+------------+-----------+---------+
-| FIRST NAME | LAST NAME | SSN |
-+------------+-----------+---------+
-| John | Barry | 123456 |
-+------------+-----------+---------+
-| Kathy | Smith | 687987 |
-+------------+-----------+---------+
-| Bob | McCornick | 3979870 |
-+------------+-----------+---------+
-`
-
- checkEqual(t, buf.String(), want, "CSV info failed")
-}
-
-func TestNoBorder(t *testing.T) {
- data := [][]string{
- {"1/1/2014", "Domain name", "2233", "$10.98"},
- {"1/1/2014", "January Hosting", "2233", "$54.95"},
- {"", " (empty)\n (empty)", "", ""},
- {"1/4/2014", "February Hosting", "2233", "$51.00"},
- {"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
- {"1/4/2014", " (Discount)", "2233", "-$1.00"},
- }
-
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetAutoWrapText(false)
- table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
- table.SetFooter([]string{"", "", "Total", "$145.93"}) // Add Footer
- table.SetBorder(false) // Set Border to false
- table.AppendBulk(data) // Add Bulk Data
- table.Render()
-
- want := ` DATE | DESCRIPTION | CV2 | AMOUNT
-+----------+--------------------------+-------+---------+
- 1/1/2014 | Domain name | 2233 | $10.98
- 1/1/2014 | January Hosting | 2233 | $54.95
- | (empty) | |
- | (empty) | |
- 1/4/2014 | February Hosting | 2233 | $51.00
- 1/4/2014 | February Extra Bandwidth | 2233 | $30.00
- 1/4/2014 | (Discount) | 2233 | -$1.00
-+----------+--------------------------+-------+---------+
- TOTAL | $145.93
- +-------+---------+
-`
-
- checkEqual(t, buf.String(), want, "border table rendering failed")
-}
-
-func TestWithBorder(t *testing.T) {
- data := [][]string{
- {"1/1/2014", "Domain name", "2233", "$10.98"},
- {"1/1/2014", "January Hosting", "2233", "$54.95"},
- {"", " (empty)\n (empty)", "", ""},
- {"1/4/2014", "February Hosting", "2233", "$51.00"},
- {"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
- {"1/4/2014", " (Discount)", "2233", "-$1.00"},
- }
-
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetAutoWrapText(false)
- table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
- table.SetFooter([]string{"", "", "Total", "$145.93"}) // Add Footer
- table.AppendBulk(data) // Add Bulk Data
- table.Render()
-
- want := `+----------+--------------------------+-------+---------+
-| DATE | DESCRIPTION | CV2 | AMOUNT |
-+----------+--------------------------+-------+---------+
-| 1/1/2014 | Domain name | 2233 | $10.98 |
-| 1/1/2014 | January Hosting | 2233 | $54.95 |
-| | (empty) | | |
-| | (empty) | | |
-| 1/4/2014 | February Hosting | 2233 | $51.00 |
-| 1/4/2014 | February Extra Bandwidth | 2233 | $30.00 |
-| 1/4/2014 | (Discount) | 2233 | -$1.00 |
-+----------+--------------------------+-------+---------+
-| TOTAL | $145.93 |
-+----------+--------------------------+-------+---------+
-`
-
- checkEqual(t, buf.String(), want, "border table rendering failed")
-}
-
-func TestPrintingInMarkdown(t *testing.T) {
- data := [][]string{
- {"1/1/2014", "Domain name", "2233", "$10.98"},
- {"1/1/2014", "January Hosting", "2233", "$54.95"},
- {"1/4/2014", "February Hosting", "2233", "$51.00"},
- {"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
- }
-
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
- table.AppendBulk(data) // Add Bulk Data
- table.SetBorders(Border{Left: true, Top: false, Right: true, Bottom: false})
- table.SetCenterSeparator("|")
- table.Render()
-
- want := `| DATE | DESCRIPTION | CV2 | AMOUNT |
-|----------|--------------------------|------|--------|
-| 1/1/2014 | Domain name | 2233 | $10.98 |
-| 1/1/2014 | January Hosting | 2233 | $54.95 |
-| 1/4/2014 | February Hosting | 2233 | $51.00 |
-| 1/4/2014 | February Extra Bandwidth | 2233 | $30.00 |
-`
- checkEqual(t, buf.String(), want, "border table rendering failed")
-}
-
-func TestPrintHeading(t *testing.T) {
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetHeader([]string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c"})
- table.printHeading()
- want := `| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C |
-+---+---+---+---+---+---+---+---+---+---+---+---+
-`
- checkEqual(t, buf.String(), want, "header rendering failed")
-}
-
-func TestPrintHeadingWithoutAutoFormat(t *testing.T) {
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetHeader([]string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c"})
- table.SetAutoFormatHeaders(false)
- table.printHeading()
- want := `| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c |
-+---+---+---+---+---+---+---+---+---+---+---+---+
-`
- checkEqual(t, buf.String(), want, "header rendering failed")
-}
-
-func TestPrintFooter(t *testing.T) {
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetHeader([]string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c"})
- table.SetFooter([]string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c"})
- table.printFooter()
- want := `| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C |
-+---+---+---+---+---+---+---+---+---+---+---+---+
-`
- checkEqual(t, buf.String(), want, "footer rendering failed")
-}
-
-func TestPrintFooterWithoutAutoFormat(t *testing.T) {
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetAutoFormatHeaders(false)
- table.SetHeader([]string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c"})
- table.SetFooter([]string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c"})
- table.printFooter()
- want := `| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c |
-+---+---+---+---+---+---+---+---+---+---+---+---+
-`
- checkEqual(t, buf.String(), want, "footer rendering failed")
-}
-
-func TestPrintShortCaption(t *testing.T) {
- var buf bytes.Buffer
- data := [][]string{
- {"A", "The Good", "500"},
- {"B", "The Very very Bad Man", "288"},
- {"C", "The Ugly", "120"},
- {"D", "The Gopher", "800"},
- }
-
- table := NewWriter(&buf)
- table.SetHeader([]string{"Name", "Sign", "Rating"})
- table.SetCaption(true, "Short caption.")
-
- for _, v := range data {
- table.Append(v)
- }
- table.Render()
-
- want := `+------+-----------------------+--------+
-| NAME | SIGN | RATING |
-+------+-----------------------+--------+
-| A | The Good | 500 |
-| B | The Very very Bad Man | 288 |
-| C | The Ugly | 120 |
-| D | The Gopher | 800 |
-+------+-----------------------+--------+
-Short caption.
-`
- checkEqual(t, buf.String(), want, "long caption for short example rendering failed")
-}
-
-func TestPrintLongCaptionWithShortExample(t *testing.T) {
- var buf bytes.Buffer
- data := [][]string{
- {"A", "The Good", "500"},
- {"B", "The Very very Bad Man", "288"},
- {"C", "The Ugly", "120"},
- {"D", "The Gopher", "800"},
- }
-
- table := NewWriter(&buf)
- table.SetHeader([]string{"Name", "Sign", "Rating"})
- table.SetCaption(true, "This is a very long caption. The text should wrap. If not, we have a problem that needs to be solved.")
-
- for _, v := range data {
- table.Append(v)
- }
- table.Render()
-
- want := `+------+-----------------------+--------+
-| NAME | SIGN | RATING |
-+------+-----------------------+--------+
-| A | The Good | 500 |
-| B | The Very very Bad Man | 288 |
-| C | The Ugly | 120 |
-| D | The Gopher | 800 |
-+------+-----------------------+--------+
-This is a very long caption. The text
-should wrap. If not, we have a problem
-that needs to be solved.
-`
- checkEqual(t, buf.String(), want, "long caption for short example rendering failed")
-}
-
-func TestPrintCaptionWithFooter(t *testing.T) {
- data := [][]string{
- {"1/1/2014", "Domain name", "2233", "$10.98"},
- {"1/1/2014", "January Hosting", "2233", "$54.95"},
- {"1/4/2014", "February Hosting", "2233", "$51.00"},
- {"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
- }
-
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
- table.SetFooter([]string{"", "", "Total", "$146.93"}) // Add Footer
- table.SetCaption(true, "This is a very long caption. The text should wrap to the width of the table.") // Add caption
- table.SetBorder(false) // Set Border to false
- table.AppendBulk(data) // Add Bulk Data
- table.Render()
-
- want := ` DATE | DESCRIPTION | CV2 | AMOUNT
-+----------+--------------------------+-------+---------+
- 1/1/2014 | Domain name | 2233 | $10.98
- 1/1/2014 | January Hosting | 2233 | $54.95
- 1/4/2014 | February Hosting | 2233 | $51.00
- 1/4/2014 | February Extra Bandwidth | 2233 | $30.00
-+----------+--------------------------+-------+---------+
- TOTAL | $146.93
- +-------+---------+
-This is a very long caption. The text should wrap to the
-width of the table.
-`
- checkEqual(t, buf.String(), want, "border table rendering failed")
-}
-
-func TestPrintLongCaptionWithLongExample(t *testing.T) {
- var buf bytes.Buffer
- data := [][]string{
- {"Learn East has computers with adapted keyboards with enlarged print etc", "Some Data", "Another Data"},
- {"Instead of lining up the letters all", "the way across, he splits the keyboard in two", "Like most ergonomic keyboards"},
- }
-
- table := NewWriter(&buf)
- table.SetCaption(true, "This is a very long caption. The text should wrap. If not, we have a problem that needs to be solved.")
- table.SetHeader([]string{"Name", "Sign", "Rating"})
-
- for _, v := range data {
- table.Append(v)
- }
- table.Render()
-
- want := `+--------------------------------+--------------------------------+-------------------------------+
-| NAME | SIGN | RATING |
-+--------------------------------+--------------------------------+-------------------------------+
-| Learn East has computers | Some Data | Another Data |
-| with adapted keyboards with | | |
-| enlarged print etc | | |
-| Instead of lining up the | the way across, he splits the | Like most ergonomic keyboards |
-| letters all | keyboard in two | |
-+--------------------------------+--------------------------------+-------------------------------+
-This is a very long caption. The text should wrap. If not, we have a problem that needs to be
-solved.
-`
- checkEqual(t, buf.String(), want, "long caption for long example rendering failed")
-}
-
-func Example_autowrap() {
- var multiline = `A multiline
-string with some lines being really long.`
-
- const (
- testRow = iota
- testHeader
- testFooter
- testFooter2
- )
- for mode := testRow; mode <= testFooter2; mode++ {
- for _, autoFmt := range []bool{false, true} {
- if mode == testRow && autoFmt {
- // Nothing special to test, skip
- continue
- }
- for _, autoWrap := range []bool{false, true} {
- for _, reflow := range []bool{false, true} {
- if !autoWrap && reflow {
- // Invalid configuration, skip
- continue
- }
- fmt.Println("mode", mode, "autoFmt", autoFmt, "autoWrap", autoWrap, "reflow", reflow)
- t := NewWriter(os.Stdout)
- t.SetAutoFormatHeaders(autoFmt)
- t.SetAutoWrapText(autoWrap)
- t.SetReflowDuringAutoWrap(reflow)
- if mode == testHeader {
- t.SetHeader([]string{"woo", multiline})
- } else {
- t.SetHeader([]string{"woo", "waa"})
- }
- if mode == testRow {
- t.Append([]string{"woo", multiline})
- } else {
- t.Append([]string{"woo", "waa"})
- }
- if mode == testFooter {
- t.SetFooter([]string{"woo", multiline})
- } else if mode == testFooter2 {
- t.SetFooter([]string{"", multiline})
- } else {
- t.SetFooter([]string{"woo", "waa"})
- }
- t.Render()
- }
- }
- }
- fmt.Println()
- }
-
- // Output:
- // mode 0 autoFmt false autoWrap false reflow false
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | woo | A multiline |
- // | | string with some lines being really long. |
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // mode 0 autoFmt false autoWrap true reflow false
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | A multiline |
- // | | |
- // | | string with some lines being |
- // | | really long. |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // mode 0 autoFmt false autoWrap true reflow true
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | A multiline string with some |
- // | | lines being really long. |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- //
- // mode 1 autoFmt false autoWrap false reflow false
- // +-----+-------------------------------------------+
- // | woo | A multiline |
- // | | string with some lines being really long. |
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // mode 1 autoFmt false autoWrap true reflow false
- // +-----+--------------------------------+
- // | woo | A multiline |
- // | | |
- // | | string with some lines being |
- // | | really long. |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // mode 1 autoFmt false autoWrap true reflow true
- // +-----+--------------------------------+
- // | woo | A multiline string with some |
- // | | lines being really long. |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // mode 1 autoFmt true autoWrap false reflow false
- // +-----+-------------------------------------------+
- // | WOO | A MULTILINE |
- // | | STRING WITH SOME LINES BEING REALLY LONG |
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | WOO | WAA |
- // +-----+-------------------------------------------+
- // mode 1 autoFmt true autoWrap true reflow false
- // +-----+--------------------------------+
- // | WOO | A MULTILINE |
- // | | |
- // | | STRING WITH SOME LINES BEING |
- // | | REALLY LONG |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | WOO | WAA |
- // +-----+--------------------------------+
- // mode 1 autoFmt true autoWrap true reflow true
- // +-----+--------------------------------+
- // | WOO | A MULTILINE STRING WITH SOME |
- // | | LINES BEING REALLY LONG |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | WOO | WAA |
- // +-----+--------------------------------+
- //
- // mode 2 autoFmt false autoWrap false reflow false
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | woo | A multiline |
- // | | string with some lines being really long. |
- // +-----+-------------------------------------------+
- // mode 2 autoFmt false autoWrap true reflow false
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | A multiline |
- // | | |
- // | | string with some lines being |
- // | | really long. |
- // +-----+--------------------------------+
- // mode 2 autoFmt false autoWrap true reflow true
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | A multiline string with some |
- // | | lines being really long. |
- // +-----+--------------------------------+
- // mode 2 autoFmt true autoWrap false reflow false
- // +-----+-------------------------------------------+
- // | WOO | WAA |
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | WOO | A MULTILINE |
- // | | STRING WITH SOME LINES BEING REALLY LONG |
- // +-----+-------------------------------------------+
- // mode 2 autoFmt true autoWrap true reflow false
- // +-----+--------------------------------+
- // | WOO | WAA |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | WOO | A MULTILINE |
- // | | |
- // | | STRING WITH SOME LINES BEING |
- // | | REALLY LONG |
- // +-----+--------------------------------+
- // mode 2 autoFmt true autoWrap true reflow true
- // +-----+--------------------------------+
- // | WOO | WAA |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | WOO | A MULTILINE STRING WITH SOME |
- // | | LINES BEING REALLY LONG |
- // +-----+--------------------------------+
- //
- // mode 3 autoFmt false autoWrap false reflow false
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | A multiline |
- // | string with some lines being really long. |
- // +-----+-------------------------------------------+
- // mode 3 autoFmt false autoWrap true reflow false
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | A multiline |
- // | |
- // | string with some lines being |
- // | really long. |
- // +-----+--------------------------------+
- // mode 3 autoFmt false autoWrap true reflow true
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | A multiline string with some |
- // | lines being really long. |
- // +-----+--------------------------------+
- // mode 3 autoFmt true autoWrap false reflow false
- // +-----+-------------------------------------------+
- // | WOO | WAA |
- // +-----+-------------------------------------------+
- // | woo | waa |
- // +-----+-------------------------------------------+
- // | A MULTILINE |
- // | STRING WITH SOME LINES BEING REALLY LONG |
- // +-----+-------------------------------------------+
- // mode 3 autoFmt true autoWrap true reflow false
- // +-----+--------------------------------+
- // | WOO | WAA |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | A MULTILINE |
- // | |
- // | STRING WITH SOME LINES BEING |
- // | REALLY LONG |
- // +-----+--------------------------------+
- // mode 3 autoFmt true autoWrap true reflow true
- // +-----+--------------------------------+
- // | WOO | WAA |
- // +-----+--------------------------------+
- // | woo | waa |
- // +-----+--------------------------------+
- // | A MULTILINE STRING WITH SOME |
- // | LINES BEING REALLY LONG |
- // +-----+--------------------------------+
-}
-
-func TestPrintLine(t *testing.T) {
- header := make([]string, 12)
- val := " "
- want := ""
- for i := range header {
- header[i] = val
- want = fmt.Sprintf("%s+-%s-", want, strings.Replace(val, " ", "-", -1))
- val = val + " "
- }
- want = want + "+"
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetHeader(header)
- table.printLine(false)
- checkEqual(t, buf.String(), want, "line rendering failed")
-}
-
-func TestAnsiStrip(t *testing.T) {
- header := make([]string, 12)
- val := " "
- want := ""
- for i := range header {
- header[i] = "\033[43;30m" + val + "\033[00m"
- want = fmt.Sprintf("%s+-%s-", want, strings.Replace(val, " ", "-", -1))
- val = val + " "
- }
- want = want + "+"
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetHeader(header)
- table.printLine(false)
- checkEqual(t, buf.String(), want, "line rendering failed")
-}
-
-func NewCustomizedTable(out io.Writer) *Table {
- table := NewWriter(out)
- table.SetCenterSeparator("")
- table.SetColumnSeparator("")
- table.SetRowSeparator("")
- table.SetBorder(false)
- table.SetAlignment(ALIGN_LEFT)
- table.SetHeader([]string{})
- return table
-}
-
-func TestSubclass(t *testing.T) {
- buf := new(bytes.Buffer)
- table := NewCustomizedTable(buf)
-
- data := [][]string{
- {"A", "The Good", "500"},
- {"B", "The Very very Bad Man", "288"},
- {"C", "The Ugly", "120"},
- {"D", "The Gopher", "800"},
- }
-
- for _, v := range data {
- table.Append(v)
- }
- table.Render()
-
- want := ` A The Good 500
- B The Very very Bad Man 288
- C The Ugly 120
- D The Gopher 800
-`
- checkEqual(t, buf.String(), want, "test subclass failed")
-}
-
-func TestAutoMergeRows(t *testing.T) {
- data := [][]string{
- {"A", "The Good", "500"},
- {"A", "The Very very Bad Man", "288"},
- {"B", "The Very very Bad Man", "120"},
- {"B", "The Very very Bad Man", "200"},
- }
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetHeader([]string{"Name", "Sign", "Rating"})
-
- for _, v := range data {
- table.Append(v)
- }
- table.SetAutoMergeCells(true)
- table.Render()
- want := `+------+-----------------------+--------+
-| NAME | SIGN | RATING |
-+------+-----------------------+--------+
-| A | The Good | 500 |
-| | The Very very Bad Man | 288 |
-| B | | 120 |
-| | | 200 |
-+------+-----------------------+--------+
-`
- got := buf.String()
- if got != want {
- t.Errorf("\ngot:\n%s\nwant:\n%s\n", got, want)
- }
-
- buf.Reset()
- table = NewWriter(&buf)
- table.SetHeader([]string{"Name", "Sign", "Rating"})
-
- for _, v := range data {
- table.Append(v)
- }
- table.SetAutoMergeCells(true)
- table.SetRowLine(true)
- table.Render()
- want = `+------+-----------------------+--------+
-| NAME | SIGN | RATING |
-+------+-----------------------+--------+
-| A | The Good | 500 |
-+ +-----------------------+--------+
-| | The Very very Bad Man | 288 |
-+------+ +--------+
-| B | | 120 |
-+ + +--------+
-| | | 200 |
-+------+-----------------------+--------+
-`
- checkEqual(t, buf.String(), want)
-
- buf.Reset()
- table = NewWriter(&buf)
- table.SetHeader([]string{"Name", "Sign", "Rating"})
-
- dataWithlongText := [][]string{
- {"A", "The Good", "500"},
- {"A", "The Very very very very very Bad Man", "288"},
- {"B", "The Very very very very very Bad Man", "120"},
- {"C", "The Very very Bad Man", "200"},
- }
- table.AppendBulk(dataWithlongText)
- table.SetAutoMergeCells(true)
- table.SetRowLine(true)
- table.Render()
- want = `+------+--------------------------------+--------+
-| NAME | SIGN | RATING |
-+------+--------------------------------+--------+
-| A | The Good | 500 |
-+------+--------------------------------+--------+
-| A | The Very very very very very | 288 |
-| | Bad Man | |
-+------+ +--------+
-| B | | 120 |
-| | | |
-+------+--------------------------------+--------+
-| C | The Very very Bad Man | 200 |
-+------+--------------------------------+--------+
-`
- checkEqual(t, buf.String(), want)
-}
-
-func TestClearRows(t *testing.T) {
- data := [][]string{
- {"1/1/2014", "Domain name", "2233", "$10.98"},
- }
-
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetAutoWrapText(false)
- table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
- table.SetFooter([]string{"", "", "Total", "$145.93"}) // Add Footer
- table.AppendBulk(data) // Add Bulk Data
- table.Render()
-
- originalWant := `+----------+-------------+-------+---------+
-| DATE | DESCRIPTION | CV2 | AMOUNT |
-+----------+-------------+-------+---------+
-| 1/1/2014 | Domain name | 2233 | $10.98 |
-+----------+-------------+-------+---------+
-| TOTAL | $145.93 |
-+----------+-------------+-------+---------+
-`
- want := originalWant
-
- checkEqual(t, buf.String(), want, "table clear rows failed")
-
- buf.Reset()
- table.ClearRows()
- table.Render()
-
- want = `+----------+-------------+-------+---------+
-| DATE | DESCRIPTION | CV2 | AMOUNT |
-+----------+-------------+-------+---------+
-+----------+-------------+-------+---------+
-| TOTAL | $145.93 |
-+----------+-------------+-------+---------+
-`
-
- checkEqual(t, buf.String(), want, "table clear rows failed")
-
- buf.Reset()
- table.AppendBulk(data) // Add Bulk Data
- table.Render()
-
- want = `+----------+-------------+-------+---------+
-| DATE | DESCRIPTION | CV2 | AMOUNT |
-+----------+-------------+-------+---------+
-| 1/1/2014 | Domain name | 2233 | $10.98 |
-+----------+-------------+-------+---------+
-| TOTAL | $145.93 |
-+----------+-------------+-------+---------+
-`
-
- checkEqual(t, buf.String(), want, "table clear rows failed")
-}
-
-func TestClearFooters(t *testing.T) {
- data := [][]string{
- {"1/1/2014", "Domain name", "2233", "$10.98"},
- }
-
- var buf bytes.Buffer
- table := NewWriter(&buf)
- table.SetAutoWrapText(false)
- table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
- table.SetFooter([]string{"", "", "Total", "$145.93"}) // Add Footer
- table.AppendBulk(data) // Add Bulk Data
- table.Render()
-
- buf.Reset()
- table.ClearFooter()
- table.Render()
-
- want := `+----------+-------------+-------+---------+
-| DATE | DESCRIPTION | CV2 | AMOUNT |
-+----------+-------------+-------+---------+
-| 1/1/2014 | Domain name | 2233 | $10.98 |
-+----------+-------------+-------+---------+
-`
-
- checkEqual(t, buf.String(), want)
-}
-
-func TestMoreDataColumnsThanHeaders(t *testing.T) {
- var (
- buf = &bytes.Buffer{}
- table = NewWriter(buf)
- header = []string{"A", "B", "C"}
- data = [][]string{
- {"a", "b", "c", "d"},
- {"1", "2", "3", "4"},
- }
- want = `+---+---+---+---+
-| A | B | C | |
-+---+---+---+---+
-| a | b | c | d |
-| 1 | 2 | 3 | 4 |
-+---+---+---+---+
-`
- )
- table.SetHeader(header)
- // table.SetFooter(ctx.tableCtx.footer)
- table.AppendBulk(data)
- table.Render()
-
- checkEqual(t, buf.String(), want)
-}
-
-func TestMoreFooterColumnsThanHeaders(t *testing.T) {
- var (
- buf = &bytes.Buffer{}
- table = NewWriter(buf)
- header = []string{"A", "B", "C"}
- data = [][]string{
- {"a", "b", "c", "d"},
- {"1", "2", "3", "4"},
- }
- footer = []string{"a", "b", "c", "d", "e"}
- want = `+---+---+---+---+---+
-| A | B | C | | |
-+---+---+---+---+---+
-| a | b | c | d |
-| 1 | 2 | 3 | 4 |
-+---+---+---+---+---+
-| A | B | C | D | E |
-+---+---+---+---+---+
-`
- )
- table.SetHeader(header)
- table.SetFooter(footer)
- table.AppendBulk(data)
- table.Render()
-
- checkEqual(t, buf.String(), want)
-}
-
-func TestSetColMinWidth(t *testing.T) {
- var (
- buf = &bytes.Buffer{}
- table = NewWriter(buf)
- header = []string{"AAA", "BBB", "CCC"}
- data = [][]string{
- {"a", "b", "c"},
- {"1", "2", "3"},
- }
- footer = []string{"a", "b", "cccc"}
- want = `+-----+-----+-------+
-| AAA | BBB | CCC |
-+-----+-----+-------+
-| a | b | c |
-| 1 | 2 | 3 |
-+-----+-----+-------+
-| A | B | CCCC |
-+-----+-----+-------+
-`
- )
- table.SetHeader(header)
- table.SetFooter(footer)
- table.AppendBulk(data)
- table.SetColMinWidth(2, 5)
- table.Render()
-
- checkEqual(t, buf.String(), want)
-}
-
-func TestWrapString(t *testing.T) {
- want := []string{"ああああああああああああああああああああああああ", "あああああああ"}
- got, _ := WrapString("ああああああああああああああああああああああああ あああああああ", 55)
- checkEqual(t, got, want)
-}
-
-func TestCustomAlign(t *testing.T) {
- var (
- buf = &bytes.Buffer{}
- table = NewWriter(buf)
- header = []string{"AAA", "BBB", "CCC"}
- data = [][]string{
- {"a", "b", "c"},
- {"1", "2", "3"},
- }
- footer = []string{"a", "b", "cccc"}
- want = `+-----+-----+-------+
-| AAA | BBB | CCC |
-+-----+-----+-------+
-| a | b | c |
-| 1 | 2 | 3 |
-+-----+-----+-------+
-| A | B | CCCC |
-+-----+-----+-------+
-`
- )
- table.SetHeader(header)
- table.SetFooter(footer)
- table.AppendBulk(data)
- table.SetColMinWidth(2, 5)
- table.SetColumnAlignment([]int{ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT})
- table.Render()
-
- checkEqual(t, buf.String(), want)
-}
-
-func TestTitle(t *testing.T) {
- ts := []struct {
- text string
- want string
- }{
- {"", ""},
- {"foo", "FOO"},
- {"Foo", "FOO"},
- {"foO", "FOO"},
- {".foo", "FOO"},
- {"foo.", "FOO"},
- {".foo.", "FOO"},
- {".foo.bar.", "FOO BAR"},
- {"_foo", "FOO"},
- {"foo_", "FOO"},
- {"_foo_", "FOO"},
- {"_foo_bar_", "FOO BAR"},
- {" foo", "FOO"},
- {"foo ", "FOO"},
- {" foo ", "FOO"},
- {" foo bar ", "FOO BAR"},
- {"0.1", "0.1"},
- {"FOO 0.1", "FOO 0.1"},
- {".1 0.1", ".1 0.1"},
- {"1. 0.1", "1. 0.1"},
- {"1. 0.", "1. 0."},
- {".1. 0.", ".1. 0."},
- {".$ . $.", "$ . $"},
- {".$. $.", "$ $"},
- }
- for _, tt := range ts {
- got := Title(tt.text)
- if got != tt.want {
- t.Errorf("want %q, bot got %q", tt.want, got)
- }
- }
-}
diff --git a/vendor/github.com/olekukonko/tablewriter/table_with_color.go b/vendor/github.com/olekukonko/tablewriter/table_with_color.go
deleted file mode 100644
index 5a4a53ec..00000000
--- a/vendor/github.com/olekukonko/tablewriter/table_with_color.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package tablewriter
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-const ESC = "\033"
-const SEP = ";"
-
-const (
- BgBlackColor int = iota + 40
- BgRedColor
- BgGreenColor
- BgYellowColor
- BgBlueColor
- BgMagentaColor
- BgCyanColor
- BgWhiteColor
-)
-
-const (
- FgBlackColor int = iota + 30
- FgRedColor
- FgGreenColor
- FgYellowColor
- FgBlueColor
- FgMagentaColor
- FgCyanColor
- FgWhiteColor
-)
-
-const (
- BgHiBlackColor int = iota + 100
- BgHiRedColor
- BgHiGreenColor
- BgHiYellowColor
- BgHiBlueColor
- BgHiMagentaColor
- BgHiCyanColor
- BgHiWhiteColor
-)
-
-const (
- FgHiBlackColor int = iota + 90
- FgHiRedColor
- FgHiGreenColor
- FgHiYellowColor
- FgHiBlueColor
- FgHiMagentaColor
- FgHiCyanColor
- FgHiWhiteColor
-)
-
-const (
- Normal = 0
- Bold = 1
- UnderlineSingle = 4
- Italic
-)
-
-type Colors []int
-
-func startFormat(seq string) string {
- return fmt.Sprintf("%s[%sm", ESC, seq)
-}
-
-func stopFormat() string {
- return fmt.Sprintf("%s[%dm", ESC, Normal)
-}
-
-// Making the SGR (Select Graphic Rendition) sequence.
-func makeSequence(codes []int) string {
- codesInString := []string{}
- for _, code := range codes {
- codesInString = append(codesInString, strconv.Itoa(code))
- }
- return strings.Join(codesInString, SEP)
-}
-
-// Adding ANSI escape sequences before and after string
-func format(s string, codes interface{}) string {
- var seq string
-
- switch v := codes.(type) {
-
- case string:
- seq = v
- case []int:
- seq = makeSequence(v)
- default:
- return s
- }
-
- if len(seq) == 0 {
- return s
- }
- return startFormat(seq) + s + stopFormat()
-}
-
-// Adding header colors (ANSI codes)
-func (t *Table) SetHeaderColor(colors ...Colors) {
- if t.colSize != len(colors) {
- panic("Number of header colors must be equal to number of headers.")
- }
- for i := 0; i < len(colors); i++ {
- t.headerParams = append(t.headerParams, makeSequence(colors[i]))
- }
-}
-
-// Adding column colors (ANSI codes)
-func (t *Table) SetColumnColor(colors ...Colors) {
- if t.colSize != len(colors) {
- panic("Number of column colors must be equal to number of headers.")
- }
- for i := 0; i < len(colors); i++ {
- t.columnsParams = append(t.columnsParams, makeSequence(colors[i]))
- }
-}
-
-// Adding column colors (ANSI codes)
-func (t *Table) SetFooterColor(colors ...Colors) {
- if len(t.footers) != len(colors) {
- panic("Number of footer colors must be equal to number of footer.")
- }
- for i := 0; i < len(colors); i++ {
- t.footerParams = append(t.footerParams, makeSequence(colors[i]))
- }
-}
-
-func Color(colors ...int) []int {
- return colors
-}
diff --git a/vendor/github.com/olekukonko/tablewriter/testdata/test.csv b/vendor/github.com/olekukonko/tablewriter/testdata/test.csv
deleted file mode 100644
index 1609327e..00000000
--- a/vendor/github.com/olekukonko/tablewriter/testdata/test.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-first_name,last_name,ssn
-John,Barry,123456
-Kathy,Smith,687987
-Bob,McCornick,3979870
\ No newline at end of file
diff --git a/vendor/github.com/olekukonko/tablewriter/testdata/test_info.csv b/vendor/github.com/olekukonko/tablewriter/testdata/test_info.csv
deleted file mode 100644
index e4c40e98..00000000
--- a/vendor/github.com/olekukonko/tablewriter/testdata/test_info.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-Field,Type,Null,Key,Default,Extra
-user_id,smallint(5),NO,PRI,NULL,auto_increment
-username,varchar(10),NO,,NULL,
-password,varchar(100),NO,,NULL,
\ No newline at end of file
diff --git a/vendor/github.com/olekukonko/tablewriter/util.go b/vendor/github.com/olekukonko/tablewriter/util.go
deleted file mode 100644
index 9e8f0cbb..00000000
--- a/vendor/github.com/olekukonko/tablewriter/util.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2014 Oleku Konko All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
-
-// This module is a Table Writer API for the Go Programming Language.
-// The protocols were written in pure Go and works on windows and unix systems
-
-package tablewriter
-
-import (
- "math"
- "regexp"
- "strings"
-
- "github.com/mattn/go-runewidth"
-)
-
-var ansi = regexp.MustCompile("\033\\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]")
-
-func DisplayWidth(str string) int {
- return runewidth.StringWidth(ansi.ReplaceAllLiteralString(str, ""))
-}
-
-// Simple Condition for string
-// Returns value based on condition
-func ConditionString(cond bool, valid, inValid string) string {
- if cond {
- return valid
- }
- return inValid
-}
-
-func isNumOrSpace(r rune) bool {
- return ('0' <= r && r <= '9') || r == ' '
-}
-
-// Format Table Header
-// Replace _ , . and spaces
-func Title(name string) string {
- origLen := len(name)
- rs := []rune(name)
- for i, r := range rs {
- switch r {
- case '_':
- rs[i] = ' '
- case '.':
- // ignore floating number 0.0
- if (i != 0 && !isNumOrSpace(rs[i-1])) || (i != len(rs)-1 && !isNumOrSpace(rs[i+1])) {
- rs[i] = ' '
- }
- }
- }
- name = string(rs)
- name = strings.TrimSpace(name)
- if len(name) == 0 && origLen > 0 {
- // Keep at least one character. This is important to preserve
- // empty lines in multi-line headers/footers.
- name = " "
- }
- return strings.ToUpper(name)
-}
-
-// Pad String
-// Attempts to play string in the center
-func Pad(s, pad string, width int) string {
- gap := width - DisplayWidth(s)
- if gap > 0 {
- gapLeft := int(math.Ceil(float64(gap / 2)))
- gapRight := gap - gapLeft
- return strings.Repeat(string(pad), gapLeft) + s + strings.Repeat(string(pad), gapRight)
- }
- return s
-}
-
-// Pad String Right position
-// This would pace string at the left side fo the screen
-func PadRight(s, pad string, width int) string {
- gap := width - DisplayWidth(s)
- if gap > 0 {
- return s + strings.Repeat(string(pad), gap)
- }
- return s
-}
-
-// Pad String Left position
-// This would pace string at the right side fo the screen
-func PadLeft(s, pad string, width int) string {
- gap := width - DisplayWidth(s)
- if gap > 0 {
- return strings.Repeat(string(pad), gap) + s
- }
- return s
-}
diff --git a/vendor/github.com/olekukonko/tablewriter/wrap.go b/vendor/github.com/olekukonko/tablewriter/wrap.go
deleted file mode 100644
index a092ee1f..00000000
--- a/vendor/github.com/olekukonko/tablewriter/wrap.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2014 Oleku Konko All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
-
-// This module is a Table Writer API for the Go Programming Language.
-// The protocols were written in pure Go and works on windows and unix systems
-
-package tablewriter
-
-import (
- "math"
- "strings"
-
- "github.com/mattn/go-runewidth"
-)
-
-var (
- nl = "\n"
- sp = " "
-)
-
-const defaultPenalty = 1e5
-
-// Wrap wraps s into a paragraph of lines of length lim, with minimal
-// raggedness.
-func WrapString(s string, lim int) ([]string, int) {
- words := strings.Split(strings.Replace(s, nl, sp, -1), sp)
- var lines []string
- max := 0
- for _, v := range words {
- max = runewidth.StringWidth(v)
- if max > lim {
- lim = max
- }
- }
- for _, line := range WrapWords(words, 1, lim, defaultPenalty) {
- lines = append(lines, strings.Join(line, sp))
- }
- return lines, lim
-}
-
-// WrapWords is the low-level line-breaking algorithm, useful if you need more
-// control over the details of the text wrapping process. For most uses,
-// WrapString will be sufficient and more convenient.
-//
-// WrapWords splits a list of words into lines with minimal "raggedness",
-// treating each rune as one unit, accounting for spc units between adjacent
-// words on each line, and attempting to limit lines to lim units. Raggedness
-// is the total error over all lines, where error is the square of the
-// difference of the length of the line and lim. Too-long lines (which only
-// happen when a single word is longer than lim units) have pen penalty units
-// added to the error.
-func WrapWords(words []string, spc, lim, pen int) [][]string {
- n := len(words)
-
- length := make([][]int, n)
- for i := 0; i < n; i++ {
- length[i] = make([]int, n)
- length[i][i] = runewidth.StringWidth(words[i])
- for j := i + 1; j < n; j++ {
- length[i][j] = length[i][j-1] + spc + runewidth.StringWidth(words[j])
- }
- }
- nbrk := make([]int, n)
- cost := make([]int, n)
- for i := range cost {
- cost[i] = math.MaxInt32
- }
- for i := n - 1; i >= 0; i-- {
- if length[i][n-1] <= lim {
- cost[i] = 0
- nbrk[i] = n
- } else {
- for j := i + 1; j < n; j++ {
- d := lim - length[i][j-1]
- c := d*d + cost[j]
- if length[i][j-1] > lim {
- c += pen // too-long lines get a worse penalty
- }
- if c < cost[i] {
- cost[i] = c
- nbrk[i] = j
- }
- }
- }
- }
- var lines [][]string
- i := 0
- for i < n {
- lines = append(lines, words[i:nbrk[i]])
- i = nbrk[i]
- }
- return lines
-}
-
-// getLines decomposes a multiline string into a slice of strings.
-func getLines(s string) []string {
- return strings.Split(s, nl)
-}
diff --git a/vendor/github.com/olekukonko/tablewriter/wrap_test.go b/vendor/github.com/olekukonko/tablewriter/wrap_test.go
deleted file mode 100644
index a03f9fc2..00000000
--- a/vendor/github.com/olekukonko/tablewriter/wrap_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 Oleku Konko All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
-
-// This module is a Table Writer API for the Go Programming Language.
-// The protocols were written in pure Go and works on windows and unix systems
-
-package tablewriter
-
-import (
- "strings"
- "testing"
-
- "github.com/mattn/go-runewidth"
-)
-
-var text = "The quick brown fox jumps over the lazy dog."
-
-func TestWrap(t *testing.T) {
- exp := []string{
- "The", "quick", "brown", "fox",
- "jumps", "over", "the", "lazy", "dog."}
-
- got, _ := WrapString(text, 6)
- checkEqual(t, len(got), len(exp))
-}
-
-func TestWrapOneLine(t *testing.T) {
- exp := "The quick brown fox jumps over the lazy dog."
- words, _ := WrapString(text, 500)
- checkEqual(t, strings.Join(words, string(sp)), exp)
-
-}
-
-func TestUnicode(t *testing.T) {
- input := "Česká řeřicha"
- var wordsUnicode []string
- if runewidth.IsEastAsian() {
- wordsUnicode, _ = WrapString(input, 14)
- } else {
- wordsUnicode, _ = WrapString(input, 13)
- }
- // input contains 13 (or 14 for CJK) runes, so it fits on one line.
- checkEqual(t, len(wordsUnicode), 1)
-}
-
-func TestDisplayWidth(t *testing.T) {
- input := "Česká řeřicha"
- want := 13
- if runewidth.IsEastAsian() {
- want = 14
- }
- if n := DisplayWidth(input); n != want {
- t.Errorf("Wants: %d Got: %d", want, n)
- }
- input = "\033[43;30m" + input + "\033[00m"
- checkEqual(t, DisplayWidth(input), want)
-}
diff --git a/vendor/github.com/packethost/packngo/.drone.yml b/vendor/github.com/packethost/packngo/.drone.yml
deleted file mode 100644
index 88ac5fd0..00000000
--- a/vendor/github.com/packethost/packngo/.drone.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-workspace:
- base: /go
- path: src/github.com/packethost/packngo
-
-pipeline:
- lint:
- image: golang:1.9
- commands:
- - go get -v -u github.com/alecthomas/gometalinter
- - gometalinter --install
- - go get -v -t ./...
- - |
- gometalinter --disable=gas ./... || :
- - |
- gometalinter --disable-all --enable=gas ./... || :
- - |
- gofmt -d . | (! grep '.') || ok=false
- - if ! $ok; then exit 1; fi
-
- build:
- image: golang:1.9
- commands:
- - go build -i -v ./...
-
- test:
- image: golang:1.9
- commands:
- - go test ./...
diff --git a/vendor/github.com/packethost/packngo/.gitignore b/vendor/github.com/packethost/packngo/.gitignore
deleted file mode 100644
index 844259c4..00000000
--- a/vendor/github.com/packethost/packngo/.gitignore
+++ /dev/null
@@ -1,28 +0,0 @@
-### Go template
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-
-# idea
-.idea**/**
diff --git a/vendor/github.com/packethost/packngo/CHANGELOG.md b/vendor/github.com/packethost/packngo/CHANGELOG.md
deleted file mode 100644
index 34e5d311..00000000
--- a/vendor/github.com/packethost/packngo/CHANGELOG.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# Changelog
-All notable changes to this project will be documented in this file.
-
-The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
-This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
-
-## [Unreleased]
-
-This release contains a bunch of fixes to the package api after some more real
-world use. There a few breaks in backwards compatibility, but we are tying to
-minimize them and move towards a 1.0 release.
-
-### Added
-- "acceptance" tests which run against production api (will incur charges)
-- HardwareReservation to Device
-- RootPassword to Device
-- Spot market support
-- Management and Manageable fields to discern between Elastic IPs and device unique IP
-- Support for Volume attachments to Device and Volume
-- Support for ProvisionEvents
-- DoRequest sugar to Client
-- Add ListProject function to the SSHKeys interface
-- Operations for switching between Network Modes, aka "L2 support"
- Support for Organization, Payment Method and Billing address resources
-
-### Fixed
-- User.Emails json tag is fixed to match api response
-- Single error object api response is now handled correctly
-
-### Changed
-- IPService was split to DeviceIPService and ProjectIPService
-- Renamed Device.IPXEScriptUrl -> Device.IPXEScriptURL
-- Renamed DeviceCreateRequest.HostName -> DeviceCreateRequest.Hostname
-- Renamed DeviceCreateRequest.IPXEScriptUrl -> DeviceCreateRequest.IPXEScriptURL
-- Renamed DeviceUpdateRequest.HostName -> DeviceUpdateRequest.Hostname
-- Renamed DeviceUpdateRequest.IPXEScriptUrl -> DeviceUpdateRequest.IPXEScriptURL
-- Sync with packet.net api change to /projects/{id}/ips which no longer returns
- the address in CIDR form
-- Removed package level exported functions that should have never existed
-
-## [0.1.0] - 2017-08-17
-
-Initial release, supports most of the api for interacting with:
-
-- Plans
-- Users
-- Emails
-- SSH Keys
-- Devices
-- Projects
-- Facilities
-- Operating Systems
-- IP Reservations
-- Volumes
diff --git a/vendor/github.com/packethost/packngo/LICENSE.txt b/vendor/github.com/packethost/packngo/LICENSE.txt
deleted file mode 100644
index 57c50110..00000000
--- a/vendor/github.com/packethost/packngo/LICENSE.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-Copyright (c) 2014 The packngo AUTHORS. All rights reserved.
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 SOFTWARE.
-
-======================
-Portions of the client are based on code at:
-https://github.com/google/go-github/ and
-https://github.com/digitalocean/godo
-
-Copyright (c) 2013 The go-github AUTHORS. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/vendor/github.com/packethost/packngo/README.md b/vendor/github.com/packethost/packngo/README.md
deleted file mode 100644
index a63faf5a..00000000
--- a/vendor/github.com/packethost/packngo/README.md
+++ /dev/null
@@ -1,72 +0,0 @@
-# packngo
-Packet Go Api Client
-
-![](https://www.packet.net/media/images/xeiw-packettwitterprofilew.png)
-
-
-Installation
-------------
-
-`go get github.com/packethost/packngo`
-
-Usage
------
-
-To authenticate to the Packet API, you must have your API token exported in env var `PACKET_API_TOKEN`.
-
-This code snippet initializes Packet API client, and lists your Projects:
-
-```go
-package main
-
-import (
- "log"
-
- "github.com/packethost/packngo"
-)
-
-func main() {
- c, err := packngo.NewClient()
- if err != nil {
- log.Fatal(err)
- }
-
- ps, _, err := c.Projects.List(nil)
- if err != nil {
- log.Fatal(err)
- }
- for _, p := range ps {
- log.Println(p.ID, p.Name)
- }
-}
-
-```
-
-This lib is used by the official [terraform-provider-packet](https://github.com/terraform-providers/terraform-provider-packet).
-
-You can also learn a lot from the `*_test.go` sources. Almost all out tests touch the Packet API, so you can see how auth, querying and POSTing works. For example [devices_test.go](devices_test.go).
-
-
-
-Acceptance Tests
-----------------
-
-If you want to run tests against the actual Packet API, you must set envvar `PACKET_TEST_ACTUAL_API` to non-empty string for the `go test`. The device tests wait for the device creation, so it's best to run a few in parallel.
-
-To run a particular test, you can do
-
-```
-$ PACKNGO_TEST_ACTUAL_API=1 go test -v -run=TestAccDeviceBasic
-```
-
-If you want to see HTTP requests, set the `PACKNGO_DEBUG` env var to non-empty string, for example:
-
-```
-$ PACKNGO_DEBUG=1 PACKNGO_TEST_ACTUAL_API=1 go test -v -run=TestAccVolumeUpdate
-```
-
-
-Committing
-----------
-
-Before committing, it's a good idea to run `gofmt -w *.go`. ([gofmt](https://golang.org/cmd/gofmt/))
diff --git a/vendor/github.com/packethost/packngo/billing_address.go b/vendor/github.com/packethost/packngo/billing_address.go
deleted file mode 100644
index 93255b32..00000000
--- a/vendor/github.com/packethost/packngo/billing_address.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package packngo
-
-type BillingAddress struct {
- StreetAddress string `json:"street_address,omitempty"`
- PostalCode string `json:"postal_code,omitempty"`
- CountryCode string `json:"country_code_alpha2,omitempty"`
-}
diff --git a/vendor/github.com/packethost/packngo/devices.go b/vendor/github.com/packethost/packngo/devices.go
deleted file mode 100644
index ac77efc8..00000000
--- a/vendor/github.com/packethost/packngo/devices.go
+++ /dev/null
@@ -1,254 +0,0 @@
-package packngo
-
-import (
- "fmt"
- "strings"
-)
-
-const deviceBasePath = "/devices"
-
-// DeviceService interface defines available device methods
-type DeviceService interface {
- List(ProjectID string, listOpt *ListOptions) ([]Device, *Response, error)
- Get(string) (*Device, *Response, error)
- GetExtra(deviceID string, includes, excludes []string) (*Device, *Response, error)
- Create(*DeviceCreateRequest) (*Device, *Response, error)
- Update(string, *DeviceUpdateRequest) (*Device, *Response, error)
- Delete(string) (*Response, error)
- Reboot(string) (*Response, error)
- PowerOff(string) (*Response, error)
- PowerOn(string) (*Response, error)
- Lock(string) (*Response, error)
- Unlock(string) (*Response, error)
- ListEvents(string, *ListOptions) ([]Event, *Response, error)
-}
-
-type devicesRoot struct {
- Devices []Device `json:"devices"`
- Meta meta `json:"meta"`
-}
-
-// Device represents a Packet device
-type Device struct {
- ID string `json:"id"`
- Href string `json:"href,omitempty"`
- Hostname string `json:"hostname,omitempty"`
- State string `json:"state,omitempty"`
- Created string `json:"created_at,omitempty"`
- Updated string `json:"updated_at,omitempty"`
- Locked bool `json:"locked,omitempty"`
- BillingCycle string `json:"billing_cycle,omitempty"`
- Storage map[string]interface{} `json:"storage,omitempty"`
- Tags []string `json:"tags,omitempty"`
- Network []*IPAddressAssignment `json:"ip_addresses"`
- Volumes []*Volume `json:"volumes"`
- OS *OS `json:"operating_system,omitempty"`
- Plan *Plan `json:"plan,omitempty"`
- Facility *Facility `json:"facility,omitempty"`
- Project *Project `json:"project,omitempty"`
- ProvisionEvents []*Event `json:"provisioning_events,omitempty"`
- ProvisionPer float32 `json:"provisioning_percentage,omitempty"`
- UserData string `json:"userdata,omitempty"`
- RootPassword string `json:"root_password,omitempty"`
- IPXEScriptURL string `json:"ipxe_script_url,omitempty"`
- AlwaysPXE bool `json:"always_pxe,omitempty"`
- HardwareReservation Href `json:"hardware_reservation,omitempty"`
- SpotInstance bool `json:"spot_instance,omitempty"`
- SpotPriceMax float64 `json:"spot_price_max,omitempty"`
- TerminationTime *Timestamp `json:"termination_time,omitempty"`
- NetworkPorts []Port `json:"network_ports,omitempty"`
- CustomData map[string]interface{} `json:"customdata,omitempty"`
-}
-
-func (d Device) String() string {
- return Stringify(d)
-}
-
-// DeviceCreateRequest type used to create a Packet device
-type DeviceCreateRequest struct {
- Hostname string `json:"hostname"`
- Plan string `json:"plan"`
- Facility string `json:"facility"`
- OS string `json:"operating_system"`
- BillingCycle string `json:"billing_cycle"`
- ProjectID string `json:"project_id"`
- UserData string `json:"userdata"`
- Storage string `json:"storage,omitempty"`
- Tags []string `json:"tags"`
- IPXEScriptURL string `json:"ipxe_script_url,omitempty"`
- PublicIPv4SubnetSize int `json:"public_ipv4_subnet_size,omitempty"`
- AlwaysPXE bool `json:"always_pxe,omitempty"`
- HardwareReservationID string `json:"hardware_reservation_id,omitempty"`
- SpotInstance bool `json:"spot_instance,omitempty"`
- SpotPriceMax float64 `json:"spot_price_max,omitempty,string"`
- TerminationTime *Timestamp `json:"termination_time,omitempty"`
- CustomData string `json:"customdata,omitempty"`
-}
-
-// DeviceUpdateRequest type used to update a Packet device
-type DeviceUpdateRequest struct {
- Hostname *string `json:"hostname,omitempty"`
- Description *string `json:"description,omitempty"`
- UserData *string `json:"userdata,omitempty"`
- Locked *bool `json:"locked,omitempty"`
- Tags *[]string `json:"tags,omitempty"`
- AlwaysPXE *bool `json:"always_pxe,omitempty"`
- IPXEScriptURL *string `json:"ipxe_script_url,omitempty"`
- CustomData *string `json:"customdata,omitempty"`
-}
-
-func (d DeviceCreateRequest) String() string {
- return Stringify(d)
-}
-
-// DeviceActionRequest type used to execute actions on devices
-type DeviceActionRequest struct {
- Type string `json:"type"`
-}
-
-func (d DeviceActionRequest) String() string {
- return Stringify(d)
-}
-
-// DeviceServiceOp implements DeviceService
-type DeviceServiceOp struct {
- client *Client
-}
-
-// List returns devices on a project
-func (s *DeviceServiceOp) List(projectID string, listOpt *ListOptions) (devices []Device, resp *Response, err error) {
- params := "include=facility"
- if listOpt != nil {
- params = listOpt.createURL()
- }
- path := fmt.Sprintf("%s/%s%s?%s", projectBasePath, projectID, deviceBasePath, params)
-
- for {
- subset := new(devicesRoot)
-
- resp, err = s.client.DoRequest("GET", path, nil, subset)
- if err != nil {
- return nil, resp, err
- }
-
- devices = append(devices, subset.Devices...)
-
- if subset.Meta.Next != nil && (listOpt == nil || listOpt.Page == 0) {
- path = subset.Meta.Next.Href
- if params != "" {
- path = fmt.Sprintf("%s&%s", path, params)
- }
- continue
- }
-
- return
- }
-}
-
-// Get returns a device by id
-func (s *DeviceServiceOp) Get(deviceID string) (*Device, *Response, error) {
- return s.GetExtra(deviceID, []string{"facility"}, nil)
-}
-
-// GetExtra returns a device by id. Specifying either includes/excludes provides more or less desired
-// detailed information about resources which would otherwise be represented with an href link
-func (s *DeviceServiceOp) GetExtra(deviceID string, includes, excludes []string) (*Device, *Response, error) {
- path := fmt.Sprintf("%s/%s", deviceBasePath, deviceID)
- if includes != nil {
- path += fmt.Sprintf("?include=%s", strings.Join(includes, ","))
- } else if excludes != nil {
- path += fmt.Sprintf("?exclude=%s", strings.Join(excludes, ","))
- }
- device := new(Device)
-
- resp, err := s.client.DoRequest("GET", path, nil, device)
- if err != nil {
- return nil, resp, err
- }
-
- return device, resp, err
-}
-
-// Create creates a new device
-func (s *DeviceServiceOp) Create(createRequest *DeviceCreateRequest) (*Device, *Response, error) {
- path := fmt.Sprintf("%s/%s%s", projectBasePath, createRequest.ProjectID, deviceBasePath)
- device := new(Device)
-
- resp, err := s.client.DoRequest("POST", path, createRequest, device)
- if err != nil {
- return nil, resp, err
- }
-
- return device, resp, err
-}
-
-// Update updates an existing device
-func (s *DeviceServiceOp) Update(deviceID string, updateRequest *DeviceUpdateRequest) (*Device, *Response, error) {
- path := fmt.Sprintf("%s/%s?include=facility", deviceBasePath, deviceID)
- device := new(Device)
-
- resp, err := s.client.DoRequest("PUT", path, updateRequest, device)
- if err != nil {
- return nil, resp, err
- }
-
- return device, resp, err
-}
-
-// Delete deletes a device
-func (s *DeviceServiceOp) Delete(deviceID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", deviceBasePath, deviceID)
-
- return s.client.DoRequest("DELETE", path, nil, nil)
-}
-
-// Reboot reboots on a device
-func (s *DeviceServiceOp) Reboot(deviceID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s/actions", deviceBasePath, deviceID)
- action := &DeviceActionRequest{Type: "reboot"}
-
- return s.client.DoRequest("POST", path, action, nil)
-}
-
-// PowerOff powers on a device
-func (s *DeviceServiceOp) PowerOff(deviceID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s/actions", deviceBasePath, deviceID)
- action := &DeviceActionRequest{Type: "power_off"}
-
- return s.client.DoRequest("POST", path, action, nil)
-}
-
-// PowerOn powers on a device
-func (s *DeviceServiceOp) PowerOn(deviceID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s/actions", deviceBasePath, deviceID)
- action := &DeviceActionRequest{Type: "power_on"}
-
- return s.client.DoRequest("POST", path, action, nil)
-}
-
-type lockType struct {
- Locked bool `json:"locked"`
-}
-
-// Lock sets a device to "locked"
-func (s *DeviceServiceOp) Lock(deviceID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", deviceBasePath, deviceID)
- action := lockType{Locked: true}
-
- return s.client.DoRequest("PATCH", path, action, nil)
-}
-
-// Unlock sets a device to "unlocked"
-func (s *DeviceServiceOp) Unlock(deviceID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", deviceBasePath, deviceID)
- action := lockType{Locked: false}
-
- return s.client.DoRequest("PATCH", path, action, nil)
-}
-
-// ListEvents returns list of device events
-func (s *DeviceServiceOp) ListEvents(deviceID string, listOpt *ListOptions) ([]Event, *Response, error) {
- path := fmt.Sprintf("%s/%s%s", deviceBasePath, deviceID, eventBasePath)
-
- return list(s.client, path, listOpt)
-}
diff --git a/vendor/github.com/packethost/packngo/devices_test.go b/vendor/github.com/packethost/packngo/devices_test.go
deleted file mode 100644
index a8815843..00000000
--- a/vendor/github.com/packethost/packngo/devices_test.go
+++ /dev/null
@@ -1,577 +0,0 @@
-package packngo
-
-import (
- "errors"
- "fmt"
- "path"
- "testing"
- "time"
-)
-
-func waitDeviceActive(id string, c *Client) (*Device, error) {
- // 15 minutes = 180 * 5sec-retry
- for i := 0; i < 180; i++ {
- <-time.After(5 * time.Second)
- d, _, err := c.Devices.Get(id)
- if err != nil {
- return nil, err
- }
- if d.State == "active" {
- return d, nil
- }
- }
- return nil, fmt.Errorf("device %s is still not active after timeout", id)
-}
-
-func deleteDevice(t *testing.T, c *Client, id string) {
- _, err := c.Devices.Delete(id)
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestAccDeviceUpdate(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- hn := randString8()
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: testFacility(),
- Plan: "baremetal_0",
- OS: "ubuntu_16_04",
- ProjectID: projectID,
- BillingCycle: "hourly",
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
-
- if len(d.ProvisionEvents) != 10 {
- t.Fatalf("10 provision events expected, but %d found", len(d.ProvisionEvents))
- }
-
- dID := d.ID
-
- d, err = waitDeviceActive(dID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(d.RootPassword) == 0 {
- t.Fatal("root_password is empty or non-existent")
- }
- newHN := randString8()
- ur := DeviceUpdateRequest{Hostname: &newHN}
-
- newD, _, err := c.Devices.Update(dID, &ur)
- if err != nil {
- t.Fatal(err)
- }
-
- if newD.Hostname != newHN {
- t.Fatalf("hostname of test device should be %s, but is %s", newHN, newD.Hostname)
- }
- for _, ipa := range newD.Network {
- if !ipa.Management {
- t.Fatalf("management flag for all the IP addresses in a new device should be True: was %s", ipa)
- }
- }
-}
-
-func TestAccDeviceBasic(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- hn := randString8()
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: testFacility(),
- Plan: "baremetal_0",
- OS: "ubuntu_16_04",
- ProjectID: projectID,
- BillingCycle: "hourly",
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
-
- if len(d.ProvisionEvents) != 10 {
- t.Fatalf("10 provision events expected, but %d found", len(d.ProvisionEvents))
- }
-
- dID := d.ID
-
- d, err = waitDeviceActive(dID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(d.RootPassword) == 0 {
- t.Fatal("root_password is empty or non-existent")
- }
- for _, ipa := range d.Network {
- if !ipa.Management {
- t.Fatalf("management flag for all the IP addresses in a new device should be True: was %s", ipa)
- }
- }
- dl, _, err := c.Devices.List(projectID, nil)
- if err != nil {
- t.Fatal(err)
- }
- if len(dl) != 1 {
- t.Fatalf("Device List should contain exactly one device, was: %v", dl)
- }
-
-}
-
-func TestAccDevicePXE(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- hn := randString8()
- pxeURL := "https://boot.netboot.xyz"
-
- cr := DeviceCreateRequest{
- Hostname: "pxe-" + hn,
- Facility: testFacility(),
- Plan: "baremetal_0",
- ProjectID: projectID,
- BillingCycle: "hourly",
- OS: "custom_ipxe",
- IPXEScriptURL: pxeURL,
- AlwaysPXE: true,
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
-
- defer deleteDevice(t, c, d.ID)
-
- d, err = waitDeviceActive(d.ID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- // Check that settings were persisted
- if !d.AlwaysPXE {
- t.Fatal("always_pxe should be true")
- }
- if d.IPXEScriptURL != pxeURL {
- t.Fatalf("ipxe_script_url should be \"%s\"", pxeURL)
- }
-
- // Check that we can update PXE options
- pxeURL = "http://boot.netboot.xyz"
- bFalse := false
- d, _, err = c.Devices.Update(d.ID,
- &DeviceUpdateRequest{
- AlwaysPXE: &bFalse,
- },
- )
- if err != nil {
- t.Fatal(err)
- }
- if d.AlwaysPXE {
- t.Fatalf("always_pxe should have been updated to false")
- }
- d, _, err = c.Devices.Update(d.ID,
- &DeviceUpdateRequest{
- IPXEScriptURL: &pxeURL,
- },
- )
- if err != nil {
- t.Fatal(err)
- }
- if d.IPXEScriptURL != pxeURL {
- t.Fatalf("ipxe_script_url should have been updated to \"%s\"", pxeURL)
- }
-}
-
-func TestAccDeviceAssignIP(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- hn := randString8()
-
- testFac := testFacility()
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: testFac,
- Plan: "baremetal_0",
- ProjectID: projectID,
- BillingCycle: "hourly",
- OS: "ubuntu_16_04",
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
-
- d, err = waitDeviceActive(d.ID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- req := IPReservationRequest{
- Type: "public_ipv4",
- Quantity: 1,
- Comments: "packngo test",
- Facility: testFac,
- }
-
- reservation, _, err := c.ProjectIPs.Request(projectID, &req)
- if err != nil {
- t.Fatal(err)
- }
-
- af := AddressStruct{Address: fmt.Sprintf("%s/%d", reservation.Address, reservation.CIDR)}
-
- assignment, _, err := c.DeviceIPs.Assign(d.ID, &af)
- if err != nil {
- t.Fatal(err)
- }
-
- if assignment.Management {
- t.Error("Management flag for assignment resource must be False")
- }
-
- d, _, err = c.Devices.Get(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- // If the Quantity in the IPReservationRequest is >1, this test won't work.
- // The assignment CIDR would then have to be extracted from the reserved
- // block.
- reservation, _, err = c.ProjectIPs.Get(reservation.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(reservation.Assignments) != 1 {
- t.Fatalf("reservation %s should have exactly 1 assignment", reservation)
- }
-
- if reservation.Assignments[0].Href != assignment.Href {
- t.Fatalf("assignment %s should be listed in reservation resource %s",
- assignment.Href, reservation)
-
- }
-
- func() {
- for _, ipa := range d.Network {
- if ipa.Href == assignment.Href {
- return
- }
- }
- t.Fatalf("assignment %s should be listed in device %s", assignment, d)
- }()
-
- if assignment.AssignedTo.Href != d.Href {
- t.Fatalf("device %s should be listed in assignment %s",
- d, assignment)
- }
-
- _, err = c.DeviceIPs.Unassign(assignment.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- // reload reservation, now without any assignment
- reservation, _, err = c.ProjectIPs.Get(reservation.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(reservation.Assignments) != 0 {
- t.Fatalf("reservation %s shoud be without assignments. Was %v",
- reservation, reservation.Assignments)
- }
-
- // reload device, now without the assigned floating IP
- d, _, err = c.Devices.Get(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- for _, ipa := range d.Network {
- if ipa.Href == assignment.Href {
- t.Fatalf("assignment %s shoud be not listed in device %s anymore",
- assignment, d)
- }
- }
-}
-
-func TestAccDeviceAttachVolume(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- hn := randString8()
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: testFacility(),
- Plan: "baremetal_0",
- ProjectID: projectID,
- BillingCycle: "hourly",
- OS: "ubuntu_16_04",
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
-
- d, err = waitDeviceActive(d.ID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- vcr := VolumeCreateRequest{
- Size: 10,
- BillingCycle: "hourly",
- PlanID: "storage_1",
- FacilityID: testFacility(),
- }
-
- v, _, err := c.Volumes.Create(&vcr, projectID)
- if err != nil {
- t.Fatal(err)
- }
- defer c.Volumes.Delete(v.ID)
-
- v, err = waitVolumeActive(v.ID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- a, _, err := c.VolumeAttachments.Create(v.ID, d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if path.Base(a.Volume.Href) != v.ID {
- t.Fatalf("wrong volume href in the attachment: %s, should be %s", a.Volume.Href, v.ID)
- }
-
- if path.Base(a.Device.Href) != d.ID {
- t.Fatalf("wrong device href in the attachment: %s, should be %s", a.Device.Href, d.ID)
- }
-
- v, _, err = c.Volumes.Get(v.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- d, _, err = c.Devices.Get(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if v.Attachments[0].Device.ID != d.ID {
- t.Fatalf("wrong device linked in volume attachment: %s, should be %s", v.Attachments[0].Device.ID, d.ID)
- }
- if path.Base(d.Volumes[0].Href) != v.ID {
- t.Fatalf("wrong volume linked in device.volumes: %s, should be %s", d.Volumes[0].Href, v.ID)
- }
-
- _, err = c.VolumeAttachments.Delete(a.ID)
- if err != nil {
- t.Fatal(err)
- }
-
-}
-
-func TestAccDeviceSpotInstance(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- hn := randString8()
-
- testSPM := 0.04
- testTerm := &Timestamp{Time: time.Now().Add(time.Hour - (time.Minute * 10))}
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: testFacility(),
- Plan: "baremetal_0",
- OS: "coreos_stable",
- ProjectID: projectID,
- BillingCycle: "hourly",
- SpotInstance: true,
- SpotPriceMax: testSPM,
- TerminationTime: testTerm,
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
-
- d, err = waitDeviceActive(d.ID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- if !d.SpotInstance {
- t.Fatal("spot_instance is false, should be true")
- }
-
- if d.SpotPriceMax != testSPM {
- t.Fatalf("spot_price_max is %f, should be %f", d.SpotPriceMax, testSPM)
- }
-
- if !d.TerminationTime.Time.Truncate(time.Minute).Equal(testTerm.Time.Truncate(time.Minute)) {
- t.Fatalf("termination_time is %s, should be %s",
- d.TerminationTime.Time.Local(), testTerm.Time.Local())
- }
-}
-
-func TestAccDeviceCustomData(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- hn := randString8()
-
- initialCustomData := `{"hello":"world"}`
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: testFacility(),
- Plan: "baremetal_0",
- OS: "ubuntu_16_04",
- ProjectID: projectID,
- BillingCycle: "hourly",
- CustomData: initialCustomData,
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
-
- dID := d.ID
-
- d, err = waitDeviceActive(dID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- device, _, err := c.Devices.Get(dID)
- if err != nil {
- t.Fatal(err)
- }
-
- if device.CustomData["hello"] != "world" {
- t.Fatal(errors.New("Did not properly set custom data when creating device"))
- }
-
- updateCustomData := `{"hi":"earth"}`
- _, _, err = c.Devices.Update(dID, &DeviceUpdateRequest{
- CustomData: &updateCustomData,
- })
- if err != nil {
- t.Fatal(err)
- }
-
- device, _, err = c.Devices.Get(dID)
- if err != nil {
- t.Fatal(err)
- }
-
- if device.CustomData["hi"] != "earth" {
- t.Fatal(errors.New("Did not properly update custom data"))
- }
-
- updateCustomData = ""
- _, _, err = c.Devices.Update(dID, &DeviceUpdateRequest{
- CustomData: &updateCustomData,
- })
- if err != nil {
- t.Fatal(err)
- }
-
- device, _, err = c.Devices.Get(dID)
- if err != nil {
- t.Fatal(err)
- }
- if len(device.CustomData) != 0 {
- t.Fatal(errors.New("Did not properly erase custom data"))
- }
-}
-
-func TestAccListDeviceEvents(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- hn := randString8()
-
- initialCustomData := `{"hello":"world"}`
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: testFacility(),
- Plan: "baremetal_0",
- OS: "ubuntu_16_04",
- ProjectID: projectID,
- BillingCycle: "hourly",
- CustomData: initialCustomData,
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
-
- d, err = waitDeviceActive(d.ID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- events, _, err := c.Devices.ListEvents(d.ID, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(events) == 0 {
- t.Fatal("Device events not returned")
- }
-}
diff --git a/vendor/github.com/packethost/packngo/email.go b/vendor/github.com/packethost/packngo/email.go
deleted file mode 100644
index 0983cb1d..00000000
--- a/vendor/github.com/packethost/packngo/email.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package packngo
-
-import "fmt"
-
-const emailBasePath = "/emails"
-
-// EmailRequest type used to add an email address to the current user
-type EmailRequest struct {
- Address string `json:"address,omitempty"`
- Default *bool `json:"default,omitempty"`
-}
-
-// EmailService interface defines available email methods
-type EmailService interface {
- Get(string) (*Email, *Response, error)
- Create(*EmailRequest) (*Email, *Response, error)
- Update(string, *EmailRequest) (*Email, *Response, error)
- Delete(string) (*Response, error)
-}
-
-// Email represents a user's email address
-type Email struct {
- ID string `json:"id"`
- Address string `json:"address"`
- Default bool `json:"default,omitempty"`
- URL string `json:"href,omitempty"`
-}
-
-func (e Email) String() string {
- return Stringify(e)
-}
-
-// EmailServiceOp implements EmailService
-type EmailServiceOp struct {
- client *Client
-}
-
-// Get retrieves an email by id
-func (s *EmailServiceOp) Get(emailID string) (*Email, *Response, error) {
- path := fmt.Sprintf("%s/%s", emailBasePath, emailID)
- email := new(Email)
-
- resp, err := s.client.DoRequest("GET", path, nil, email)
- if err != nil {
- return nil, resp, err
- }
-
- return email, resp, err
-}
-
-// Create adds a new email address to the current user.
-func (s *EmailServiceOp) Create(request *EmailRequest) (*Email, *Response, error) {
- email := new(Email)
-
- resp, err := s.client.DoRequest("POST", emailBasePath, request, email)
- if err != nil {
- return nil, resp, err
- }
-
- return email, resp, err
-}
-
-// Delete removes the email addres from the current user account
-func (s *EmailServiceOp) Delete(emailID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", emailBasePath, emailID)
-
- resp, err := s.client.DoRequest("DELETE", path, nil, nil)
- if err != nil {
- return resp, err
- }
-
- return resp, err
-}
-
-// Update email parameters
-func (s *EmailServiceOp) Update(emailID string, request *EmailRequest) (*Email, *Response, error) {
- email := new(Email)
- path := fmt.Sprintf("%s/%s", emailBasePath, emailID)
-
- resp, err := s.client.DoRequest("PUT", path, request, email)
- if err != nil {
- return nil, resp, err
- }
-
- return email, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/email_test.go b/vendor/github.com/packethost/packngo/email_test.go
deleted file mode 100644
index f729a41d..00000000
--- a/vendor/github.com/packethost/packngo/email_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package packngo
-
-import (
- "testing"
-)
-
-func TestAccCreateEmail(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- updatedAddress := "update@domain.com"
- c := setup(t)
-
- req := &EmailRequest{
- Address: "test@domain.com",
- }
-
- ret, _, err := c.Emails.Create(req)
- if err != nil {
- t.Fatal("Create failed", err)
- }
-
- if req.Address != ret.Address {
- t.Fatal("Address not equal to", req.Address)
- }
-
- emailID := ret.ID
- req.Address = updatedAddress
-
- email, _, err := c.Emails.Get(emailID)
- if err != nil {
- t.Fatal("Get failed", err)
- }
-
- ret, _, err = c.Emails.Update(email.ID, req)
- if err != nil {
- t.Fatal("Update failed:", err)
- }
-
- if req.Address == ret.Address {
- t.Fatal("Address not updated")
- }
-
- _, err = c.Emails.Delete(email.ID)
- if err != nil {
- t.Fatal("Delete failed:", err)
- }
-}
diff --git a/vendor/github.com/packethost/packngo/events.go b/vendor/github.com/packethost/packngo/events.go
deleted file mode 100644
index b2ad1037..00000000
--- a/vendor/github.com/packethost/packngo/events.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package packngo
-
-import "fmt"
-
-const eventBasePath = "/events"
-
-// Event struct
-type Event struct {
- ID string `json:"id,omitempty"`
- State string `json:"state,omitempty"`
- Type string `json:"type,omitempty"`
- Body string `json:"body,omitempty"`
- Relationships []Href `json:"relationships,omitempty"`
- Interpolated string `json:"interpolated,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- Href string `json:"href,omitempty"`
-}
-
-type eventsRoot struct {
- Events []Event `json:"events,omitempty"`
- Meta meta `json:"meta,omitempty"`
-}
-
-// EventService interface defines available event functions
-type EventService interface {
- List(*ListOptions) ([]Event, *Response, error)
- Get(string, *ListOptions) (*Event, *Response, error)
-}
-
-// EventServiceOp implements EventService
-type EventServiceOp struct {
- client *Client
-}
-
-// List returns all events
-func (s *EventServiceOp) List(listOpt *ListOptions) ([]Event, *Response, error) {
- return list(s.client, eventBasePath, listOpt)
-}
-
-// Get returns an event by ID
-func (s *EventServiceOp) Get(eventID string, listOpt *ListOptions) (*Event, *Response, error) {
- path := fmt.Sprintf("%s/%s", eventBasePath, eventID)
- return get(s.client, path, listOpt)
-}
-
-// list helper function for all event functions
-func list(client *Client, path string, listOpt *ListOptions) ([]Event, *Response, error) {
- var params string
- if listOpt != nil {
- params = listOpt.createURL()
- }
-
- root := new(eventsRoot)
-
- path = fmt.Sprintf("%s?%s", path, params)
-
- resp, err := client.DoRequest("GET", path, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- return root.Events, resp, err
-}
-
-func get(client *Client, path string, listOpt *ListOptions) (*Event, *Response, error) {
- var params string
- if listOpt != nil {
- params = listOpt.createURL()
- }
-
- event := new(Event)
-
- path = fmt.Sprintf("%s?%s", path, params)
-
- resp, err := client.DoRequest("GET", path, nil, event)
- if err != nil {
- return nil, resp, err
- }
-
- return event, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/events_test.go b/vendor/github.com/packethost/packngo/events_test.go
deleted file mode 100644
index 1041d87d..00000000
--- a/vendor/github.com/packethost/packngo/events_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package packngo
-
-import (
- "testing"
-)
-
-func TestAccListEvents(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- c := setup(t)
-
- events, _, err := c.Events.List(nil)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(events) == 0 {
- t.Fatal("Events are empty")
- }
-
- event, _, err := c.Events.Get(events[0].ID, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- if event == nil {
- t.Fatal("Event not returned")
- }
-}
diff --git a/vendor/github.com/packethost/packngo/examples/otp.go b/vendor/github.com/packethost/packngo/examples/otp.go
deleted file mode 100644
index bf9ec694..00000000
--- a/vendor/github.com/packethost/packngo/examples/otp.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package examples
-
-import (
- "bufio"
- "fmt"
- "log"
- "net/url"
- "os"
-
- "github.com/packethost/packngo"
-)
-
-func GetPacketOtpSms(c *packngo.Client) (string, error) {
- _, err := c.TwoFactorAuth.ReceiveSms()
- if err != nil {
- return "", err
- }
-
- reader := bufio.NewReader(os.Stdin)
- fmt.Print("Enter SMS code: ")
- otp, err := reader.ReadString('\n')
- if err != nil {
- return "", err
- }
- return otp[:len(otp)-1], nil
-}
-
-func SeedPacketOtpApp(c *packngo.Client) (string, error) {
- otpUri, _, err := c.TwoFactorAuth.SeedApp()
- if err != nil {
- return "", err
- }
- log.Println("OTP URI:", otpUri)
- u, err := url.Parse(otpUri)
- if err != nil {
- return "", err
- }
- q := u.Query()
- log.Println("Secret for 2FA App:", q["secret"][0])
-
- reader := bufio.NewReader(os.Stdin)
- fmt.Print("Enter Packet 2FA App code: ")
- otp, err := reader.ReadString('\n')
- if err != nil {
- return "", err
- }
- return otp[:len(otp)-1], nil
-}
-
-func GetOtpApp(c *packngo.Client) (string, error) {
- reader := bufio.NewReader(os.Stdin)
- fmt.Print("Enter 2FA App code: ")
- otp, err := reader.ReadString('\n')
- if err != nil {
- return "", err
- }
- return otp[:len(otp)-1], nil
-}
-
-func TestSMSEnable() {
- c, err := packngo.NewClient()
- if err != nil {
- log.Fatal(err)
- }
-
- otp, err := GetPacketOtpSms(c)
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = c.TwoFactorAuth.EnableSms(otp)
- if err != nil {
- log.Fatal(err)
- }
- log.Println("SMS enabled")
-
- otp, err = GetPacketOtpSms(c)
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = c.TwoFactorAuth.DisableSms(otp)
- if err != nil {
- log.Fatal(err)
- }
- log.Println("SMS disabled")
-}
-
-func TestAppEnable() {
- c, err := packngo.NewClient()
- if err != nil {
- log.Fatal(err)
- }
-
- otp, err := SeedPacketOtpApp(c)
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = c.TwoFactorAuth.EnableApp(otp)
- if err != nil {
- log.Fatal(err)
- }
- log.Println("App enabled")
-
- otp, err = GetOtpApp(c)
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = c.TwoFactorAuth.DisableApp(otp)
- if err != nil {
- log.Fatal(err)
- }
- log.Println("App disabled")
-}
diff --git a/vendor/github.com/packethost/packngo/facilities.go b/vendor/github.com/packethost/packngo/facilities.go
deleted file mode 100644
index 12aac919..00000000
--- a/vendor/github.com/packethost/packngo/facilities.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package packngo
-
-const facilityBasePath = "/facilities"
-
-// FacilityService interface defines available facility methods
-type FacilityService interface {
- List() ([]Facility, *Response, error)
-}
-
-type facilityRoot struct {
- Facilities []Facility `json:"facilities"`
-}
-
-// Facility represents a Packet facility
-type Facility struct {
- ID string `json:"id"`
- Name string `json:"name,omitempty"`
- Code string `json:"code,omitempty"`
- Features []string `json:"features,omitempty"`
- Address *Address `json:"address,omitempty"`
- URL string `json:"href,omitempty"`
-}
-
-func (f Facility) String() string {
- return Stringify(f)
-}
-
-// Address - the physical address of the facility
-type Address struct {
- ID string `json:"id,omitempty"`
-}
-
-func (a Address) String() string {
- return Stringify(a)
-}
-
-// FacilityServiceOp implements FacilityService
-type FacilityServiceOp struct {
- client *Client
-}
-
-// List returns all available Packet facilities
-func (s *FacilityServiceOp) List() ([]Facility, *Response, error) {
- root := new(facilityRoot)
-
- resp, err := s.client.DoRequest("GET", facilityBasePath, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- return root.Facilities, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/hardware_reservations.go b/vendor/github.com/packethost/packngo/hardware_reservations.go
deleted file mode 100644
index 6ddc2ebe..00000000
--- a/vendor/github.com/packethost/packngo/hardware_reservations.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package packngo
-
-import "fmt"
-
-const hardwareReservationBasePath = "/hardware-reservations"
-
-// HardwareReservationService interface defines available hardware reservation functions
-type HardwareReservationService interface {
- Get(hardwareReservationID string, listOpt *ListOptions) (*HardwareReservation, *Response, error)
- List(projectID string, listOpt *ListOptions) ([]HardwareReservation, *Response, error)
- Move(string, string) (*HardwareReservation, *Response, error)
-}
-
-// HardwareReservationServiceOp implements HardwareReservationService
-type HardwareReservationServiceOp struct {
- client *Client
-}
-
-// HardwareReservation struct
-type HardwareReservation struct {
- ID string `json:"id,omitempty"`
- ShortID string `json:"short_id,omitempty"`
- Facility Facility `json:"facility,omitempty"`
- Plan Plan `json:"plan,omitempty"`
- Href string `json:"href,omitempty"`
- Project Project `json:"project,omitempty"`
- Device *Device `json:"device,omitempty"`
- CreatedAt Timestamp `json:"created_at,omitempty"`
-}
-
-type hardwareReservationRoot struct {
- HardwareReservations []HardwareReservation `json:"hardware_reservations"`
- Meta meta `json:"meta"`
-}
-
-// List returns all hardware reservations for a given project
-func (s *HardwareReservationServiceOp) List(projectID string, listOpt *ListOptions) (reservations []HardwareReservation, resp *Response, err error) {
- root := new(hardwareReservationRoot)
- var params string
- if listOpt != nil {
- params = listOpt.createURL()
- }
-
- path := fmt.Sprintf("%s/%s%s?%s", projectBasePath, projectID, hardwareReservationBasePath, params)
-
- for {
- subset := new(hardwareReservationRoot)
-
- resp, err = s.client.DoRequest("GET", path, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- reservations = append(reservations, root.HardwareReservations...)
-
- if subset.Meta.Next != nil && (listOpt == nil || listOpt.Page == 0) {
- path = subset.Meta.Next.Href
- if params != "" {
- path = fmt.Sprintf("%s&%s", path, params)
- }
- continue
- }
-
- return
- }
-}
-
-// Get returns a single hardware reservation
-func (s *HardwareReservationServiceOp) Get(hardwareReservationdID string, listOpt *ListOptions) (*HardwareReservation, *Response, error) {
- var params string
- if listOpt != nil {
- params = listOpt.createURL()
- }
-
- hardwareReservation := new(HardwareReservation)
-
- path := fmt.Sprintf("%s/%s?%s", hardwareReservationBasePath, hardwareReservationdID, params)
-
- resp, err := s.client.DoRequest("GET", path, nil, hardwareReservation)
- if err != nil {
- return nil, resp, err
- }
-
- return hardwareReservation, resp, err
-}
-
-// Move a hardware reservation to another project
-func (s *HardwareReservationServiceOp) Move(hardwareReservationdID, projectID string) (*HardwareReservation, *Response, error) {
- hardwareReservation := new(HardwareReservation)
- path := fmt.Sprintf("%s/%s/%s", hardwareReservationBasePath, hardwareReservationdID, "move")
- body := map[string]string{}
- body["project_id"] = projectID
-
- resp, err := s.client.DoRequest("POST", path, body, hardwareReservation)
- if err != nil {
- return nil, resp, err
- }
-
- return hardwareReservation, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/hardware_reservations_test.go b/vendor/github.com/packethost/packngo/hardware_reservations_test.go
deleted file mode 100644
index e62e9de3..00000000
--- a/vendor/github.com/packethost/packngo/hardware_reservations_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package packngo
-
-import (
- "testing"
-)
-
-func TestAccListHardwareReservations(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- c, projectID, tearDown := setupWithProject(t)
- defer tearDown()
-
- hardwareReservations, _, err := c.HardwareReservations.List(projectID, nil)
- if err != nil {
- t.Fatal(err)
- }
- if len(hardwareReservations) != 0 {
- t.Fatal("There should not be any hardware reservations.")
- }
-}
diff --git a/vendor/github.com/packethost/packngo/ip.go b/vendor/github.com/packethost/packngo/ip.go
deleted file mode 100644
index 671eea60..00000000
--- a/vendor/github.com/packethost/packngo/ip.go
+++ /dev/null
@@ -1,194 +0,0 @@
-package packngo
-
-import (
- "fmt"
-)
-
-const ipBasePath = "/ips"
-
-// DeviceIPService handles assignment of addresses from reserved blocks to instances in a project.
-type DeviceIPService interface {
- Assign(deviceID string, assignRequest *AddressStruct) (*IPAddressAssignment, *Response, error)
- Unassign(assignmentID string) (*Response, error)
- Get(assignmentID string) (*IPAddressAssignment, *Response, error)
-}
-
-// ProjectIPService handles reservation of IP address blocks for a project.
-type ProjectIPService interface {
- Get(reservationID string) (*IPAddressReservation, *Response, error)
- List(projectID string) ([]IPAddressReservation, *Response, error)
- Request(projectID string, ipReservationReq *IPReservationRequest) (*IPAddressReservation, *Response, error)
- Remove(ipReservationID string) (*Response, error)
- AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error)
-}
-
-type ipAddressCommon struct {
- ID string `json:"id"`
- Address string `json:"address"`
- Gateway string `json:"gateway"`
- Network string `json:"network"`
- AddressFamily int `json:"address_family"`
- Netmask string `json:"netmask"`
- Public bool `json:"public"`
- CIDR int `json:"cidr"`
- Created string `json:"created_at,omitempty"`
- Updated string `json:"updated_at,omitempty"`
- Href string `json:"href"`
- Management bool `json:"management"`
- Manageable bool `json:"manageable"`
- Project Href `json:"project"`
-}
-
-// IPAddressReservation is created when user sends IP reservation request for a project (considering it's within quota).
-type IPAddressReservation struct {
- ipAddressCommon
- Assignments []Href `json:"assignments"`
- Facility Facility `json:"facility,omitempty"`
- Available string `json:"available"`
- Addon bool `json:"addon"`
- Bill bool `json:"bill"`
-}
-
-// AvailableResponse is a type for listing of available addresses from a reserved block.
-type AvailableResponse struct {
- Available []string `json:"available"`
-}
-
-// AvailableRequest is a type for listing available addresses from a reserved block.
-type AvailableRequest struct {
- CIDR int `json:"cidr"`
-}
-
-// IPAddressAssignment is created when an IP address from reservation block is assigned to a device.
-type IPAddressAssignment struct {
- ipAddressCommon
- AssignedTo Href `json:"assigned_to"`
-}
-
-// IPReservationRequest represents the body of a reservation request.
-type IPReservationRequest struct {
- Type string `json:"type"`
- Quantity int `json:"quantity"`
- Comments string `json:"comments"`
- Facility string `json:"facility"`
-}
-
-// AddressStruct is a helper type for request/response with dict like {"address": ... }
-type AddressStruct struct {
- Address string `json:"address"`
-}
-
-func deleteFromIP(client *Client, resourceID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", ipBasePath, resourceID)
-
- return client.DoRequest("DELETE", path, nil, nil)
-}
-
-func (i IPAddressReservation) String() string {
- return Stringify(i)
-}
-
-func (i IPAddressAssignment) String() string {
- return Stringify(i)
-}
-
-// DeviceIPServiceOp is interface for IP-address assignment methods.
-type DeviceIPServiceOp struct {
- client *Client
-}
-
-// Unassign unassigns an IP address from the device to which it is currently assigned.
-// This will remove the relationship between an IP and the device and will make the IP
-// address available to be assigned to another device.
-func (i *DeviceIPServiceOp) Unassign(assignmentID string) (*Response, error) {
- return deleteFromIP(i.client, assignmentID)
-}
-
-// Assign assigns an IP address to a device.
-// The IP address must be in one of the IP ranges assigned to the device’s project.
-func (i *DeviceIPServiceOp) Assign(deviceID string, assignRequest *AddressStruct) (*IPAddressAssignment, *Response, error) {
- path := fmt.Sprintf("%s/%s%s", deviceBasePath, deviceID, ipBasePath)
- ipa := new(IPAddressAssignment)
-
- resp, err := i.client.DoRequest("POST", path, assignRequest, ipa)
- if err != nil {
- return nil, resp, err
- }
-
- return ipa, resp, err
-}
-
-// Get returns assignment by ID.
-func (i *DeviceIPServiceOp) Get(assignmentID string) (*IPAddressAssignment, *Response, error) {
- path := fmt.Sprintf("%s/%s", ipBasePath, assignmentID)
- ipa := new(IPAddressAssignment)
-
- resp, err := i.client.DoRequest("GET", path, nil, ipa)
- if err != nil {
- return nil, resp, err
- }
-
- return ipa, resp, err
-}
-
-// ProjectIPServiceOp is interface for IP assignment methods.
-type ProjectIPServiceOp struct {
- client *Client
-}
-
-// Get returns reservation by ID.
-func (i *ProjectIPServiceOp) Get(reservationID string) (*IPAddressReservation, *Response, error) {
- path := fmt.Sprintf("%s/%s", ipBasePath, reservationID)
- ipr := new(IPAddressReservation)
-
- resp, err := i.client.DoRequest("GET", path, nil, ipr)
- if err != nil {
- return nil, resp, err
- }
-
- return ipr, resp, err
-}
-
-// List provides a list of IP resevations for a single project.
-func (i *ProjectIPServiceOp) List(projectID string) ([]IPAddressReservation, *Response, error) {
- path := fmt.Sprintf("%s/%s%s", projectBasePath, projectID, ipBasePath)
- reservations := new(struct {
- Reservations []IPAddressReservation `json:"ip_addresses"`
- })
-
- resp, err := i.client.DoRequest("GET", path, nil, reservations)
- if err != nil {
- return nil, resp, err
- }
- return reservations.Reservations, resp, nil
-}
-
-// Request requests more IP space for a project in order to have additional IP addresses to assign to devices.
-func (i *ProjectIPServiceOp) Request(projectID string, ipReservationReq *IPReservationRequest) (*IPAddressReservation, *Response, error) {
- path := fmt.Sprintf("%s/%s%s", projectBasePath, projectID, ipBasePath)
- ipr := new(IPAddressReservation)
-
- resp, err := i.client.DoRequest("POST", path, ipReservationReq, ipr)
- if err != nil {
- return nil, resp, err
- }
- return ipr, resp, err
-}
-
-// Remove removes an IP reservation from the project.
-func (i *ProjectIPServiceOp) Remove(ipReservationID string) (*Response, error) {
- return deleteFromIP(i.client, ipReservationID)
-}
-
-// AvailableAddresses lists addresses available from a reserved block
-func (i *ProjectIPServiceOp) AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error) {
- path := fmt.Sprintf("%s/%s/available?cidr=%d", ipBasePath, ipReservationID, r.CIDR)
- ar := new(AvailableResponse)
-
- resp, err := i.client.DoRequest("GET", path, r, ar)
- if err != nil {
- return nil, resp, err
- }
- return ar.Available, resp, nil
-
-}
diff --git a/vendor/github.com/packethost/packngo/ip_test.go b/vendor/github.com/packethost/packngo/ip_test.go
deleted file mode 100644
index 238f2c95..00000000
--- a/vendor/github.com/packethost/packngo/ip_test.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package packngo
-
-import (
- "path"
- "testing"
-)
-
-func TestAccIPReservation(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- quantityToMask := map[int]int{
- 1: 32, 2: 31, 4: 30, 8: 29, 16: 28,
- }
-
- testFac := testFacility()
- quantity := 2
-
- ipList, _, err := c.ProjectIPs.List(projectID)
- if err != nil {
- t.Fatal(err)
- }
- if len(ipList) != 0 {
- t.Fatalf("There should be no reservations a new project, existing list: %s", ipList)
- }
-
- req := IPReservationRequest{
- Type: "public_ipv4",
- Quantity: quantity,
- Comments: "packngo test",
- Facility: testFac,
- }
-
- res, _, err := c.ProjectIPs.Request(projectID, &req)
- if err != nil {
- t.Fatal(err)
- }
-
- if res.CIDR != quantityToMask[quantity] {
- t.Fatalf(
- "CIDR prefix length for requested reservation should be %d, was %d",
- quantityToMask[quantity], res.CIDR)
- }
-
- if path.Base(res.Project.Href) != projectID {
- t.Fatalf("Wrong project linked in reserved block: %s", res.Project.Href)
- }
-
- if res.Management {
- t.Fatal("Management flag of new reservation block must be False")
- }
- if res.Facility.Code != testFac {
- t.Fatalf(
- "Facility of new reservation should be %s, was %s", testFac,
- res.Facility.Code)
- }
-
- ipList, _, err = c.ProjectIPs.List(projectID)
- if len(ipList) != 1 {
- t.Fatalf("There should be only one reservation, was: %s", ipList)
- }
- if err != nil {
- t.Fatal(err)
- }
-
- sameRes, _, err := c.ProjectIPs.Get(res.ID)
- if err != nil {
- t.Fatal(err)
- }
- if sameRes.ID != res.ID {
- t.Fatalf("re-requested test reservation should be %s, is %s",
- res, sameRes)
- }
-
- availableAddresses, _, err := c.ProjectIPs.AvailableAddresses(
- res.ID, &AvailableRequest{CIDR: 32})
- if err != nil {
- t.Fatal(err)
- }
- if len(availableAddresses) != quantity {
- t.Fatalf("New block should have %d available addresses, got %s",
- quantity, availableAddresses)
- }
-
- _, err = c.ProjectIPs.Remove(res.ID)
- if err != nil {
- t.Fatal(err)
- }
- _, _, err = c.ProjectIPs.Get(res.ID)
- if err == nil {
- t.Fatalf("Reservation %s should be deleted at this point", res)
- }
-}
diff --git a/vendor/github.com/packethost/packngo/metadata/metadata.go b/vendor/github.com/packethost/packngo/metadata/metadata.go
deleted file mode 100644
index 9430aa9c..00000000
--- a/vendor/github.com/packethost/packngo/metadata/metadata.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package metadata
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "io/ioutil"
- "net"
- "net/http"
-)
-
-const BaseURL = "https://metadata.packet.net"
-
-func GetMetadata() (*CurrentDevice, error) {
- return getMetadataFromURL(BaseURL)
-}
-
-func getMetadataFromURL(baseURL string) (*CurrentDevice, error) {
- res, err := http.Get(baseURL + "/metadata")
- if err != nil {
- return nil, err
- }
-
- b, err := ioutil.ReadAll(res.Body)
- res.Body.Close()
- if err != nil {
- return nil, err
- }
-
- var result struct {
- Error string `json:"error"`
- *CurrentDevice
- }
- if err := json.Unmarshal(b, &result); err != nil {
- if res.StatusCode >= 400 {
- return nil, errors.New(res.Status)
- }
- return nil, err
- }
- if result.Error != "" {
- return nil, errors.New(result.Error)
- }
- return result.CurrentDevice, nil
-}
-
-func GetUserData() ([]byte, error) {
- return getUserDataFromURL(BaseURL)
-}
-
-func getUserDataFromURL(baseURL string) ([]byte, error) {
- res, err := http.Get(baseURL + "/userdata")
- if err != nil {
- return nil, err
- }
-
- b, err := ioutil.ReadAll(res.Body)
- res.Body.Close()
- return b, err
-}
-
-type AddressFamily int
-
-const (
- IPv4 = AddressFamily(4)
- IPv6 = AddressFamily(6)
-)
-
-type AddressInfo struct {
- ID string `json:"id"`
- Family AddressFamily `json:"address_family"`
- Public bool `json:"public"`
- Management bool `json:"management"`
- Address net.IP `json:"address"`
- NetworkMask net.IP `json:"netmask"`
- Gateway net.IP `json:"gateway"`
- NetworkBits int `json:"cidr"`
-
- // These are available, but not really needed:
- // Network net.IP `json:"network"`
-}
-
-type BondingMode int
-
-const (
- BondingBalanceRR = BondingMode(0)
- BondingActiveBackup = BondingMode(1)
- BondingBalanceXOR = BondingMode(2)
- BondingBroadcast = BondingMode(3)
- BondingLACP = BondingMode(4)
- BondingBalanceTLB = BondingMode(5)
- BondingBalanceALB = BondingMode(6)
-)
-
-var bondingModeStrings = map[BondingMode]string{
- BondingBalanceRR: "balance-rr",
- BondingActiveBackup: "active-backup",
- BondingBalanceXOR: "balance-xor",
- BondingBroadcast: "broadcast",
- BondingLACP: "802.3ad",
- BondingBalanceTLB: "balance-tlb",
- BondingBalanceALB: "balance-alb",
-}
-
-func (m BondingMode) String() string {
- if str, ok := bondingModeStrings[m]; ok {
- return str
- }
- return fmt.Sprintf("%d", m)
-}
-
-type CurrentDevice struct {
- ID string `json:"id"`
- Hostname string `json:"hostname"`
- IQN string `json:"iqn"`
- Plan string `json:"plan"`
- Facility string `json:"facility"`
- Tags []string `json:"tags"`
- SSHKeys []string `json:"ssh_keys"`
- OS OperatingSystem `json:"operating_system"`
- Network NetworkInfo `json:"network"`
- Volumes []VolumeInfo `json:"volumes"`
- CustomData map[string]interface{} `json:"customdata"`
-
- // This is available, but is actually inaccurate, currently:
- // APIBaseURL string `json:"api_url"`
-}
-
-type InterfaceInfo struct {
- Name string `json:"name"`
- MAC string `json:"mac"`
-}
-
-func (i *InterfaceInfo) ParseMAC() (net.HardwareAddr, error) {
- return net.ParseMAC(i.MAC)
-}
-
-type NetworkInfo struct {
- Interfaces []InterfaceInfo `json:"interfaces"`
- Addresses []AddressInfo `json:"addresses"`
-
- Bonding struct {
- Mode BondingMode `json:"mode"`
- } `json:"bonding"`
-}
-
-func (n *NetworkInfo) BondingMode() BondingMode {
- return n.Bonding.Mode
-}
-
-type OperatingSystem struct {
- Slug string `json:"slug"`
- Distro string `json:"distro"`
- Version string `json:"version"`
-}
-
-type VolumeInfo struct {
- Name string `json:"name"`
- IQN string `json:"iqn"`
- IPs []net.IP `json:"ips"`
-
- Capacity struct {
- Size int `json:"size,string"`
- Unit string `json:"unit"`
- } `json:"capacity"`
-}
diff --git a/vendor/github.com/packethost/packngo/metadata/metadata_test.go b/vendor/github.com/packethost/packngo/metadata/metadata_test.go
deleted file mode 100644
index 0ca2ff21..00000000
--- a/vendor/github.com/packethost/packngo/metadata/metadata_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package metadata
-
-import (
- "io/ioutil"
- "net/http"
- "net/http/httptest"
-
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func ServerMock() (baseURL string, mux *http.ServeMux, teardownFn func()) {
- mux = http.NewServeMux()
- srv := httptest.NewServer(mux)
- return srv.URL, mux, srv.Close
-}
-
-func Test_Deserialization(t *testing.T) {
- baseURL, mux, teardown := ServerMock()
- defer teardown()
-
- mux.HandleFunc("/metadata", func(w http.ResponseWriter, req *http.Request) {
- b, err := ioutil.ReadFile("testdata/" + "device.json")
- if err != nil {
- panic(err)
- }
- w.Write(b)
- })
-
- device, err := getMetadataFromURL(baseURL)
- assert.Nil(t, err)
- assert.NotNil(t, device)
-
- assert.Equal(t, "9307dc37-7f39-400b-9cd2-009087434a95", device.ID)
- assert.Equal(t, "spcqvzylz6-worker-2409003", device.Hostname)
-
- volumes := device.Volumes
- assert.Equal(t, 1, len(volumes))
- assert.Equal(t, "volume-b7f8e13c", volumes[0].Name)
- assert.Equal(t, "iqn.2013-05.com.daterainc:tc:01:sn:60448a8a63a20a82", volumes[0].IQN)
- assert.Equal(t, 2, len(volumes[0].IPs))
- assert.Equal(t, "10.144.35.132", volumes[0].IPs[0].String())
- assert.Equal(t, "10.144.51.11", volumes[0].IPs[1].String())
- assert.Equal(t, 10, volumes[0].Capacity.Size)
- assert.Equal(t, "gb", volumes[0].Capacity.Unit)
-
-}
diff --git a/vendor/github.com/packethost/packngo/metadata/testdata/device.json b/vendor/github.com/packethost/packngo/metadata/testdata/device.json
deleted file mode 100644
index a6a0005f..00000000
--- a/vendor/github.com/packethost/packngo/metadata/testdata/device.json
+++ /dev/null
@@ -1,181 +0,0 @@
-{
- "id": "9307dc37-7f39-400b-9cd2-009087434a95",
- "hostname": "spcqvzylz6-worker-2409003",
- "iqn": "iqn.2018-06.net.packet:device.9307dc37",
- "operating_system": {
- "slug": "coreos_stable",
- "distro": "coreos",
- "version": "stable",
- "license_activation": {
- "state": "unlicensed"
- },
- "image_tag": null
- },
- "plan": "baremetal_1",
- "class": "c1.small.x86",
- "facility": "ewr1",
- "tags": [],
- "ssh_keys": [
- "ssh-rsa AAAAB3N1234567890 user@host"
- ],
- "storage": {
- "disks": [
- {
- "device": "/dev/sda",
- "wipeTable": true,
- "partitions": [
- {
- "label": "BIOS",
- "number": 1,
- "size": "512M"
- },
- {
- "label": "SWAP",
- "number": 2,
- "size": "3993600"
- },
- {
- "label": "ROOT",
- "number": 3,
- "size": 0
- }
- ]
- }
- ],
- "filesystems": [
- {
- "mount": {
- "device": "/dev/sda1",
- "format": "vfat",
- "point": "/boot/efi",
- "create": {
- "options": [
- "32",
- "-n",
- "EFI"
- ]
- }
- }
- },
- {
- "mount": {
- "device": "/dev/sda3",
- "format": "ext4",
- "point": "/",
- "create": {
- "options": [
- "-L",
- "ROOT"
- ]
- }
- }
- },
- {
- "mount": {
- "device": "/dev/sda2",
- "format": "swap",
- "point": "none",
- "create": {
- "options": [
- "-L",
- "SWAP"
- ]
- }
- }
- }
- ]
- },
- "network": {
- "bonding": {
- "mode": 4
- },
- "interfaces": [
- {
- "name": "enp1s0f0",
- "mac": "0c:c4:7a:15:dc:06",
- "bond": "bond0"
- },
- {
- "name": "enp1s0f1",
- "mac": "0c:c4:7a:15:dc:07",
- "bond": "bond0"
- }
- ],
- "addresses": [
- {
- "id": "4e4781a1-0138-4138-8706-a33420d7073f",
- "address_family": 4,
- "netmask": "255.255.255.254",
- "created_at": "2018-06-28T18:58:19Z",
- "public": true,
- "cidr": 31,
- "management": true,
- "enabled": true,
- "network": "147.75.197.68",
- "address": "147.75.197.69",
- "gateway": "147.75.197.68",
- "parent_block": {
- "network": "147.75.197.68",
- "netmask": "255.255.255.254",
- "cidr": 31,
- "href": "/ips/b7425760-f4fd-4db2-8965-6044e565d705"
- }
- },
- {
- "id": "6d32ce83-50a9-4312-99c0-2116353ee647",
- "address_family": 6,
- "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe",
- "created_at": "2018-06-28T18:58:18Z",
- "public": true,
- "cidr": 127,
- "management": true,
- "enabled": true,
- "network": "2604:1380:0:7e00::6",
- "address": "2604:1380:0:7e00::7",
- "gateway": "2604:1380:0:7e00::6",
- "parent_block": {
- "network": "2604:1380:0000:7e00:0000:0000:0000:0000",
- "netmask": "ffff:ffff:ffff:ff00:0000:0000:0000:0000",
- "cidr": 56,
- "href": "/ips/5d7254c1-fca7-4e01-8417-f7d2cf00f888"
- }
- },
- {
- "id": "6357b697-92ac-4ec5-b074-b1a56dd94678",
- "address_family": 4,
- "netmask": "255.255.255.254",
- "created_at": "2018-06-28T18:58:18Z",
- "public": false,
- "cidr": 31,
- "management": true,
- "enabled": true,
- "network": "10.99.73.134",
- "address": "10.99.73.135",
- "gateway": "10.99.73.134",
- "parent_block": {
- "network": "10.99.73.128",
- "netmask": "255.255.255.128",
- "cidr": 25,
- "href": "/ips/8f55d3b9-2d52-4361-9c02-1678e842432c"
- }
- }
- ]
- },
- "customdata": {},
- "volumes": [
- {
- "ips": [
- "10.144.35.132",
- "10.144.51.11"
- ],
- "name": "volume-b7f8e13c",
- "capacity": {
- "size": "10",
- "unit": "gb"
- },
- "iqn": "iqn.2013-05.com.daterainc:tc:01:sn:60448a8a63a20a82"
- }
- ],
- "api_url": "https://metadata.packet.net",
- "phone_home_url": "http://147.75.195.231/phone-home"
-}
diff --git a/vendor/github.com/packethost/packngo/operatingsystems.go b/vendor/github.com/packethost/packngo/operatingsystems.go
deleted file mode 100644
index 7fd7f27a..00000000
--- a/vendor/github.com/packethost/packngo/operatingsystems.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package packngo
-
-const osBasePath = "/operating-systems"
-
-// OSService interface defines available operating_systems methods
-type OSService interface {
- List() ([]OS, *Response, error)
-}
-
-type osRoot struct {
- OperatingSystems []OS `json:"operating_systems"`
-}
-
-// OS represents a Packet operating system
-type OS struct {
- Name string `json:"name"`
- Slug string `json:"slug"`
- Distro string `json:"distro"`
- Version string `json:"version"`
-}
-
-func (o OS) String() string {
- return Stringify(o)
-}
-
-// OSServiceOp implements OSService
-type OSServiceOp struct {
- client *Client
-}
-
-// List returns all available operating systems
-func (s *OSServiceOp) List() ([]OS, *Response, error) {
- root := new(osRoot)
-
- resp, err := s.client.DoRequest("GET", osBasePath, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- return root.OperatingSystems, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/organizations.go b/vendor/github.com/packethost/packngo/organizations.go
deleted file mode 100644
index 57300c11..00000000
--- a/vendor/github.com/packethost/packngo/organizations.go
+++ /dev/null
@@ -1,155 +0,0 @@
-package packngo
-
-import "fmt"
-
-// API documentation https://www.packet.net/developers/api/organizations/
-const organizationBasePath = "/organizations"
-
-// OrganizationService interface defines available organization methods
-type OrganizationService interface {
- List() ([]Organization, *Response, error)
- Get(string) (*Organization, *Response, error)
- Create(*OrganizationCreateRequest) (*Organization, *Response, error)
- Update(string, *OrganizationUpdateRequest) (*Organization, *Response, error)
- Delete(string) (*Response, error)
- ListPaymentMethods(string) ([]PaymentMethod, *Response, error)
- ListEvents(string, *ListOptions) ([]Event, *Response, error)
-}
-
-type organizationsRoot struct {
- Organizations []Organization `json:"organizations"`
-}
-
-// Organization represents a Packet organization
-type Organization struct {
- ID string `json:"id"`
- Name string `json:"name,omitempty"`
- Description string `json:"description,omitempty"`
- Website string `json:"website,omitempty"`
- Twitter string `json:"twitter,omitempty"`
- Created string `json:"created_at,omitempty"`
- Updated string `json:"updated_at,omitempty"`
- Address Address `json:"address,omitempty"`
- TaxID string `json:"tax_id,omitempty"`
- MainPhone string `json:"main_phone,omitempty"`
- BillingPhone string `json:"billing_phone,omitempty"`
- CreditAmount float64 `json:"credit_amount,omitempty"`
- Logo string `json:"logo,omitempty"`
- LogoThumb string `json:"logo_thumb,omitempty"`
- Projects []Project `json:"projects,omitempty"`
- URL string `json:"href,omitempty"`
- Users []User `json:"members,omitempty"`
- Owners []User `json:"owners,omitempty"`
-}
-
-func (o Organization) String() string {
- return Stringify(o)
-}
-
-// OrganizationCreateRequest type used to create a Packet organization
-type OrganizationCreateRequest struct {
- Name string `json:"name"`
- Description string `json:"description"`
- Website string `json:"website"`
- Twitter string `json:"twitter"`
- Logo string `json:"logo"`
-}
-
-func (o OrganizationCreateRequest) String() string {
- return Stringify(o)
-}
-
-// OrganizationUpdateRequest type used to update a Packet organization
-type OrganizationUpdateRequest struct {
- Name *string `json:"name,omitempty"`
- Description *string `json:"description,omitempty"`
- Website *string `json:"website,omitempty"`
- Twitter *string `json:"twitter,omitempty"`
- Logo *string `json:"logo,omitempty"`
-}
-
-func (o OrganizationUpdateRequest) String() string {
- return Stringify(o)
-}
-
-// OrganizationServiceOp implements OrganizationService
-type OrganizationServiceOp struct {
- client *Client
-}
-
-// List returns the user's organizations
-func (s *OrganizationServiceOp) List() ([]Organization, *Response, error) {
- root := new(organizationsRoot)
-
- resp, err := s.client.DoRequest("GET", organizationBasePath, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- return root.Organizations, resp, err
-}
-
-// Get returns a organization by id
-func (s *OrganizationServiceOp) Get(organizationID string) (*Organization, *Response, error) {
- path := fmt.Sprintf("%s/%s", organizationBasePath, organizationID)
- organization := new(Organization)
-
- resp, err := s.client.DoRequest("GET", path, nil, organization)
- if err != nil {
- return nil, resp, err
- }
-
- return organization, resp, err
-}
-
-// Create creates a new organization
-func (s *OrganizationServiceOp) Create(createRequest *OrganizationCreateRequest) (*Organization, *Response, error) {
- organization := new(Organization)
-
- resp, err := s.client.DoRequest("POST", organizationBasePath, createRequest, organization)
- if err != nil {
- return nil, resp, err
- }
-
- return organization, resp, err
-}
-
-// Update updates an organization
-func (s *OrganizationServiceOp) Update(id string, updateRequest *OrganizationUpdateRequest) (*Organization, *Response, error) {
- path := fmt.Sprintf("%s/%s", organizationBasePath, id)
- organization := new(Organization)
-
- resp, err := s.client.DoRequest("PATCH", path, updateRequest, organization)
- if err != nil {
- return nil, resp, err
- }
-
- return organization, resp, err
-}
-
-// Delete deletes an organizationID
-func (s *OrganizationServiceOp) Delete(organizationID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", organizationBasePath, organizationID)
-
- return s.client.DoRequest("DELETE", path, nil, nil)
-}
-
-// ListPaymentMethods returns PaymentMethods for an organization
-func (s *OrganizationServiceOp) ListPaymentMethods(organizationID string) ([]PaymentMethod, *Response, error) {
- url := fmt.Sprintf("%s/%s%s", organizationBasePath, organizationID, paymentMethodBasePath)
- root := new(paymentMethodsRoot)
-
- resp, err := s.client.DoRequest("GET", url, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- return root.PaymentMethods, resp, err
-}
-
-// ListEvents returns list of organization events
-func (s *OrganizationServiceOp) ListEvents(organizationID string, listOpt *ListOptions) ([]Event, *Response, error) {
- path := fmt.Sprintf("%s/%s%s", organizationBasePath, organizationID, eventBasePath)
-
- return list(s.client, path, listOpt)
-}
diff --git a/vendor/github.com/packethost/packngo/organizations_test.go b/vendor/github.com/packethost/packngo/organizations_test.go
deleted file mode 100644
index efaf80aa..00000000
--- a/vendor/github.com/packethost/packngo/organizations_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package packngo
-
-import "testing"
-
-func TestAccOrgBasic(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c := setup(t)
- defer organizationTeardown(c)
-
- rs := testProjectPrefix + randString8()
- ocr := OrganizationCreateRequest{
- Name: rs,
- Description: "Managed by Packngo.",
- Website: "http://example.com",
- Twitter: "foo",
- }
- p, _, err := c.Organizations.Create(&ocr)
- if err != nil {
- t.Fatal(err)
- }
- if p.Name != rs {
- t.Fatalf("Expected new project name to be %s, not %s", rs, p.Name)
- }
- rs = testProjectPrefix + randString8()
- oDesc := "Managed by Packngo."
- oWeb := "http://quux.example.com"
- oTwi := "bar"
- pur := OrganizationUpdateRequest{
- Name: &rs,
- Description: &oDesc,
- Website: &oWeb,
- Twitter: &oTwi,
- }
- org, _, err := c.Organizations.Update(p.ID, &pur)
- if err != nil {
- t.Fatal(err)
- }
- if org.Name != rs {
- t.Fatalf("Expected the name of the updated project to be %s, not %s", rs, p.Name)
- }
- gotOrg, _, err := c.Organizations.Get(org.ID)
- if err != nil {
- t.Fatal(err)
- }
- if gotOrg.Name != rs {
- t.Fatalf("Expected the name of the GOT project to be %s, not %s", rs, gotOrg.Name)
- }
-
- _, _, err = c.Organizations.ListEvents(org.ID, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = c.Organizations.Delete(org.ID)
- if err != nil {
- t.Fatal(err)
- }
-
-}
-func TestAccOrgListPaymentMethods(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- // setup
- c := setup(t)
- defer organizationTeardown(c)
-
- rs := testProjectPrefix + randString8()
- ocr := OrganizationCreateRequest{
- Name: rs,
- Description: "Managed by Packngo.",
- Website: "http://example.com",
- Twitter: "foo",
- }
- org, _, err := c.Organizations.Create(&ocr)
- if err != nil {
- t.Fatal(err)
- }
-
- // tests
- pms, _, err := c.Organizations.ListPaymentMethods(org.ID)
-
- if err != nil {
- t.Fatal("error: ", err)
- }
-
- if len(pms) != 0 {
- t.Fatal("the new test org should have no payment methods")
- }
-
- // teardown
- _, err = c.Organizations.Delete(org.ID)
- if err != nil {
- t.Fatal(err)
- }
-
-}
diff --git a/vendor/github.com/packethost/packngo/packngo.go b/vendor/github.com/packethost/packngo/packngo.go
deleted file mode 100644
index b5245df7..00000000
--- a/vendor/github.com/packethost/packngo/packngo.go
+++ /dev/null
@@ -1,334 +0,0 @@
-package packngo
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "os"
- "strconv"
- "strings"
- "time"
-)
-
-const (
- packetTokenEnvVar = "PACKET_AUTH_TOKEN"
- libraryVersion = "0.1.0"
- baseURL = "https://api.packet.net/"
- userAgent = "packngo/" + libraryVersion
- mediaType = "application/json"
- debugEnvVar = "PACKNGO_DEBUG"
-
- headerRateLimit = "X-RateLimit-Limit"
- headerRateRemaining = "X-RateLimit-Remaining"
- headerRateReset = "X-RateLimit-Reset"
-)
-
-// ListOptions specifies optional global API parameters
-type ListOptions struct {
- // for paginated result sets, page of results to retrieve
- Page int `url:"page,omitempty"`
-
- // for paginated result sets, the number of results to return per page
- PerPage int `url:"per_page,omitempty"`
-
- // specify which resources you want to return as collections instead of references
- Includes string
-}
-
-func (l *ListOptions) createURL() (url string) {
- if l.Includes != "" {
- url += fmt.Sprintf("include=%s", l.Includes)
- }
-
- if l.Page != 0 {
- if url != "" {
- url += "&"
- }
- url += fmt.Sprintf("page=%d", l.Page)
- }
-
- if l.PerPage != 0 {
- if url != "" {
- url += "&"
- }
- url += fmt.Sprintf("per_page=%d", l.PerPage)
- }
-
- return
-}
-
-// meta contains pagination information
-type meta struct {
- Self *Href `json:"self"`
- First *Href `json:"first"`
- Last *Href `json:"last"`
- Previous *Href `json:"previous,omitempty"`
- Next *Href `json:"next,omitempty"`
- Total int `json:"total"`
- CurrentPageNum int `json:"current_page"`
- LastPageNum int `json:"last_page"`
-}
-
-// Response is the http response from api calls
-type Response struct {
- *http.Response
- Rate
-}
-
-// Href is an API link
-type Href struct {
- Href string `json:"href"`
-}
-
-func (r *Response) populateRate() {
- // parse the rate limit headers and populate Response.Rate
- if limit := r.Header.Get(headerRateLimit); limit != "" {
- r.Rate.RequestLimit, _ = strconv.Atoi(limit)
- }
- if remaining := r.Header.Get(headerRateRemaining); remaining != "" {
- r.Rate.RequestsRemaining, _ = strconv.Atoi(remaining)
- }
- if reset := r.Header.Get(headerRateReset); reset != "" {
- if v, _ := strconv.ParseInt(reset, 10, 64); v != 0 {
- r.Rate.Reset = Timestamp{time.Unix(v, 0)}
- }
- }
-}
-
-// ErrorResponse is the http response used on errors
-type ErrorResponse struct {
- Response *http.Response
- Errors []string `json:"errors"`
- SingleError string `json:"error"`
-}
-
-func (r *ErrorResponse) Error() string {
- return fmt.Sprintf("%v %v: %d %v %v",
- r.Response.Request.Method, r.Response.Request.URL, r.Response.StatusCode, strings.Join(r.Errors, ", "), r.SingleError)
-}
-
-// Client is the base API Client
-type Client struct {
- client *http.Client
- debug bool
-
- BaseURL *url.URL
-
- UserAgent string
- ConsumerToken string
- APIKey string
-
- RateLimit Rate
-
- // Packet Api Objects
- Plans PlanService
- Users UserService
- Emails EmailService
- SSHKeys SSHKeyService
- Devices DeviceService
- Projects ProjectService
- Facilities FacilityService
- OperatingSystems OSService
- DeviceIPs DeviceIPService
- DevicePorts DevicePortService
- ProjectIPs ProjectIPService
- ProjectVirtualNetworks ProjectVirtualNetworkService
- Volumes VolumeService
- VolumeAttachments VolumeAttachmentService
- SpotMarket SpotMarketService
- SpotMarketRequests SpotMarketRequestService
- Organizations OrganizationService
- TwoFactorAuth TwoFactorAuthService
- VPN VPNService
- HardwareReservations HardwareReservationService
- Events EventService
-}
-
-// NewRequest inits a new http request with the proper headers
-func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) {
- // relative path to append to the endpoint url, no leading slash please
- rel, err := url.Parse(path)
- if err != nil {
- return nil, err
- }
-
- u := c.BaseURL.ResolveReference(rel)
-
- // json encode the request body, if any
- buf := new(bytes.Buffer)
- if body != nil {
- err := json.NewEncoder(buf).Encode(body)
- if err != nil {
- return nil, err
- }
- }
-
- req, err := http.NewRequest(method, u.String(), buf)
- if err != nil {
- return nil, err
- }
-
- req.Close = true
-
- req.Header.Add("X-Auth-Token", c.APIKey)
- req.Header.Add("X-Consumer-Token", c.ConsumerToken)
-
- req.Header.Add("Content-Type", mediaType)
- req.Header.Add("Accept", mediaType)
- req.Header.Add("User-Agent", userAgent)
- return req, nil
-}
-
-// Do executes the http request
-func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) {
- resp, err := c.client.Do(req)
- if err != nil {
- return nil, err
- }
-
- defer resp.Body.Close()
-
- response := Response{Response: resp}
- response.populateRate()
- if c.debug {
- o, _ := httputil.DumpResponse(response.Response, true)
- log.Printf("\n=======[RESPONSE]============\n%s\n\n", string(o))
- }
- c.RateLimit = response.Rate
-
- err = checkResponse(resp)
- // if the response is an error, return the ErrorResponse
- if err != nil {
- return &response, err
- }
-
- if v != nil {
- // if v implements the io.Writer interface, return the raw response
- if w, ok := v.(io.Writer); ok {
- io.Copy(w, resp.Body)
- } else {
- err = json.NewDecoder(resp.Body).Decode(v)
- if err != nil {
- return &response, err
- }
- }
- }
-
- return &response, err
-}
-
-// DoRequest is a convenience method, it calls NewRequest followed by Do
-// v is the interface to unmarshal the response JSON into
-func (c *Client) DoRequest(method, path string, body, v interface{}) (*Response, error) {
- req, err := c.NewRequest(method, path, body)
- if c.debug {
- o, _ := httputil.DumpRequestOut(req, true)
- log.Printf("\n=======[REQUEST]=============\n%s\n", string(o))
- }
- if err != nil {
- return nil, err
- }
- return c.Do(req, v)
-}
-
-// DoRequestWithHeader same as DoRequest
-func (c *Client) DoRequestWithHeader(method string, headers map[string]string, path string, body, v interface{}) (*Response, error) {
- req, err := c.NewRequest(method, path, body)
- for k, v := range headers {
- req.Header.Add(k, v)
- }
-
- if c.debug {
- o, _ := httputil.DumpRequestOut(req, true)
- log.Printf("\n=======[REQUEST]=============\n%s\n", string(o))
- }
- if err != nil {
- return nil, err
- }
- return c.Do(req, v)
-}
-
-// NewClient initializes and returns a Client
-func NewClient() (*Client, error) {
- apiToken := os.Getenv(packetTokenEnvVar)
- if apiToken == "" {
- return nil, fmt.Errorf("you must export %s", packetTokenEnvVar)
- }
- c := NewClientWithAuth("packngo lib", apiToken, nil)
- return c, nil
-
-}
-
-// NewClientWithAuth initializes and returns a Client, use this to get an API Client to operate on
-// N.B.: Packet's API certificate requires Go 1.5+ to successfully parse. If you are using
-// an older version of Go, pass in a custom http.Client with a custom TLS configuration
-// that sets "InsecureSkipVerify" to "true"
-func NewClientWithAuth(consumerToken string, apiKey string, httpClient *http.Client) *Client {
- client, _ := NewClientWithBaseURL(consumerToken, apiKey, httpClient, baseURL)
- return client
-}
-
-// NewClientWithBaseURL returns a Client pointing to nonstandard API URL, e.g.
-// for mocking the remote API
-func NewClientWithBaseURL(consumerToken string, apiKey string, httpClient *http.Client, apiBaseURL string) (*Client, error) {
- if httpClient == nil {
- // Don't fall back on http.DefaultClient as it's not nice to adjust state
- // implicitly. If the client wants to use http.DefaultClient, they can
- // pass it in explicitly.
- httpClient = &http.Client{}
- }
-
- u, err := url.Parse(apiBaseURL)
- if err != nil {
- return nil, err
- }
-
- c := &Client{client: httpClient, BaseURL: u, UserAgent: userAgent, ConsumerToken: consumerToken, APIKey: apiKey}
- c.debug = os.Getenv(debugEnvVar) != ""
- c.Plans = &PlanServiceOp{client: c}
- c.Organizations = &OrganizationServiceOp{client: c}
- c.Users = &UserServiceOp{client: c}
- c.Emails = &EmailServiceOp{client: c}
- c.SSHKeys = &SSHKeyServiceOp{client: c}
- c.Devices = &DeviceServiceOp{client: c}
- c.Projects = &ProjectServiceOp{client: c}
- c.Facilities = &FacilityServiceOp{client: c}
- c.OperatingSystems = &OSServiceOp{client: c}
- c.DeviceIPs = &DeviceIPServiceOp{client: c}
- c.DevicePorts = &DevicePortServiceOp{client: c}
- c.ProjectVirtualNetworks = &ProjectVirtualNetworkServiceOp{client: c}
- c.ProjectIPs = &ProjectIPServiceOp{client: c}
- c.Volumes = &VolumeServiceOp{client: c}
- c.VolumeAttachments = &VolumeAttachmentServiceOp{client: c}
- c.SpotMarket = &SpotMarketServiceOp{client: c}
- c.TwoFactorAuth = &TwoFactorAuthServiceOp{client: c}
- c.VPN = &VPNServiceOp{client: c}
- c.HardwareReservations = &HardwareReservationServiceOp{client: c}
- c.SpotMarketRequests = &SpotMarketRequestServiceOp{client: c}
- c.Events = &EventServiceOp{client: c}
-
- return c, nil
-}
-
-func checkResponse(r *http.Response) error {
- // return if http status code is within 200 range
- if c := r.StatusCode; c >= 200 && c <= 299 {
- // response is good, return
- return nil
- }
-
- errorResponse := &ErrorResponse{Response: r}
- data, err := ioutil.ReadAll(r.Body)
- // if the response has a body, populate the message in errorResponse
- if err == nil && len(data) > 0 {
- json.Unmarshal(data, errorResponse)
- }
-
- return errorResponse
-}
diff --git a/vendor/github.com/packethost/packngo/packngo_test.go b/vendor/github.com/packethost/packngo/packngo_test.go
deleted file mode 100644
index 4703e01c..00000000
--- a/vendor/github.com/packethost/packngo/packngo_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-package packngo
-
-import (
- "fmt"
- "math/rand"
- "os"
- "regexp"
- "strings"
- "testing"
- "time"
-)
-
-const (
- packetURLEnvVar = "PACKET_API_URL"
- packngoAccTestVar = "PACKNGO_TEST_ACTUAL_API"
- testProjectPrefix = "PACKNGO_TEST_DELME_2d768716_"
- testFacilityVar = "PACKNGO_TEST_FACILITY"
-)
-
-func testFacility() string {
- envFac := os.Getenv(testFacilityVar)
- if envFac != "" {
- return envFac
- }
- return "ewr1"
-}
-
-func randString8() string {
- n := 8
- rand.Seed(time.Now().UnixNano())
- letterRunes := []rune("acdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
- b := make([]rune, n)
- for i := range b {
- b[i] = letterRunes[rand.Intn(len(letterRunes))]
- }
- return string(b)
-}
-
-func setupWithProject(t *testing.T) (*Client, string, func()) {
- c := setup(t)
- p, _, err := c.Projects.Create(&ProjectCreateRequest{Name: testProjectPrefix + randString8()})
- if err != nil {
- t.Fatal(err)
- }
-
- return c, p.ID, func() {
- _, err := c.Projects.Delete(p.ID)
- if err != nil {
- panic(fmt.Errorf("while deleting %s: %s", p, err))
- }
- }
-
-}
-
-func skipUnlessAcceptanceTestsAllowed(t *testing.T) {
- if os.Getenv(packngoAccTestVar) == "" {
- t.Skipf("%s is not set", packngoAccTestVar)
- }
-}
-
-func setup(t *testing.T) *Client {
- apiToken := os.Getenv(packetTokenEnvVar)
- if apiToken == "" {
- t.Fatalf("If you want to run packngo test, you must export %s.", packetTokenEnvVar)
- }
- apiURL := os.Getenv(packetURLEnvVar)
- if apiURL == "" {
- apiURL = baseURL
- }
- c, err := NewClientWithBaseURL("packngo test", apiToken, nil, apiURL)
- if err != nil {
- t.Fatal(err)
- }
- return c
-}
-
-func projectTeardown(c *Client) {
- ps, _, err := c.Projects.List(nil)
- if err != nil {
- panic(fmt.Errorf("while teardown: %s", err))
- }
- for _, p := range ps {
- if strings.HasPrefix(p.Name, testProjectPrefix) {
- _, err := c.Projects.Delete(p.ID)
- if err != nil {
- panic(fmt.Errorf("while deleting %s: %s", p, err))
- }
- }
- }
-}
-
-func organizationTeardown(c *Client) {
- ps, _, err := c.Organizations.List()
- if err != nil {
- panic(fmt.Errorf("while teardown: %s", err))
- }
- for _, p := range ps {
- if strings.HasPrefix(p.Name, testProjectPrefix) {
- _, err := c.Organizations.Delete(p.ID)
- if err != nil {
- panic(fmt.Errorf("while deleting %s: %s", p, err))
- }
- }
- }
-}
-
-func TestAccInvalidCredentials(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- c := NewClientWithAuth("packngo test", "wrongApiToken", nil)
- _, r, expectedErr := c.Projects.List(nil)
- matched, err := regexp.MatchString(".*Invalid.*", expectedErr.Error())
- if err != nil {
- t.Fatalf("Err while matching err string from response err %s: %s", expectedErr, err)
- }
- if r.StatusCode != 401 {
- t.Fatalf("Expected 401 as response code, got: %d", r.StatusCode)
- }
-
- if !matched {
- t.Fatalf("Unexpected error string: %s", expectedErr)
- }
-
-}
diff --git a/vendor/github.com/packethost/packngo/payment_methods.go b/vendor/github.com/packethost/packngo/payment_methods.go
deleted file mode 100644
index 3479f092..00000000
--- a/vendor/github.com/packethost/packngo/payment_methods.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package packngo
-
-// API documentation https://www.packet.net/developers/api/paymentmethods/
-const paymentMethodBasePath = "/payment-methods"
-
-// ProjectService interface defines available project methods
-type PaymentMethodService interface {
- List() ([]PaymentMethod, *Response, error)
- Get(string) (*PaymentMethod, *Response, error)
- Create(*PaymentMethodCreateRequest) (*PaymentMethod, *Response, error)
- Update(string, *PaymentMethodUpdateRequest) (*PaymentMethod, *Response, error)
- Delete(string) (*Response, error)
-}
-
-type paymentMethodsRoot struct {
- PaymentMethods []PaymentMethod `json:"payment_methods"`
-}
-
-// PaymentMethod represents a Packet payment method of an organization
-type PaymentMethod struct {
- ID string `json:"id"`
- Name string `json:"name,omitempty"`
- Created string `json:"created_at,omitempty"`
- Updated string `json:"updated_at,omitempty"`
- Nonce string `json:"nonce,omitempty"`
- Default bool `json:"default,omitempty"`
- Organization Organization `json:"organization,omitempty"`
- Projects []Project `json:"projects,omitempty"`
- Type string `json:"type,omitempty"`
- CardholderName string `json:"cardholder_name,omitempty"`
- ExpMonth string `json:"expiration_month,omitempty"`
- ExpYear string `json:"expiration_year,omitempty"`
- Last4 string `json:"last_4,omitempty"`
- BillingAddress BillingAddress `json:"billing_address,omitempty"`
- URL string `json:"href,omitempty"`
-}
-
-func (pm PaymentMethod) String() string {
- return Stringify(pm)
-}
-
-// PaymentMethodCreateRequest type used to create a Packet payment method of an organization
-type PaymentMethodCreateRequest struct {
- Name string `json:"name"`
- Nonce string `json:"name"`
- CardholderName string `json:"cardholder_name,omitempty"`
- ExpMonth string `json:"expiration_month,omitempty"`
- ExpYear string `json:"expiration_year,omitempty"`
- BillingAddress string `json:"billing_address,omitempty"`
-}
-
-func (pm PaymentMethodCreateRequest) String() string {
- return Stringify(pm)
-}
-
-// PaymentMethodUpdateRequest type used to update a Packet payment method of an organization
-type PaymentMethodUpdateRequest struct {
- Name *string `json:"name,omitempty"`
- CardholderName *string `json:"cardholder_name,omitempty"`
- ExpMonth *string `json:"expiration_month,omitempty"`
- ExpYear *string `json:"expiration_year,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
-}
-
-func (pm PaymentMethodUpdateRequest) String() string {
- return Stringify(pm)
-}
-
-// PaymentMethodServiceOp implements PaymentMethodService
-type PaymentMethodServiceOp struct {
- client *Client
-}
diff --git a/vendor/github.com/packethost/packngo/plans.go b/vendor/github.com/packethost/packngo/plans.go
deleted file mode 100644
index 148a2a5c..00000000
--- a/vendor/github.com/packethost/packngo/plans.go
+++ /dev/null
@@ -1,117 +0,0 @@
-package packngo
-
-const planBasePath = "/plans"
-
-// PlanService interface defines available plan methods
-type PlanService interface {
- List() ([]Plan, *Response, error)
-}
-
-type planRoot struct {
- Plans []Plan `json:"plans"`
-}
-
-// Plan represents a Packet service plan
-type Plan struct {
- ID string `json:"id"`
- Slug string `json:"slug,omitempty"`
- Name string `json:"name,omitempty"`
- Description string `json:"description,omitempty"`
- Line string `json:"line,omitempty"`
- Specs *Specs `json:"specs,omitempty"`
- Pricing *Pricing `json:"pricing,omitempty"`
-}
-
-func (p Plan) String() string {
- return Stringify(p)
-}
-
-// Specs - the server specs for a plan
-type Specs struct {
- Cpus []*Cpus `json:"cpus,omitempty"`
- Memory *Memory `json:"memory,omitempty"`
- Drives []*Drives `json:"drives,omitempty"`
- Nics []*Nics `json:"nics,omitempty"`
- Features *Features `json:"features,omitempty"`
-}
-
-func (s Specs) String() string {
- return Stringify(s)
-}
-
-// Cpus - the CPU config details for specs on a plan
-type Cpus struct {
- Count int `json:"count,omitempty"`
- Type string `json:"type,omitempty"`
-}
-
-func (c Cpus) String() string {
- return Stringify(c)
-}
-
-// Memory - the RAM config details for specs on a plan
-type Memory struct {
- Total string `json:"total,omitempty"`
-}
-
-func (m Memory) String() string {
- return Stringify(m)
-}
-
-// Drives - the storage config details for specs on a plan
-type Drives struct {
- Count int `json:"count,omitempty"`
- Size string `json:"size,omitempty"`
- Type string `json:"type,omitempty"`
-}
-
-func (d Drives) String() string {
- return Stringify(d)
-}
-
-// Nics - the network hardware details for specs on a plan
-type Nics struct {
- Count int `json:"count,omitempty"`
- Type string `json:"type,omitempty"`
-}
-
-func (n Nics) String() string {
- return Stringify(n)
-}
-
-// Features - other features in the specs for a plan
-type Features struct {
- Raid bool `json:"raid,omitempty"`
- Txt bool `json:"txt,omitempty"`
-}
-
-func (f Features) String() string {
- return Stringify(f)
-}
-
-// Pricing - the pricing options on a plan
-type Pricing struct {
- Hourly float32 `json:"hourly,omitempty"`
- Monthly float32 `json:"monthly,omitempty"`
-}
-
-func (p Pricing) String() string {
- return Stringify(p)
-}
-
-// PlanServiceOp implements PlanService
-type PlanServiceOp struct {
- client *Client
-}
-
-// List method returns all available plans
-func (s *PlanServiceOp) List() ([]Plan, *Response, error) {
- root := new(planRoot)
-
- resp, err := s.client.DoRequest("GET", planBasePath, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- return root.Plans, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/ports.go b/vendor/github.com/packethost/packngo/ports.go
deleted file mode 100644
index c0f79d38..00000000
--- a/vendor/github.com/packethost/packngo/ports.go
+++ /dev/null
@@ -1,225 +0,0 @@
-package packngo
-
-import (
- "fmt"
-)
-
-const portBasePath = "/ports"
-
-type NetworkType int
-
-const (
- NetworkL3 NetworkType = iota
- NetworkHybrid
- NetworkL2Bonded
- NetworkL2Individual
- NetworkUnknown
-)
-
-// DevicePortService handles operations on a port which belongs to a particular device
-type DevicePortService interface {
- Assign(*PortAssignRequest) (*Port, *Response, error)
- Unassign(*PortAssignRequest) (*Port, *Response, error)
- Bond(*BondRequest) (*Port, *Response, error)
- Disbond(*DisbondRequest) (*Port, *Response, error)
- PortToLayerTwo(string) (*Port, *Response, error)
- PortToLayerThree(string) (*Port, *Response, error)
- DeviceToLayerTwo(string) (*Device, error)
- DeviceToLayerThree(string) (*Device, error)
- DeviceNetworkType(string) (NetworkType, error)
- GetBondPort(string) (*Port, error)
- GetPortByName(string, string) (*Port, error)
-}
-
-type PortData struct {
- MAC string `json:"mac"`
- Bonded bool `json:"bonded"`
-}
-
-type Port struct {
- ID string `json:"id"`
- Type string `json:"type"`
- Name string `json:"name"`
- Data PortData `json:"data"`
- AttachedVirtualNetworks []VirtualNetwork `json:"virtual_networks"`
-}
-
-type AddressRequest struct {
- AddressFamily int `json:"address_family"`
- Public bool `json:"public"`
-}
-
-type BackToL3Request struct {
- RequestIPs []AddressRequest `json:"request_ips"`
-}
-
-type DevicePortServiceOp struct {
- client *Client
-}
-
-type PortAssignRequest struct {
- PortID string `json:"id"`
- VirtualNetworkID string `json:"vnid"`
-}
-
-type BondRequest struct {
- PortID string `json:"id"`
- BulkEnable bool `json:"bulk_enable"`
-}
-
-type DisbondRequest struct {
- PortID string `json:"id"`
- BulkDisable bool `json:"bulk_disable"`
-}
-
-func (i *DevicePortServiceOp) GetBondPort(deviceID string) (*Port, error) {
- device, _, err := i.client.Devices.Get(deviceID)
- if err != nil {
- return nil, err
- }
- for _, port := range device.NetworkPorts {
- if port.Type == "NetworkBondPort" {
- return &port, nil
- }
- }
-
- return nil, fmt.Errorf("No bonded port found in device %s", deviceID)
-}
-
-func (i *DevicePortServiceOp) GetPortByName(deviceID, name string) (*Port, error) {
- device, _, err := i.client.Devices.Get(deviceID)
- if err != nil {
- return nil, err
- }
- for _, port := range device.NetworkPorts {
- if port.Name == name {
- return &port, nil
- }
- }
-
- return nil, fmt.Errorf("Port %s not found in device %s", name, deviceID)
-}
-
-func (i *DevicePortServiceOp) Assign(par *PortAssignRequest) (*Port, *Response, error) {
- path := fmt.Sprintf("%s/%s/assign", portBasePath, par.PortID)
- return i.portAction(path, par)
-}
-
-func (i *DevicePortServiceOp) Unassign(par *PortAssignRequest) (*Port, *Response, error) {
- path := fmt.Sprintf("%s/%s/unassign", portBasePath, par.PortID)
- return i.portAction(path, par)
-}
-
-func (i *DevicePortServiceOp) Bond(br *BondRequest) (*Port, *Response, error) {
- path := fmt.Sprintf("%s/%s/bond", portBasePath, br.PortID)
- return i.portAction(path, br)
-}
-
-func (i *DevicePortServiceOp) Disbond(dr *DisbondRequest) (*Port, *Response, error) {
- path := fmt.Sprintf("%s/%s/disbond", portBasePath, dr.PortID)
- return i.portAction(path, dr)
-}
-
-func (i *DevicePortServiceOp) portAction(path string, req interface{}) (*Port, *Response, error) {
- port := new(Port)
-
- resp, err := i.client.DoRequest("POST", path, req, port)
- if err != nil {
- return nil, resp, err
- }
-
- return port, resp, err
-}
-
-func (i *DevicePortServiceOp) PortToLayerTwo(portID string) (*Port, *Response, error) {
- path := fmt.Sprintf("%s/%s/convert/layer-2", portBasePath, portID)
- port := new(Port)
-
- resp, err := i.client.DoRequest("POST", path, nil, port)
- if err != nil {
- return nil, resp, err
- }
-
- return port, resp, err
-}
-
-func (i *DevicePortServiceOp) PortToLayerThree(portID string) (*Port, *Response, error) {
- path := fmt.Sprintf("%s/%s/convert/layer-3", portBasePath, portID)
- port := new(Port)
-
- req := BackToL3Request{
- RequestIPs: []AddressRequest{
- AddressRequest{AddressFamily: 4, Public: true},
- AddressRequest{AddressFamily: 4, Public: false},
- AddressRequest{AddressFamily: 6, Public: true},
- },
- }
-
- resp, err := i.client.DoRequest("POST", path, &req, port)
- if err != nil {
- return nil, resp, err
- }
-
- return port, resp, err
-}
-
-func (i *DevicePortServiceOp) DeviceNetworkType(deviceID string) (NetworkType, error) {
- d, _, err := i.client.Devices.Get(deviceID)
- if err != nil {
- return NetworkUnknown, err
- }
- if d.Plan.Slug == "baremetal_0" || d.Plan.Slug == "baremetal_1" {
- return NetworkL3, nil
- }
- if d.Plan.Slug == "baremetal_1e" {
- return NetworkHybrid, nil
- }
- if len(d.NetworkPorts) < 1 {
- // really?
- return NetworkL2Individual, nil
- }
- if d.NetworkPorts[0].Data.Bonded {
- if d.NetworkPorts[2].Data.Bonded {
- for _, ip := range d.Network {
- if ip.Management {
- return NetworkL3, nil
- }
- }
- return NetworkL2Bonded, nil
- } else {
- return NetworkHybrid, nil
- }
- }
- return NetworkL2Individual, nil
-}
-
-func (i *DevicePortServiceOp) DeviceToLayerThree(deviceID string) (*Device, error) {
- // hopefull all the VLANs are unassigned at this point
- bond0, err := i.client.DevicePorts.GetBondPort(deviceID)
- if err != nil {
- return nil, err
- }
-
- bond0, _, err = i.client.DevicePorts.PortToLayerThree(bond0.ID)
- if err != nil {
- return nil, err
- }
- d, _, err := i.client.Devices.Get(deviceID)
- return d, err
-}
-
-// DeviceToLayerTwo converts device to L2 networking. Use bond0 to attach VLAN.
-func (i *DevicePortServiceOp) DeviceToLayerTwo(deviceID string) (*Device, error) {
- bond0, err := i.client.DevicePorts.GetBondPort(deviceID)
- if err != nil {
- return nil, err
- }
-
- bond0, _, err = i.client.DevicePorts.PortToLayerTwo(bond0.ID)
- if err != nil {
- return nil, err
- }
- d, _, err := i.client.Devices.Get(deviceID)
- return d, err
-
-}
diff --git a/vendor/github.com/packethost/packngo/ports_test.go b/vendor/github.com/packethost/packngo/ports_test.go
deleted file mode 100644
index 359ebf97..00000000
--- a/vendor/github.com/packethost/packngo/ports_test.go
+++ /dev/null
@@ -1,431 +0,0 @@
-package packngo
-
-import (
- "log"
- "path"
- "testing"
-)
-
-// run this test as
-// PACKNGO_TEST_FACILITY=atl1 PACKNGO_TEST_ACTUAL_API=1 go test -v -run=TestAccPort1E
-// .. you can choose another facility, but there must be Type 1E available
-
-func TestAccPort1E(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- // MARK_1
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- hn := randString8()
-
- fac := testFacility()
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: fac,
- Plan: "baremetal_1e",
- OS: "ubuntu_16_04",
- ProjectID: projectID,
- BillingCycle: "hourly",
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
- dID := d.ID
-
- // If you need to test this, run a 1e device in your project in a faciltiy
- // and then comment code from MARK_1 to here and uncomment following.
- // Fill the values from your device, project and facility.
-
- /*
-
- c := setup(t)
-
- dID := "414f52d3-022a-420d-a521-915fdcc66801"
- projectID := "52000fb2-ee46-4673-93a8-de2c2bdba33b"
- fac := "atl1"
- d := &Device{}
- err := fmt.Errorf("hi")
-
- */
-
- d, err = waitDeviceActive(dID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- nType, err := c.DevicePorts.DeviceNetworkType(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if nType != NetworkHybrid {
- t.Fatal("New 1E device should be in Hybrid Network Type")
- }
-
- eth1, err := c.DevicePorts.GetPortByName(d.ID, "eth1")
-
- if err != nil {
- t.Fatal(err)
- }
-
- if len(eth1.AttachedVirtualNetworks) != 0 {
- t.Fatal("No vlans should be attached to a eth1 in the begining of this test")
- }
-
- vncr := VirtualNetworkCreateRequest{
- ProjectID: projectID,
- Facility: fac,
- }
-
- vlan, _, err := c.ProjectVirtualNetworks.Create(&vncr)
- if err != nil {
- t.Fatal(err)
- }
- defer c.ProjectVirtualNetworks.Delete(vlan.ID)
- par := PortAssignRequest{
- PortID: eth1.ID,
- VirtualNetworkID: vlan.ID}
-
- p, _, err := c.DevicePorts.Assign(&par)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(p.AttachedVirtualNetworks) != 1 {
- t.Fatal("Exactly one vlan should be attached to a eth1 at this point")
- }
-
- if path.Base(p.AttachedVirtualNetworks[0].Href) != vlan.ID {
- t.Fatal("mismatch in the UUID of the assigned VLAN")
- }
-
- p, _, err = c.DevicePorts.Unassign(&par)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(p.AttachedVirtualNetworks) != 0 {
- t.Fatal("No vlans should be attached to the port at this time")
- }
-}
-
-func TestAccPortL2HybridL3ConvertType2A(t *testing.T) {
- // PACKNGO_TEST_FACILITY=nrt1 PACKNGO_TEST_ACTUAL_API=1 go test -v -timeout 30m -run=TestAccPortL2HybridL3ConvertType2A
- testL2HybridL3Convert(t, "baremetal_2a")
-}
-
-func TestAccPortL2HybridL3ConvertType2(t *testing.T) {
- testL2HybridL3Convert(t, "baremetal_2")
-}
-
-func TestAccPortL2HybridL3ConvertType3(t *testing.T) {
- testL2HybridL3Convert(t, "baremetal_3")
-}
-
-func TestAccPortL2HybridL3ConvertTypeS(t *testing.T) {
- testL2HybridL3Convert(t, "baremetal_s")
-}
-
-func testL2HybridL3Convert(t *testing.T, plan string) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- log.Println("Testing type", plan, "convert to Hybrid L2 and back to L3")
-
- // MARK_2
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- hn := randString8()
-
- fac := testFacility()
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: fac,
- Plan: plan,
- OS: "ubuntu_16_04",
- ProjectID: projectID,
- BillingCycle: "hourly",
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
- dID := d.ID
-
- // If you need to test this, run a ${plan} device in your project in a
- // facility,
- // and then comment code from MARK_2 to here and uncomment following.
- // Fill the values from youri testing device, project and facility.
-
- /*
-
- c := setup(t)
-
- dID := "2dd8d2a3-fcb5-44ef-9150-00167c4392ec"
- projectID := "52000fb2-ee46-4673-93a8-de2c2bdba33b"
- fac := "nrt1"
-
- d := &Device{}
- err := fmt.Errorf("hi")
- */
-
- d, err = waitDeviceActive(dID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- nType, err := c.DevicePorts.DeviceNetworkType(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if nType != NetworkL3 {
- t.Fatalf("New %s device should be in network type L3", plan)
- }
-
- // The "hybrid" network type means removing eth1 from the bond.
- // We can then assign VLAN to eth1, instead of bond0 like in the other
- // L2 network type.
-
- eth1, err := c.DevicePorts.GetPortByName(d.ID, "eth1")
- if err != nil {
- t.Fatal(err)
- }
-
- eth1, _, err = c.DevicePorts.Disbond(
- &DisbondRequest{PortID: eth1.ID, BulkDisable: false},
- )
- if err != nil {
- t.Fatal(err)
- }
-
- nType, err = c.DevicePorts.DeviceNetworkType(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if nType != NetworkHybrid {
- t.Fatal("the device should now be in network type L2 Bonded")
- }
-
- if len(eth1.AttachedVirtualNetworks) != 0 {
- t.Fatal("No vlans should be attached to a eth1 in the begining of this test")
- }
-
- vncr := VirtualNetworkCreateRequest{
- ProjectID: projectID,
- Facility: fac,
- }
-
- vlan, _, err := c.ProjectVirtualNetworks.Create(&vncr)
- if err != nil {
- t.Fatal(err)
- }
- defer c.ProjectVirtualNetworks.Delete(vlan.ID)
-
- par := PortAssignRequest{
- PortID: eth1.ID,
- VirtualNetworkID: vlan.ID}
- p, _, err := c.DevicePorts.Assign(&par)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(p.AttachedVirtualNetworks) != 1 {
- t.Fatal("Exactly one vlan should be attached to a eth1 at this point")
- }
-
- if path.Base(p.AttachedVirtualNetworks[0].Href) != vlan.ID {
- t.Fatal("mismatch in the UUID of the assigned VLAN")
- }
-
- p, _, err = c.DevicePorts.Unassign(&par)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(p.AttachedVirtualNetworks) != 0 {
- t.Fatal("No vlans should be attached to the port at this time")
- }
-
- eth1, _, err = c.DevicePorts.Bond(&BondRequest{PortID: eth1.ID, BulkEnable: false})
- if err != nil {
- t.Fatal(err)
- }
-
- nType, err = c.DevicePorts.DeviceNetworkType(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if nType != NetworkL3 {
- t.Fatal("the device should now be back in network type L3")
- }
-
-}
-
-func TestAccPortL2L3ConvertType2A(t *testing.T) {
- // run possible as:
- // PACKNGO_TEST_FACILITY=nrt1 PACKNGO_TEST_ACTUAL_API=1 go test -v -timeout 20m -run=TestAccPort2A
- testL2L3Convert(t, "baremetal_2a")
-}
-
-func TestAccPortL2L3ConvertType2(t *testing.T) {
- // PACKNGO_TEST_FACILITY=nrt1 PACKNGO_TEST_ACTUAL_API=1 go test -v -run=TestAccPort2
- testL2L3Convert(t, "baremetal_2")
-}
-
-func TestAccPortL2L3ConvertType3(t *testing.T) {
- testL2L3Convert(t, "baremetal_3")
-}
-
-func TestAccPortL2L3ConvertTypeS(t *testing.T) {
- testL2L3Convert(t, "baremetal_s")
-}
-
-func testL2L3Convert(t *testing.T, plan string) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- log.Println("Testing type", plan, "convert to L2 and back to L3")
-
- // MARK_2
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- hn := randString8()
-
- fac := testFacility()
-
- cr := DeviceCreateRequest{
- Hostname: hn,
- Facility: fac,
- Plan: plan,
- OS: "ubuntu_16_04",
- ProjectID: projectID,
- BillingCycle: "hourly",
- }
-
- d, _, err := c.Devices.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
- defer deleteDevice(t, c, d.ID)
- dID := d.ID
-
- // If you need to test this, run a ${plan} device in your project in a
- // facility,
- // and then comment code from MARK_2 to here and uncomment following.
- // Fill the values from youri testing device, project and facility.
-
- /*
-
- c := setup(t)
-
- dID := "873fecd1-85a0-4998-ae61-13cfb4f199a8"
- projectID := "52000fb2-ee46-4673-93a8-de2c2bdba33b"
- fac := "nrt1"
-
- d := &Device{}
- err := fmt.Errorf("hi")
- */
-
- d, err = waitDeviceActive(dID, c)
- if err != nil {
- t.Fatal(err)
- }
-
- nType, err := c.DevicePorts.DeviceNetworkType(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if nType != NetworkL3 {
- t.Fatalf("New %s device should be in network type L3", plan)
- }
-
- d, err = c.DevicePorts.DeviceToLayerTwo(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- nType, err = c.DevicePorts.DeviceNetworkType(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if nType != NetworkL2Bonded {
- t.Fatal("the device should now be in network type L2 Bonded")
- }
-
- bond0, err := c.DevicePorts.GetBondPort(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(bond0.AttachedVirtualNetworks) != 0 {
- t.Fatal("No vlans should be attached to a bond0 in the begining of this test")
- }
-
- vncr := VirtualNetworkCreateRequest{
- ProjectID: projectID,
- Facility: fac,
- }
-
- vlan, _, err := c.ProjectVirtualNetworks.Create(&vncr)
- if err != nil {
- t.Fatal(err)
- }
- defer c.ProjectVirtualNetworks.Delete(vlan.ID)
-
- par := PortAssignRequest{
- PortID: bond0.ID,
- VirtualNetworkID: vlan.ID}
- p, _, err := c.DevicePorts.Assign(&par)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(p.AttachedVirtualNetworks) != 1 {
- t.Fatal("Exactly one vlan should be attached to a bond0 at this point")
- }
-
- if path.Base(p.AttachedVirtualNetworks[0].Href) != vlan.ID {
- t.Fatal("mismatch in the UUID of the assigned VLAN")
- }
-
- p, _, err = c.DevicePorts.Unassign(&par)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(p.AttachedVirtualNetworks) != 0 {
- t.Fatal("No vlans should be attached to the port at this time")
- }
-
- d, err = c.DevicePorts.DeviceToLayerThree(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- nType, err = c.DevicePorts.DeviceNetworkType(d.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if nType != NetworkL3 {
- t.Fatal("the device now should be back in network type L3")
- }
-
-}
diff --git a/vendor/github.com/packethost/packngo/projects.go b/vendor/github.com/packethost/packngo/projects.go
deleted file mode 100644
index 72b1799a..00000000
--- a/vendor/github.com/packethost/packngo/projects.go
+++ /dev/null
@@ -1,168 +0,0 @@
-package packngo
-
-import (
- "fmt"
- "strings"
-)
-
-const projectBasePath = "/projects"
-
-// ProjectService interface defines available project methods
-type ProjectService interface {
- List(listOpt *ListOptions) ([]Project, *Response, error)
- Get(string) (*Project, *Response, error)
- GetExtra(projectID string, includes, excludes []string) (*Project, *Response, error)
- Create(*ProjectCreateRequest) (*Project, *Response, error)
- Update(string, *ProjectUpdateRequest) (*Project, *Response, error)
- Delete(string) (*Response, error)
- ListEvents(string, *ListOptions) ([]Event, *Response, error)
-}
-
-type projectsRoot struct {
- Projects []Project `json:"projects"`
- Meta meta `json:"meta"`
-}
-
-// Project represents a Packet project
-type Project struct {
- ID string `json:"id"`
- Name string `json:"name,omitempty"`
- Organization Organization `json:"organization,omitempty"`
- Created string `json:"created_at,omitempty"`
- Updated string `json:"updated_at,omitempty"`
- Users []User `json:"members,omitempty"`
- Devices []Device `json:"devices,omitempty"`
- SSHKeys []SSHKey `json:"ssh_keys,omitempty"`
- URL string `json:"href,omitempty"`
- PaymentMethod PaymentMethod `json:"payment_method,omitempty"`
-}
-
-func (p Project) String() string {
- return Stringify(p)
-}
-
-// ProjectCreateRequest type used to create a Packet project
-type ProjectCreateRequest struct {
- Name string `json:"name"`
- PaymentMethodID string `json:"payment_method_id,omitempty"`
- OrganizationID string `json:"organization_id,omitempty"`
-}
-
-func (p ProjectCreateRequest) String() string {
- return Stringify(p)
-}
-
-// ProjectUpdateRequest type used to update a Packet project
-type ProjectUpdateRequest struct {
- Name *string `json:"name,omitempty"`
- PaymentMethodID *string `json:"payment_method_id,omitempty"`
-}
-
-func (p ProjectUpdateRequest) String() string {
- return Stringify(p)
-}
-
-// ProjectServiceOp implements ProjectService
-type ProjectServiceOp struct {
- client *Client
-}
-
-// List returns the user's projects
-func (s *ProjectServiceOp) List(listOpt *ListOptions) (projects []Project, resp *Response, err error) {
- var params string
- if listOpt != nil {
- params = listOpt.createURL()
- }
- root := new(projectsRoot)
-
- path := fmt.Sprintf("%s?%s", projectBasePath, params)
-
- for {
- resp, err = s.client.DoRequest("GET", path, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- projects = append(projects, root.Projects...)
-
- if root.Meta.Next != nil && (listOpt == nil || listOpt.Page == 0) {
- path = root.Meta.Next.Href
- if params != "" {
- path = fmt.Sprintf("%s&%s", path, params)
- }
- continue
- }
-
- return
- }
-}
-
-// GetExtra returns a project by id with extra information
-func (s *ProjectServiceOp) GetExtra(projectID string, includes, excludes []string) (*Project, *Response, error) {
- path := fmt.Sprintf("%s/%s", projectBasePath, projectID)
- if includes != nil {
- path += fmt.Sprintf("?include=%s", strings.Join(includes, ","))
- } else if excludes != nil {
- path += fmt.Sprintf("?exclude=%s", strings.Join(excludes, ","))
- }
-
- project := new(Project)
- resp, err := s.client.DoRequest("GET", path, nil, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, err
-}
-
-// Get returns a project by id
-func (s *ProjectServiceOp) Get(projectID string) (*Project, *Response, error) {
- path := fmt.Sprintf("%s/%s", projectBasePath, projectID)
- project := new(Project)
-
- resp, err := s.client.DoRequest("GET", path, nil, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, err
-}
-
-// Create creates a new project
-func (s *ProjectServiceOp) Create(createRequest *ProjectCreateRequest) (*Project, *Response, error) {
- project := new(Project)
-
- resp, err := s.client.DoRequest("POST", projectBasePath, createRequest, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, err
-}
-
-// Update updates a project
-func (s *ProjectServiceOp) Update(id string, updateRequest *ProjectUpdateRequest) (*Project, *Response, error) {
- path := fmt.Sprintf("%s/%s", projectBasePath, id)
- project := new(Project)
-
- resp, err := s.client.DoRequest("PATCH", path, updateRequest, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, err
-}
-
-// Delete deletes a project
-func (s *ProjectServiceOp) Delete(projectID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", projectBasePath, projectID)
-
- return s.client.DoRequest("DELETE", path, nil, nil)
-}
-
-// ListEvents returns list of project events
-func (s *ProjectServiceOp) ListEvents(projectID string, listOpt *ListOptions) ([]Event, *Response, error) {
- path := fmt.Sprintf("%s/%s%s", projectBasePath, projectID, eventBasePath)
-
- return list(s.client, path, listOpt)
-}
diff --git a/vendor/github.com/packethost/packngo/projects_test.go b/vendor/github.com/packethost/packngo/projects_test.go
deleted file mode 100644
index 59c69b1d..00000000
--- a/vendor/github.com/packethost/packngo/projects_test.go
+++ /dev/null
@@ -1,256 +0,0 @@
-package packngo
-
-import (
- "testing"
-)
-
-func TestAccProjectBasic(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c := setup(t)
- defer projectTeardown(c)
-
- rs := testProjectPrefix + randString8()
- pcr := ProjectCreateRequest{Name: rs}
- p, _, err := c.Projects.Create(&pcr)
- if err != nil {
- t.Fatal(err)
- }
- if p.Name != rs {
- t.Fatalf("Expected new project name to be %s, not %s", rs, p.Name)
- }
- rs = testProjectPrefix + randString8()
- pur := ProjectUpdateRequest{Name: &rs}
- p, _, err = c.Projects.Update(p.ID, &pur)
- if err != nil {
- t.Fatal(err)
- }
- if p.Name != rs {
- t.Fatalf("Expected the name of the updated project to be %s, not %s", rs, p.Name)
- }
- gotProject, _, err := c.Projects.Get(p.ID)
- if err != nil {
- t.Fatal(err)
- }
- if gotProject.Name != rs {
- t.Fatalf("Expected the name of the GOT project to be %s, not %s", rs, gotProject.Name)
- }
-
- if gotProject.PaymentMethod.URL == "" {
- t.Fatalf("Empty payment_method: %v", gotProject)
- }
-
- _, _, err = c.Projects.ListEvents(gotProject.ID, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = c.Projects.Delete(p.ID)
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestAccProjectExtra(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c := setup(t)
- defer projectTeardown(c)
- u, _, err := c.Users.Current()
- if err != nil {
- t.Fatal(err)
- }
-
- rs := testProjectPrefix + randString8()
- pcr := ProjectCreateRequest{Name: rs}
- p, _, err := c.Projects.Create(&pcr)
- if err != nil {
- t.Fatal(err)
- }
- if p.Name != rs {
- t.Fatalf("Expected new project name to be %s, not %s", rs, p.Name)
- }
- rs = testProjectPrefix + randString8()
- pur := ProjectUpdateRequest{Name: &rs}
- p, _, err = c.Projects.Update(p.ID, &pur)
- if err != nil {
- t.Fatal(err)
- }
- if p.Name != rs {
- t.Fatalf("Expected the name of the updated project to be %s, not %s", rs, p.Name)
- }
- gotProject, _, err := c.Projects.GetExtra(p.ID, []string{"members"}, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- for _, user := range gotProject.Users {
- if user.ID == "" {
- t.Fatal("Project user details not returned.")
- } else if user.ID == u.ID {
- break
- }
- }
-
- _, err = c.Projects.Delete(p.ID)
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestAccCreateOrgProject(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c := setup(t)
- defer projectTeardown(c)
-
- u, _, err := c.Users.Current()
- if err != nil {
- t.Fatal(err)
- }
-
- rs := testProjectPrefix + randString8()
-
- orgPath := "/organizations/" + u.DefaultOrganizationID
- pcr := ProjectCreateRequest{Name: rs}
- p, _, err := c.Projects.Create(&pcr)
- if err != nil {
- t.Fatal(err)
- }
- if p.Organization.URL != orgPath {
- t.Fatalf("Expected new project to be part of org %s, not %v", orgPath, p.Organization)
- }
-}
-
-func TestAccCreateNonDefaultOrgProject(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c := setup(t)
- defer organizationTeardown(c)
- defer projectTeardown(c)
-
- u, _, err := c.Users.Current()
- if err != nil {
- t.Fatal(err)
- }
-
- orgName := testProjectPrefix + randString8()
- ocr := OrganizationCreateRequest{
- Name: orgName,
- Description: "Managed by Packngo.",
- Website: "http://example.com",
- Twitter: "foo",
- }
- org, _, err := c.Organizations.Create(&ocr)
- if err != nil {
- t.Fatal(err)
- }
-
- rs := testProjectPrefix + randString8()
-
- if org.ID == u.DefaultOrganizationID {
- t.Fatalf("Expected new organization %s to not have same ID as Default org %s", org.ID, u.DefaultOrganizationID)
- }
-
- orgPath := "/organizations/" + org.ID
- pcr := ProjectCreateRequest{Name: rs, OrganizationID: org.ID}
- p, _, err := c.Projects.Create(&pcr)
- if err != nil {
- t.Fatal(err)
- }
-
- if p.Organization.URL != orgPath {
- t.Fatalf("Expected new project to be part of org %s, not %v", orgPath, p.Organization)
- }
-
- defaultOrgPath := "/organizations/" + u.DefaultOrganizationID
- if p.Organization.URL == defaultOrgPath {
- t.Fatalf("Expected new project to not be part of org %s", orgPath)
- }
-}
-
-func TestAccListProjects(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- c := setup(t)
-
- defer projectTeardown(c)
-
- rs := testProjectPrefix + randString8()
-
- u, _, err := c.Users.Current()
- if err != nil {
- t.Fatal(err)
- }
-
- orgPath := "/organizations/" + u.DefaultOrganizationID
-
- pcr := ProjectCreateRequest{Name: rs}
- p, _, err := c.Projects.Create(&pcr)
- if err != nil {
- t.Fatal(err)
- }
-
- if p.Organization.URL != orgPath {
- t.Fatalf("Expected new project to be part of org %s, not %v", orgPath, p.Organization)
- }
-
- listOpt := &ListOptions{
- Includes: "members",
- }
- projs, _, err := c.Projects.List(listOpt)
- if err != nil {
- t.Fatal(err)
- }
-
- for _, proj := range projs {
- if proj.ID == p.ID {
- if proj.Users[0].ID != u.ID {
- t.Fatal("Project user details not returned.")
- }
- break
- }
- }
-}
-
-func TestAccProjectListPagination(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- c := setup(t)
- defer projectTeardown(c)
- for i := 0; i < 3; i++ {
- pcr := ProjectCreateRequest{
- Name: testProjectPrefix + randString8(),
- }
- _, _, err := c.Projects.Create(&pcr)
- if err != nil {
- t.Fatal(err)
- }
- }
- listOpts := &ListOptions{
- Page: 1,
- PerPage: 3,
- }
-
- projects, _, err := c.Projects.List(listOpts)
- if err != nil {
- t.Fatalf("failed to get list of projects: %v", err)
- }
- // The user account that runs this test probably have some projects on
- // his own, keep it in mind when improving/extending this test.
- if len(projects) != 3 {
- t.Fatalf("exactly 3 projects should have been fetched: %v", err)
- }
-
- listOpts = &ListOptions{
- Page: 2,
- PerPage: 1,
- }
-
- projects, _, err = c.Projects.List(listOpts)
- if err != nil {
- t.Fatalf("failed to get list of projects: %v", err)
- }
- if len(projects) != 1 {
- t.Fatalf("only 1 project should have been fetched: %v", err)
- }
-
-}
diff --git a/vendor/github.com/packethost/packngo/rate.go b/vendor/github.com/packethost/packngo/rate.go
deleted file mode 100644
index 965967d4..00000000
--- a/vendor/github.com/packethost/packngo/rate.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package packngo
-
-// Rate provides the API request rate limit details
-type Rate struct {
- RequestLimit int `json:"request_limit"`
- RequestsRemaining int `json:"requests_remaining"`
- Reset Timestamp `json:"rate_reset"`
-}
-
-func (r Rate) String() string {
- return Stringify(r)
-}
diff --git a/vendor/github.com/packethost/packngo/spotmarket.go b/vendor/github.com/packethost/packngo/spotmarket.go
deleted file mode 100644
index 5dfb7d55..00000000
--- a/vendor/github.com/packethost/packngo/spotmarket.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package packngo
-
-const spotMarketBasePath = "/market/spot/prices"
-
-// SpotMarketService expooses Spot Market methods
-type SpotMarketService interface {
- Prices() (PriceMap, *Response, error)
-}
-
-// SpotMarketServiceOp implements SpotMarketService
-type SpotMarketServiceOp struct {
- client *Client
-}
-
-// PriceMap is a map of [facility][plan]-> float Price
-type PriceMap map[string]map[string]float64
-
-// Prices gets current PriceMap from the API
-func (s *SpotMarketServiceOp) Prices() (PriceMap, *Response, error) {
- root := new(struct {
- SMPs map[string]map[string]struct {
- Price float64 `json:"price"`
- } `json:"spot_market_prices"`
- })
-
- resp, err := s.client.DoRequest("GET", spotMarketBasePath, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- prices := make(PriceMap)
- for facility, planMap := range root.SMPs {
- prices[facility] = map[string]float64{}
- for plan, v := range planMap {
- prices[facility][plan] = v.Price
- }
- }
- return prices, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/spotmarket_test.go b/vendor/github.com/packethost/packngo/spotmarket_test.go
deleted file mode 100644
index b403dcfc..00000000
--- a/vendor/github.com/packethost/packngo/spotmarket_test.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package packngo
-
-import "testing"
-
-func TestAccSpotMarketBasic(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
-
- c := setup(t)
- prices, _, err := c.SpotMarket.Prices()
- if err != nil {
- t.Fatal(err)
- }
-
- dcs := []string{testFacility()}
- for _, dc := range dcs {
- if val, ok := prices[dc]; ok {
- if len(val) == 0 {
- t.Errorf("spot market listing for facility %s doesn't contain any plan prices: %v", dc, val)
- }
- } else {
- t.Errorf("facility %s not in spot prices market map: %v", dc, prices)
- }
- }
-
-}
diff --git a/vendor/github.com/packethost/packngo/spotmarketrequest.go b/vendor/github.com/packethost/packngo/spotmarketrequest.go
deleted file mode 100644
index 137a720a..00000000
--- a/vendor/github.com/packethost/packngo/spotmarketrequest.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package packngo
-
-import (
- "fmt"
- "math"
-)
-
-const spotMarketRequestBasePath = "/spot-market-requests"
-
-type SpotMarketRequestService interface {
- List(string) ([]SpotMarketRequest, *Response, error)
- Create(*SpotMarketRequestCreateRequest, string) (*SpotMarketRequest, *Response, error)
- Delete(string, bool) (*Response, error)
- Get(string, *ListOptions) (*SpotMarketRequest, *Response, error)
-}
-
-type SpotMarketRequestCreateRequest struct {
- DevicesMax int `json:"devices_max"`
- DevicesMin int `json:"devices_min"`
- EndAt *Timestamp `json:"end_at,omitempty"`
- FacilityIDs []string `json:"facility_ids"`
- MaxBidPrice float64 `json:"max_bid_price"`
-
- Parameters SpotMarketRequestInstanceParameters `json:"instance_parameters"`
-}
-
-type SpotMarketRequest struct {
- SpotMarketRequestCreateRequest
- ID string `json:"id"`
- Devices []Device `json:"devices"`
- Facilities []Facility `json:"facilities"`
- Project Project `json:"project"`
- Href string `json:"href"`
-}
-
-type SpotMarketRequestInstanceParameters struct {
- AlwaysPXE bool `json:"always_pxe,omitempty"`
- BillingCycle string `json:"billing_cycle"`
- CustomData string `json:"customdata,omitempty"`
- Description string `json:"description,omitempty"`
- Features []string `json:"features,omitempty"`
- Hostname string `json:"hostname,omitempty"`
- Hostnames []string `json:"hostnames,omitempty"`
- Locked bool `json:"locked,omitempty"`
- OperatingSystem string `json:"operating_system"`
- Plan string `json:"plan"`
- ProjectSSHKeys []string `json:"project_ssh_keys,omitempty"`
- Tags []string `json:"tags"`
- TerminationTime *Timestamp `json:"termination_time,omitempty"`
- UserSSHKeys []string `json:"user_ssh_keys,omitempty"`
- UserData string `json:"userdata"`
-}
-
-type SpotMarketRequestServiceOp struct {
- client *Client
-}
-
-func roundPlus(f float64, places int) float64 {
- shift := math.Pow(10, float64(places))
- return math.Floor(f*shift+.5) / shift
-}
-
-func (s *SpotMarketRequestServiceOp) Create(cr *SpotMarketRequestCreateRequest, pID string) (*SpotMarketRequest, *Response, error) {
- path := fmt.Sprintf("%s/%s%s?include=devices,project", projectBasePath, pID, spotMarketRequestBasePath)
- cr.MaxBidPrice = roundPlus(cr.MaxBidPrice, 2)
- smr := new(SpotMarketRequest)
-
- resp, err := s.client.DoRequest("POST", path, cr, smr)
- if err != nil {
- return nil, resp, err
- }
-
- return smr, resp, err
-}
-
-func (s *SpotMarketRequestServiceOp) List(pID string) ([]SpotMarketRequest, *Response, error) {
- smrRoot := struct {
- SMRs []SpotMarketRequest `json:"spot_market_requests"`
- }{}
-
- path := fmt.Sprintf("%s/%s%s?include=devices,project", projectBasePath, pID, spotMarketRequestBasePath)
- resp, err := s.client.DoRequest("GET", path, nil, &smrRoot)
- if err != nil {
- return nil, resp, err
- }
- return smrRoot.SMRs, resp, nil
-}
-
-func (s *SpotMarketRequestServiceOp) Get(id string, listOpt *ListOptions) (*SpotMarketRequest, *Response, error) {
- var params string
- if listOpt != nil {
- params = listOpt.createURL()
- }
- path := fmt.Sprintf("%s/%s?%s", spotMarketRequestBasePath, id, params)
- smr := new(SpotMarketRequest)
-
- resp, err := s.client.DoRequest("GET", path, nil, &smr)
- if err != nil {
- return nil, resp, err
- }
-
- return smr, resp, err
-}
-
-func (s *SpotMarketRequestServiceOp) Delete(id string, forceDelete bool) (*Response, error) {
- path := fmt.Sprintf("%s/%s", spotMarketRequestBasePath, id)
- var params *map[string]bool
- if forceDelete {
- params = &map[string]bool{"force_termination": true}
- }
- return s.client.DoRequest("DELETE", path, params, nil)
-}
diff --git a/vendor/github.com/packethost/packngo/spotmarketrequest_test.go b/vendor/github.com/packethost/packngo/spotmarketrequest_test.go
deleted file mode 100644
index c3194f5e..00000000
--- a/vendor/github.com/packethost/packngo/spotmarketrequest_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package packngo
-
-import (
- "fmt"
- "log"
- "testing"
- "time"
-)
-
-func TestAccSpotMarketRequestBasic(t *testing.T) {
- // This test is only going to create the spot market request with
- // max bid price set to half of current spot price, so that the devices
- // are not run at all.
- skipUnlessAcceptanceTestsAllowed(t)
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- hn := randString8()
-
- ps := SpotMarketRequestInstanceParameters{
- BillingCycle: "hourly",
- Plan: "baremetal_0",
- OperatingSystem: "rancher",
- Hostname: fmt.Sprintf("%s{{index}}", hn),
- }
-
- prices, _, err := c.SpotMarket.Prices()
- pri := prices["ewr1"]["baremetal_0"]
- if err != nil {
- t.Fatal(err)
- }
-
- cr := SpotMarketRequestCreateRequest{
- DevicesMax: 3,
- DevicesMin: 2,
- FacilityIDs: []string{"ewr1", "sjc1"},
- MaxBidPrice: pri / 2,
- Parameters: ps,
- }
-
- smr, _, err := c.SpotMarketRequests.Create(&cr, projectID)
-
- if err != nil {
- t.Fatal(err)
- }
- defer c.SpotMarketRequests.Delete(smr.ID, true)
-
- if smr.Project.ID != projectID {
- t.Fatal("Strange project ID in SpotMarketReuqest:", smr.Project.ID)
- }
-
- smrs, _, err := c.SpotMarketRequests.List(projectID)
- if err != nil {
- t.Fatal(err)
- }
- if len(smrs) != 1 {
- t.Fatal("there should be only one SpotMarketRequest")
- }
-
- smr2, _, err := c.SpotMarketRequests.Get(smr.ID, nil)
- if err != nil {
- t.Fatal(err)
- }
- if (smr.ID != smrs[0].ID) || (smrs[0].ID != smr2.ID) {
- t.Fatal("mismatch in the created SpotMarketRequest")
- }
-}
-
-func TestAccSpotMarketRequestPriceAware(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- prices, _, err := c.SpotMarket.Prices()
- if err != nil {
- t.Fatal(err)
- }
-
- pri := prices["ewr1"]["baremetal_0"]
- thr := pri * 2.0
- hn := randString8()
-
- ps := SpotMarketRequestInstanceParameters{
- BillingCycle: "hourly",
- Plan: "baremetal_0",
- OperatingSystem: "rancher",
- Hostname: fmt.Sprintf("%s{{index}}", hn),
- }
-
- nDevices := 3
-
- cr := SpotMarketRequestCreateRequest{
- DevicesMax: nDevices,
- DevicesMin: nDevices,
- FacilityIDs: []string{"ewr1"},
- MaxBidPrice: thr,
- Parameters: ps,
- }
-
- smr, _, err := c.SpotMarketRequests.Create(&cr, projectID)
- if err != nil {
- t.Fatal(err)
- }
-
-out:
- for {
- select {
- case <-time.Tick(5 * time.Second):
- smr, _, err = c.SpotMarketRequests.Get(
- smr.ID,
- &ListOptions{Includes: "devices"},
- )
- if err != nil {
- t.Fatal(err)
- }
- activeDevs := 0
- for _, d := range smr.Devices {
- if d.State == "active" {
- activeDevs++
- }
- }
- if activeDevs == nDevices {
- break out
- }
- }
- }
- log.Println("all devices active")
- c.SpotMarketRequests.Delete(smr.ID, true)
-out2:
- // wait for devices to disappear .. takes ~5 minutes
- for {
- select {
- case <-time.Tick(5 * time.Second):
- ds, _, err := c.Devices.List(projectID, nil)
- if err != nil {
- t.Fatal(err)
- }
- if len(ds) > 0 {
- log.Println(len(ds), "devices still exist")
- } else {
- break out2
- }
-
- }
- }
-}
diff --git a/vendor/github.com/packethost/packngo/sshkeys.go b/vendor/github.com/packethost/packngo/sshkeys.go
deleted file mode 100644
index 260bf087..00000000
--- a/vendor/github.com/packethost/packngo/sshkeys.go
+++ /dev/null
@@ -1,138 +0,0 @@
-package packngo
-
-import "fmt"
-
-const (
- sshKeyBasePath = "/ssh-keys"
-)
-
-// SSHKeyService interface defines available device methods
-type SSHKeyService interface {
- List() ([]SSHKey, *Response, error)
- ProjectList(string) ([]SSHKey, *Response, error)
- Get(string) (*SSHKey, *Response, error)
- Create(*SSHKeyCreateRequest) (*SSHKey, *Response, error)
- Update(string, *SSHKeyUpdateRequest) (*SSHKey, *Response, error)
- Delete(string) (*Response, error)
-}
-
-type sshKeyRoot struct {
- SSHKeys []SSHKey `json:"ssh_keys"`
-}
-
-// SSHKey represents a user's ssh key
-type SSHKey struct {
- ID string `json:"id"`
- Label string `json:"label"`
- Key string `json:"key"`
- FingerPrint string `json:"fingerprint"`
- Created string `json:"created_at"`
- Updated string `json:"updated_at"`
- User User `json:"user,omitempty"`
- URL string `json:"href,omitempty"`
-}
-
-func (s SSHKey) String() string {
- return Stringify(s)
-}
-
-// SSHKeyCreateRequest type used to create an ssh key
-type SSHKeyCreateRequest struct {
- Label string `json:"label"`
- Key string `json:"key"`
- ProjectID string `json:"-"`
-}
-
-func (s SSHKeyCreateRequest) String() string {
- return Stringify(s)
-}
-
-// SSHKeyUpdateRequest type used to update an ssh key
-type SSHKeyUpdateRequest struct {
- Label *string `json:"label,omitempty"`
- Key *string `json:"key,omitempty"`
-}
-
-func (s SSHKeyUpdateRequest) String() string {
- return Stringify(s)
-}
-
-// SSHKeyServiceOp implements SSHKeyService
-type SSHKeyServiceOp struct {
- client *Client
-}
-
-func (s *SSHKeyServiceOp) list(url string) ([]SSHKey, *Response, error) {
- root := new(sshKeyRoot)
-
- resp, err := s.client.DoRequest("GET", url, nil, root)
- if err != nil {
- return nil, resp, err
- }
-
- return root.SSHKeys, resp, err
-}
-
-// ProjectList lists ssh keys of a project
-func (s *SSHKeyServiceOp) ProjectList(projectID string) ([]SSHKey, *Response, error) {
- return s.list(fmt.Sprintf("%s/%s%s", projectBasePath, projectID, sshKeyBasePath))
-
-}
-
-// List returns a user's ssh keys
-func (s *SSHKeyServiceOp) List() ([]SSHKey, *Response, error) {
- return s.list(sshKeyBasePath)
-}
-
-// Get returns an ssh key by id
-func (s *SSHKeyServiceOp) Get(sshKeyID string) (*SSHKey, *Response, error) {
- path := fmt.Sprintf("%s/%s", sshKeyBasePath, sshKeyID)
- sshKey := new(SSHKey)
-
- resp, err := s.client.DoRequest("GET", path, nil, sshKey)
- if err != nil {
- return nil, resp, err
- }
-
- return sshKey, resp, err
-}
-
-// Create creates a new ssh key
-func (s *SSHKeyServiceOp) Create(createRequest *SSHKeyCreateRequest) (*SSHKey, *Response, error) {
- path := sshKeyBasePath
- if createRequest.ProjectID != "" {
- path = fmt.Sprintf("%s/%s%s", projectBasePath, createRequest.ProjectID, sshKeyBasePath)
- }
- sshKey := new(SSHKey)
-
- resp, err := s.client.DoRequest("POST", path, createRequest, sshKey)
- if err != nil {
- return nil, resp, err
- }
-
- return sshKey, resp, err
-}
-
-// Update updates an ssh key
-func (s *SSHKeyServiceOp) Update(id string, updateRequest *SSHKeyUpdateRequest) (*SSHKey, *Response, error) {
- if updateRequest.Label == nil && updateRequest.Key == nil {
- return nil, nil, fmt.Errorf("You must set either Label or Key string for SSH Key update")
- }
- path := fmt.Sprintf("%s/%s", sshKeyBasePath, id)
-
- sshKey := new(SSHKey)
-
- resp, err := s.client.DoRequest("PATCH", path, updateRequest, sshKey)
- if err != nil {
- return nil, resp, err
- }
-
- return sshKey, resp, err
-}
-
-// Delete deletes an ssh key
-func (s *SSHKeyServiceOp) Delete(sshKeyID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", sshKeyBasePath, sshKeyID)
-
- return s.client.DoRequest("DELETE", path, nil, nil)
-}
diff --git a/vendor/github.com/packethost/packngo/sshkeys_test.go b/vendor/github.com/packethost/packngo/sshkeys_test.go
deleted file mode 100644
index a482329a..00000000
--- a/vendor/github.com/packethost/packngo/sshkeys_test.go
+++ /dev/null
@@ -1,241 +0,0 @@
-package packngo
-
-import (
- "crypto/rand"
- "crypto/rsa"
- "reflect"
- "testing"
-
- "golang.org/x/crypto/ssh"
-)
-
-func makePubKey(t *testing.T) string {
- priv, err := rsa.GenerateKey(rand.Reader, 2048)
- if err != nil {
- t.Fatalf("error generating test private key: %v", err)
- }
-
- pub, err := ssh.NewPublicKey(&priv.PublicKey)
- if err != nil {
- t.Fatalf("error generating test public key: %v", err)
- }
- return string(ssh.MarshalAuthorizedKey(pub))
-}
-
-func createKey(t *testing.T, c *Client, p string) *SSHKey {
- req := SSHKeyCreateRequest{
- Label: "PACKNGO_TEST_KEY_DELETE_ME-" + randString8(),
- ProjectID: p,
- Key: makePubKey(t),
- }
-
- key, _, err := c.SSHKeys.Create(&req)
- if err != nil {
- t.Fatalf("errored posting key: %v", err)
- }
-
- return key
-}
-
-func TestAccSSHKeyList(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, _, teardown := setupWithProject(t)
- defer teardown()
- key := createKey(t, c, "")
- defer c.SSHKeys.Delete(key.ID)
-
- keys, _, err := c.SSHKeys.List()
- if err != nil {
- t.Fatalf("failed to get list of sshkeys: %v", err)
- }
-
- for _, k := range keys {
- if k.ID == key.ID {
- return
- }
- }
- t.Error("failed to find created key in list of keys retrieved")
-}
-
-func TestAccSSHKeyProjectList(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- key := createKey(t, c, projectID)
- defer c.SSHKeys.Delete(key.ID)
-
- keys, _, err := c.SSHKeys.ProjectList(projectID)
- if err != nil {
- t.Fatalf("failed to get list of project sshkeys: %v", err)
- }
-
- if len(keys) != 1 {
- t.Fatal("there should be exactly one key for the project")
- }
-
- for _, k := range keys {
- if k.ID == key.ID {
- return
- }
- }
- t.Error("failed to find created project key in list of project keys retrieved")
-}
-
-func TestAccSSHKeyGet(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- user := createKey(t, c, "")
- defer c.SSHKeys.Delete(user.ID)
- proj := createKey(t, c, projectID)
-
- for _, k := range []*SSHKey{user, proj} {
- got, _, err := c.SSHKeys.Get(k.ID)
- if err != nil {
- t.Fatalf("failed to retrieve created key")
- }
-
- if !reflect.DeepEqual(k, got) {
- t.Errorf("keys do not match, want: %v, got:%v", k, got)
- }
- }
-}
-
-func TestAccSSHKeyCreate(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- req := SSHKeyCreateRequest{
- Label: "PACKNGO_TEST_KEY_DELETE_ME-" + randString8(),
- ProjectID: projectID,
- Key: makePubKey(t),
- }
-
- key, _, err := c.SSHKeys.Create(&req)
- if err != nil {
- t.Fatalf("errored posting key: %v", err)
- }
-
- if key.Label != req.Label {
- t.Fatalf("returned key label does not match, want: %v, got: %v", req.Label, key.Label)
- }
- if key.Key != req.Key {
- t.Fatalf("returned key does not match, want: %v, got: %v", req.Key, key.Key)
- }
-}
-
-func TestWrongSSHKeyUpdate(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- key := createKey(t, c, projectID)
- req := SSHKeyUpdateRequest{}
- _, _, err := c.SSHKeys.Update(key.ID, &req)
- if err == nil {
- t.Fatalf("SSHKey update by request without label or key string should be invalid")
- }
-}
-
-func TestAccSSHKeyStringUpdate(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- key := createKey(t, c, projectID)
-
- newKey := makePubKey(t)
- req := SSHKeyUpdateRequest{
- Key: &newKey,
- }
- got, _, err := c.SSHKeys.Update(key.ID, &req)
- if err != nil {
- t.Fatalf("failed to update key: %v", err)
- }
-
- if reflect.DeepEqual(key, got) {
- t.Fatalf("expected keys to differ, got: %v", key)
- }
-
- if got.Key != newKey {
- t.Fatalf("expected updated key string, want: %s, got: %s", newKey, got.Key)
- }
-}
-
-func TestAccSSHKeyLabelUpdate(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- key := createKey(t, c, projectID)
-
- kLabel := key.Label + "-updated"
-
- req := SSHKeyUpdateRequest{Label: &kLabel}
- got, _, err := c.SSHKeys.Update(key.ID, &req)
- if err != nil {
- t.Fatalf("failed to update key: %v", err)
- }
-
- if reflect.DeepEqual(key, got) {
- t.Fatalf("expected keys to differ, got: %v", key)
- }
-
- if got.Label != key.Label+"-updated" {
- t.Fatalf("expected updated label, want: %s-updated, got: %s", key.Label, got.Label)
- }
-}
-
-func TestAccSSHKeyUpdate(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- key := createKey(t, c, projectID)
-
- newKey := makePubKey(t)
- kLabel := key.Label + "-updated"
- req := SSHKeyUpdateRequest{
- Key: &newKey,
- Label: &kLabel,
- }
- got, _, err := c.SSHKeys.Update(key.ID, &req)
- if err != nil {
- t.Fatalf("failed to update key: %v", err)
- }
-
- if reflect.DeepEqual(key, got) {
- t.Fatalf("expected keys to differ, got: %v", key)
- }
-
- if got.Label != key.Label+"-updated" {
- t.Fatalf("expected updated label, want: %s-updated, got: %s", key.Label, got.Label)
- }
- if got.Key != newKey {
- t.Fatalf("expected updated key string, want: %s, got: %s", newKey, got.Key)
- }
-}
-
-func TestAccSSHKeyDelete(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
- key := createKey(t, c, projectID)
-
- _, err := c.SSHKeys.Delete(key.ID)
- if err != nil {
- t.Fatalf("unable to delete key: %v", err)
- }
-
- unexpected, _, err := c.SSHKeys.Get(key.ID)
- if err == nil {
- t.Fatalf("expected an error getting key, got: %v", unexpected)
- }
-}
diff --git a/vendor/github.com/packethost/packngo/timestamp.go b/vendor/github.com/packethost/packngo/timestamp.go
deleted file mode 100644
index c3320ed6..00000000
--- a/vendor/github.com/packethost/packngo/timestamp.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package packngo
-
-import (
- "strconv"
- "time"
-)
-
-// Timestamp represents a time that can be unmarshalled from a JSON string
-// formatted as either an RFC3339 or Unix timestamp. All
-// exported methods of time.Time can be called on Timestamp.
-type Timestamp struct {
- time.Time
-}
-
-func (t Timestamp) String() string {
- return t.Time.String()
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-// Time is expected in RFC3339 or Unix format.
-func (t *Timestamp) UnmarshalJSON(data []byte) (err error) {
- str := string(data)
- i, err := strconv.ParseInt(str, 10, 64)
- if err == nil {
- t.Time = time.Unix(i, 0)
- } else {
- t.Time, err = time.Parse(`"`+time.RFC3339+`"`, str)
- }
- return
-}
-
-// Equal reports whether t and u are equal based on time.Equal
-func (t Timestamp) Equal(u Timestamp) bool {
- return t.Time.Equal(u.Time)
-}
diff --git a/vendor/github.com/packethost/packngo/two_factor_auth.go b/vendor/github.com/packethost/packngo/two_factor_auth.go
deleted file mode 100644
index 5064b09f..00000000
--- a/vendor/github.com/packethost/packngo/two_factor_auth.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package packngo
-
-const twoFactorAuthAppPath = "/user/otp/app"
-const twoFactorAuthSmsPath = "/user/otp/sms"
-
-// TwoFactorAuthService interface defines available two factor authentication functions
-type TwoFactorAuthService interface {
- EnableApp(string) (*Response, error)
- DisableApp(string) (*Response, error)
- EnableSms(string) (*Response, error)
- DisableSms(string) (*Response, error)
- ReceiveSms() (*Response, error)
- SeedApp() (string, *Response, error)
-}
-
-// TwoFactorAuthServiceOp implements TwoFactorAuthService
-type TwoFactorAuthServiceOp struct {
- client *Client
-}
-
-// EnableApp function enables two factor auth using authenticatior app
-func (s *TwoFactorAuthServiceOp) EnableApp(token string) (resp *Response, err error) {
- headers := map[string]string{"x-otp-token": token}
- return s.client.DoRequestWithHeader("POST", headers, twoFactorAuthAppPath, nil, nil)
-}
-
-// EnableSms function enables two factor auth using sms
-func (s *TwoFactorAuthServiceOp) EnableSms(token string) (resp *Response, err error) {
- headers := map[string]string{"x-otp-token": token}
- return s.client.DoRequestWithHeader("POST", headers, twoFactorAuthSmsPath, nil, nil)
-}
-
-// ReceiveSms orders the auth service to issue an SMS token
-func (s *TwoFactorAuthServiceOp) ReceiveSms() (resp *Response, err error) {
- return s.client.DoRequest("POST", twoFactorAuthSmsPath+"/receive", nil, nil)
-}
-
-// DisableApp function disables two factor auth using
-func (s *TwoFactorAuthServiceOp) DisableApp(token string) (resp *Response, err error) {
- headers := map[string]string{"x-otp-token": token}
- return s.client.DoRequestWithHeader("DELETE", headers, twoFactorAuthAppPath, nil, nil)
-}
-
-// DisableSms function disables two factor auth using
-func (s *TwoFactorAuthServiceOp) DisableSms(token string) (resp *Response, err error) {
- headers := map[string]string{"x-otp-token": token}
- return s.client.DoRequestWithHeader("DELETE", headers, twoFactorAuthSmsPath, nil, nil)
-}
-
-// SeedApp orders the auth service to issue a token via google authenticator
-func (s *TwoFactorAuthServiceOp) SeedApp() (otpURI string, resp *Response, err error) {
- ret := &map[string]string{}
- resp, err = s.client.DoRequest("POST", twoFactorAuthAppPath+"/receive", nil, ret)
-
- return (*ret)["otp_uri"], resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/user.go b/vendor/github.com/packethost/packngo/user.go
deleted file mode 100644
index 536bccc8..00000000
--- a/vendor/github.com/packethost/packngo/user.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package packngo
-
-const userBasePath = "/users"
-const userPath = "/user"
-
-// UserService interface defines available user methods
-type UserService interface {
- Get(string) (*User, *Response, error)
- Current() (*User, *Response, error)
-}
-
-// User represents a Packet user
-type User struct {
- ID string `json:"id"`
- FirstName string `json:"first_name,omitempty"`
- LastName string `json:"last_name,omitempty"`
- FullName string `json:"full_name,omitempty"`
- Email string `json:"email,omitempty"`
- TwoFactor string `json:"two_factor_auth,omitempty"`
- DefaultOrganizationID string `json:"default_organization_id,omitempty"`
- AvatarURL string `json:"avatar_url,omitempty"`
- Facebook string `json:"twitter,omitempty"`
- Twitter string `json:"facebook,omitempty"`
- LinkedIn string `json:"linkedin,omitempty"`
- Created string `json:"created_at,omitempty"`
- Updated string `json:"updated_at,omitempty"`
- TimeZone string `json:"timezone,omitempty"`
- Emails []Email `json:"emails,omitempty"`
- PhoneNumber string `json:"phone_number,omitempty"`
- URL string `json:"href,omitempty"`
- VPN bool `json:"vpn"`
-}
-
-func (u User) String() string {
- return Stringify(u)
-}
-
-// UserServiceOp implements UserService
-type UserServiceOp struct {
- client *Client
-}
-
-// Get method gets a user by userID
-func (s *UserServiceOp) Get(userID string) (*User, *Response, error) {
- user := new(User)
-
- resp, err := s.client.DoRequest("GET", userBasePath, nil, user)
- if err != nil {
- return nil, resp, err
- }
-
- return user, resp, err
-}
-
-// Returns the user object for the currently logged-in user.
-func (s *UserServiceOp) Current() (*User, *Response, error) {
- user := new(User)
-
- resp, err := s.client.DoRequest("GET", userPath, nil, user)
- if err != nil {
- return nil, resp, err
- }
-
- return user, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/user_test.go b/vendor/github.com/packethost/packngo/user_test.go
deleted file mode 100644
index a6e7ebb5..00000000
--- a/vendor/github.com/packethost/packngo/user_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package packngo
-
-import (
- "testing"
-)
-
-func TestUserCurrent(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c := setup(t)
-
- u, _, err := c.Users.Current()
- if err != nil {
- t.Fatal(err)
- }
-
- if u.DefaultOrganizationID == "" {
- t.Fatal("Expected DefaultOrganizationID should not be empty")
- }
-}
diff --git a/vendor/github.com/packethost/packngo/utils.go b/vendor/github.com/packethost/packngo/utils.go
deleted file mode 100644
index 57e5ef16..00000000
--- a/vendor/github.com/packethost/packngo/utils.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package packngo
-
-import (
- "bytes"
- "fmt"
- "io"
- "reflect"
-)
-
-var timestampType = reflect.TypeOf(Timestamp{})
-
-// Stringify creates a string representation of the provided message
-func Stringify(message interface{}) string {
- var buf bytes.Buffer
- v := reflect.ValueOf(message)
- stringifyValue(&buf, v)
- return buf.String()
-}
-
-// StreamToString converts a reader to a string
-func StreamToString(stream io.Reader) string {
- buf := new(bytes.Buffer)
- buf.ReadFrom(stream)
- return buf.String()
-}
-
-// stringifyValue was graciously cargoculted from the goprotubuf library
-func stringifyValue(w io.Writer, val reflect.Value) {
- if val.Kind() == reflect.Ptr && val.IsNil() {
- w.Write([]byte(""))
- return
- }
-
- v := reflect.Indirect(val)
-
- switch v.Kind() {
- case reflect.String:
- fmt.Fprintf(w, `"%s"`, v)
- case reflect.Slice:
- w.Write([]byte{'['})
- for i := 0; i < v.Len(); i++ {
- if i > 0 {
- w.Write([]byte{' '})
- }
-
- stringifyValue(w, v.Index(i))
- }
-
- w.Write([]byte{']'})
- return
- case reflect.Struct:
- if v.Type().Name() != "" {
- w.Write([]byte(v.Type().String()))
- }
-
- // special handling of Timestamp values
- if v.Type() == timestampType {
- fmt.Fprintf(w, "{%s}", v.Interface())
- return
- }
-
- w.Write([]byte{'{'})
-
- var sep bool
- for i := 0; i < v.NumField(); i++ {
- fv := v.Field(i)
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- continue
- }
- if fv.Kind() == reflect.Slice && fv.IsNil() {
- continue
- }
-
- if sep {
- w.Write([]byte(", "))
- } else {
- sep = true
- }
-
- w.Write([]byte(v.Type().Field(i).Name))
- w.Write([]byte{':'})
- stringifyValue(w, fv)
- }
-
- w.Write([]byte{'}'})
- default:
- if v.CanInterface() {
- fmt.Fprint(w, v.Interface())
- }
- }
-}
diff --git a/vendor/github.com/packethost/packngo/virtualnetworks.go b/vendor/github.com/packethost/packngo/virtualnetworks.go
deleted file mode 100644
index ec0b9fc6..00000000
--- a/vendor/github.com/packethost/packngo/virtualnetworks.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package packngo
-
-import (
- "fmt"
-)
-
-const virtualNetworkBasePath = "/virtual-networks"
-
-// DevicePortService handles operations on a port which belongs to a particular device
-type ProjectVirtualNetworkService interface {
- List(projectID string) (*VirtualNetworkListResponse, *Response, error)
- Create(*VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error)
- Delete(virtualNetworkID string) (*Response, error)
-}
-
-type VirtualNetwork struct {
- ID string `json:"id"`
- Description string `json:"description,omitempty"`
- VXLAN int `json:"vxlan,omitempty"`
- FacilityCode string `json:"facility_code,omitempty"`
- CreatedAt string `json:"created_at,omitempty"`
- Href string `json:"href"`
-}
-
-type ProjectVirtualNetworkServiceOp struct {
- client *Client
-}
-
-type VirtualNetworkListResponse struct {
- VirtualNetworks []VirtualNetwork `json:"virtual_networks"`
-}
-
-func (i *ProjectVirtualNetworkServiceOp) List(projectID string) (*VirtualNetworkListResponse, *Response, error) {
- path := fmt.Sprintf("%s/%s%s", projectBasePath, projectID, virtualNetworkBasePath)
- output := new(VirtualNetworkListResponse)
-
- resp, err := i.client.DoRequest("GET", path, nil, output)
- if err != nil {
- return nil, nil, err
- }
-
- return output, resp, nil
-}
-
-type VirtualNetworkCreateRequest struct {
- ProjectID string `json:"project_id"`
- Description string `json:"description"`
- Facility string `json:"facility"`
- VXLAN int `json:"vxlan"`
- VLAN int `json:"vlan"`
-}
-
-type VirtualNetworkCreateResponse struct {
- VirtualNetwork VirtualNetwork `json:"virtual_networks"`
-}
-
-func (i *ProjectVirtualNetworkServiceOp) Create(input *VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error) {
- // TODO: May need to add timestamp to output from 'post' request
- // for the 'created_at' attribute of VirtualNetwork struct since
- // API response doesn't include it
- path := fmt.Sprintf("%s/%s%s", projectBasePath, input.ProjectID, virtualNetworkBasePath)
- output := new(VirtualNetwork)
-
- resp, err := i.client.DoRequest("POST", path, input, output)
- if err != nil {
- return nil, nil, err
- }
-
- return output, resp, nil
-}
-
-func (i *ProjectVirtualNetworkServiceOp) Delete(virtualNetworkID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", virtualNetworkBasePath, virtualNetworkID)
-
- resp, err := i.client.DoRequest("DELETE", path, nil, nil)
- if err != nil {
- return nil, err
- }
-
- return resp, nil
-}
diff --git a/vendor/github.com/packethost/packngo/virtualnetworks_test.go b/vendor/github.com/packethost/packngo/virtualnetworks_test.go
deleted file mode 100644
index 8a3d48d3..00000000
--- a/vendor/github.com/packethost/packngo/virtualnetworks_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package packngo
-
-import (
- "testing"
-)
-
-func TestAccVirtualNetworks(t *testing.T) {
-
- skipUnlessAcceptanceTestsAllowed(t)
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- l, _, err := c.ProjectVirtualNetworks.List(projectID)
- if err != nil {
- t.Fatal(err)
- }
- if len(l.VirtualNetworks) != 0 {
- t.Fatal("Newly created project should not have any vlans")
-
- }
- l, _, err = c.ProjectVirtualNetworks.List(projectID)
- if err != nil {
- t.Fatal(err)
- }
-
- testDesc := "test_desc_" + randString8()
-
- cr := VirtualNetworkCreateRequest{
- ProjectID: projectID,
- Description: testDesc,
- Facility: testFacility(),
- }
-
- vlan, _, err := c.ProjectVirtualNetworks.Create(&cr)
- if err != nil {
- t.Fatal(err)
- }
-
- if vlan.Description != testDesc {
- t.Fatal("Wrong description string in created VLAN")
- }
-
- l, _, err = c.ProjectVirtualNetworks.List(projectID)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(l.VirtualNetworks) != 1 {
- t.Fatal("At this point, there should be exactly 1 VLAN in the project")
- }
-
- _, err = c.ProjectVirtualNetworks.Delete(l.VirtualNetworks[0].ID)
- if err != nil {
- t.Fatal(err)
- }
-
- l, _, err = c.ProjectVirtualNetworks.List(projectID)
- if err != nil {
- t.Fatal(err)
- }
- if len(l.VirtualNetworks) != 0 {
- t.Fatal("The test project should not have any VLANs now")
- }
-
- // TODO: Test several bad inputs to ensure rejection without adverse affects
- // Create virtual network with bad POST body parameters
- // Ensure create failed
-}
diff --git a/vendor/github.com/packethost/packngo/volumes.go b/vendor/github.com/packethost/packngo/volumes.go
deleted file mode 100644
index 772672a3..00000000
--- a/vendor/github.com/packethost/packngo/volumes.go
+++ /dev/null
@@ -1,239 +0,0 @@
-package packngo
-
-import "fmt"
-
-const (
- volumeBasePath = "/storage"
- attachmentsBasePath = "/attachments"
-)
-
-// VolumeService interface defines available Volume methods
-type VolumeService interface {
- List(string, *ListOptions) ([]Volume, *Response, error)
- Get(string) (*Volume, *Response, error)
- Update(string, *VolumeUpdateRequest) (*Volume, *Response, error)
- Delete(string) (*Response, error)
- Create(*VolumeCreateRequest, string) (*Volume, *Response, error)
- Lock(string) (*Response, error)
- Unlock(string) (*Response, error)
-}
-
-// VolumeAttachmentService defines attachment methdods
-type VolumeAttachmentService interface {
- Get(string) (*VolumeAttachment, *Response, error)
- Create(string, string) (*VolumeAttachment, *Response, error)
- Delete(string) (*Response, error)
-}
-
-type volumesRoot struct {
- Volumes []Volume `json:"volumes"`
- Meta meta `json:"meta"`
-}
-
-// Volume represents a volume
-type Volume struct {
- Attachments []*VolumeAttachment `json:"attachments,omitempty"`
- BillingCycle string `json:"billing_cycle,omitempty"`
- Created string `json:"created_at,omitempty"`
- Description string `json:"description,omitempty"`
- Facility *Facility `json:"facility,omitempty"`
- Href string `json:"href,omitempty"`
- ID string `json:"id"`
- Locked bool `json:"locked,omitempty"`
- Name string `json:"name,omitempty"`
- Plan *Plan `json:"plan,omitempty"`
- Project *Project `json:"project,omitempty"`
- Size int `json:"size,omitempty"`
- SnapshotPolicies []*SnapshotPolicy `json:"snapshot_policies,omitempty"`
- State string `json:"state,omitempty"`
- Updated string `json:"updated_at,omitempty"`
-}
-
-// SnapshotPolicy used to execute actions on volume
-type SnapshotPolicy struct {
- ID string `json:"id"`
- Href string `json:"href"`
- SnapshotFrequency string `json:"snapshot_frequency,omitempty"`
- SnapshotCount int `json:"snapshot_count,omitempty"`
-}
-
-func (v Volume) String() string {
- return Stringify(v)
-}
-
-// VolumeCreateRequest type used to create a Packet volume
-type VolumeCreateRequest struct {
- BillingCycle string `json:"billing_cycle"`
- Description string `json:"description,omitempty"`
- Locked bool `json:"locked,omitempty"`
- Size int `json:"size"`
- PlanID string `json:"plan_id"`
- FacilityID string `json:"facility_id"`
- SnapshotPolicies []*SnapshotPolicy `json:"snapshot_policies,omitempty"`
-}
-
-func (v VolumeCreateRequest) String() string {
- return Stringify(v)
-}
-
-// VolumeUpdateRequest type used to update a Packet volume
-type VolumeUpdateRequest struct {
- Description *string `json:"description,omitempty"`
- PlanID *string `json:"plan_id,omitempty"`
- Size *int `json:"size,omitempty"`
- BillingCycle *string `json:"billing_cycle,omitempty"`
-}
-
-// VolumeAttachment is a type from Packet API
-type VolumeAttachment struct {
- Href string `json:"href"`
- ID string `json:"id"`
- Volume Volume `json:"volume"`
- Device Device `json:"device"`
-}
-
-func (v VolumeUpdateRequest) String() string {
- return Stringify(v)
-}
-
-// VolumeAttachmentServiceOp implements VolumeService
-type VolumeAttachmentServiceOp struct {
- client *Client
-}
-
-// VolumeServiceOp implements VolumeService
-type VolumeServiceOp struct {
- client *Client
-}
-
-// List returns the volumes for a project
-func (v *VolumeServiceOp) List(projectID string, listOpt *ListOptions) (volumes []Volume, resp *Response, err error) {
- url := fmt.Sprintf("%s/%s%s", projectBasePath, projectID, volumeBasePath)
- var params string
- if listOpt != nil {
- params = listOpt.createURL()
- if params != "" {
- url = fmt.Sprintf("%s?%s", url, params)
- }
- }
-
- for {
- subset := new(volumesRoot)
-
- resp, err = v.client.DoRequest("GET", url, nil, subset)
- if err != nil {
- return nil, resp, err
- }
-
- volumes = append(volumes, subset.Volumes...)
-
- if subset.Meta.Next != nil && (listOpt == nil || listOpt.Page == 0) {
- url = subset.Meta.Next.Href
- if params != "" {
- url = fmt.Sprintf("%s&%s", url, params)
- }
- continue
- }
-
- return
- }
-}
-
-// Get returns a volume by id
-func (v *VolumeServiceOp) Get(volumeID string) (*Volume, *Response, error) {
- path := fmt.Sprintf("%s/%s?include=facility,snapshot_policies,attachments.device", volumeBasePath, volumeID)
- volume := new(Volume)
-
- resp, err := v.client.DoRequest("GET", path, nil, volume)
- if err != nil {
- return nil, resp, err
- }
-
- return volume, resp, err
-}
-
-// Update updates a volume
-func (v *VolumeServiceOp) Update(id string, updateRequest *VolumeUpdateRequest) (*Volume, *Response, error) {
- path := fmt.Sprintf("%s/%s", volumeBasePath, id)
- volume := new(Volume)
-
- resp, err := v.client.DoRequest("PATCH", path, updateRequest, volume)
- if err != nil {
- return nil, resp, err
- }
-
- return volume, resp, err
-}
-
-// Delete deletes a volume
-func (v *VolumeServiceOp) Delete(volumeID string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", volumeBasePath, volumeID)
-
- return v.client.DoRequest("DELETE", path, nil, nil)
-}
-
-// Create creates a new volume for a project
-func (v *VolumeServiceOp) Create(createRequest *VolumeCreateRequest, projectID string) (*Volume, *Response, error) {
- url := fmt.Sprintf("%s/%s%s", projectBasePath, projectID, volumeBasePath)
- volume := new(Volume)
-
- resp, err := v.client.DoRequest("POST", url, createRequest, volume)
- if err != nil {
- return nil, resp, err
- }
-
- return volume, resp, err
-}
-
-// Attachments
-
-// Create Attachment, i.e. attach volume to a device
-func (v *VolumeAttachmentServiceOp) Create(volumeID, deviceID string) (*VolumeAttachment, *Response, error) {
- url := fmt.Sprintf("%s/%s%s", volumeBasePath, volumeID, attachmentsBasePath)
- volAttachParam := map[string]string{
- "device_id": deviceID,
- }
- volumeAttachment := new(VolumeAttachment)
-
- resp, err := v.client.DoRequest("POST", url, volAttachParam, volumeAttachment)
- if err != nil {
- return nil, resp, err
- }
- return volumeAttachment, resp, nil
-}
-
-// Get gets attachment by id
-func (v *VolumeAttachmentServiceOp) Get(attachmentID string) (*VolumeAttachment, *Response, error) {
- path := fmt.Sprintf("%s%s/%s", volumeBasePath, attachmentsBasePath, attachmentID)
- volumeAttachment := new(VolumeAttachment)
-
- resp, err := v.client.DoRequest("GET", path, nil, volumeAttachment)
- if err != nil {
- return nil, resp, err
- }
-
- return volumeAttachment, resp, nil
-}
-
-// Delete deletes attachment by id
-func (v *VolumeAttachmentServiceOp) Delete(attachmentID string) (*Response, error) {
- path := fmt.Sprintf("%s%s/%s", volumeBasePath, attachmentsBasePath, attachmentID)
-
- return v.client.DoRequest("DELETE", path, nil, nil)
-}
-
-// Lock sets a volume to "locked"
-func (s *VolumeServiceOp) Lock(id string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", volumeBasePath, id)
- action := lockType{Locked: true}
-
- return s.client.DoRequest("PATCH", path, action, nil)
-}
-
-// Unlock sets a volume to "unlocked"
-func (s *VolumeServiceOp) Unlock(id string) (*Response, error) {
- path := fmt.Sprintf("%s/%s", volumeBasePath, id)
- action := lockType{Locked: false}
-
- return s.client.DoRequest("PATCH", path, action, nil)
-}
diff --git a/vendor/github.com/packethost/packngo/volumes_test.go b/vendor/github.com/packethost/packngo/volumes_test.go
deleted file mode 100644
index 9c046347..00000000
--- a/vendor/github.com/packethost/packngo/volumes_test.go
+++ /dev/null
@@ -1,235 +0,0 @@
-package packngo
-
-import (
- "fmt"
- "testing"
- "time"
-)
-
-func waitVolumeActive(id string, c *Client) (*Volume, error) {
- // 15 minutes = 180 * 5sec-retry
- for i := 0; i < 180; i++ {
- c, _, err := c.Volumes.Get(id)
- if err != nil {
- return nil, err
- }
- if c.State == "active" {
- return c, nil
- }
- <-time.After(5 * time.Second)
- }
- return nil, fmt.Errorf("volume %s is still not active after timeout", id)
-}
-
-func TestAccVolumeBasic(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- sp := SnapshotPolicy{
- SnapshotFrequency: "1day",
- SnapshotCount: 3,
- }
-
- vcr := VolumeCreateRequest{
- Size: 10,
- BillingCycle: "hourly",
- PlanID: "storage_1",
- FacilityID: testFacility(),
- SnapshotPolicies: []*SnapshotPolicy{&sp},
- Description: "ahoj!",
- Locked: true,
- }
-
- v, _, err := c.Volumes.Create(&vcr, projectID)
- if err != nil {
- t.Fatal(err)
- }
-
- v, err = waitVolumeActive(v.ID, c)
- if err != nil {
- t.Fatal(err)
- }
- defer c.Volumes.Delete(v.ID)
-
- if len(v.SnapshotPolicies) != 1 {
- t.Fatal("Test volume should have one snapshot policy")
- }
-
- if v.SnapshotPolicies[0].SnapshotFrequency != sp.SnapshotFrequency {
- t.Fatal("Test volume has wrong snapshot frequency")
- }
-
- if v.SnapshotPolicies[0].SnapshotCount != sp.SnapshotCount {
- t.Fatal("Test volume has wrong snapshot count")
- }
-
- if v.Facility.Code != testFacility() {
- t.Fatal("Test volume has wrong facility")
- }
- _, err = c.Volumes.Unlock(v.ID)
- if err != nil {
- t.Fatal(err)
- }
-
-}
-
-func TestAccVolumeUpdate(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
-
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- sp := SnapshotPolicy{
- SnapshotFrequency: "1day",
- SnapshotCount: 3,
- }
-
- vcr := VolumeCreateRequest{
- Size: 10,
- BillingCycle: "hourly",
- PlanID: "storage_1",
- FacilityID: testFacility(),
- SnapshotPolicies: []*SnapshotPolicy{&sp},
- }
-
- v, _, err := c.Volumes.Create(&vcr, projectID)
- if err != nil {
- t.Fatal(err)
- }
-
- v, err = waitVolumeActive(v.ID, c)
- if err != nil {
- t.Fatal(err)
- }
- defer c.Volumes.Delete(v.ID)
-
- vDesc := "new Desc"
-
- vur := VolumeUpdateRequest{Description: &vDesc}
-
- _, _, err = c.Volumes.Update(v.ID, &vur)
- if err != nil {
- t.Fatal(err)
- }
-
- v, _, err = c.Volumes.Get(v.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if v.Description != vDesc {
- t.Fatalf("Volume desc should be %q, but is %q", vDesc, v.Description)
- }
-
- newSize := 15
-
- vur = VolumeUpdateRequest{Size: &newSize}
-
- _, _, err = c.Volumes.Update(v.ID, &vur)
- if err != nil {
- t.Fatal(err)
- }
-
- v, _, err = c.Volumes.Get(v.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if v.Size != newSize {
- t.Fatalf("Volume size should be %q, but is %q", newSize, v.Size)
- }
-
- newPlan := "storage_2"
-
- vur = VolumeUpdateRequest{PlanID: &newPlan}
-
- _, _, err = c.Volumes.Update(v.ID, &vur)
- if err != nil {
- t.Fatal(err)
- }
-
- v, _, err = c.Volumes.Get(v.ID)
- if err != nil {
- t.Fatal(err)
- }
-
- if v.Plan.Slug != newPlan {
- t.Fatalf("Plan should be %q, but is %q", newPlan, v.Plan.Slug)
- }
-
-}
-
-func TestAccVolumeLargeList(t *testing.T) {
- skipUnlessAcceptanceTestsAllowed(t)
- t.Parallel()
- c, projectID, teardown := setupWithProject(t)
- defer teardown()
-
- sp := SnapshotPolicy{
- SnapshotFrequency: "1day",
- SnapshotCount: 3,
- }
-
- vcr := VolumeCreateRequest{
- Size: 10,
- BillingCycle: "hourly",
- PlanID: "storage_1",
- FacilityID: testFacility(),
- SnapshotPolicies: []*SnapshotPolicy{&sp},
- }
-
- numOfVolumes := 11
- createdVolumes := make([]Volume, numOfVolumes)
- for i := 0; i < numOfVolumes; i++ {
- vcr.Description = randString8()
- v, _, err := c.Volumes.Create(&vcr, projectID)
- if err != nil {
- t.Fatal(err)
- }
- defer c.Volumes.Delete(v.ID)
- createdVolumes[i] = *v
- }
-
- for _, volume := range createdVolumes {
- if _, err := waitVolumeActive(volume.ID, c); err != nil {
- t.Fatal(err)
- }
- }
-
- volumes, _, err := c.Volumes.List(projectID, nil)
- if err != nil {
- t.Fatalf("failed to get list of volumes: %v", err)
- }
-
- if len(volumes) < numOfVolumes {
- t.Fatalf("failed due to expecting at least %d volumes, but actually got %d", numOfVolumes, len(volumes))
- }
-
- volumeMap := map[string]Volume{}
- for _, volume := range volumes {
- volumeMap[volume.ID] = volume
- }
-
- for _, k := range createdVolumes {
- if _, ok := volumeMap[k.ID]; !ok {
- t.Fatalf("failed to find expected volume in list: %s", k.ID)
- }
- }
-
- perPage := 4
- listOpt := &ListOptions{
- Page: 2,
- PerPage: perPage,
- }
-
- volumes, _, err = c.Volumes.List(projectID, listOpt)
- if err != nil {
- t.Fatalf("failed to get list of volumes: %v", err)
- }
-
- if len(volumes) != perPage {
- t.Fatalf("failed due to expecting %d volumes, but actually got %d", perPage, len(volumes))
- }
-}
diff --git a/vendor/github.com/packethost/packngo/vpn.go b/vendor/github.com/packethost/packngo/vpn.go
deleted file mode 100644
index 885ab3f0..00000000
--- a/vendor/github.com/packethost/packngo/vpn.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package packngo
-
-import "fmt"
-
-const vpnBasePath = "/user/vpn"
-
-// VPNConfig struct
-type VPNConfig struct {
- Config string `json:"config,omitempty"`
-}
-
-// VPNService interface defines available VPN functions
-type VPNService interface {
- Enable() (*Response, error)
- Disable() (*Response, error)
- Get(code string) (*VPNConfig, *Response, error)
-}
-
-// VPNServiceOp implements VPNService
-type VPNServiceOp struct {
- client *Client
-}
-
-// Enable VPN for current user
-func (s *VPNServiceOp) Enable() (resp *Response, err error) {
- return s.client.DoRequest("POST", vpnBasePath, nil, nil)
-}
-
-// Disable VPN for current user
-func (s *VPNServiceOp) Disable() (resp *Response, err error) {
- return s.client.DoRequest("DELETE", vpnBasePath, nil, nil)
-
-}
-
-// Get returns the client vpn config for the currently logged-in user.
-func (s *VPNServiceOp) Get(code string) (config *VPNConfig, resp *Response, err error) {
- config = &VPNConfig{}
- path := fmt.Sprintf("%s?code=%s", vpnBasePath, code)
-
- resp, err = s.client.DoRequest("GET", path, nil, config)
- if err != nil {
- return nil, resp, err
- }
-
- return config, resp, err
-}
diff --git a/vendor/github.com/packethost/packngo/vpn_test.go b/vendor/github.com/packethost/packngo/vpn_test.go
deleted file mode 100644
index a0122e58..00000000
--- a/vendor/github.com/packethost/packngo/vpn_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package packngo
-
-import (
- "testing"
-)
-
-func TestAccVPN(t *testing.T) {
-
- skipUnlessAcceptanceTestsAllowed(t)
-
- c := setup(t)
-
- u, _, err := c.Users.Current()
- if err != nil {
- t.Fatal(err)
- }
-
- if u.TwoFactor == "" {
- t.Fatal("VPN can't be used with with disabled 2FA")
- }
-
- if u.VPN {
- t.Fatal("You must disable VPN in your account before this test")
- }
-
- _, err = c.VPN.Enable()
- if err != nil {
- t.Fatal(err)
- }
-
- _, _, err = c.VPN.Get("ewr1")
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = c.VPN.Disable()
- if err != nil {
- t.Fatal(err)
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/.gitignore b/vendor/github.com/pelletier/go-toml/.gitignore
deleted file mode 100644
index 99e38bbc..00000000
--- a/vendor/github.com/pelletier/go-toml/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-test_program/test_program_bin
-fuzz/
diff --git a/vendor/github.com/pelletier/go-toml/.travis.yml b/vendor/github.com/pelletier/go-toml/.travis.yml
deleted file mode 100644
index c9fbf304..00000000
--- a/vendor/github.com/pelletier/go-toml/.travis.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.8.x
- - 1.9.x
- - 1.10.x
- - tip
-matrix:
- allow_failures:
- - go: tip
- fast_finish: true
-script:
- - if [ -n "$(go fmt ./...)" ]; then exit 1; fi
- - ./test.sh
- - ./benchmark.sh $TRAVIS_BRANCH https://github.com/$TRAVIS_REPO_SLUG.git
-before_install:
- - go get github.com/axw/gocov/gocov
- - go get github.com/mattn/goveralls
- - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
-branches:
- only: [master]
-after_success:
- - $HOME/gopath/bin/goveralls -service=travis-ci -coverprofile=coverage.out -repotoken $COVERALLS_TOKEN
diff --git a/vendor/github.com/pelletier/go-toml/LICENSE b/vendor/github.com/pelletier/go-toml/LICENSE
deleted file mode 100644
index 583bdae6..00000000
--- a/vendor/github.com/pelletier/go-toml/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 - 2017 Thomas Pelletier, Eric Anderton
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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
-SOFTWARE.
diff --git a/vendor/github.com/pelletier/go-toml/README.md b/vendor/github.com/pelletier/go-toml/README.md
deleted file mode 100644
index 0d357acf..00000000
--- a/vendor/github.com/pelletier/go-toml/README.md
+++ /dev/null
@@ -1,131 +0,0 @@
-# go-toml
-
-Go library for the [TOML](https://github.com/mojombo/toml) format.
-
-This library supports TOML version
-[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md)
-
-[![GoDoc](https://godoc.org/github.com/pelletier/go-toml?status.svg)](http://godoc.org/github.com/pelletier/go-toml)
-[![license](https://img.shields.io/github/license/pelletier/go-toml.svg)](https://github.com/pelletier/go-toml/blob/master/LICENSE)
-[![Build Status](https://travis-ci.org/pelletier/go-toml.svg?branch=master)](https://travis-ci.org/pelletier/go-toml)
-[![Coverage Status](https://coveralls.io/repos/github/pelletier/go-toml/badge.svg?branch=master)](https://coveralls.io/github/pelletier/go-toml?branch=master)
-[![Go Report Card](https://goreportcard.com/badge/github.com/pelletier/go-toml)](https://goreportcard.com/report/github.com/pelletier/go-toml)
-
-## Features
-
-Go-toml provides the following features for using data parsed from TOML documents:
-
-* Load TOML documents from files and string data
-* Easily navigate TOML structure using Tree
-* Mashaling and unmarshaling to and from data structures
-* Line & column position data for all parsed elements
-* [Query support similar to JSON-Path](query/)
-* Syntax errors contain line and column numbers
-
-## Import
-
-```go
-import "github.com/pelletier/go-toml"
-```
-
-## Usage example
-
-Read a TOML document:
-
-```go
-config, _ := toml.Load(`
-[postgres]
-user = "pelletier"
-password = "mypassword"`)
-// retrieve data directly
-user := config.Get("postgres.user").(string)
-
-// or using an intermediate object
-postgresConfig := config.Get("postgres").(*toml.Tree)
-password := postgresConfig.Get("password").(string)
-```
-
-Or use Unmarshal:
-
-```go
-type Postgres struct {
- User string
- Password string
-}
-type Config struct {
- Postgres Postgres
-}
-
-doc := []byte(`
-[Postgres]
-User = "pelletier"
-Password = "mypassword"`)
-
-config := Config{}
-toml.Unmarshal(doc, &config)
-fmt.Println("user=", config.Postgres.User)
-```
-
-Or use a query:
-
-```go
-// use a query to gather elements without walking the tree
-q, _ := query.Compile("$..[user,password]")
-results := q.Execute(config)
-for ii, item := range results.Values() {
- fmt.Println("Query result %d: %v", ii, item)
-}
-```
-
-## Documentation
-
-The documentation and additional examples are available at
-[godoc.org](http://godoc.org/github.com/pelletier/go-toml).
-
-## Tools
-
-Go-toml provides two handy command line tools:
-
-* `tomll`: Reads TOML files and lint them.
-
- ```
- go install github.com/pelletier/go-toml/cmd/tomll
- tomll --help
- ```
-* `tomljson`: Reads a TOML file and outputs its JSON representation.
-
- ```
- go install github.com/pelletier/go-toml/cmd/tomljson
- tomljson --help
- ```
-
-## Contribute
-
-Feel free to report bugs and patches using GitHub's pull requests system on
-[pelletier/go-toml](https://github.com/pelletier/go-toml). Any feedback would be
-much appreciated!
-
-### Run tests
-
-You have to make sure two kind of tests run:
-
-1. The Go unit tests
-2. The TOML examples base
-
-You can run both of them using `./test.sh`.
-
-### Fuzzing
-
-The script `./fuzz.sh` is available to
-run [go-fuzz](https://github.com/dvyukov/go-fuzz) on go-toml.
-
-## Versioning
-
-Go-toml follows [Semantic Versioning](http://semver.org/). The supported version
-of [TOML](https://github.com/toml-lang/toml) is indicated at the beginning of
-this document. The last two major versions of Go are supported
-(see [Go Release Policy](https://golang.org/doc/devel/release.html#policy)).
-
-## License
-
-The MIT License (MIT). Read [LICENSE](LICENSE).
diff --git a/vendor/github.com/pelletier/go-toml/benchmark.json b/vendor/github.com/pelletier/go-toml/benchmark.json
deleted file mode 100644
index 86f99c6a..00000000
--- a/vendor/github.com/pelletier/go-toml/benchmark.json
+++ /dev/null
@@ -1,164 +0,0 @@
-{
- "array": {
- "key1": [
- 1,
- 2,
- 3
- ],
- "key2": [
- "red",
- "yellow",
- "green"
- ],
- "key3": [
- [
- 1,
- 2
- ],
- [
- 3,
- 4,
- 5
- ]
- ],
- "key4": [
- [
- 1,
- 2
- ],
- [
- "a",
- "b",
- "c"
- ]
- ],
- "key5": [
- 1,
- 2,
- 3
- ],
- "key6": [
- 1,
- 2
- ]
- },
- "boolean": {
- "False": false,
- "True": true
- },
- "datetime": {
- "key1": "1979-05-27T07:32:00Z",
- "key2": "1979-05-27T00:32:00-07:00",
- "key3": "1979-05-27T00:32:00.999999-07:00"
- },
- "float": {
- "both": {
- "key": 6.626e-34
- },
- "exponent": {
- "key1": 5e+22,
- "key2": 1000000,
- "key3": -0.02
- },
- "fractional": {
- "key1": 1,
- "key2": 3.1415,
- "key3": -0.01
- },
- "underscores": {
- "key1": 9224617.445991227,
- "key2": 1e+100
- }
- },
- "fruit": [{
- "name": "apple",
- "physical": {
- "color": "red",
- "shape": "round"
- },
- "variety": [{
- "name": "red delicious"
- },
- {
- "name": "granny smith"
- }
- ]
- },
- {
- "name": "banana",
- "variety": [{
- "name": "plantain"
- }]
- }
- ],
- "integer": {
- "key1": 99,
- "key2": 42,
- "key3": 0,
- "key4": -17,
- "underscores": {
- "key1": 1000,
- "key2": 5349221,
- "key3": 12345
- }
- },
- "products": [{
- "name": "Hammer",
- "sku": 738594937
- },
- {},
- {
- "color": "gray",
- "name": "Nail",
- "sku": 284758393
- }
- ],
- "string": {
- "basic": {
- "basic": "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."
- },
- "literal": {
- "multiline": {
- "lines": "The first newline is\ntrimmed in raw strings.\n All other whitespace\n is preserved.\n",
- "regex2": "I [dw]on't need \\d{2} apples"
- },
- "quoted": "Tom \"Dubs\" Preston-Werner",
- "regex": "\u003c\\i\\c*\\s*\u003e",
- "winpath": "C:\\Users\\nodejs\\templates",
- "winpath2": "\\\\ServerX\\admin$\\system32\\"
- },
- "multiline": {
- "continued": {
- "key1": "The quick brown fox jumps over the lazy dog.",
- "key2": "The quick brown fox jumps over the lazy dog.",
- "key3": "The quick brown fox jumps over the lazy dog."
- },
- "key1": "One\nTwo",
- "key2": "One\nTwo",
- "key3": "One\nTwo"
- }
- },
- "table": {
- "inline": {
- "name": {
- "first": "Tom",
- "last": "Preston-Werner"
- },
- "point": {
- "x": 1,
- "y": 2
- }
- },
- "key": "value",
- "subtable": {
- "key": "another value"
- }
- },
- "x": {
- "y": {
- "z": {
- "w": {}
- }
- }
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/benchmark.sh b/vendor/github.com/pelletier/go-toml/benchmark.sh
deleted file mode 100755
index 8b8bb528..00000000
--- a/vendor/github.com/pelletier/go-toml/benchmark.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-set -e
-
-reference_ref=${1:-master}
-reference_git=${2:-.}
-
-if ! `hash benchstat 2>/dev/null`; then
- echo "Installing benchstat"
- go get golang.org/x/perf/cmd/benchstat
- go install golang.org/x/perf/cmd/benchstat
-fi
-
-tempdir=`mktemp -d /tmp/go-toml-benchmark-XXXXXX`
-ref_tempdir="${tempdir}/ref"
-ref_benchmark="${ref_tempdir}/benchmark-`echo -n ${reference_ref}|tr -s '/' '-'`.txt"
-local_benchmark="`pwd`/benchmark-local.txt"
-
-echo "=== ${reference_ref} (${ref_tempdir})"
-git clone ${reference_git} ${ref_tempdir} >/dev/null 2>/dev/null
-pushd ${ref_tempdir} >/dev/null
-git checkout ${reference_ref} >/dev/null 2>/dev/null
-go test -bench=. -benchmem | tee ${ref_benchmark}
-popd >/dev/null
-
-echo ""
-echo "=== local"
-go test -bench=. -benchmem | tee ${local_benchmark}
-
-echo ""
-echo "=== diff"
-benchstat -delta-test=none ${ref_benchmark} ${local_benchmark}
\ No newline at end of file
diff --git a/vendor/github.com/pelletier/go-toml/benchmark.toml b/vendor/github.com/pelletier/go-toml/benchmark.toml
deleted file mode 100644
index dfd77e09..00000000
--- a/vendor/github.com/pelletier/go-toml/benchmark.toml
+++ /dev/null
@@ -1,244 +0,0 @@
-################################################################################
-## Comment
-
-# Speak your mind with the hash symbol. They go from the symbol to the end of
-# the line.
-
-
-################################################################################
-## Table
-
-# Tables (also known as hash tables or dictionaries) are collections of
-# key/value pairs. They appear in square brackets on a line by themselves.
-
-[table]
-
-key = "value" # Yeah, you can do this.
-
-# Nested tables are denoted by table names with dots in them. Name your tables
-# whatever crap you please, just don't use #, ., [ or ].
-
-[table.subtable]
-
-key = "another value"
-
-# You don't need to specify all the super-tables if you don't want to. TOML
-# knows how to do it for you.
-
-# [x] you
-# [x.y] don't
-# [x.y.z] need these
-[x.y.z.w] # for this to work
-
-
-################################################################################
-## Inline Table
-
-# Inline tables provide a more compact syntax for expressing tables. They are
-# especially useful for grouped data that can otherwise quickly become verbose.
-# Inline tables are enclosed in curly braces `{` and `}`. No newlines are
-# allowed between the curly braces unless they are valid within a value.
-
-[table.inline]
-
-name = { first = "Tom", last = "Preston-Werner" }
-point = { x = 1, y = 2 }
-
-
-################################################################################
-## String
-
-# There are four ways to express strings: basic, multi-line basic, literal, and
-# multi-line literal. All strings must contain only valid UTF-8 characters.
-
-[string.basic]
-
-basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
-
-[string.multiline]
-
-# The following strings are byte-for-byte equivalent:
-key1 = "One\nTwo"
-key2 = """One\nTwo"""
-key3 = """
-One
-Two"""
-
-[string.multiline.continued]
-
-# The following strings are byte-for-byte equivalent:
-key1 = "The quick brown fox jumps over the lazy dog."
-
-key2 = """
-The quick brown \
-
-
- fox jumps over \
- the lazy dog."""
-
-key3 = """\
- The quick brown \
- fox jumps over \
- the lazy dog.\
- """
-
-[string.literal]
-
-# What you see is what you get.
-winpath = 'C:\Users\nodejs\templates'
-winpath2 = '\\ServerX\admin$\system32\'
-quoted = 'Tom "Dubs" Preston-Werner'
-regex = '<\i\c*\s*>'
-
-
-[string.literal.multiline]
-
-regex2 = '''I [dw]on't need \d{2} apples'''
-lines = '''
-The first newline is
-trimmed in raw strings.
- All other whitespace
- is preserved.
-'''
-
-
-################################################################################
-## Integer
-
-# Integers are whole numbers. Positive numbers may be prefixed with a plus sign.
-# Negative numbers are prefixed with a minus sign.
-
-[integer]
-
-key1 = +99
-key2 = 42
-key3 = 0
-key4 = -17
-
-[integer.underscores]
-
-# For large numbers, you may use underscores to enhance readability. Each
-# underscore must be surrounded by at least one digit.
-key1 = 1_000
-key2 = 5_349_221
-key3 = 1_2_3_4_5 # valid but inadvisable
-
-
-################################################################################
-## Float
-
-# A float consists of an integer part (which may be prefixed with a plus or
-# minus sign) followed by a fractional part and/or an exponent part.
-
-[float.fractional]
-
-key1 = +1.0
-key2 = 3.1415
-key3 = -0.01
-
-[float.exponent]
-
-key1 = 5e+22
-key2 = 1e6
-key3 = -2E-2
-
-[float.both]
-
-key = 6.626e-34
-
-[float.underscores]
-
-key1 = 9_224_617.445_991_228_313
-key2 = 1e1_00
-
-
-################################################################################
-## Boolean
-
-# Booleans are just the tokens you're used to. Always lowercase.
-
-[boolean]
-
-True = true
-False = false
-
-
-################################################################################
-## Datetime
-
-# Datetimes are RFC 3339 dates.
-
-[datetime]
-
-key1 = 1979-05-27T07:32:00Z
-key2 = 1979-05-27T00:32:00-07:00
-key3 = 1979-05-27T00:32:00.999999-07:00
-
-
-################################################################################
-## Array
-
-# Arrays are square brackets with other primitives inside. Whitespace is
-# ignored. Elements are separated by commas. Data types may not be mixed.
-
-[array]
-
-key1 = [ 1, 2, 3 ]
-key2 = [ "red", "yellow", "green" ]
-key3 = [ [ 1, 2 ], [3, 4, 5] ]
-#key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok
-
-# Arrays can also be multiline. So in addition to ignoring whitespace, arrays
-# also ignore newlines between the brackets. Terminating commas are ok before
-# the closing bracket.
-
-key5 = [
- 1, 2, 3
-]
-key6 = [
- 1,
- 2, # this is ok
-]
-
-
-################################################################################
-## Array of Tables
-
-# These can be expressed by using a table name in double brackets. Each table
-# with the same double bracketed name will be an element in the array. The
-# tables are inserted in the order encountered.
-
-[[products]]
-
-name = "Hammer"
-sku = 738594937
-
-[[products]]
-
-[[products]]
-
-name = "Nail"
-sku = 284758393
-color = "gray"
-
-
-# You can create nested arrays of tables as well.
-
-[[fruit]]
- name = "apple"
-
- [fruit.physical]
- color = "red"
- shape = "round"
-
- [[fruit.variety]]
- name = "red delicious"
-
- [[fruit.variety]]
- name = "granny smith"
-
-[[fruit]]
- name = "banana"
-
- [[fruit.variety]]
- name = "plantain"
diff --git a/vendor/github.com/pelletier/go-toml/benchmark.yml b/vendor/github.com/pelletier/go-toml/benchmark.yml
deleted file mode 100644
index 0bd19f08..00000000
--- a/vendor/github.com/pelletier/go-toml/benchmark.yml
+++ /dev/null
@@ -1,121 +0,0 @@
----
-array:
- key1:
- - 1
- - 2
- - 3
- key2:
- - red
- - yellow
- - green
- key3:
- - - 1
- - 2
- - - 3
- - 4
- - 5
- key4:
- - - 1
- - 2
- - - a
- - b
- - c
- key5:
- - 1
- - 2
- - 3
- key6:
- - 1
- - 2
-boolean:
- 'False': false
- 'True': true
-datetime:
- key1: '1979-05-27T07:32:00Z'
- key2: '1979-05-27T00:32:00-07:00'
- key3: '1979-05-27T00:32:00.999999-07:00'
-float:
- both:
- key: 6.626e-34
- exponent:
- key1: 5.0e+22
- key2: 1000000
- key3: -0.02
- fractional:
- key1: 1
- key2: 3.1415
- key3: -0.01
- underscores:
- key1: 9224617.445991227
- key2: 1.0e+100
-fruit:
-- name: apple
- physical:
- color: red
- shape: round
- variety:
- - name: red delicious
- - name: granny smith
-- name: banana
- variety:
- - name: plantain
-integer:
- key1: 99
- key2: 42
- key3: 0
- key4: -17
- underscores:
- key1: 1000
- key2: 5349221
- key3: 12345
-products:
-- name: Hammer
- sku: 738594937
-- {}
-- color: gray
- name: Nail
- sku: 284758393
-string:
- basic:
- basic: "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."
- literal:
- multiline:
- lines: |
- The first newline is
- trimmed in raw strings.
- All other whitespace
- is preserved.
- regex2: I [dw]on't need \d{2} apples
- quoted: Tom "Dubs" Preston-Werner
- regex: "<\\i\\c*\\s*>"
- winpath: C:\Users\nodejs\templates
- winpath2: "\\\\ServerX\\admin$\\system32\\"
- multiline:
- continued:
- key1: The quick brown fox jumps over the lazy dog.
- key2: The quick brown fox jumps over the lazy dog.
- key3: The quick brown fox jumps over the lazy dog.
- key1: |-
- One
- Two
- key2: |-
- One
- Two
- key3: |-
- One
- Two
-table:
- inline:
- name:
- first: Tom
- last: Preston-Werner
- point:
- x: 1
- y: 2
- key: value
- subtable:
- key: another value
-x:
- y:
- z:
- w: {}
diff --git a/vendor/github.com/pelletier/go-toml/benchmark_test.go b/vendor/github.com/pelletier/go-toml/benchmark_test.go
deleted file mode 100644
index e1f209df..00000000
--- a/vendor/github.com/pelletier/go-toml/benchmark_test.go
+++ /dev/null
@@ -1,192 +0,0 @@
-package toml
-
-import (
- "bytes"
- "encoding/json"
- "io/ioutil"
- "testing"
- "time"
-
- burntsushi "github.com/BurntSushi/toml"
- yaml "gopkg.in/yaml.v2"
-)
-
-type benchmarkDoc struct {
- Table struct {
- Key string
- Subtable struct {
- Key string
- }
- Inline struct {
- Name struct {
- First string
- Last string
- }
- Point struct {
- X int64
- U int64
- }
- }
- }
- String struct {
- Basic struct {
- Basic string
- }
- Multiline struct {
- Key1 string
- Key2 string
- Key3 string
- Continued struct {
- Key1 string
- Key2 string
- Key3 string
- }
- }
- Literal struct {
- Winpath string
- Winpath2 string
- Quoted string
- Regex string
- Multiline struct {
- Regex2 string
- Lines string
- }
- }
- }
- Integer struct {
- Key1 int64
- Key2 int64
- Key3 int64
- Key4 int64
- Underscores struct {
- Key1 int64
- Key2 int64
- Key3 int64
- }
- }
- Float struct {
- Fractional struct {
- Key1 float64
- Key2 float64
- Key3 float64
- }
- Exponent struct {
- Key1 float64
- Key2 float64
- Key3 float64
- }
- Both struct {
- Key float64
- }
- Underscores struct {
- Key1 float64
- Key2 float64
- }
- }
- Boolean struct {
- True bool
- False bool
- }
- Datetime struct {
- Key1 time.Time
- Key2 time.Time
- Key3 time.Time
- }
- Array struct {
- Key1 []int64
- Key2 []string
- Key3 [][]int64
- // TODO: Key4 not supported by go-toml's Unmarshal
- Key5 []int64
- Key6 []int64
- }
- Products []struct {
- Name string
- Sku int64
- Color string
- }
- Fruit []struct {
- Name string
- Physical struct {
- Color string
- Shape string
- Variety []struct {
- Name string
- }
- }
- }
-}
-
-func BenchmarkParseToml(b *testing.B) {
- fileBytes, err := ioutil.ReadFile("benchmark.toml")
- if err != nil {
- b.Fatal(err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- _, err := LoadReader(bytes.NewReader(fileBytes))
- if err != nil {
- b.Fatal(err)
- }
- }
-}
-
-func BenchmarkUnmarshalToml(b *testing.B) {
- bytes, err := ioutil.ReadFile("benchmark.toml")
- if err != nil {
- b.Fatal(err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- target := benchmarkDoc{}
- err := Unmarshal(bytes, &target)
- if err != nil {
- b.Fatal(err)
- }
- }
-}
-
-func BenchmarkUnmarshalBurntSushiToml(b *testing.B) {
- bytes, err := ioutil.ReadFile("benchmark.toml")
- if err != nil {
- b.Fatal(err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- target := benchmarkDoc{}
- err := burntsushi.Unmarshal(bytes, &target)
- if err != nil {
- b.Fatal(err)
- }
- }
-}
-
-func BenchmarkUnmarshalJson(b *testing.B) {
- bytes, err := ioutil.ReadFile("benchmark.json")
- if err != nil {
- b.Fatal(err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- target := benchmarkDoc{}
- err := json.Unmarshal(bytes, &target)
- if err != nil {
- b.Fatal(err)
- }
- }
-}
-
-func BenchmarkUnmarshalYaml(b *testing.B) {
- bytes, err := ioutil.ReadFile("benchmark.yml")
- if err != nil {
- b.Fatal(err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- target := benchmarkDoc{}
- err := yaml.Unmarshal(bytes, &target)
- if err != nil {
- b.Fatal(err)
- }
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/cmd/test_program.go b/vendor/github.com/pelletier/go-toml/cmd/test_program.go
deleted file mode 100644
index 73077f61..00000000
--- a/vendor/github.com/pelletier/go-toml/cmd/test_program.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package main
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "log"
- "os"
- "time"
-
- "github.com/pelletier/go-toml"
-)
-
-func main() {
- bytes, err := ioutil.ReadAll(os.Stdin)
- if err != nil {
- log.Fatalf("Error during TOML read: %s", err)
- os.Exit(2)
- }
- tree, err := toml.Load(string(bytes))
- if err != nil {
- log.Fatalf("Error during TOML load: %s", err)
- os.Exit(1)
- }
-
- typedTree := translate(*tree)
-
- if err := json.NewEncoder(os.Stdout).Encode(typedTree); err != nil {
- log.Fatalf("Error encoding JSON: %s", err)
- os.Exit(3)
- }
-
- os.Exit(0)
-}
-
-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 *toml.Tree:
- return translate(*orig)
- case toml.Tree:
- keys := orig.Keys()
- typed := make(map[string]interface{}, len(keys))
- for _, k := range keys {
- typed[k] = translate(orig.GetPath([]string{k}))
- }
- return typed
- case []*toml.Tree:
- typed := make([]map[string]interface{}, len(orig))
- for i, v := range orig {
- typed[i] = translate(v).(map[string]interface{})
- }
- 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)
- }
- 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,
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/cmd/tomljson/main.go b/vendor/github.com/pelletier/go-toml/cmd/tomljson/main.go
deleted file mode 100644
index 322315b5..00000000
--- a/vendor/github.com/pelletier/go-toml/cmd/tomljson/main.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Tomljson reads TOML and converts to JSON.
-//
-// Usage:
-// cat file.toml | tomljson > file.json
-// tomljson file1.toml > file.json
-package main
-
-import (
- "encoding/json"
- "flag"
- "fmt"
- "io"
- "os"
-
- "github.com/pelletier/go-toml"
-)
-
-func main() {
- flag.Usage = func() {
- fmt.Fprintln(os.Stderr, "tomljson can be used in two ways:")
- fmt.Fprintln(os.Stderr, "Writing to STDIN and reading from STDOUT:")
- fmt.Fprintln(os.Stderr, " cat file.toml | tomljson > file.json")
- fmt.Fprintln(os.Stderr, "")
- fmt.Fprintln(os.Stderr, "Reading from a file name:")
- fmt.Fprintln(os.Stderr, " tomljson file.toml")
- }
- flag.Parse()
- os.Exit(processMain(flag.Args(), os.Stdin, os.Stdout, os.Stderr))
-}
-
-func processMain(files []string, defaultInput io.Reader, output io.Writer, errorOutput io.Writer) int {
- // read from stdin and print to stdout
- inputReader := defaultInput
-
- if len(files) > 0 {
- var err error
- inputReader, err = os.Open(files[0])
- if err != nil {
- printError(err, errorOutput)
- return -1
- }
- }
- s, err := reader(inputReader)
- if err != nil {
- printError(err, errorOutput)
- return -1
- }
- io.WriteString(output, s+"\n")
- return 0
-}
-
-func printError(err error, output io.Writer) {
- io.WriteString(output, err.Error()+"\n")
-}
-
-func reader(r io.Reader) (string, error) {
- tree, err := toml.LoadReader(r)
- if err != nil {
- return "", err
- }
- return mapToJSON(tree)
-}
-
-func mapToJSON(tree *toml.Tree) (string, error) {
- treeMap := tree.ToMap()
- bytes, err := json.MarshalIndent(treeMap, "", " ")
- if err != nil {
- return "", err
- }
- return string(bytes[:]), nil
-}
diff --git a/vendor/github.com/pelletier/go-toml/cmd/tomljson/main_test.go b/vendor/github.com/pelletier/go-toml/cmd/tomljson/main_test.go
deleted file mode 100644
index 0b4bdbb1..00000000
--- a/vendor/github.com/pelletier/go-toml/cmd/tomljson/main_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package main
-
-import (
- "bytes"
- "io/ioutil"
- "os"
- "strings"
- "testing"
-)
-
-func expectBufferEquality(t *testing.T, name string, buffer *bytes.Buffer, expected string) {
- output := buffer.String()
- if output != expected {
- t.Errorf("incorrect %s:\n%s\n\nexpected %s:\n%s", name, output, name, expected)
- t.Log([]rune(output))
- t.Log([]rune(expected))
- }
-}
-
-func expectProcessMainResults(t *testing.T, input string, args []string, exitCode int, expectedOutput string, expectedError string) {
- inputReader := strings.NewReader(input)
- outputBuffer := new(bytes.Buffer)
- errorBuffer := new(bytes.Buffer)
-
- returnCode := processMain(args, inputReader, outputBuffer, errorBuffer)
-
- expectBufferEquality(t, "output", outputBuffer, expectedOutput)
- expectBufferEquality(t, "error", errorBuffer, expectedError)
-
- if returnCode != exitCode {
- t.Error("incorrect return code:", returnCode, "expected", exitCode)
- }
-}
-
-func TestProcessMainReadFromStdin(t *testing.T) {
- input := `
- [mytoml]
- a = 42`
- expectedOutput := `{
- "mytoml": {
- "a": 42
- }
-}
-`
- expectedError := ``
- expectedExitCode := 0
-
- expectProcessMainResults(t, input, []string{}, expectedExitCode, expectedOutput, expectedError)
-}
-
-func TestProcessMainReadFromFile(t *testing.T) {
- input := `
- [mytoml]
- a = 42`
-
- tmpfile, err := ioutil.TempFile("", "example.toml")
- if err != nil {
- t.Fatal(err)
- }
- if _, err := tmpfile.Write([]byte(input)); err != nil {
- t.Fatal(err)
- }
-
- defer os.Remove(tmpfile.Name())
-
- expectedOutput := `{
- "mytoml": {
- "a": 42
- }
-}
-`
- expectedError := ``
- expectedExitCode := 0
-
- expectProcessMainResults(t, ``, []string{tmpfile.Name()}, expectedExitCode, expectedOutput, expectedError)
-}
-
-func TestProcessMainReadFromMissingFile(t *testing.T) {
- expectedError := `open /this/file/does/not/exist: no such file or directory
-`
- expectProcessMainResults(t, ``, []string{"/this/file/does/not/exist"}, -1, ``, expectedError)
-}
diff --git a/vendor/github.com/pelletier/go-toml/cmd/tomll/main.go b/vendor/github.com/pelletier/go-toml/cmd/tomll/main.go
deleted file mode 100644
index 93ab0c96..00000000
--- a/vendor/github.com/pelletier/go-toml/cmd/tomll/main.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Tomll is a linter for TOML
-//
-// Usage:
-// cat file.toml | tomll > file_linted.toml
-// tomll file1.toml file2.toml # lint the two files in place
-package main
-
-import (
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "os"
-
- "github.com/pelletier/go-toml"
-)
-
-func main() {
- flag.Usage = func() {
- fmt.Fprintln(os.Stderr, "tomll can be used in two ways:")
- fmt.Fprintln(os.Stderr, "Writing to STDIN and reading from STDOUT:")
- fmt.Fprintln(os.Stderr, " cat file.toml | tomll > file.toml")
- fmt.Fprintln(os.Stderr, "")
- fmt.Fprintln(os.Stderr, "Reading and updating a list of files:")
- fmt.Fprintln(os.Stderr, " tomll a.toml b.toml c.toml")
- fmt.Fprintln(os.Stderr, "")
- fmt.Fprintln(os.Stderr, "When given a list of files, tomll will modify all files in place without asking.")
- }
- flag.Parse()
- // read from stdin and print to stdout
- if flag.NArg() == 0 {
- s, err := lintReader(os.Stdin)
- if err != nil {
- io.WriteString(os.Stderr, err.Error())
- os.Exit(-1)
- }
- io.WriteString(os.Stdout, s)
- } else {
- // otherwise modify a list of files
- for _, filename := range flag.Args() {
- s, err := lintFile(filename)
- if err != nil {
- io.WriteString(os.Stderr, err.Error())
- os.Exit(-1)
- }
- ioutil.WriteFile(filename, []byte(s), 0644)
- }
- }
-}
-
-func lintFile(filename string) (string, error) {
- tree, err := toml.LoadFile(filename)
- if err != nil {
- return "", err
- }
- return tree.String(), nil
-}
-
-func lintReader(r io.Reader) (string, error) {
- tree, err := toml.LoadReader(r)
- if err != nil {
- return "", err
- }
- return tree.String(), nil
-}
diff --git a/vendor/github.com/pelletier/go-toml/doc.go b/vendor/github.com/pelletier/go-toml/doc.go
deleted file mode 100644
index d5fd98c0..00000000
--- a/vendor/github.com/pelletier/go-toml/doc.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Package toml is a TOML parser and manipulation library.
-//
-// This version supports the specification as described in
-// https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md
-//
-// Marshaling
-//
-// Go-toml can marshal and unmarshal TOML documents from and to data
-// structures.
-//
-// TOML document as a tree
-//
-// Go-toml can operate on a TOML document as a tree. Use one of the Load*
-// functions to parse TOML data and obtain a Tree instance, then one of its
-// methods to manipulate the tree.
-//
-// JSONPath-like queries
-//
-// The package github.com/pelletier/go-toml/query implements a system
-// similar to JSONPath to quickly retrieve elements of a TOML document using a
-// single expression. See the package documentation for more information.
-//
-package toml
diff --git a/vendor/github.com/pelletier/go-toml/doc_test.go b/vendor/github.com/pelletier/go-toml/doc_test.go
deleted file mode 100644
index 3b8171b2..00000000
--- a/vendor/github.com/pelletier/go-toml/doc_test.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// code examples for godoc
-
-package toml_test
-
-import (
- "fmt"
- "log"
-
- toml "github.com/pelletier/go-toml"
-)
-
-func Example_tree() {
- config, err := toml.LoadFile("config.toml")
-
- if err != nil {
- fmt.Println("Error ", err.Error())
- } else {
- // retrieve data directly
- user := config.Get("postgres.user").(string)
- password := config.Get("postgres.password").(string)
-
- // or using an intermediate object
- configTree := config.Get("postgres").(*toml.Tree)
- user = configTree.Get("user").(string)
- password = configTree.Get("password").(string)
- fmt.Println("User is", user, " and password is", password)
-
- // show where elements are in the file
- fmt.Printf("User position: %v\n", configTree.GetPosition("user"))
- fmt.Printf("Password position: %v\n", configTree.GetPosition("password"))
- }
-}
-
-func Example_unmarshal() {
- type Employer struct {
- Name string
- Phone string
- }
- type Person struct {
- Name string
- Age int64
- Employer Employer
- }
-
- document := []byte(`
- name = "John"
- age = 30
- [employer]
- name = "Company Inc."
- phone = "+1 234 567 89012"
- `)
-
- person := Person{}
- toml.Unmarshal(document, &person)
- fmt.Println(person.Name, "is", person.Age, "and works at", person.Employer.Name)
- // Output:
- // John is 30 and works at Company Inc.
-}
-
-func ExampleMarshal() {
- type Postgres struct {
- User string `toml:"user"`
- Password string `toml:"password"`
- Database string `toml:"db" commented:"true" comment:"not used anymore"`
- }
- type Config struct {
- Postgres Postgres `toml:"postgres" comment:"Postgres configuration"`
- }
-
- config := Config{Postgres{User: "pelletier", Password: "mypassword", Database: "old_database"}}
- b, err := toml.Marshal(config)
- if err != nil {
- log.Fatal(err)
- }
- fmt.Println(string(b))
- // Output:
- // # Postgres configuration
- // [postgres]
- //
- // # not used anymore
- // # db = "old_database"
- // password = "mypassword"
- // user = "pelletier"
-}
-
-func ExampleUnmarshal() {
- type Postgres struct {
- User string
- Password string
- }
- type Config struct {
- Postgres Postgres
- }
-
- doc := []byte(`
- [postgres]
- user = "pelletier"
- password = "mypassword"`)
-
- config := Config{}
- toml.Unmarshal(doc, &config)
- fmt.Println("user=", config.Postgres.User)
- // Output:
- // user= pelletier
-}
diff --git a/vendor/github.com/pelletier/go-toml/example-crlf.toml b/vendor/github.com/pelletier/go-toml/example-crlf.toml
deleted file mode 100644
index 3d902f28..00000000
--- a/vendor/github.com/pelletier/go-toml/example-crlf.toml
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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
diff --git a/vendor/github.com/pelletier/go-toml/example.toml b/vendor/github.com/pelletier/go-toml/example.toml
deleted file mode 100644
index 3d902f28..00000000
--- a/vendor/github.com/pelletier/go-toml/example.toml
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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
diff --git a/vendor/github.com/pelletier/go-toml/fuzz.go b/vendor/github.com/pelletier/go-toml/fuzz.go
deleted file mode 100644
index 14570c8d..00000000
--- a/vendor/github.com/pelletier/go-toml/fuzz.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// +build gofuzz
-
-package toml
-
-func Fuzz(data []byte) int {
- tree, err := LoadBytes(data)
- if err != nil {
- if tree != nil {
- panic("tree must be nil if there is an error")
- }
- return 0
- }
-
- str, err := tree.ToTomlString()
- if err != nil {
- if str != "" {
- panic(`str must be "" if there is an error`)
- }
- panic(err)
- }
-
- tree, err = Load(str)
- if err != nil {
- if tree != nil {
- panic("tree must be nil if there is an error")
- }
- return 0
- }
-
- return 1
-}
diff --git a/vendor/github.com/pelletier/go-toml/fuzz.sh b/vendor/github.com/pelletier/go-toml/fuzz.sh
deleted file mode 100755
index 3204b4c4..00000000
--- a/vendor/github.com/pelletier/go-toml/fuzz.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/sh
-set -eu
-
-go get github.com/dvyukov/go-fuzz/go-fuzz
-go get github.com/dvyukov/go-fuzz/go-fuzz-build
-
-if [ ! -e toml-fuzz.zip ]; then
- go-fuzz-build github.com/pelletier/go-toml
-fi
-
-rm -fr fuzz
-mkdir -p fuzz/corpus
-cp *.toml fuzz/corpus
-
-go-fuzz -bin=toml-fuzz.zip -workdir=fuzz
diff --git a/vendor/github.com/pelletier/go-toml/keysparsing.go b/vendor/github.com/pelletier/go-toml/keysparsing.go
deleted file mode 100644
index 284db646..00000000
--- a/vendor/github.com/pelletier/go-toml/keysparsing.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Parsing keys handling both bare and quoted keys.
-
-package toml
-
-import (
- "bytes"
- "errors"
- "fmt"
- "unicode"
-)
-
-// Convert the bare key group string to an array.
-// The input supports double quotation to allow "." inside the key name,
-// but escape sequences are not supported. Lexers must unescape them beforehand.
-func parseKey(key string) ([]string, error) {
- groups := []string{}
- var buffer bytes.Buffer
- inQuotes := false
- wasInQuotes := false
- ignoreSpace := true
- expectDot := false
-
- for _, char := range key {
- if ignoreSpace {
- if char == ' ' {
- continue
- }
- ignoreSpace = false
- }
- switch char {
- case '"':
- if inQuotes {
- groups = append(groups, buffer.String())
- buffer.Reset()
- wasInQuotes = true
- }
- inQuotes = !inQuotes
- expectDot = false
- case '.':
- if inQuotes {
- buffer.WriteRune(char)
- } else {
- if !wasInQuotes {
- if buffer.Len() == 0 {
- return nil, errors.New("empty table key")
- }
- groups = append(groups, buffer.String())
- buffer.Reset()
- }
- ignoreSpace = true
- expectDot = false
- wasInQuotes = false
- }
- case ' ':
- if inQuotes {
- buffer.WriteRune(char)
- } else {
- expectDot = true
- }
- default:
- if !inQuotes && !isValidBareChar(char) {
- return nil, fmt.Errorf("invalid bare character: %c", char)
- }
- if !inQuotes && expectDot {
- return nil, errors.New("what?")
- }
- buffer.WriteRune(char)
- expectDot = false
- }
- }
- if inQuotes {
- return nil, errors.New("mismatched quotes")
- }
- if buffer.Len() > 0 {
- groups = append(groups, buffer.String())
- }
- if len(groups) == 0 {
- return nil, errors.New("empty key")
- }
- return groups, nil
-}
-
-func isValidBareChar(r rune) bool {
- return isAlphanumeric(r) || r == '-' || unicode.IsNumber(r)
-}
diff --git a/vendor/github.com/pelletier/go-toml/keysparsing_test.go b/vendor/github.com/pelletier/go-toml/keysparsing_test.go
deleted file mode 100644
index 84cb8260..00000000
--- a/vendor/github.com/pelletier/go-toml/keysparsing_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package toml
-
-import (
- "fmt"
- "testing"
-)
-
-func testResult(t *testing.T, key string, expected []string) {
- parsed, err := parseKey(key)
- t.Logf("key=%s expected=%s parsed=%s", key, expected, parsed)
- if err != nil {
- t.Fatal("Unexpected error:", err)
- }
- if len(expected) != len(parsed) {
- t.Fatal("Expected length", len(expected), "but", len(parsed), "parsed")
- }
- for index, expectedKey := range expected {
- if expectedKey != parsed[index] {
- t.Fatal("Expected", expectedKey, "at index", index, "but found", parsed[index])
- }
- }
-}
-
-func testError(t *testing.T, key string, expectedError string) {
- res, err := parseKey(key)
- if err == nil {
- t.Fatalf("Expected error, but succesfully parsed key %s", res)
- }
- if fmt.Sprintf("%s", err) != expectedError {
- t.Fatalf("Expected error \"%s\", but got \"%s\".", expectedError, err)
- }
-}
-
-func TestBareKeyBasic(t *testing.T) {
- testResult(t, "test", []string{"test"})
-}
-
-func TestBareKeyDotted(t *testing.T) {
- testResult(t, "this.is.a.key", []string{"this", "is", "a", "key"})
-}
-
-func TestDottedKeyBasic(t *testing.T) {
- testResult(t, "\"a.dotted.key\"", []string{"a.dotted.key"})
-}
-
-func TestBaseKeyPound(t *testing.T) {
- testError(t, "hello#world", "invalid bare character: #")
-}
-
-func TestQuotedKeys(t *testing.T) {
- testResult(t, `hello."foo".bar`, []string{"hello", "foo", "bar"})
- testResult(t, `"hello!"`, []string{"hello!"})
- testResult(t, `foo."ba.r".baz`, []string{"foo", "ba.r", "baz"})
-
- // escape sequences must not be converted
- testResult(t, `"hello\tworld"`, []string{`hello\tworld`})
-}
-
-func TestEmptyKey(t *testing.T) {
- testError(t, "", "empty key")
- testError(t, " ", "empty key")
- testResult(t, `""`, []string{""})
-}
diff --git a/vendor/github.com/pelletier/go-toml/lexer.go b/vendor/github.com/pelletier/go-toml/lexer.go
deleted file mode 100644
index d11de428..00000000
--- a/vendor/github.com/pelletier/go-toml/lexer.go
+++ /dev/null
@@ -1,750 +0,0 @@
-// TOML lexer.
-//
-// Written using the principles developed by Rob Pike in
-// http://www.youtube.com/watch?v=HxaD_trXwRE
-
-package toml
-
-import (
- "bytes"
- "errors"
- "fmt"
- "regexp"
- "strconv"
- "strings"
-)
-
-var dateRegexp *regexp.Regexp
-
-// Define state functions
-type tomlLexStateFn func() tomlLexStateFn
-
-// Define lexer
-type tomlLexer struct {
- inputIdx int
- input []rune // Textual source
- currentTokenStart int
- currentTokenStop int
- tokens []token
- depth int
- line int
- col int
- endbufferLine int
- endbufferCol int
-}
-
-// Basic read operations on input
-
-func (l *tomlLexer) read() rune {
- r := l.peek()
- if r == '\n' {
- l.endbufferLine++
- l.endbufferCol = 1
- } else {
- l.endbufferCol++
- }
- l.inputIdx++
- return r
-}
-
-func (l *tomlLexer) next() rune {
- r := l.read()
-
- if r != eof {
- l.currentTokenStop++
- }
- return r
-}
-
-func (l *tomlLexer) ignore() {
- l.currentTokenStart = l.currentTokenStop
- l.line = l.endbufferLine
- l.col = l.endbufferCol
-}
-
-func (l *tomlLexer) skip() {
- l.next()
- l.ignore()
-}
-
-func (l *tomlLexer) fastForward(n int) {
- for i := 0; i < n; i++ {
- l.next()
- }
-}
-
-func (l *tomlLexer) emitWithValue(t tokenType, value string) {
- l.tokens = append(l.tokens, token{
- Position: Position{l.line, l.col},
- typ: t,
- val: value,
- })
- l.ignore()
-}
-
-func (l *tomlLexer) emit(t tokenType) {
- l.emitWithValue(t, string(l.input[l.currentTokenStart:l.currentTokenStop]))
-}
-
-func (l *tomlLexer) peek() rune {
- if l.inputIdx >= len(l.input) {
- return eof
- }
- return l.input[l.inputIdx]
-}
-
-func (l *tomlLexer) peekString(size int) string {
- maxIdx := len(l.input)
- upperIdx := l.inputIdx + size // FIXME: potential overflow
- if upperIdx > maxIdx {
- upperIdx = maxIdx
- }
- return string(l.input[l.inputIdx:upperIdx])
-}
-
-func (l *tomlLexer) follow(next string) bool {
- return next == l.peekString(len(next))
-}
-
-// Error management
-
-func (l *tomlLexer) errorf(format string, args ...interface{}) tomlLexStateFn {
- l.tokens = append(l.tokens, token{
- Position: Position{l.line, l.col},
- typ: tokenError,
- val: fmt.Sprintf(format, args...),
- })
- return nil
-}
-
-// State functions
-
-func (l *tomlLexer) lexVoid() tomlLexStateFn {
- for {
- next := l.peek()
- switch next {
- case '[':
- return l.lexTableKey
- case '#':
- return l.lexComment(l.lexVoid)
- case '=':
- return l.lexEqual
- case '\r':
- fallthrough
- case '\n':
- l.skip()
- continue
- }
-
- if isSpace(next) {
- l.skip()
- }
-
- if l.depth > 0 {
- return l.lexRvalue
- }
-
- if isKeyStartChar(next) {
- return l.lexKey
- }
-
- if next == eof {
- l.next()
- break
- }
- }
-
- l.emit(tokenEOF)
- return nil
-}
-
-func (l *tomlLexer) lexRvalue() tomlLexStateFn {
- for {
- next := l.peek()
- switch next {
- case '.':
- return l.errorf("cannot start float with a dot")
- case '=':
- return l.lexEqual
- case '[':
- l.depth++
- return l.lexLeftBracket
- case ']':
- l.depth--
- return l.lexRightBracket
- case '{':
- return l.lexLeftCurlyBrace
- case '}':
- return l.lexRightCurlyBrace
- case '#':
- return l.lexComment(l.lexRvalue)
- case '"':
- return l.lexString
- case '\'':
- return l.lexLiteralString
- case ',':
- return l.lexComma
- case '\r':
- fallthrough
- case '\n':
- l.skip()
- if l.depth == 0 {
- return l.lexVoid
- }
- return l.lexRvalue
- case '_':
- return l.errorf("cannot start number with underscore")
- }
-
- if l.follow("true") {
- return l.lexTrue
- }
-
- if l.follow("false") {
- return l.lexFalse
- }
-
- if l.follow("inf") {
- return l.lexInf
- }
-
- if l.follow("nan") {
- return l.lexNan
- }
-
- if isSpace(next) {
- l.skip()
- continue
- }
-
- if next == eof {
- l.next()
- break
- }
-
- possibleDate := l.peekString(35)
- dateMatch := dateRegexp.FindString(possibleDate)
- if dateMatch != "" {
- l.fastForward(len(dateMatch))
- return l.lexDate
- }
-
- if next == '+' || next == '-' || isDigit(next) {
- return l.lexNumber
- }
-
- if isAlphanumeric(next) {
- return l.lexKey
- }
-
- return l.errorf("no value can start with %c", next)
- }
-
- l.emit(tokenEOF)
- return nil
-}
-
-func (l *tomlLexer) lexLeftCurlyBrace() tomlLexStateFn {
- l.next()
- l.emit(tokenLeftCurlyBrace)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexRightCurlyBrace() tomlLexStateFn {
- l.next()
- l.emit(tokenRightCurlyBrace)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexDate() tomlLexStateFn {
- l.emit(tokenDate)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexTrue() tomlLexStateFn {
- l.fastForward(4)
- l.emit(tokenTrue)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexFalse() tomlLexStateFn {
- l.fastForward(5)
- l.emit(tokenFalse)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexInf() tomlLexStateFn {
- l.fastForward(3)
- l.emit(tokenInf)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexNan() tomlLexStateFn {
- l.fastForward(3)
- l.emit(tokenNan)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexEqual() tomlLexStateFn {
- l.next()
- l.emit(tokenEqual)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexComma() tomlLexStateFn {
- l.next()
- l.emit(tokenComma)
- return l.lexRvalue
-}
-
-// Parse the key and emits its value without escape sequences.
-// bare keys, basic string keys and literal string keys are supported.
-func (l *tomlLexer) lexKey() tomlLexStateFn {
- growingString := ""
-
- for r := l.peek(); isKeyChar(r) || r == '\n' || r == '\r'; r = l.peek() {
- if r == '"' {
- l.next()
- str, err := l.lexStringAsString(`"`, false, true)
- if err != nil {
- return l.errorf(err.Error())
- }
- growingString += str
- l.next()
- continue
- } else if r == '\'' {
- l.next()
- str, err := l.lexLiteralStringAsString(`'`, false)
- if err != nil {
- return l.errorf(err.Error())
- }
- growingString += str
- l.next()
- continue
- } else if r == '\n' {
- return l.errorf("keys cannot contain new lines")
- } else if isSpace(r) {
- break
- } else if !isValidBareChar(r) {
- return l.errorf("keys cannot contain %c character", r)
- }
- growingString += string(r)
- l.next()
- }
- l.emitWithValue(tokenKey, growingString)
- return l.lexVoid
-}
-
-func (l *tomlLexer) lexComment(previousState tomlLexStateFn) tomlLexStateFn {
- return func() tomlLexStateFn {
- for next := l.peek(); next != '\n' && next != eof; next = l.peek() {
- if next == '\r' && l.follow("\r\n") {
- break
- }
- l.next()
- }
- l.ignore()
- return previousState
- }
-}
-
-func (l *tomlLexer) lexLeftBracket() tomlLexStateFn {
- l.next()
- l.emit(tokenLeftBracket)
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexLiteralStringAsString(terminator string, discardLeadingNewLine bool) (string, error) {
- growingString := ""
-
- if discardLeadingNewLine {
- if l.follow("\r\n") {
- l.skip()
- l.skip()
- } else if l.peek() == '\n' {
- l.skip()
- }
- }
-
- // find end of string
- for {
- if l.follow(terminator) {
- return growingString, nil
- }
-
- next := l.peek()
- if next == eof {
- break
- }
- growingString += string(l.next())
- }
-
- return "", errors.New("unclosed string")
-}
-
-func (l *tomlLexer) lexLiteralString() tomlLexStateFn {
- l.skip()
-
- // handle special case for triple-quote
- terminator := "'"
- discardLeadingNewLine := false
- if l.follow("''") {
- l.skip()
- l.skip()
- terminator = "'''"
- discardLeadingNewLine = true
- }
-
- str, err := l.lexLiteralStringAsString(terminator, discardLeadingNewLine)
- if err != nil {
- return l.errorf(err.Error())
- }
-
- l.emitWithValue(tokenString, str)
- l.fastForward(len(terminator))
- l.ignore()
- return l.lexRvalue
-}
-
-// Lex a string and return the results as a string.
-// Terminator is the substring indicating the end of the token.
-// The resulting string does not include the terminator.
-func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine, acceptNewLines bool) (string, error) {
- growingString := ""
-
- if discardLeadingNewLine {
- if l.follow("\r\n") {
- l.skip()
- l.skip()
- } else if l.peek() == '\n' {
- l.skip()
- }
- }
-
- for {
- if l.follow(terminator) {
- return growingString, nil
- }
-
- if l.follow("\\") {
- l.next()
- switch l.peek() {
- case '\r':
- fallthrough
- case '\n':
- fallthrough
- case '\t':
- fallthrough
- case ' ':
- // skip all whitespace chars following backslash
- for strings.ContainsRune("\r\n\t ", l.peek()) {
- l.next()
- }
- case '"':
- growingString += "\""
- l.next()
- case 'n':
- growingString += "\n"
- l.next()
- case 'b':
- growingString += "\b"
- l.next()
- case 'f':
- growingString += "\f"
- l.next()
- case '/':
- growingString += "/"
- l.next()
- case 't':
- growingString += "\t"
- l.next()
- case 'r':
- growingString += "\r"
- l.next()
- case '\\':
- growingString += "\\"
- l.next()
- case 'u':
- l.next()
- code := ""
- for i := 0; i < 4; i++ {
- c := l.peek()
- if !isHexDigit(c) {
- return "", errors.New("unfinished unicode escape")
- }
- l.next()
- code = code + string(c)
- }
- intcode, err := strconv.ParseInt(code, 16, 32)
- if err != nil {
- return "", errors.New("invalid unicode escape: \\u" + code)
- }
- growingString += string(rune(intcode))
- case 'U':
- l.next()
- code := ""
- for i := 0; i < 8; i++ {
- c := l.peek()
- if !isHexDigit(c) {
- return "", errors.New("unfinished unicode escape")
- }
- l.next()
- code = code + string(c)
- }
- intcode, err := strconv.ParseInt(code, 16, 64)
- if err != nil {
- return "", errors.New("invalid unicode escape: \\U" + code)
- }
- growingString += string(rune(intcode))
- default:
- return "", errors.New("invalid escape sequence: \\" + string(l.peek()))
- }
- } else {
- r := l.peek()
-
- if 0x00 <= r && r <= 0x1F && !(acceptNewLines && (r == '\n' || r == '\r')) {
- return "", fmt.Errorf("unescaped control character %U", r)
- }
- l.next()
- growingString += string(r)
- }
-
- if l.peek() == eof {
- break
- }
- }
-
- return "", errors.New("unclosed string")
-}
-
-func (l *tomlLexer) lexString() tomlLexStateFn {
- l.skip()
-
- // handle special case for triple-quote
- terminator := `"`
- discardLeadingNewLine := false
- acceptNewLines := false
- if l.follow(`""`) {
- l.skip()
- l.skip()
- terminator = `"""`
- discardLeadingNewLine = true
- acceptNewLines = true
- }
-
- str, err := l.lexStringAsString(terminator, discardLeadingNewLine, acceptNewLines)
-
- if err != nil {
- return l.errorf(err.Error())
- }
-
- l.emitWithValue(tokenString, str)
- l.fastForward(len(terminator))
- l.ignore()
- return l.lexRvalue
-}
-
-func (l *tomlLexer) lexTableKey() tomlLexStateFn {
- l.next()
-
- if l.peek() == '[' {
- // token '[[' signifies an array of tables
- l.next()
- l.emit(tokenDoubleLeftBracket)
- return l.lexInsideTableArrayKey
- }
- // vanilla table key
- l.emit(tokenLeftBracket)
- return l.lexInsideTableKey
-}
-
-// Parse the key till "]]", but only bare keys are supported
-func (l *tomlLexer) lexInsideTableArrayKey() tomlLexStateFn {
- for r := l.peek(); r != eof; r = l.peek() {
- switch r {
- case ']':
- if l.currentTokenStop > l.currentTokenStart {
- l.emit(tokenKeyGroupArray)
- }
- l.next()
- if l.peek() != ']' {
- break
- }
- l.next()
- l.emit(tokenDoubleRightBracket)
- return l.lexVoid
- case '[':
- return l.errorf("table array key cannot contain ']'")
- default:
- l.next()
- }
- }
- return l.errorf("unclosed table array key")
-}
-
-// Parse the key till "]" but only bare keys are supported
-func (l *tomlLexer) lexInsideTableKey() tomlLexStateFn {
- for r := l.peek(); r != eof; r = l.peek() {
- switch r {
- case ']':
- if l.currentTokenStop > l.currentTokenStart {
- l.emit(tokenKeyGroup)
- }
- l.next()
- l.emit(tokenRightBracket)
- return l.lexVoid
- case '[':
- return l.errorf("table key cannot contain ']'")
- default:
- l.next()
- }
- }
- return l.errorf("unclosed table key")
-}
-
-func (l *tomlLexer) lexRightBracket() tomlLexStateFn {
- l.next()
- l.emit(tokenRightBracket)
- return l.lexRvalue
-}
-
-type validRuneFn func(r rune) bool
-
-func isValidHexRune(r rune) bool {
- return r >= 'a' && r <= 'f' ||
- r >= 'A' && r <= 'F' ||
- r >= '0' && r <= '9' ||
- r == '_'
-}
-
-func isValidOctalRune(r rune) bool {
- return r >= '0' && r <= '7' || r == '_'
-}
-
-func isValidBinaryRune(r rune) bool {
- return r == '0' || r == '1' || r == '_'
-}
-
-func (l *tomlLexer) lexNumber() tomlLexStateFn {
- r := l.peek()
-
- if r == '0' {
- follow := l.peekString(2)
- if len(follow) == 2 {
- var isValidRune validRuneFn
- switch follow[1] {
- case 'x':
- isValidRune = isValidHexRune
- case 'o':
- isValidRune = isValidOctalRune
- case 'b':
- isValidRune = isValidBinaryRune
- default:
- if follow[1] >= 'a' && follow[1] <= 'z' || follow[1] >= 'A' && follow[1] <= 'Z' {
- return l.errorf("unknown number base: %s. possible options are x (hex) o (octal) b (binary)", string(follow[1]))
- }
- }
-
- if isValidRune != nil {
- l.next()
- l.next()
- digitSeen := false
- for {
- next := l.peek()
- if !isValidRune(next) {
- break
- }
- digitSeen = true
- l.next()
- }
-
- if !digitSeen {
- return l.errorf("number needs at least one digit")
- }
-
- l.emit(tokenInteger)
-
- return l.lexRvalue
- }
- }
- }
-
- if r == '+' || r == '-' {
- l.next()
- if l.follow("inf") {
- return l.lexInf
- }
- if l.follow("nan") {
- return l.lexNan
- }
- }
-
- pointSeen := false
- expSeen := false
- digitSeen := false
- for {
- next := l.peek()
- if next == '.' {
- if pointSeen {
- return l.errorf("cannot have two dots in one float")
- }
- l.next()
- if !isDigit(l.peek()) {
- return l.errorf("float cannot end with a dot")
- }
- pointSeen = true
- } else if next == 'e' || next == 'E' {
- expSeen = true
- l.next()
- r := l.peek()
- if r == '+' || r == '-' {
- l.next()
- }
- } else if isDigit(next) {
- digitSeen = true
- l.next()
- } else if next == '_' {
- l.next()
- } else {
- break
- }
- if pointSeen && !digitSeen {
- return l.errorf("cannot start float with a dot")
- }
- }
-
- if !digitSeen {
- return l.errorf("no digit in that number")
- }
- if pointSeen || expSeen {
- l.emit(tokenFloat)
- } else {
- l.emit(tokenInteger)
- }
- return l.lexRvalue
-}
-
-func (l *tomlLexer) run() {
- for state := l.lexVoid; state != nil; {
- state = state()
- }
-}
-
-func init() {
- dateRegexp = regexp.MustCompile(`^\d{1,4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})`)
-}
-
-// Entry point
-func lexToml(inputBytes []byte) []token {
- runes := bytes.Runes(inputBytes)
- l := &tomlLexer{
- input: runes,
- tokens: make([]token, 0, 256),
- line: 1,
- col: 1,
- endbufferLine: 1,
- endbufferCol: 1,
- }
- l.run()
- return l.tokens
-}
diff --git a/vendor/github.com/pelletier/go-toml/lexer_test.go b/vendor/github.com/pelletier/go-toml/lexer_test.go
deleted file mode 100644
index cb491303..00000000
--- a/vendor/github.com/pelletier/go-toml/lexer_test.go
+++ /dev/null
@@ -1,750 +0,0 @@
-package toml
-
-import (
- "reflect"
- "testing"
-)
-
-func testFlow(t *testing.T, input string, expectedFlow []token) {
- tokens := lexToml([]byte(input))
- if !reflect.DeepEqual(tokens, expectedFlow) {
- t.Fatal("Different flows. Expected\n", expectedFlow, "\nGot:\n", tokens)
- }
-}
-
-func TestValidKeyGroup(t *testing.T) {
- testFlow(t, "[hello world]", []token{
- {Position{1, 1}, tokenLeftBracket, "["},
- {Position{1, 2}, tokenKeyGroup, "hello world"},
- {Position{1, 13}, tokenRightBracket, "]"},
- {Position{1, 14}, tokenEOF, ""},
- })
-}
-
-func TestNestedQuotedUnicodeKeyGroup(t *testing.T) {
- testFlow(t, `[ j . "ʞ" . l ]`, []token{
- {Position{1, 1}, tokenLeftBracket, "["},
- {Position{1, 2}, tokenKeyGroup, ` j . "ʞ" . l `},
- {Position{1, 15}, tokenRightBracket, "]"},
- {Position{1, 16}, tokenEOF, ""},
- })
-}
-
-func TestUnclosedKeyGroup(t *testing.T) {
- testFlow(t, "[hello world", []token{
- {Position{1, 1}, tokenLeftBracket, "["},
- {Position{1, 2}, tokenError, "unclosed table key"},
- })
-}
-
-func TestComment(t *testing.T) {
- testFlow(t, "# blahblah", []token{
- {Position{1, 11}, tokenEOF, ""},
- })
-}
-
-func TestKeyGroupComment(t *testing.T) {
- testFlow(t, "[hello world] # blahblah", []token{
- {Position{1, 1}, tokenLeftBracket, "["},
- {Position{1, 2}, tokenKeyGroup, "hello world"},
- {Position{1, 13}, tokenRightBracket, "]"},
- {Position{1, 25}, tokenEOF, ""},
- })
-}
-
-func TestMultipleKeyGroupsComment(t *testing.T) {
- testFlow(t, "[hello world] # blahblah\n[test]", []token{
- {Position{1, 1}, tokenLeftBracket, "["},
- {Position{1, 2}, tokenKeyGroup, "hello world"},
- {Position{1, 13}, tokenRightBracket, "]"},
- {Position{2, 1}, tokenLeftBracket, "["},
- {Position{2, 2}, tokenKeyGroup, "test"},
- {Position{2, 6}, tokenRightBracket, "]"},
- {Position{2, 7}, tokenEOF, ""},
- })
-}
-
-func TestSimpleWindowsCRLF(t *testing.T) {
- testFlow(t, "a=4\r\nb=2", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 2}, tokenEqual, "="},
- {Position{1, 3}, tokenInteger, "4"},
- {Position{2, 1}, tokenKey, "b"},
- {Position{2, 2}, tokenEqual, "="},
- {Position{2, 3}, tokenInteger, "2"},
- {Position{2, 4}, tokenEOF, ""},
- })
-}
-
-func TestBasicKey(t *testing.T) {
- testFlow(t, "hello", []token{
- {Position{1, 1}, tokenKey, "hello"},
- {Position{1, 6}, tokenEOF, ""},
- })
-}
-
-func TestBasicKeyWithUnderscore(t *testing.T) {
- testFlow(t, "hello_hello", []token{
- {Position{1, 1}, tokenKey, "hello_hello"},
- {Position{1, 12}, tokenEOF, ""},
- })
-}
-
-func TestBasicKeyWithDash(t *testing.T) {
- testFlow(t, "hello-world", []token{
- {Position{1, 1}, tokenKey, "hello-world"},
- {Position{1, 12}, tokenEOF, ""},
- })
-}
-
-func TestBasicKeyWithUppercaseMix(t *testing.T) {
- testFlow(t, "helloHELLOHello", []token{
- {Position{1, 1}, tokenKey, "helloHELLOHello"},
- {Position{1, 16}, tokenEOF, ""},
- })
-}
-
-func TestBasicKeyWithInternationalCharacters(t *testing.T) {
- testFlow(t, "héllÖ", []token{
- {Position{1, 1}, tokenKey, "héllÖ"},
- {Position{1, 6}, tokenEOF, ""},
- })
-}
-
-func TestBasicKeyAndEqual(t *testing.T) {
- testFlow(t, "hello =", []token{
- {Position{1, 1}, tokenKey, "hello"},
- {Position{1, 7}, tokenEqual, "="},
- {Position{1, 8}, tokenEOF, ""},
- })
-}
-
-func TestKeyWithSharpAndEqual(t *testing.T) {
- testFlow(t, "key#name = 5", []token{
- {Position{1, 1}, tokenError, "keys cannot contain # character"},
- })
-}
-
-func TestKeyWithSymbolsAndEqual(t *testing.T) {
- testFlow(t, "~!@$^&*()_+-`1234567890[]\\|/?><.,;:' = 5", []token{
- {Position{1, 1}, tokenError, "keys cannot contain ~ character"},
- })
-}
-
-func TestKeyEqualStringEscape(t *testing.T) {
- testFlow(t, `foo = "hello\""`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "hello\""},
- {Position{1, 16}, tokenEOF, ""},
- })
-}
-
-func TestKeyEqualStringUnfinished(t *testing.T) {
- testFlow(t, `foo = "bar`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenError, "unclosed string"},
- })
-}
-
-func TestKeyEqualString(t *testing.T) {
- testFlow(t, `foo = "bar"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "bar"},
- {Position{1, 12}, tokenEOF, ""},
- })
-}
-
-func TestKeyEqualTrue(t *testing.T) {
- testFlow(t, "foo = true", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenTrue, "true"},
- {Position{1, 11}, tokenEOF, ""},
- })
-}
-
-func TestKeyEqualFalse(t *testing.T) {
- testFlow(t, "foo = false", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenFalse, "false"},
- {Position{1, 12}, tokenEOF, ""},
- })
-}
-
-func TestArrayNestedString(t *testing.T) {
- testFlow(t, `a = [ ["hello", "world"] ]`, []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenLeftBracket, "["},
- {Position{1, 7}, tokenLeftBracket, "["},
- {Position{1, 9}, tokenString, "hello"},
- {Position{1, 15}, tokenComma, ","},
- {Position{1, 18}, tokenString, "world"},
- {Position{1, 24}, tokenRightBracket, "]"},
- {Position{1, 26}, tokenRightBracket, "]"},
- {Position{1, 27}, tokenEOF, ""},
- })
-}
-
-func TestArrayNestedInts(t *testing.T) {
- testFlow(t, "a = [ [42, 21], [10] ]", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenLeftBracket, "["},
- {Position{1, 7}, tokenLeftBracket, "["},
- {Position{1, 8}, tokenInteger, "42"},
- {Position{1, 10}, tokenComma, ","},
- {Position{1, 12}, tokenInteger, "21"},
- {Position{1, 14}, tokenRightBracket, "]"},
- {Position{1, 15}, tokenComma, ","},
- {Position{1, 17}, tokenLeftBracket, "["},
- {Position{1, 18}, tokenInteger, "10"},
- {Position{1, 20}, tokenRightBracket, "]"},
- {Position{1, 22}, tokenRightBracket, "]"},
- {Position{1, 23}, tokenEOF, ""},
- })
-}
-
-func TestArrayInts(t *testing.T) {
- testFlow(t, "a = [ 42, 21, 10, ]", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenLeftBracket, "["},
- {Position{1, 7}, tokenInteger, "42"},
- {Position{1, 9}, tokenComma, ","},
- {Position{1, 11}, tokenInteger, "21"},
- {Position{1, 13}, tokenComma, ","},
- {Position{1, 15}, tokenInteger, "10"},
- {Position{1, 17}, tokenComma, ","},
- {Position{1, 19}, tokenRightBracket, "]"},
- {Position{1, 20}, tokenEOF, ""},
- })
-}
-
-func TestMultilineArrayComments(t *testing.T) {
- testFlow(t, "a = [1, # wow\n2, # such items\n3, # so array\n]", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenLeftBracket, "["},
- {Position{1, 6}, tokenInteger, "1"},
- {Position{1, 7}, tokenComma, ","},
- {Position{2, 1}, tokenInteger, "2"},
- {Position{2, 2}, tokenComma, ","},
- {Position{3, 1}, tokenInteger, "3"},
- {Position{3, 2}, tokenComma, ","},
- {Position{4, 1}, tokenRightBracket, "]"},
- {Position{4, 2}, tokenEOF, ""},
- })
-}
-
-func TestNestedArraysComment(t *testing.T) {
- toml := `
-someArray = [
-# does not work
-["entry1"]
-]`
- testFlow(t, toml, []token{
- {Position{2, 1}, tokenKey, "someArray"},
- {Position{2, 11}, tokenEqual, "="},
- {Position{2, 13}, tokenLeftBracket, "["},
- {Position{4, 1}, tokenLeftBracket, "["},
- {Position{4, 3}, tokenString, "entry1"},
- {Position{4, 10}, tokenRightBracket, "]"},
- {Position{5, 1}, tokenRightBracket, "]"},
- {Position{5, 2}, tokenEOF, ""},
- })
-}
-
-func TestKeyEqualArrayBools(t *testing.T) {
- testFlow(t, "foo = [true, false, true]", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenLeftBracket, "["},
- {Position{1, 8}, tokenTrue, "true"},
- {Position{1, 12}, tokenComma, ","},
- {Position{1, 14}, tokenFalse, "false"},
- {Position{1, 19}, tokenComma, ","},
- {Position{1, 21}, tokenTrue, "true"},
- {Position{1, 25}, tokenRightBracket, "]"},
- {Position{1, 26}, tokenEOF, ""},
- })
-}
-
-func TestKeyEqualArrayBoolsWithComments(t *testing.T) {
- testFlow(t, "foo = [true, false, true] # YEAH", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenLeftBracket, "["},
- {Position{1, 8}, tokenTrue, "true"},
- {Position{1, 12}, tokenComma, ","},
- {Position{1, 14}, tokenFalse, "false"},
- {Position{1, 19}, tokenComma, ","},
- {Position{1, 21}, tokenTrue, "true"},
- {Position{1, 25}, tokenRightBracket, "]"},
- {Position{1, 33}, tokenEOF, ""},
- })
-}
-
-func TestDateRegexp(t *testing.T) {
- if dateRegexp.FindString("1979-05-27T07:32:00Z") == "" {
- t.Error("basic lexing")
- }
- if dateRegexp.FindString("1979-05-27T00:32:00-07:00") == "" {
- t.Error("offset lexing")
- }
- if dateRegexp.FindString("1979-05-27T00:32:00.999999-07:00") == "" {
- t.Error("nano precision lexing")
- }
-}
-
-func TestKeyEqualDate(t *testing.T) {
- testFlow(t, "foo = 1979-05-27T07:32:00Z", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenDate, "1979-05-27T07:32:00Z"},
- {Position{1, 27}, tokenEOF, ""},
- })
- testFlow(t, "foo = 1979-05-27T00:32:00-07:00", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenDate, "1979-05-27T00:32:00-07:00"},
- {Position{1, 32}, tokenEOF, ""},
- })
- testFlow(t, "foo = 1979-05-27T00:32:00.999999-07:00", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenDate, "1979-05-27T00:32:00.999999-07:00"},
- {Position{1, 39}, tokenEOF, ""},
- })
-}
-
-func TestFloatEndingWithDot(t *testing.T) {
- testFlow(t, "foo = 42.", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenError, "float cannot end with a dot"},
- })
-}
-
-func TestFloatWithTwoDots(t *testing.T) {
- testFlow(t, "foo = 4.2.", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenError, "cannot have two dots in one float"},
- })
-}
-
-func TestFloatWithExponent1(t *testing.T) {
- testFlow(t, "a = 5e+22", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenFloat, "5e+22"},
- {Position{1, 10}, tokenEOF, ""},
- })
-}
-
-func TestFloatWithExponent2(t *testing.T) {
- testFlow(t, "a = 5E+22", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenFloat, "5E+22"},
- {Position{1, 10}, tokenEOF, ""},
- })
-}
-
-func TestFloatWithExponent3(t *testing.T) {
- testFlow(t, "a = -5e+22", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenFloat, "-5e+22"},
- {Position{1, 11}, tokenEOF, ""},
- })
-}
-
-func TestFloatWithExponent4(t *testing.T) {
- testFlow(t, "a = -5e-22", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenFloat, "-5e-22"},
- {Position{1, 11}, tokenEOF, ""},
- })
-}
-
-func TestFloatWithExponent5(t *testing.T) {
- testFlow(t, "a = 6.626e-34", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenFloat, "6.626e-34"},
- {Position{1, 14}, tokenEOF, ""},
- })
-}
-
-func TestInvalidEsquapeSequence(t *testing.T) {
- testFlow(t, `foo = "\x"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenError, "invalid escape sequence: \\x"},
- })
-}
-
-func TestNestedArrays(t *testing.T) {
- testFlow(t, "foo = [[[]]]", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenLeftBracket, "["},
- {Position{1, 8}, tokenLeftBracket, "["},
- {Position{1, 9}, tokenLeftBracket, "["},
- {Position{1, 10}, tokenRightBracket, "]"},
- {Position{1, 11}, tokenRightBracket, "]"},
- {Position{1, 12}, tokenRightBracket, "]"},
- {Position{1, 13}, tokenEOF, ""},
- })
-}
-
-func TestKeyEqualNumber(t *testing.T) {
- testFlow(t, "foo = 42", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenInteger, "42"},
- {Position{1, 9}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = +42", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenInteger, "+42"},
- {Position{1, 10}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = -42", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenInteger, "-42"},
- {Position{1, 10}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = 4.2", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenFloat, "4.2"},
- {Position{1, 10}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = +4.2", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenFloat, "+4.2"},
- {Position{1, 11}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = -4.2", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenFloat, "-4.2"},
- {Position{1, 11}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = 1_000", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenInteger, "1_000"},
- {Position{1, 12}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = 5_349_221", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenInteger, "5_349_221"},
- {Position{1, 16}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = 1_2_3_4_5", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenInteger, "1_2_3_4_5"},
- {Position{1, 16}, tokenEOF, ""},
- })
-
- testFlow(t, "flt8 = 9_224_617.445_991_228_313", []token{
- {Position{1, 1}, tokenKey, "flt8"},
- {Position{1, 6}, tokenEqual, "="},
- {Position{1, 8}, tokenFloat, "9_224_617.445_991_228_313"},
- {Position{1, 33}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = +", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenError, "no digit in that number"},
- })
-}
-
-func TestMultiline(t *testing.T) {
- testFlow(t, "foo = 42\nbar=21", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 7}, tokenInteger, "42"},
- {Position{2, 1}, tokenKey, "bar"},
- {Position{2, 4}, tokenEqual, "="},
- {Position{2, 5}, tokenInteger, "21"},
- {Position{2, 7}, tokenEOF, ""},
- })
-}
-
-func TestKeyEqualStringUnicodeEscape(t *testing.T) {
- testFlow(t, `foo = "hello \u2665"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "hello ♥"},
- {Position{1, 21}, tokenEOF, ""},
- })
- testFlow(t, `foo = "hello \U000003B4"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "hello δ"},
- {Position{1, 25}, tokenEOF, ""},
- })
- testFlow(t, `foo = "\uabcd"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "\uabcd"},
- {Position{1, 15}, tokenEOF, ""},
- })
- testFlow(t, `foo = "\uABCD"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "\uABCD"},
- {Position{1, 15}, tokenEOF, ""},
- })
- testFlow(t, `foo = "\U000bcdef"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "\U000bcdef"},
- {Position{1, 19}, tokenEOF, ""},
- })
- testFlow(t, `foo = "\U000BCDEF"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "\U000BCDEF"},
- {Position{1, 19}, tokenEOF, ""},
- })
- testFlow(t, `foo = "\u2"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenError, "unfinished unicode escape"},
- })
- testFlow(t, `foo = "\U2"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenError, "unfinished unicode escape"},
- })
-}
-
-func TestKeyEqualStringNoEscape(t *testing.T) {
- testFlow(t, "foo = \"hello \u0002\"", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenError, "unescaped control character U+0002"},
- })
- testFlow(t, "foo = \"hello \u001F\"", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenError, "unescaped control character U+001F"},
- })
-}
-
-func TestLiteralString(t *testing.T) {
- testFlow(t, `foo = 'C:\Users\nodejs\templates'`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, `C:\Users\nodejs\templates`},
- {Position{1, 34}, tokenEOF, ""},
- })
- testFlow(t, `foo = '\\ServerX\admin$\system32\'`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, `\\ServerX\admin$\system32\`},
- {Position{1, 35}, tokenEOF, ""},
- })
- testFlow(t, `foo = 'Tom "Dubs" Preston-Werner'`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, `Tom "Dubs" Preston-Werner`},
- {Position{1, 34}, tokenEOF, ""},
- })
- testFlow(t, `foo = '<\i\c*\s*>'`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, `<\i\c*\s*>`},
- {Position{1, 19}, tokenEOF, ""},
- })
- testFlow(t, `foo = 'C:\Users\nodejs\unfinis`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenError, "unclosed string"},
- })
-}
-
-func TestMultilineLiteralString(t *testing.T) {
- testFlow(t, `foo = '''hello 'literal' world'''`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 10}, tokenString, `hello 'literal' world`},
- {Position{1, 34}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = '''\nhello\n'literal'\nworld'''", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{2, 1}, tokenString, "hello\n'literal'\nworld"},
- {Position{4, 9}, tokenEOF, ""},
- })
- testFlow(t, "foo = '''\r\nhello\r\n'literal'\r\nworld'''", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{2, 1}, tokenString, "hello\r\n'literal'\r\nworld"},
- {Position{4, 9}, tokenEOF, ""},
- })
-}
-
-func TestMultilineString(t *testing.T) {
- testFlow(t, `foo = """hello "literal" world"""`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 10}, tokenString, `hello "literal" world`},
- {Position{1, 34}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = \"\"\"\r\nhello\\\r\n\"literal\"\\\nworld\"\"\"", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{2, 1}, tokenString, "hello\"literal\"world"},
- {Position{4, 9}, tokenEOF, ""},
- })
-
- testFlow(t, "foo = \"\"\"\\\n \\\n \\\n hello\\\nmultiline\\\nworld\"\"\"", []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 10}, tokenString, "hellomultilineworld"},
- {Position{6, 9}, tokenEOF, ""},
- })
-
- testFlow(t, "key2 = \"\"\"\nThe quick brown \\\n\n\n fox jumps over \\\n the lazy dog.\"\"\"", []token{
- {Position{1, 1}, tokenKey, "key2"},
- {Position{1, 6}, tokenEqual, "="},
- {Position{2, 1}, tokenString, "The quick brown fox jumps over the lazy dog."},
- {Position{6, 21}, tokenEOF, ""},
- })
-
- testFlow(t, "key2 = \"\"\"\\\n The quick brown \\\n fox jumps over \\\n the lazy dog.\\\n \"\"\"", []token{
- {Position{1, 1}, tokenKey, "key2"},
- {Position{1, 6}, tokenEqual, "="},
- {Position{1, 11}, tokenString, "The quick brown fox jumps over the lazy dog."},
- {Position{5, 11}, tokenEOF, ""},
- })
-
- testFlow(t, `key2 = "Roses are red\nViolets are blue"`, []token{
- {Position{1, 1}, tokenKey, "key2"},
- {Position{1, 6}, tokenEqual, "="},
- {Position{1, 9}, tokenString, "Roses are red\nViolets are blue"},
- {Position{1, 41}, tokenEOF, ""},
- })
-
- testFlow(t, "key2 = \"\"\"\nRoses are red\nViolets are blue\"\"\"", []token{
- {Position{1, 1}, tokenKey, "key2"},
- {Position{1, 6}, tokenEqual, "="},
- {Position{2, 1}, tokenString, "Roses are red\nViolets are blue"},
- {Position{3, 20}, tokenEOF, ""},
- })
-}
-
-func TestUnicodeString(t *testing.T) {
- testFlow(t, `foo = "hello ♥ world"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "hello ♥ world"},
- {Position{1, 22}, tokenEOF, ""},
- })
-}
-func TestEscapeInString(t *testing.T) {
- testFlow(t, `foo = "\b\f\/"`, []token{
- {Position{1, 1}, tokenKey, "foo"},
- {Position{1, 5}, tokenEqual, "="},
- {Position{1, 8}, tokenString, "\b\f/"},
- {Position{1, 15}, tokenEOF, ""},
- })
-}
-
-func TestKeyGroupArray(t *testing.T) {
- testFlow(t, "[[foo]]", []token{
- {Position{1, 1}, tokenDoubleLeftBracket, "[["},
- {Position{1, 3}, tokenKeyGroupArray, "foo"},
- {Position{1, 6}, tokenDoubleRightBracket, "]]"},
- {Position{1, 8}, tokenEOF, ""},
- })
-}
-
-func TestQuotedKey(t *testing.T) {
- testFlow(t, "\"a b\" = 42", []token{
- {Position{1, 1}, tokenKey, "a b"},
- {Position{1, 7}, tokenEqual, "="},
- {Position{1, 9}, tokenInteger, "42"},
- {Position{1, 11}, tokenEOF, ""},
- })
-}
-
-func TestKeyNewline(t *testing.T) {
- testFlow(t, "a\n= 4", []token{
- {Position{1, 1}, tokenError, "keys cannot contain new lines"},
- })
-}
-
-func TestInvalidFloat(t *testing.T) {
- testFlow(t, "a=7e1_", []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 2}, tokenEqual, "="},
- {Position{1, 3}, tokenFloat, "7e1_"},
- {Position{1, 7}, tokenEOF, ""},
- })
-}
-
-func TestLexUnknownRvalue(t *testing.T) {
- testFlow(t, `a = !b`, []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenError, "no value can start with !"},
- })
-
- testFlow(t, `a = \b`, []token{
- {Position{1, 1}, tokenKey, "a"},
- {Position{1, 3}, tokenEqual, "="},
- {Position{1, 5}, tokenError, `no value can start with \`},
- })
-}
-
-func BenchmarkLexer(b *testing.B) {
- sample := `title = "Hugo: A Fast and Flexible Website Generator"
-baseurl = "http://gohugo.io/"
-MetaDataFormat = "yaml"
-pluralizeListTitles = false
-
-[params]
- description = "Documentation of Hugo, a fast and flexible static site generator built with love by spf13, bep and friends in Go"
- author = "Steve Francia (spf13) and friends"
- release = "0.22-DEV"
-
-[[menu.main]]
- name = "Download Hugo"
- pre = ""
- url = "https://github.com/spf13/hugo/releases"
- weight = -200
-`
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- lexToml([]byte(sample))
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/marshal.go b/vendor/github.com/pelletier/go-toml/marshal.go
deleted file mode 100644
index 671da556..00000000
--- a/vendor/github.com/pelletier/go-toml/marshal.go
+++ /dev/null
@@ -1,609 +0,0 @@
-package toml
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-const tagKeyMultiline = "multiline"
-
-type tomlOpts struct {
- name string
- comment string
- commented bool
- multiline bool
- include bool
- omitempty bool
-}
-
-type encOpts struct {
- quoteMapKeys bool
- arraysOneElementPerLine bool
-}
-
-var encOptsDefaults = encOpts{
- quoteMapKeys: false,
-}
-
-var timeType = reflect.TypeOf(time.Time{})
-var marshalerType = reflect.TypeOf(new(Marshaler)).Elem()
-
-// Check if the given marshall type maps to a Tree primitive
-func isPrimitive(mtype reflect.Type) bool {
- switch mtype.Kind() {
- case reflect.Ptr:
- return isPrimitive(mtype.Elem())
- case reflect.Bool:
- return true
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return true
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- return true
- case reflect.Float32, reflect.Float64:
- return true
- case reflect.String:
- return true
- case reflect.Struct:
- return mtype == timeType || isCustomMarshaler(mtype)
- default:
- return false
- }
-}
-
-// Check if the given marshall type maps to a Tree slice
-func isTreeSlice(mtype reflect.Type) bool {
- switch mtype.Kind() {
- case reflect.Slice:
- return !isOtherSlice(mtype)
- default:
- return false
- }
-}
-
-// Check if the given marshall type maps to a non-Tree slice
-func isOtherSlice(mtype reflect.Type) bool {
- switch mtype.Kind() {
- case reflect.Ptr:
- return isOtherSlice(mtype.Elem())
- case reflect.Slice:
- return isPrimitive(mtype.Elem()) || isOtherSlice(mtype.Elem())
- default:
- return false
- }
-}
-
-// Check if the given marshall type maps to a Tree
-func isTree(mtype reflect.Type) bool {
- switch mtype.Kind() {
- case reflect.Map:
- return true
- case reflect.Struct:
- return !isPrimitive(mtype)
- default:
- return false
- }
-}
-
-func isCustomMarshaler(mtype reflect.Type) bool {
- return mtype.Implements(marshalerType)
-}
-
-func callCustomMarshaler(mval reflect.Value) ([]byte, error) {
- return mval.Interface().(Marshaler).MarshalTOML()
-}
-
-// Marshaler is the interface implemented by types that
-// can marshal themselves into valid TOML.
-type Marshaler interface {
- MarshalTOML() ([]byte, error)
-}
-
-/*
-Marshal returns the TOML encoding of v. Behavior is similar to the Go json
-encoder, except that there is no concept of a Marshaler interface or MarshalTOML
-function for sub-structs, and currently only definite types can be marshaled
-(i.e. no `interface{}`).
-
-The following struct annotations are supported:
-
- toml:"Field" Overrides the field's name to output.
- omitempty When set, empty values and groups are not emitted.
- comment:"comment" Emits a # comment on the same line. This supports new lines.
- commented:"true" Emits the value as commented.
-
-Note that pointers are automatically assigned the "omitempty" option, as TOML
-explicitly does not handle null values (saying instead the label should be
-dropped).
-
-Tree structural types and corresponding marshal types:
-
- *Tree (*)struct, (*)map[string]interface{}
- []*Tree (*)[](*)struct, (*)[](*)map[string]interface{}
- []interface{} (as interface{}) (*)[]primitive, (*)[]([]interface{})
- interface{} (*)primitive
-
-Tree primitive types and corresponding marshal types:
-
- uint64 uint, uint8-uint64, pointers to same
- int64 int, int8-uint64, pointers to same
- float64 float32, float64, pointers to same
- string string, pointers to same
- bool bool, pointers to same
- time.Time time.Time{}, pointers to same
-*/
-func Marshal(v interface{}) ([]byte, error) {
- return NewEncoder(nil).marshal(v)
-}
-
-// Encoder writes TOML values to an output stream.
-type Encoder struct {
- w io.Writer
- encOpts
-}
-
-// NewEncoder returns a new encoder that writes to w.
-func NewEncoder(w io.Writer) *Encoder {
- return &Encoder{
- w: w,
- encOpts: encOptsDefaults,
- }
-}
-
-// Encode writes the TOML encoding of v to the stream.
-//
-// See the documentation for Marshal for details.
-func (e *Encoder) Encode(v interface{}) error {
- b, err := e.marshal(v)
- if err != nil {
- return err
- }
- if _, err := e.w.Write(b); err != nil {
- return err
- }
- return nil
-}
-
-// QuoteMapKeys sets up the encoder to encode
-// maps with string type keys with quoted TOML keys.
-//
-// This relieves the character limitations on map keys.
-func (e *Encoder) QuoteMapKeys(v bool) *Encoder {
- e.quoteMapKeys = v
- return e
-}
-
-// ArraysWithOneElementPerLine sets up the encoder to encode arrays
-// with more than one element on multiple lines instead of one.
-//
-// For example:
-//
-// A = [1,2,3]
-//
-// Becomes
-//
-// A = [
-// 1,
-// 2,
-// 3,
-// ]
-func (e *Encoder) ArraysWithOneElementPerLine(v bool) *Encoder {
- e.arraysOneElementPerLine = v
- return e
-}
-
-func (e *Encoder) marshal(v interface{}) ([]byte, error) {
- mtype := reflect.TypeOf(v)
- if mtype.Kind() != reflect.Struct {
- return []byte{}, errors.New("Only a struct can be marshaled to TOML")
- }
- sval := reflect.ValueOf(v)
- if isCustomMarshaler(mtype) {
- return callCustomMarshaler(sval)
- }
- t, err := e.valueToTree(mtype, sval)
- if err != nil {
- return []byte{}, err
- }
-
- var buf bytes.Buffer
- _, err = t.writeTo(&buf, "", "", 0, e.arraysOneElementPerLine)
-
- return buf.Bytes(), err
-}
-
-// Convert given marshal struct or map value to toml tree
-func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, error) {
- if mtype.Kind() == reflect.Ptr {
- return e.valueToTree(mtype.Elem(), mval.Elem())
- }
- tval := newTree()
- switch mtype.Kind() {
- case reflect.Struct:
- for i := 0; i < mtype.NumField(); i++ {
- mtypef, mvalf := mtype.Field(i), mval.Field(i)
- opts := tomlOptions(mtypef)
- if opts.include && (!opts.omitempty || !isZero(mvalf)) {
- val, err := e.valueToToml(mtypef.Type, mvalf)
- if err != nil {
- return nil, err
- }
-
- tval.SetWithOptions(opts.name, SetOptions{
- Comment: opts.comment,
- Commented: opts.commented,
- Multiline: opts.multiline,
- }, val)
- }
- }
- case reflect.Map:
- for _, key := range mval.MapKeys() {
- mvalf := mval.MapIndex(key)
- val, err := e.valueToToml(mtype.Elem(), mvalf)
- if err != nil {
- return nil, err
- }
- if e.quoteMapKeys {
- keyStr, err := tomlValueStringRepresentation(key.String(), "", e.arraysOneElementPerLine)
- if err != nil {
- return nil, err
- }
- tval.SetPath([]string{keyStr}, val)
- } else {
- tval.Set(key.String(), val)
- }
- }
- }
- return tval, nil
-}
-
-// Convert given marshal slice to slice of Toml trees
-func (e *Encoder) valueToTreeSlice(mtype reflect.Type, mval reflect.Value) ([]*Tree, error) {
- tval := make([]*Tree, mval.Len(), mval.Len())
- for i := 0; i < mval.Len(); i++ {
- val, err := e.valueToTree(mtype.Elem(), mval.Index(i))
- if err != nil {
- return nil, err
- }
- tval[i] = val
- }
- return tval, nil
-}
-
-// Convert given marshal slice to slice of toml values
-func (e *Encoder) valueToOtherSlice(mtype reflect.Type, mval reflect.Value) (interface{}, error) {
- tval := make([]interface{}, mval.Len(), mval.Len())
- for i := 0; i < mval.Len(); i++ {
- val, err := e.valueToToml(mtype.Elem(), mval.Index(i))
- if err != nil {
- return nil, err
- }
- tval[i] = val
- }
- return tval, nil
-}
-
-// Convert given marshal value to toml value
-func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface{}, error) {
- if mtype.Kind() == reflect.Ptr {
- return e.valueToToml(mtype.Elem(), mval.Elem())
- }
- switch {
- case isCustomMarshaler(mtype):
- return callCustomMarshaler(mval)
- case isTree(mtype):
- return e.valueToTree(mtype, mval)
- case isTreeSlice(mtype):
- return e.valueToTreeSlice(mtype, mval)
- case isOtherSlice(mtype):
- return e.valueToOtherSlice(mtype, mval)
- default:
- switch mtype.Kind() {
- case reflect.Bool:
- return mval.Bool(), nil
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return mval.Int(), nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- return mval.Uint(), nil
- case reflect.Float32, reflect.Float64:
- return mval.Float(), nil
- case reflect.String:
- return mval.String(), nil
- case reflect.Struct:
- return mval.Interface().(time.Time), nil
- default:
- return nil, fmt.Errorf("Marshal can't handle %v(%v)", mtype, mtype.Kind())
- }
- }
-}
-
-// Unmarshal attempts to unmarshal the Tree into a Go struct pointed by v.
-// Neither Unmarshaler interfaces nor UnmarshalTOML functions are supported for
-// sub-structs, and only definite types can be unmarshaled.
-func (t *Tree) Unmarshal(v interface{}) error {
- d := Decoder{tval: t}
- return d.unmarshal(v)
-}
-
-// Marshal returns the TOML encoding of Tree.
-// See Marshal() documentation for types mapping table.
-func (t *Tree) Marshal() ([]byte, error) {
- var buf bytes.Buffer
- err := NewEncoder(&buf).Encode(t)
- return buf.Bytes(), err
-}
-
-// Unmarshal parses the TOML-encoded data and stores the result in the value
-// pointed to by v. Behavior is similar to the Go json encoder, except that there
-// is no concept of an Unmarshaler interface or UnmarshalTOML function for
-// sub-structs, and currently only definite types can be unmarshaled to (i.e. no
-// `interface{}`).
-//
-// The following struct annotations are supported:
-//
-// toml:"Field" Overrides the field's name to map to.
-//
-// See Marshal() documentation for types mapping table.
-func Unmarshal(data []byte, v interface{}) error {
- t, err := LoadReader(bytes.NewReader(data))
- if err != nil {
- return err
- }
- return t.Unmarshal(v)
-}
-
-// Decoder reads and decodes TOML values from an input stream.
-type Decoder struct {
- r io.Reader
- tval *Tree
- encOpts
-}
-
-// NewDecoder returns a new decoder that reads from r.
-func NewDecoder(r io.Reader) *Decoder {
- return &Decoder{
- r: r,
- encOpts: encOptsDefaults,
- }
-}
-
-// Decode reads a TOML-encoded value from it's input
-// and unmarshals it in the value pointed at by v.
-//
-// See the documentation for Marshal for details.
-func (d *Decoder) Decode(v interface{}) error {
- var err error
- d.tval, err = LoadReader(d.r)
- if err != nil {
- return err
- }
- return d.unmarshal(v)
-}
-
-func (d *Decoder) unmarshal(v interface{}) error {
- mtype := reflect.TypeOf(v)
- if mtype.Kind() != reflect.Ptr || mtype.Elem().Kind() != reflect.Struct {
- return errors.New("Only a pointer to struct can be unmarshaled from TOML")
- }
-
- sval, err := d.valueFromTree(mtype.Elem(), d.tval)
- if err != nil {
- return err
- }
- reflect.ValueOf(v).Elem().Set(sval)
- return nil
-}
-
-// Convert toml tree to marshal struct or map, using marshal type
-func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree) (reflect.Value, error) {
- if mtype.Kind() == reflect.Ptr {
- return d.unwrapPointer(mtype, tval)
- }
- var mval reflect.Value
- switch mtype.Kind() {
- case reflect.Struct:
- mval = reflect.New(mtype).Elem()
- for i := 0; i < mtype.NumField(); i++ {
- mtypef := mtype.Field(i)
- opts := tomlOptions(mtypef)
- if opts.include {
- baseKey := opts.name
- keysToTry := []string{baseKey, strings.ToLower(baseKey), strings.ToTitle(baseKey)}
- for _, key := range keysToTry {
- exists := tval.Has(key)
- if !exists {
- continue
- }
- val := tval.Get(key)
- mvalf, err := d.valueFromToml(mtypef.Type, val)
- if err != nil {
- return mval, formatError(err, tval.GetPosition(key))
- }
- mval.Field(i).Set(mvalf)
- break
- }
- }
- }
- case reflect.Map:
- mval = reflect.MakeMap(mtype)
- for _, key := range tval.Keys() {
- // TODO: path splits key
- val := tval.GetPath([]string{key})
- mvalf, err := d.valueFromToml(mtype.Elem(), val)
- if err != nil {
- return mval, formatError(err, tval.GetPosition(key))
- }
- mval.SetMapIndex(reflect.ValueOf(key), mvalf)
- }
- }
- return mval, nil
-}
-
-// Convert toml value to marshal struct/map slice, using marshal type
-func (d *Decoder) valueFromTreeSlice(mtype reflect.Type, tval []*Tree) (reflect.Value, error) {
- mval := reflect.MakeSlice(mtype, len(tval), len(tval))
- for i := 0; i < len(tval); i++ {
- val, err := d.valueFromTree(mtype.Elem(), tval[i])
- if err != nil {
- return mval, err
- }
- mval.Index(i).Set(val)
- }
- return mval, nil
-}
-
-// Convert toml value to marshal primitive slice, using marshal type
-func (d *Decoder) valueFromOtherSlice(mtype reflect.Type, tval []interface{}) (reflect.Value, error) {
- mval := reflect.MakeSlice(mtype, len(tval), len(tval))
- for i := 0; i < len(tval); i++ {
- val, err := d.valueFromToml(mtype.Elem(), tval[i])
- if err != nil {
- return mval, err
- }
- mval.Index(i).Set(val)
- }
- return mval, nil
-}
-
-// Convert toml value to marshal value, using marshal type
-func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}) (reflect.Value, error) {
- if mtype.Kind() == reflect.Ptr {
- return d.unwrapPointer(mtype, tval)
- }
-
- switch tval.(type) {
- case *Tree:
- if isTree(mtype) {
- return d.valueFromTree(mtype, tval.(*Tree))
- }
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to a tree", tval, tval)
- case []*Tree:
- if isTreeSlice(mtype) {
- return d.valueFromTreeSlice(mtype, tval.([]*Tree))
- }
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to trees", tval, tval)
- case []interface{}:
- if isOtherSlice(mtype) {
- return d.valueFromOtherSlice(mtype, tval.([]interface{}))
- }
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to a slice", tval, tval)
- default:
- switch mtype.Kind() {
- case reflect.Bool, reflect.Struct:
- val := reflect.ValueOf(tval)
- // if this passes for when mtype is reflect.Struct, tval is a time.Time
- if !val.Type().ConvertibleTo(mtype) {
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
- }
-
- return val.Convert(mtype), nil
- case reflect.String:
- val := reflect.ValueOf(tval)
- // stupidly, int64 is convertible to string. So special case this.
- if !val.Type().ConvertibleTo(mtype) || val.Kind() == reflect.Int64 {
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
- }
-
- return val.Convert(mtype), nil
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- val := reflect.ValueOf(tval)
- if !val.Type().ConvertibleTo(mtype) {
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
- }
- if reflect.Indirect(reflect.New(mtype)).OverflowInt(val.Int()) {
- return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String())
- }
-
- return val.Convert(mtype), nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- val := reflect.ValueOf(tval)
- if !val.Type().ConvertibleTo(mtype) {
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
- }
- if val.Int() < 0 {
- return reflect.ValueOf(nil), fmt.Errorf("%v(%T) is negative so does not fit in %v", tval, tval, mtype.String())
- }
- if reflect.Indirect(reflect.New(mtype)).OverflowUint(uint64(val.Int())) {
- return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String())
- }
-
- return val.Convert(mtype), nil
- case reflect.Float32, reflect.Float64:
- val := reflect.ValueOf(tval)
- if !val.Type().ConvertibleTo(mtype) {
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
- }
- if reflect.Indirect(reflect.New(mtype)).OverflowFloat(val.Float()) {
- return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String())
- }
-
- return val.Convert(mtype), nil
- default:
- return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v(%v)", tval, tval, mtype, mtype.Kind())
- }
- }
-}
-
-func (d *Decoder) unwrapPointer(mtype reflect.Type, tval interface{}) (reflect.Value, error) {
- val, err := d.valueFromToml(mtype.Elem(), tval)
- if err != nil {
- return reflect.ValueOf(nil), err
- }
- mval := reflect.New(mtype.Elem())
- mval.Elem().Set(val)
- return mval, nil
-}
-
-func tomlOptions(vf reflect.StructField) tomlOpts {
- tag := vf.Tag.Get("toml")
- parse := strings.Split(tag, ",")
- var comment string
- if c := vf.Tag.Get("comment"); c != "" {
- comment = c
- }
- commented, _ := strconv.ParseBool(vf.Tag.Get("commented"))
- multiline, _ := strconv.ParseBool(vf.Tag.Get(tagKeyMultiline))
- result := tomlOpts{name: vf.Name, comment: comment, commented: commented, multiline: multiline, include: true, omitempty: false}
- if parse[0] != "" {
- if parse[0] == "-" && len(parse) == 1 {
- result.include = false
- } else {
- result.name = strings.Trim(parse[0], " ")
- }
- }
- if vf.PkgPath != "" {
- result.include = false
- }
- if len(parse) > 1 && strings.Trim(parse[1], " ") == "omitempty" {
- result.omitempty = true
- }
- if vf.Type.Kind() == reflect.Ptr {
- result.omitempty = true
- }
- return result
-}
-
-func isZero(val reflect.Value) bool {
- switch val.Type().Kind() {
- case reflect.Map:
- fallthrough
- case reflect.Array:
- fallthrough
- case reflect.Slice:
- return val.Len() == 0
- default:
- return reflect.DeepEqual(val.Interface(), reflect.Zero(val.Type()).Interface())
- }
-}
-
-func formatError(err error, pos Position) error {
- if err.Error()[0] == '(' { // Error already contains position information
- return err
- }
- return fmt.Errorf("%s: %s", pos, err)
-}
diff --git a/vendor/github.com/pelletier/go-toml/marshal_test.go b/vendor/github.com/pelletier/go-toml/marshal_test.go
deleted file mode 100644
index 00cbbf31..00000000
--- a/vendor/github.com/pelletier/go-toml/marshal_test.go
+++ /dev/null
@@ -1,806 +0,0 @@
-package toml
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io/ioutil"
- "reflect"
- "strings"
- "testing"
- "time"
-)
-
-type basicMarshalTestStruct struct {
- String string `toml:"string"`
- StringList []string `toml:"strlist"`
- Sub basicMarshalTestSubStruct `toml:"subdoc"`
- SubList []basicMarshalTestSubStruct `toml:"sublist"`
-}
-
-type basicMarshalTestSubStruct struct {
- String2 string
-}
-
-var basicTestData = basicMarshalTestStruct{
- String: "Hello",
- StringList: []string{"Howdy", "Hey There"},
- Sub: basicMarshalTestSubStruct{"One"},
- SubList: []basicMarshalTestSubStruct{{"Two"}, {"Three"}},
-}
-
-var basicTestToml = []byte(`string = "Hello"
-strlist = ["Howdy","Hey There"]
-
-[subdoc]
- String2 = "One"
-
-[[sublist]]
- String2 = "Two"
-
-[[sublist]]
- String2 = "Three"
-`)
-
-func TestBasicMarshal(t *testing.T) {
- result, err := Marshal(basicTestData)
- if err != nil {
- t.Fatal(err)
- }
- expected := basicTestToml
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-func TestBasicUnmarshal(t *testing.T) {
- result := basicMarshalTestStruct{}
- err := Unmarshal(basicTestToml, &result)
- expected := basicTestData
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("Bad unmarshal: expected %v, got %v", expected, result)
- }
-}
-
-type testDoc struct {
- Title string `toml:"title"`
- Basics testDocBasics `toml:"basic"`
- BasicLists testDocBasicLists `toml:"basic_lists"`
- BasicMap map[string]string `toml:"basic_map"`
- Subdocs testDocSubs `toml:"subdoc"`
- SubDocList []testSubDoc `toml:"subdoclist"`
- SubDocPtrs []*testSubDoc `toml:"subdocptrs"`
- err int `toml:"shouldntBeHere"`
- unexported int `toml:"shouldntBeHere"`
- Unexported2 int `toml:"-"`
-}
-
-type testDocBasics struct {
- Bool bool `toml:"bool"`
- Date time.Time `toml:"date"`
- Float float32 `toml:"float"`
- Int int `toml:"int"`
- Uint uint `toml:"uint"`
- String *string `toml:"string"`
- unexported int `toml:"shouldntBeHere"`
-}
-
-type testDocBasicLists struct {
- Bools []bool `toml:"bools"`
- Dates []time.Time `toml:"dates"`
- Floats []*float32 `toml:"floats"`
- Ints []int `toml:"ints"`
- Strings []string `toml:"strings"`
- UInts []uint `toml:"uints"`
-}
-
-type testDocSubs struct {
- First testSubDoc `toml:"first"`
- Second *testSubDoc `toml:"second"`
-}
-
-type testSubDoc struct {
- Name string `toml:"name"`
- unexported int `toml:"shouldntBeHere"`
-}
-
-var biteMe = "Bite me"
-var float1 float32 = 12.3
-var float2 float32 = 45.6
-var float3 float32 = 78.9
-var subdoc = testSubDoc{"Second", 0}
-
-var docData = testDoc{
- Title: "TOML Marshal Testing",
- unexported: 0,
- Unexported2: 0,
- Basics: testDocBasics{
- Bool: true,
- Date: time.Date(1979, 5, 27, 7, 32, 0, 0, time.UTC),
- Float: 123.4,
- Int: 5000,
- Uint: 5001,
- String: &biteMe,
- unexported: 0,
- },
- BasicLists: testDocBasicLists{
- Bools: []bool{true, false, true},
- Dates: []time.Time{
- time.Date(1979, 5, 27, 7, 32, 0, 0, time.UTC),
- time.Date(1980, 5, 27, 7, 32, 0, 0, time.UTC),
- },
- Floats: []*float32{&float1, &float2, &float3},
- Ints: []int{8001, 8001, 8002},
- Strings: []string{"One", "Two", "Three"},
- UInts: []uint{5002, 5003},
- },
- BasicMap: map[string]string{
- "one": "one",
- "two": "two",
- },
- Subdocs: testDocSubs{
- First: testSubDoc{"First", 0},
- Second: &subdoc,
- },
- SubDocList: []testSubDoc{
- {"List.First", 0},
- {"List.Second", 0},
- },
- SubDocPtrs: []*testSubDoc{&subdoc},
-}
-
-func TestDocMarshal(t *testing.T) {
- result, err := Marshal(docData)
- if err != nil {
- t.Fatal(err)
- }
- expected, _ := ioutil.ReadFile("marshal_test.toml")
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-func TestDocUnmarshal(t *testing.T) {
- result := testDoc{}
- tomlData, _ := ioutil.ReadFile("marshal_test.toml")
- err := Unmarshal(tomlData, &result)
- expected := docData
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- resStr, _ := json.MarshalIndent(result, "", " ")
- expStr, _ := json.MarshalIndent(expected, "", " ")
- t.Errorf("Bad unmarshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expStr, resStr)
- }
-}
-
-func TestDocPartialUnmarshal(t *testing.T) {
- result := testDocSubs{}
-
- tree, _ := LoadFile("marshal_test.toml")
- subTree := tree.Get("subdoc").(*Tree)
- err := subTree.Unmarshal(&result)
- expected := docData.Subdocs
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- resStr, _ := json.MarshalIndent(result, "", " ")
- expStr, _ := json.MarshalIndent(expected, "", " ")
- t.Errorf("Bad partial unmartial: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expStr, resStr)
- }
-}
-
-type tomlTypeCheckTest struct {
- name string
- item interface{}
- typ int //0=primitive, 1=otherslice, 2=treeslice, 3=tree
-}
-
-func TestTypeChecks(t *testing.T) {
- tests := []tomlTypeCheckTest{
- {"integer", 2, 0},
- {"time", time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC), 0},
- {"stringlist", []string{"hello", "hi"}, 1},
- {"timelist", []time.Time{time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)}, 1},
- {"objectlist", []tomlTypeCheckTest{}, 2},
- {"object", tomlTypeCheckTest{}, 3},
- }
-
- for _, test := range tests {
- expected := []bool{false, false, false, false}
- expected[test.typ] = true
- result := []bool{
- isPrimitive(reflect.TypeOf(test.item)),
- isOtherSlice(reflect.TypeOf(test.item)),
- isTreeSlice(reflect.TypeOf(test.item)),
- isTree(reflect.TypeOf(test.item)),
- }
- if !reflect.DeepEqual(expected, result) {
- t.Errorf("Bad type check on %q: expected %v, got %v", test.name, expected, result)
- }
- }
-}
-
-type unexportedMarshalTestStruct struct {
- String string `toml:"string"`
- StringList []string `toml:"strlist"`
- Sub basicMarshalTestSubStruct `toml:"subdoc"`
- SubList []basicMarshalTestSubStruct `toml:"sublist"`
- unexported int `toml:"shouldntBeHere"`
- Unexported2 int `toml:"-"`
-}
-
-var unexportedTestData = unexportedMarshalTestStruct{
- String: "Hello",
- StringList: []string{"Howdy", "Hey There"},
- Sub: basicMarshalTestSubStruct{"One"},
- SubList: []basicMarshalTestSubStruct{{"Two"}, {"Three"}},
- unexported: 0,
- Unexported2: 0,
-}
-
-var unexportedTestToml = []byte(`string = "Hello"
-strlist = ["Howdy","Hey There"]
-unexported = 1
-shouldntBeHere = 2
-
-[subdoc]
- String2 = "One"
-
-[[sublist]]
- String2 = "Two"
-
-[[sublist]]
- String2 = "Three"
-`)
-
-func TestUnexportedUnmarshal(t *testing.T) {
- result := unexportedMarshalTestStruct{}
- err := Unmarshal(unexportedTestToml, &result)
- expected := unexportedTestData
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("Bad unexported unmarshal: expected %v, got %v", expected, result)
- }
-}
-
-type errStruct struct {
- Bool bool `toml:"bool"`
- Date time.Time `toml:"date"`
- Float float64 `toml:"float"`
- Int int16 `toml:"int"`
- String *string `toml:"string"`
-}
-
-var errTomls = []string{
- "bool = truly\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = \"Bite me\"",
- "bool = true\ndate = 1979-05-27T07:3200Z\nfloat = 123.4\nint = 5000\nstring = \"Bite me\"",
- "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123a4\nint = 5000\nstring = \"Bite me\"",
- "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = j000\nstring = \"Bite me\"",
- "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = Bite me",
- "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = Bite me",
- "bool = 1\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = \"Bite me\"",
- "bool = true\ndate = 1\nfloat = 123.4\nint = 5000\nstring = \"Bite me\"",
- "bool = true\ndate = 1979-05-27T07:32:00Z\n\"sorry\"\nint = 5000\nstring = \"Bite me\"",
- "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = \"sorry\"\nstring = \"Bite me\"",
- "bool = true\ndate = 1979-05-27T07:32:00Z\nfloat = 123.4\nint = 5000\nstring = 1",
-}
-
-type mapErr struct {
- Vals map[string]float64
-}
-
-type intErr struct {
- Int1 int
- Int2 int8
- Int3 int16
- Int4 int32
- Int5 int64
- UInt1 uint
- UInt2 uint8
- UInt3 uint16
- UInt4 uint32
- UInt5 uint64
- Flt1 float32
- Flt2 float64
-}
-
-var intErrTomls = []string{
- "Int1 = []\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = []\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = []\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = []\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = []\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = []\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = []\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = []\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = []\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = []\nFlt1 = 1.0\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = []\nFlt2 = 2.0",
- "Int1 = 1\nInt2 = 2\nInt3 = 3\nInt4 = 4\nInt5 = 5\nUInt1 = 1\nUInt2 = 2\nUInt3 = 3\nUInt4 = 4\nUInt5 = 5\nFlt1 = 1.0\nFlt2 = []",
-}
-
-func TestErrUnmarshal(t *testing.T) {
- for ind, toml := range errTomls {
- result := errStruct{}
- err := Unmarshal([]byte(toml), &result)
- if err == nil {
- t.Errorf("Expected err from case %d\n", ind)
- }
- }
- result2 := mapErr{}
- err := Unmarshal([]byte("[Vals]\nfred=\"1.2\""), &result2)
- if err == nil {
- t.Errorf("Expected err from map")
- }
- for ind, toml := range intErrTomls {
- result3 := intErr{}
- err := Unmarshal([]byte(toml), &result3)
- if err == nil {
- t.Errorf("Expected int err from case %d\n", ind)
- }
- }
-}
-
-type emptyMarshalTestStruct struct {
- Title string `toml:"title"`
- Bool bool `toml:"bool"`
- Int int `toml:"int"`
- String string `toml:"string"`
- StringList []string `toml:"stringlist"`
- Ptr *basicMarshalTestStruct `toml:"ptr"`
- Map map[string]string `toml:"map"`
-}
-
-var emptyTestData = emptyMarshalTestStruct{
- Title: "Placeholder",
- Bool: false,
- Int: 0,
- String: "",
- StringList: []string{},
- Ptr: nil,
- Map: map[string]string{},
-}
-
-var emptyTestToml = []byte(`bool = false
-int = 0
-string = ""
-stringlist = []
-title = "Placeholder"
-
-[map]
-`)
-
-type emptyMarshalTestStruct2 struct {
- Title string `toml:"title"`
- Bool bool `toml:"bool,omitempty"`
- Int int `toml:"int, omitempty"`
- String string `toml:"string,omitempty "`
- StringList []string `toml:"stringlist,omitempty"`
- Ptr *basicMarshalTestStruct `toml:"ptr,omitempty"`
- Map map[string]string `toml:"map,omitempty"`
-}
-
-var emptyTestData2 = emptyMarshalTestStruct2{
- Title: "Placeholder",
- Bool: false,
- Int: 0,
- String: "",
- StringList: []string{},
- Ptr: nil,
- Map: map[string]string{},
-}
-
-var emptyTestToml2 = []byte(`title = "Placeholder"
-`)
-
-func TestEmptyMarshal(t *testing.T) {
- result, err := Marshal(emptyTestData)
- if err != nil {
- t.Fatal(err)
- }
- expected := emptyTestToml
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad empty marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-func TestEmptyMarshalOmit(t *testing.T) {
- result, err := Marshal(emptyTestData2)
- if err != nil {
- t.Fatal(err)
- }
- expected := emptyTestToml2
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad empty omit marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-func TestEmptyUnmarshal(t *testing.T) {
- result := emptyMarshalTestStruct{}
- err := Unmarshal(emptyTestToml, &result)
- expected := emptyTestData
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("Bad empty unmarshal: expected %v, got %v", expected, result)
- }
-}
-
-func TestEmptyUnmarshalOmit(t *testing.T) {
- result := emptyMarshalTestStruct2{}
- err := Unmarshal(emptyTestToml, &result)
- expected := emptyTestData2
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("Bad empty omit unmarshal: expected %v, got %v", expected, result)
- }
-}
-
-type pointerMarshalTestStruct struct {
- Str *string
- List *[]string
- ListPtr *[]*string
- Map *map[string]string
- MapPtr *map[string]*string
- EmptyStr *string
- EmptyList *[]string
- EmptyMap *map[string]string
- DblPtr *[]*[]*string
-}
-
-var pointerStr = "Hello"
-var pointerList = []string{"Hello back"}
-var pointerListPtr = []*string{&pointerStr}
-var pointerMap = map[string]string{"response": "Goodbye"}
-var pointerMapPtr = map[string]*string{"alternate": &pointerStr}
-var pointerTestData = pointerMarshalTestStruct{
- Str: &pointerStr,
- List: &pointerList,
- ListPtr: &pointerListPtr,
- Map: &pointerMap,
- MapPtr: &pointerMapPtr,
- EmptyStr: nil,
- EmptyList: nil,
- EmptyMap: nil,
-}
-
-var pointerTestToml = []byte(`List = ["Hello back"]
-ListPtr = ["Hello"]
-Str = "Hello"
-
-[Map]
- response = "Goodbye"
-
-[MapPtr]
- alternate = "Hello"
-`)
-
-func TestPointerMarshal(t *testing.T) {
- result, err := Marshal(pointerTestData)
- if err != nil {
- t.Fatal(err)
- }
- expected := pointerTestToml
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad pointer marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-func TestPointerUnmarshal(t *testing.T) {
- result := pointerMarshalTestStruct{}
- err := Unmarshal(pointerTestToml, &result)
- expected := pointerTestData
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("Bad pointer unmarshal: expected %v, got %v", expected, result)
- }
-}
-
-func TestUnmarshalTypeMismatch(t *testing.T) {
- result := pointerMarshalTestStruct{}
- err := Unmarshal([]byte("List = 123"), &result)
- if !strings.HasPrefix(err.Error(), "(1, 1): Can't convert 123(int64) to []string(slice)") {
- t.Errorf("Type mismatch must be reported: got %v", err.Error())
- }
-}
-
-type nestedMarshalTestStruct struct {
- String [][]string
- //Struct [][]basicMarshalTestSubStruct
- StringPtr *[]*[]*string
- // StructPtr *[]*[]*basicMarshalTestSubStruct
-}
-
-var str1 = "Three"
-var str2 = "Four"
-var strPtr = []*string{&str1, &str2}
-var strPtr2 = []*[]*string{&strPtr}
-
-var nestedTestData = nestedMarshalTestStruct{
- String: [][]string{{"Five", "Six"}, {"One", "Two"}},
- StringPtr: &strPtr2,
-}
-
-var nestedTestToml = []byte(`String = [["Five","Six"],["One","Two"]]
-StringPtr = [["Three","Four"]]
-`)
-
-func TestNestedMarshal(t *testing.T) {
- result, err := Marshal(nestedTestData)
- if err != nil {
- t.Fatal(err)
- }
- expected := nestedTestToml
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad nested marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-func TestNestedUnmarshal(t *testing.T) {
- result := nestedMarshalTestStruct{}
- err := Unmarshal(nestedTestToml, &result)
- expected := nestedTestData
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("Bad nested unmarshal: expected %v, got %v", expected, result)
- }
-}
-
-type customMarshalerParent struct {
- Self customMarshaler `toml:"me"`
- Friends []customMarshaler `toml:"friends"`
-}
-
-type customMarshaler struct {
- FirsName string
- LastName string
-}
-
-func (c customMarshaler) MarshalTOML() ([]byte, error) {
- fullName := fmt.Sprintf("%s %s", c.FirsName, c.LastName)
- return []byte(fullName), nil
-}
-
-var customMarshalerData = customMarshaler{FirsName: "Sally", LastName: "Fields"}
-var customMarshalerToml = []byte(`Sally Fields`)
-var nestedCustomMarshalerData = customMarshalerParent{
- Self: customMarshaler{FirsName: "Maiku", LastName: "Suteda"},
- Friends: []customMarshaler{customMarshalerData},
-}
-var nestedCustomMarshalerToml = []byte(`friends = ["Sally Fields"]
-me = "Maiku Suteda"
-`)
-
-func TestCustomMarshaler(t *testing.T) {
- result, err := Marshal(customMarshalerData)
- if err != nil {
- t.Fatal(err)
- }
- expected := customMarshalerToml
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad custom marshaler: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-func TestNestedCustomMarshaler(t *testing.T) {
- result, err := Marshal(nestedCustomMarshalerData)
- if err != nil {
- t.Fatal(err)
- }
- expected := nestedCustomMarshalerToml
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad nested custom marshaler: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-var commentTestToml = []byte(`
-# it's a comment on type
-[postgres]
- # isCommented = "dvalue"
- noComment = "cvalue"
-
- # A comment on AttrB with a
- # break line
- password = "bvalue"
-
- # A comment on AttrA
- user = "avalue"
-
- [[postgres.My]]
-
- # a comment on my on typeC
- My = "Foo"
-
- [[postgres.My]]
-
- # a comment on my on typeC
- My = "Baar"
-`)
-
-func TestMarshalComment(t *testing.T) {
- type TypeC struct {
- My string `comment:"a comment on my on typeC"`
- }
- type TypeB struct {
- AttrA string `toml:"user" comment:"A comment on AttrA"`
- AttrB string `toml:"password" comment:"A comment on AttrB with a\n break line"`
- AttrC string `toml:"noComment"`
- AttrD string `toml:"isCommented" commented:"true"`
- My []TypeC
- }
- type TypeA struct {
- TypeB TypeB `toml:"postgres" comment:"it's a comment on type"`
- }
-
- ta := []TypeC{{My: "Foo"}, {My: "Baar"}}
- config := TypeA{TypeB{AttrA: "avalue", AttrB: "bvalue", AttrC: "cvalue", AttrD: "dvalue", My: ta}}
- result, err := Marshal(config)
- if err != nil {
- t.Fatal(err)
- }
- expected := commentTestToml
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-type mapsTestStruct struct {
- Simple map[string]string
- Paths map[string]string
- Other map[string]float64
- X struct {
- Y struct {
- Z map[string]bool
- }
- }
-}
-
-var mapsTestData = mapsTestStruct{
- Simple: map[string]string{
- "one plus one": "two",
- "next": "three",
- },
- Paths: map[string]string{
- "/this/is/a/path": "/this/is/also/a/path",
- "/heloo.txt": "/tmp/lololo.txt",
- },
- Other: map[string]float64{
- "testing": 3.9999,
- },
- X: struct{ Y struct{ Z map[string]bool } }{
- Y: struct{ Z map[string]bool }{
- Z: map[string]bool{
- "is.Nested": true,
- },
- },
- },
-}
-var mapsTestToml = []byte(`
-[Other]
- "testing" = 3.9999
-
-[Paths]
- "/heloo.txt" = "/tmp/lololo.txt"
- "/this/is/a/path" = "/this/is/also/a/path"
-
-[Simple]
- "next" = "three"
- "one plus one" = "two"
-
-[X]
-
- [X.Y]
-
- [X.Y.Z]
- "is.Nested" = true
-`)
-
-func TestEncodeQuotedMapKeys(t *testing.T) {
- var buf bytes.Buffer
- if err := NewEncoder(&buf).QuoteMapKeys(true).Encode(mapsTestData); err != nil {
- t.Fatal(err)
- }
- result := buf.Bytes()
- expected := mapsTestToml
- if !bytes.Equal(result, expected) {
- t.Errorf("Bad maps marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
- }
-}
-
-func TestDecodeQuotedMapKeys(t *testing.T) {
- result := mapsTestStruct{}
- err := NewDecoder(bytes.NewBuffer(mapsTestToml)).Decode(&result)
- expected := mapsTestData
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(result, expected) {
- t.Errorf("Bad maps unmarshal: expected %v, got %v", expected, result)
- }
-}
-
-type structArrayNoTag struct {
- A struct {
- B []int64
- C []int64
- }
-}
-
-func TestMarshalArray(t *testing.T) {
- expected := []byte(`
-[A]
- B = [1,2,3]
- C = [1]
-`)
-
- m := structArrayNoTag{
- A: struct {
- B []int64
- C []int64
- }{
- B: []int64{1, 2, 3},
- C: []int64{1},
- },
- }
-
- b, err := Marshal(m)
-
- if err != nil {
- t.Fatal(err)
- }
-
- if !bytes.Equal(b, expected) {
- t.Errorf("Bad arrays marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, b)
- }
-}
-
-func TestMarshalArrayOnePerLine(t *testing.T) {
- expected := []byte(`
-[A]
- B = [
- 1,
- 2,
- 3,
- ]
- C = [1]
-`)
-
- m := structArrayNoTag{
- A: struct {
- B []int64
- C []int64
- }{
- B: []int64{1, 2, 3},
- C: []int64{1},
- },
- }
-
- var buf bytes.Buffer
- encoder := NewEncoder(&buf).ArraysWithOneElementPerLine(true)
- err := encoder.Encode(m)
-
- if err != nil {
- t.Fatal(err)
- }
-
- b := buf.Bytes()
-
- if !bytes.Equal(b, expected) {
- t.Errorf("Bad arrays marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, b)
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/marshal_test.toml b/vendor/github.com/pelletier/go-toml/marshal_test.toml
deleted file mode 100644
index 1c5f98e7..00000000
--- a/vendor/github.com/pelletier/go-toml/marshal_test.toml
+++ /dev/null
@@ -1,38 +0,0 @@
-title = "TOML Marshal Testing"
-
-[basic]
- bool = true
- date = 1979-05-27T07:32:00Z
- float = 123.4
- int = 5000
- string = "Bite me"
- uint = 5001
-
-[basic_lists]
- bools = [true,false,true]
- dates = [1979-05-27T07:32:00Z,1980-05-27T07:32:00Z]
- floats = [12.3,45.6,78.9]
- ints = [8001,8001,8002]
- strings = ["One","Two","Three"]
- uints = [5002,5003]
-
-[basic_map]
- one = "one"
- two = "two"
-
-[subdoc]
-
- [subdoc.first]
- name = "First"
-
- [subdoc.second]
- name = "Second"
-
-[[subdoclist]]
- name = "List.First"
-
-[[subdoclist]]
- name = "List.Second"
-
-[[subdocptrs]]
- name = "Second"
diff --git a/vendor/github.com/pelletier/go-toml/parser.go b/vendor/github.com/pelletier/go-toml/parser.go
deleted file mode 100644
index 2d27599a..00000000
--- a/vendor/github.com/pelletier/go-toml/parser.go
+++ /dev/null
@@ -1,430 +0,0 @@
-// TOML Parser.
-
-package toml
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
- "regexp"
- "strconv"
- "strings"
- "time"
-)
-
-type tomlParser struct {
- flowIdx int
- flow []token
- tree *Tree
- currentTable []string
- seenTableKeys []string
-}
-
-type tomlParserStateFn func() tomlParserStateFn
-
-// Formats and panics an error message based on a token
-func (p *tomlParser) raiseError(tok *token, msg string, args ...interface{}) {
- panic(tok.Position.String() + ": " + fmt.Sprintf(msg, args...))
-}
-
-func (p *tomlParser) run() {
- for state := p.parseStart; state != nil; {
- state = state()
- }
-}
-
-func (p *tomlParser) peek() *token {
- if p.flowIdx >= len(p.flow) {
- return nil
- }
- return &p.flow[p.flowIdx]
-}
-
-func (p *tomlParser) assume(typ tokenType) {
- tok := p.getToken()
- if tok == nil {
- p.raiseError(tok, "was expecting token %s, but token stream is empty", tok)
- }
- if tok.typ != typ {
- p.raiseError(tok, "was expecting token %s, but got %s instead", typ, tok)
- }
-}
-
-func (p *tomlParser) getToken() *token {
- tok := p.peek()
- if tok == nil {
- return nil
- }
- p.flowIdx++
- return tok
-}
-
-func (p *tomlParser) parseStart() tomlParserStateFn {
- tok := p.peek()
-
- // end of stream, parsing is finished
- if tok == nil {
- return nil
- }
-
- switch tok.typ {
- case tokenDoubleLeftBracket:
- return p.parseGroupArray
- case tokenLeftBracket:
- return p.parseGroup
- case tokenKey:
- return p.parseAssign
- case tokenEOF:
- return nil
- default:
- p.raiseError(tok, "unexpected token")
- }
- return nil
-}
-
-func (p *tomlParser) parseGroupArray() tomlParserStateFn {
- startToken := p.getToken() // discard the [[
- key := p.getToken()
- if key.typ != tokenKeyGroupArray {
- p.raiseError(key, "unexpected token %s, was expecting a table array key", key)
- }
-
- // get or create table array element at the indicated part in the path
- keys, err := parseKey(key.val)
- if err != nil {
- p.raiseError(key, "invalid table array key: %s", err)
- }
- p.tree.createSubTree(keys[:len(keys)-1], startToken.Position) // create parent entries
- destTree := p.tree.GetPath(keys)
- var array []*Tree
- if destTree == nil {
- array = make([]*Tree, 0)
- } else if target, ok := destTree.([]*Tree); ok && target != nil {
- array = destTree.([]*Tree)
- } else {
- p.raiseError(key, "key %s is already assigned and not of type table array", key)
- }
- p.currentTable = keys
-
- // add a new tree to the end of the table array
- newTree := newTree()
- newTree.position = startToken.Position
- array = append(array, newTree)
- p.tree.SetPath(p.currentTable, array)
-
- // remove all keys that were children of this table array
- prefix := key.val + "."
- found := false
- for ii := 0; ii < len(p.seenTableKeys); {
- tableKey := p.seenTableKeys[ii]
- if strings.HasPrefix(tableKey, prefix) {
- p.seenTableKeys = append(p.seenTableKeys[:ii], p.seenTableKeys[ii+1:]...)
- } else {
- found = (tableKey == key.val)
- ii++
- }
- }
-
- // keep this key name from use by other kinds of assignments
- if !found {
- p.seenTableKeys = append(p.seenTableKeys, key.val)
- }
-
- // move to next parser state
- p.assume(tokenDoubleRightBracket)
- return p.parseStart
-}
-
-func (p *tomlParser) parseGroup() tomlParserStateFn {
- startToken := p.getToken() // discard the [
- key := p.getToken()
- if key.typ != tokenKeyGroup {
- p.raiseError(key, "unexpected token %s, was expecting a table key", key)
- }
- for _, item := range p.seenTableKeys {
- if item == key.val {
- p.raiseError(key, "duplicated tables")
- }
- }
-
- p.seenTableKeys = append(p.seenTableKeys, key.val)
- keys, err := parseKey(key.val)
- if err != nil {
- p.raiseError(key, "invalid table array key: %s", err)
- }
- if err := p.tree.createSubTree(keys, startToken.Position); err != nil {
- p.raiseError(key, "%s", err)
- }
- p.assume(tokenRightBracket)
- p.currentTable = keys
- return p.parseStart
-}
-
-func (p *tomlParser) parseAssign() tomlParserStateFn {
- key := p.getToken()
- p.assume(tokenEqual)
-
- value := p.parseRvalue()
- var tableKey []string
- if len(p.currentTable) > 0 {
- tableKey = p.currentTable
- } else {
- tableKey = []string{}
- }
-
- // find the table to assign, looking out for arrays of tables
- var targetNode *Tree
- switch node := p.tree.GetPath(tableKey).(type) {
- case []*Tree:
- targetNode = node[len(node)-1]
- case *Tree:
- targetNode = node
- default:
- p.raiseError(key, "Unknown table type for path: %s",
- strings.Join(tableKey, "."))
- }
-
- // assign value to the found table
- keyVals := []string{key.val}
- if len(keyVals) != 1 {
- p.raiseError(key, "Invalid key")
- }
- keyVal := keyVals[0]
- localKey := []string{keyVal}
- finalKey := append(tableKey, keyVal)
- if targetNode.GetPath(localKey) != nil {
- p.raiseError(key, "The following key was defined twice: %s",
- strings.Join(finalKey, "."))
- }
- var toInsert interface{}
-
- switch value.(type) {
- case *Tree, []*Tree:
- toInsert = value
- default:
- toInsert = &tomlValue{value: value, position: key.Position}
- }
- targetNode.values[keyVal] = toInsert
- return p.parseStart
-}
-
-var numberUnderscoreInvalidRegexp *regexp.Regexp
-var hexNumberUnderscoreInvalidRegexp *regexp.Regexp
-
-func numberContainsInvalidUnderscore(value string) error {
- if numberUnderscoreInvalidRegexp.MatchString(value) {
- return errors.New("invalid use of _ in number")
- }
- return nil
-}
-
-func hexNumberContainsInvalidUnderscore(value string) error {
- if hexNumberUnderscoreInvalidRegexp.MatchString(value) {
- return errors.New("invalid use of _ in hex number")
- }
- return nil
-}
-
-func cleanupNumberToken(value string) string {
- cleanedVal := strings.Replace(value, "_", "", -1)
- return cleanedVal
-}
-
-func (p *tomlParser) parseRvalue() interface{} {
- tok := p.getToken()
- if tok == nil || tok.typ == tokenEOF {
- p.raiseError(tok, "expecting a value")
- }
-
- switch tok.typ {
- case tokenString:
- return tok.val
- case tokenTrue:
- return true
- case tokenFalse:
- return false
- case tokenInf:
- if tok.val[0] == '-' {
- return math.Inf(-1)
- }
- return math.Inf(1)
- case tokenNan:
- return math.NaN()
- case tokenInteger:
- cleanedVal := cleanupNumberToken(tok.val)
- var err error
- var val int64
- if len(cleanedVal) >= 3 && cleanedVal[0] == '0' {
- switch cleanedVal[1] {
- case 'x':
- err = hexNumberContainsInvalidUnderscore(tok.val)
- if err != nil {
- p.raiseError(tok, "%s", err)
- }
- val, err = strconv.ParseInt(cleanedVal[2:], 16, 64)
- case 'o':
- err = numberContainsInvalidUnderscore(tok.val)
- if err != nil {
- p.raiseError(tok, "%s", err)
- }
- val, err = strconv.ParseInt(cleanedVal[2:], 8, 64)
- case 'b':
- err = numberContainsInvalidUnderscore(tok.val)
- if err != nil {
- p.raiseError(tok, "%s", err)
- }
- val, err = strconv.ParseInt(cleanedVal[2:], 2, 64)
- default:
- panic("invalid base") // the lexer should catch this first
- }
- } else {
- err = numberContainsInvalidUnderscore(tok.val)
- if err != nil {
- p.raiseError(tok, "%s", err)
- }
- val, err = strconv.ParseInt(cleanedVal, 10, 64)
- }
- if err != nil {
- p.raiseError(tok, "%s", err)
- }
- return val
- case tokenFloat:
- err := numberContainsInvalidUnderscore(tok.val)
- if err != nil {
- p.raiseError(tok, "%s", err)
- }
- cleanedVal := cleanupNumberToken(tok.val)
- val, err := strconv.ParseFloat(cleanedVal, 64)
- if err != nil {
- p.raiseError(tok, "%s", err)
- }
- return val
- case tokenDate:
- val, err := time.ParseInLocation(time.RFC3339Nano, tok.val, time.UTC)
- if err != nil {
- p.raiseError(tok, "%s", err)
- }
- return val
- case tokenLeftBracket:
- return p.parseArray()
- case tokenLeftCurlyBrace:
- return p.parseInlineTable()
- case tokenEqual:
- p.raiseError(tok, "cannot have multiple equals for the same key")
- case tokenError:
- p.raiseError(tok, "%s", tok)
- }
-
- p.raiseError(tok, "never reached")
-
- return nil
-}
-
-func tokenIsComma(t *token) bool {
- return t != nil && t.typ == tokenComma
-}
-
-func (p *tomlParser) parseInlineTable() *Tree {
- tree := newTree()
- var previous *token
-Loop:
- for {
- follow := p.peek()
- if follow == nil || follow.typ == tokenEOF {
- p.raiseError(follow, "unterminated inline table")
- }
- switch follow.typ {
- case tokenRightCurlyBrace:
- p.getToken()
- break Loop
- case tokenKey:
- if !tokenIsComma(previous) && previous != nil {
- p.raiseError(follow, "comma expected between fields in inline table")
- }
- key := p.getToken()
- p.assume(tokenEqual)
- value := p.parseRvalue()
- tree.Set(key.val, value)
- case tokenComma:
- if previous == nil {
- p.raiseError(follow, "inline table cannot start with a comma")
- }
- if tokenIsComma(previous) {
- p.raiseError(follow, "need field between two commas in inline table")
- }
- p.getToken()
- default:
- p.raiseError(follow, "unexpected token type in inline table: %s", follow.String())
- }
- previous = follow
- }
- if tokenIsComma(previous) {
- p.raiseError(previous, "trailing comma at the end of inline table")
- }
- return tree
-}
-
-func (p *tomlParser) parseArray() interface{} {
- var array []interface{}
- arrayType := reflect.TypeOf(nil)
- for {
- follow := p.peek()
- if follow == nil || follow.typ == tokenEOF {
- p.raiseError(follow, "unterminated array")
- }
- if follow.typ == tokenRightBracket {
- p.getToken()
- break
- }
- val := p.parseRvalue()
- if arrayType == nil {
- arrayType = reflect.TypeOf(val)
- }
- if reflect.TypeOf(val) != arrayType {
- p.raiseError(follow, "mixed types in array")
- }
- array = append(array, val)
- follow = p.peek()
- if follow == nil || follow.typ == tokenEOF {
- p.raiseError(follow, "unterminated array")
- }
- if follow.typ != tokenRightBracket && follow.typ != tokenComma {
- p.raiseError(follow, "missing comma")
- }
- if follow.typ == tokenComma {
- p.getToken()
- }
- }
- // An array of Trees is actually an array of inline
- // tables, which is a shorthand for a table array. If the
- // array was not converted from []interface{} to []*Tree,
- // the two notations would not be equivalent.
- if arrayType == reflect.TypeOf(newTree()) {
- tomlArray := make([]*Tree, len(array))
- for i, v := range array {
- tomlArray[i] = v.(*Tree)
- }
- return tomlArray
- }
- return array
-}
-
-func parseToml(flow []token) *Tree {
- result := newTree()
- result.position = Position{1, 1}
- parser := &tomlParser{
- flowIdx: 0,
- flow: flow,
- tree: result,
- currentTable: make([]string, 0),
- seenTableKeys: make([]string, 0),
- }
- parser.run()
- return result
-}
-
-func init() {
- numberUnderscoreInvalidRegexp = regexp.MustCompile(`([^\d]_|_[^\d])|_$|^_`)
- hexNumberUnderscoreInvalidRegexp = regexp.MustCompile(`(^0x_)|([^\da-f]_|_[^\da-f])|_$|^_`)
-}
diff --git a/vendor/github.com/pelletier/go-toml/parser_test.go b/vendor/github.com/pelletier/go-toml/parser_test.go
deleted file mode 100644
index ca29c442..00000000
--- a/vendor/github.com/pelletier/go-toml/parser_test.go
+++ /dev/null
@@ -1,899 +0,0 @@
-package toml
-
-import (
- "fmt"
- "math"
- "reflect"
- "testing"
- "time"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-func assertSubTree(t *testing.T, path []string, tree *Tree, err error, ref map[string]interface{}) {
- if err != nil {
- t.Error("Non-nil error:", err.Error())
- return
- }
- for k, v := range ref {
- nextPath := append(path, k)
- t.Log("asserting path", nextPath)
- // NOTE: directly access key instead of resolve by path
- // NOTE: see TestSpecialKV
- switch node := tree.GetPath([]string{k}).(type) {
- case []*Tree:
- t.Log("\tcomparing key", nextPath, "by array iteration")
- for idx, item := range node {
- assertSubTree(t, nextPath, item, err, v.([]map[string]interface{})[idx])
- }
- case *Tree:
- t.Log("\tcomparing key", nextPath, "by subtree assestion")
- assertSubTree(t, nextPath, node, err, v.(map[string]interface{}))
- default:
- t.Log("\tcomparing key", nextPath, "by string representation because it's of type", reflect.TypeOf(node))
- if fmt.Sprintf("%v", node) != fmt.Sprintf("%v", v) {
- t.Errorf("was expecting %v at %v but got %v", v, k, node)
- }
- }
- }
-}
-
-func assertTree(t *testing.T, tree *Tree, err error, ref map[string]interface{}) {
- t.Log("Asserting tree:\n", spew.Sdump(tree))
- assertSubTree(t, []string{}, tree, err, ref)
- t.Log("Finished tree assertion.")
-}
-
-func TestCreateSubTree(t *testing.T) {
- tree := newTree()
- tree.createSubTree([]string{"a", "b", "c"}, Position{})
- tree.Set("a.b.c", 42)
- if tree.Get("a.b.c") != 42 {
- t.Fail()
- }
-}
-
-func TestSimpleKV(t *testing.T) {
- tree, err := Load("a = 42")
- assertTree(t, tree, err, map[string]interface{}{
- "a": int64(42),
- })
-
- tree, _ = Load("a = 42\nb = 21")
- assertTree(t, tree, err, map[string]interface{}{
- "a": int64(42),
- "b": int64(21),
- })
-}
-
-func TestNumberInKey(t *testing.T) {
- tree, err := Load("hello2 = 42")
- assertTree(t, tree, err, map[string]interface{}{
- "hello2": int64(42),
- })
-}
-
-func TestIncorrectKeyExtraSquareBracket(t *testing.T) {
- _, err := Load(`[a]b]
-zyx = 42`)
- if err == nil {
- t.Error("Error should have been returned.")
- }
- if err.Error() != "(1, 4): unexpected token" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestSimpleNumbers(t *testing.T) {
- tree, err := Load("a = +42\nb = -21\nc = +4.2\nd = -2.1")
- assertTree(t, tree, err, map[string]interface{}{
- "a": int64(42),
- "b": int64(-21),
- "c": float64(4.2),
- "d": float64(-2.1),
- })
-}
-
-func TestSpecialFloats(t *testing.T) {
- tree, err := Load(`
-normalinf = inf
-plusinf = +inf
-minusinf = -inf
-normalnan = nan
-plusnan = +nan
-minusnan = -nan
-`)
- assertTree(t, tree, err, map[string]interface{}{
- "normalinf": math.Inf(1),
- "plusinf": math.Inf(1),
- "minusinf": math.Inf(-1),
- "normalnan": math.NaN(),
- "plusnan": math.NaN(),
- "minusnan": math.NaN(),
- })
-}
-
-func TestHexIntegers(t *testing.T) {
- tree, err := Load(`a = 0xDEADBEEF`)
- assertTree(t, tree, err, map[string]interface{}{"a": int64(3735928559)})
-
- tree, err = Load(`a = 0xdeadbeef`)
- assertTree(t, tree, err, map[string]interface{}{"a": int64(3735928559)})
-
- tree, err = Load(`a = 0xdead_beef`)
- assertTree(t, tree, err, map[string]interface{}{"a": int64(3735928559)})
-
- _, err = Load(`a = 0x_1`)
- if err.Error() != "(1, 5): invalid use of _ in hex number" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestOctIntegers(t *testing.T) {
- tree, err := Load(`a = 0o01234567`)
- assertTree(t, tree, err, map[string]interface{}{"a": int64(342391)})
-
- tree, err = Load(`a = 0o755`)
- assertTree(t, tree, err, map[string]interface{}{"a": int64(493)})
-
- _, err = Load(`a = 0o_1`)
- if err.Error() != "(1, 5): invalid use of _ in number" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestBinIntegers(t *testing.T) {
- tree, err := Load(`a = 0b11010110`)
- assertTree(t, tree, err, map[string]interface{}{"a": int64(214)})
-
- _, err = Load(`a = 0b_1`)
- if err.Error() != "(1, 5): invalid use of _ in number" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestBadIntegerBase(t *testing.T) {
- _, err := Load(`a = 0k1`)
- if err.Error() != "(1, 5): unknown number base: k. possible options are x (hex) o (octal) b (binary)" {
- t.Error("Error should have been returned.")
- }
-}
-
-func TestIntegerNoDigit(t *testing.T) {
- _, err := Load(`a = 0b`)
- if err.Error() != "(1, 5): number needs at least one digit" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestNumbersWithUnderscores(t *testing.T) {
- tree, err := Load("a = 1_000")
- assertTree(t, tree, err, map[string]interface{}{
- "a": int64(1000),
- })
-
- tree, err = Load("a = 5_349_221")
- assertTree(t, tree, err, map[string]interface{}{
- "a": int64(5349221),
- })
-
- tree, err = Load("a = 1_2_3_4_5")
- assertTree(t, tree, err, map[string]interface{}{
- "a": int64(12345),
- })
-
- tree, err = Load("flt8 = 9_224_617.445_991_228_313")
- assertTree(t, tree, err, map[string]interface{}{
- "flt8": float64(9224617.445991228313),
- })
-
- tree, err = Load("flt9 = 1e1_00")
- assertTree(t, tree, err, map[string]interface{}{
- "flt9": float64(1e100),
- })
-}
-
-func TestFloatsWithExponents(t *testing.T) {
- tree, err := Load("a = 5e+22\nb = 5E+22\nc = -5e+22\nd = -5e-22\ne = 6.626e-34")
- assertTree(t, tree, err, map[string]interface{}{
- "a": float64(5e+22),
- "b": float64(5E+22),
- "c": float64(-5e+22),
- "d": float64(-5e-22),
- "e": float64(6.626e-34),
- })
-}
-
-func TestSimpleDate(t *testing.T) {
- tree, err := Load("a = 1979-05-27T07:32:00Z")
- assertTree(t, tree, err, map[string]interface{}{
- "a": time.Date(1979, time.May, 27, 7, 32, 0, 0, time.UTC),
- })
-}
-
-func TestDateOffset(t *testing.T) {
- tree, err := Load("a = 1979-05-27T00:32:00-07:00")
- assertTree(t, tree, err, map[string]interface{}{
- "a": time.Date(1979, time.May, 27, 0, 32, 0, 0, time.FixedZone("", -7*60*60)),
- })
-}
-
-func TestDateNano(t *testing.T) {
- tree, err := Load("a = 1979-05-27T00:32:00.999999999-07:00")
- assertTree(t, tree, err, map[string]interface{}{
- "a": time.Date(1979, time.May, 27, 0, 32, 0, 999999999, time.FixedZone("", -7*60*60)),
- })
-}
-
-func TestSimpleString(t *testing.T) {
- tree, err := Load("a = \"hello world\"")
- assertTree(t, tree, err, map[string]interface{}{
- "a": "hello world",
- })
-}
-
-func TestSpaceKey(t *testing.T) {
- tree, err := Load("\"a b\" = \"hello world\"")
- assertTree(t, tree, err, map[string]interface{}{
- "a b": "hello world",
- })
-}
-
-func TestDoubleQuotedKey(t *testing.T) {
- tree, err := Load(`
- "key" = "a"
- "\t" = "b"
- "\U0001F914" = "c"
- "\u2764" = "d"
- `)
- assertTree(t, tree, err, map[string]interface{}{
- "key": "a",
- "\t": "b",
- "\U0001F914": "c",
- "\u2764": "d",
- })
-}
-
-func TestSingleQuotedKey(t *testing.T) {
- tree, err := Load(`
- 'key' = "a"
- '\t' = "b"
- '\U0001F914' = "c"
- '\u2764' = "d"
- `)
- assertTree(t, tree, err, map[string]interface{}{
- `key`: "a",
- `\t`: "b",
- `\U0001F914`: "c",
- `\u2764`: "d",
- })
-}
-
-func TestStringEscapables(t *testing.T) {
- tree, err := Load("a = \"a \\n b\"")
- assertTree(t, tree, err, map[string]interface{}{
- "a": "a \n b",
- })
-
- tree, err = Load("a = \"a \\t b\"")
- assertTree(t, tree, err, map[string]interface{}{
- "a": "a \t b",
- })
-
- tree, err = Load("a = \"a \\r b\"")
- assertTree(t, tree, err, map[string]interface{}{
- "a": "a \r b",
- })
-
- tree, err = Load("a = \"a \\\\ b\"")
- assertTree(t, tree, err, map[string]interface{}{
- "a": "a \\ b",
- })
-}
-
-func TestEmptyQuotedString(t *testing.T) {
- tree, err := Load(`[""]
-"" = 1`)
- assertTree(t, tree, err, map[string]interface{}{
- "": map[string]interface{}{
- "": int64(1),
- },
- })
-}
-
-func TestBools(t *testing.T) {
- tree, err := Load("a = true\nb = false")
- assertTree(t, tree, err, map[string]interface{}{
- "a": true,
- "b": false,
- })
-}
-
-func TestNestedKeys(t *testing.T) {
- tree, err := Load("[a.b.c]\nd = 42")
- assertTree(t, tree, err, map[string]interface{}{
- "a": map[string]interface{}{
- "b": map[string]interface{}{
- "c": map[string]interface{}{
- "d": int64(42),
- },
- },
- },
- })
-}
-
-func TestNestedQuotedUnicodeKeys(t *testing.T) {
- tree, err := Load("[ j . \"ʞ\" . l ]\nd = 42")
- assertTree(t, tree, err, map[string]interface{}{
- "j": map[string]interface{}{
- "ʞ": map[string]interface{}{
- "l": map[string]interface{}{
- "d": int64(42),
- },
- },
- },
- })
-
- tree, err = Load("[ g . h . i ]\nd = 42")
- assertTree(t, tree, err, map[string]interface{}{
- "g": map[string]interface{}{
- "h": map[string]interface{}{
- "i": map[string]interface{}{
- "d": int64(42),
- },
- },
- },
- })
-
- tree, err = Load("[ d.e.f ]\nk = 42")
- assertTree(t, tree, err, map[string]interface{}{
- "d": map[string]interface{}{
- "e": map[string]interface{}{
- "f": map[string]interface{}{
- "k": int64(42),
- },
- },
- },
- })
-}
-
-func TestArrayOne(t *testing.T) {
- tree, err := Load("a = [1]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": []int64{int64(1)},
- })
-}
-
-func TestArrayZero(t *testing.T) {
- tree, err := Load("a = []")
- assertTree(t, tree, err, map[string]interface{}{
- "a": []interface{}{},
- })
-}
-
-func TestArraySimple(t *testing.T) {
- tree, err := Load("a = [42, 21, 10]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": []int64{int64(42), int64(21), int64(10)},
- })
-
- tree, _ = Load("a = [42, 21, 10,]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": []int64{int64(42), int64(21), int64(10)},
- })
-}
-
-func TestArrayMultiline(t *testing.T) {
- tree, err := Load("a = [42,\n21, 10,]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": []int64{int64(42), int64(21), int64(10)},
- })
-}
-
-func TestArrayNested(t *testing.T) {
- tree, err := Load("a = [[42, 21], [10]]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": [][]int64{{int64(42), int64(21)}, {int64(10)}},
- })
-}
-
-func TestNestedArrayComment(t *testing.T) {
- tree, err := Load(`
-someArray = [
-# does not work
-["entry1"]
-]`)
- assertTree(t, tree, err, map[string]interface{}{
- "someArray": [][]string{{"entry1"}},
- })
-}
-
-func TestNestedEmptyArrays(t *testing.T) {
- tree, err := Load("a = [[[]]]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": [][][]interface{}{{{}}},
- })
-}
-
-func TestArrayMixedTypes(t *testing.T) {
- _, err := Load("a = [42, 16.0]")
- if err.Error() != "(1, 10): mixed types in array" {
- t.Error("Bad error message:", err.Error())
- }
-
- _, err = Load("a = [42, \"hello\"]")
- if err.Error() != "(1, 11): mixed types in array" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestArrayNestedStrings(t *testing.T) {
- tree, err := Load("data = [ [\"gamma\", \"delta\"], [\"Foo\"] ]")
- assertTree(t, tree, err, map[string]interface{}{
- "data": [][]string{{"gamma", "delta"}, {"Foo"}},
- })
-}
-
-func TestParseUnknownRvalue(t *testing.T) {
- _, err := Load("a = !bssss")
- if err == nil {
- t.Error("Expecting a parse error")
- }
-
- _, err = Load("a = /b")
- if err == nil {
- t.Error("Expecting a parse error")
- }
-}
-
-func TestMissingValue(t *testing.T) {
- _, err := Load("a = ")
- if err.Error() != "(1, 5): expecting a value" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestUnterminatedArray(t *testing.T) {
- _, err := Load("a = [1,")
- if err.Error() != "(1, 8): unterminated array" {
- t.Error("Bad error message:", err.Error())
- }
-
- _, err = Load("a = [1")
- if err.Error() != "(1, 7): unterminated array" {
- t.Error("Bad error message:", err.Error())
- }
-
- _, err = Load("a = [1 2")
- if err.Error() != "(1, 8): missing comma" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestNewlinesInArrays(t *testing.T) {
- tree, err := Load("a = [1,\n2,\n3]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": []int64{int64(1), int64(2), int64(3)},
- })
-}
-
-func TestArrayWithExtraComma(t *testing.T) {
- tree, err := Load("a = [1,\n2,\n3,\n]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": []int64{int64(1), int64(2), int64(3)},
- })
-}
-
-func TestArrayWithExtraCommaComment(t *testing.T) {
- tree, err := Load("a = [1, # wow\n2, # such items\n3, # so array\n]")
- assertTree(t, tree, err, map[string]interface{}{
- "a": []int64{int64(1), int64(2), int64(3)},
- })
-}
-
-func TestSimpleInlineGroup(t *testing.T) {
- tree, err := Load("key = {a = 42}")
- assertTree(t, tree, err, map[string]interface{}{
- "key": map[string]interface{}{
- "a": int64(42),
- },
- })
-}
-
-func TestDoubleInlineGroup(t *testing.T) {
- tree, err := Load("key = {a = 42, b = \"foo\"}")
- assertTree(t, tree, err, map[string]interface{}{
- "key": map[string]interface{}{
- "a": int64(42),
- "b": "foo",
- },
- })
-}
-
-func TestExampleInlineGroup(t *testing.T) {
- tree, err := Load(`name = { first = "Tom", last = "Preston-Werner" }
-point = { x = 1, y = 2 }`)
- assertTree(t, tree, err, map[string]interface{}{
- "name": map[string]interface{}{
- "first": "Tom",
- "last": "Preston-Werner",
- },
- "point": map[string]interface{}{
- "x": int64(1),
- "y": int64(2),
- },
- })
-}
-
-func TestExampleInlineGroupInArray(t *testing.T) {
- tree, err := Load(`points = [{ x = 1, y = 2 }]`)
- assertTree(t, tree, err, map[string]interface{}{
- "points": []map[string]interface{}{
- {
- "x": int64(1),
- "y": int64(2),
- },
- },
- })
-}
-
-func TestInlineTableUnterminated(t *testing.T) {
- _, err := Load("foo = {")
- if err.Error() != "(1, 8): unterminated inline table" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestInlineTableCommaExpected(t *testing.T) {
- _, err := Load("foo = {hello = 53 test = foo}")
- if err.Error() != "(1, 19): comma expected between fields in inline table" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestInlineTableCommaStart(t *testing.T) {
- _, err := Load("foo = {, hello = 53}")
- if err.Error() != "(1, 8): inline table cannot start with a comma" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestInlineTableDoubleComma(t *testing.T) {
- _, err := Load("foo = {hello = 53,, foo = 17}")
- if err.Error() != "(1, 19): need field between two commas in inline table" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestDuplicateGroups(t *testing.T) {
- _, err := Load("[foo]\na=2\n[foo]b=3")
- if err.Error() != "(3, 2): duplicated tables" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestDuplicateKeys(t *testing.T) {
- _, err := Load("foo = 2\nfoo = 3")
- if err.Error() != "(2, 1): The following key was defined twice: foo" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestEmptyIntermediateTable(t *testing.T) {
- _, err := Load("[foo..bar]")
- if err.Error() != "(1, 2): invalid table array key: empty table key" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestImplicitDeclarationBefore(t *testing.T) {
- tree, err := Load("[a.b.c]\nanswer = 42\n[a]\nbetter = 43")
- assertTree(t, tree, err, map[string]interface{}{
- "a": map[string]interface{}{
- "b": map[string]interface{}{
- "c": map[string]interface{}{
- "answer": int64(42),
- },
- },
- "better": int64(43),
- },
- })
-}
-
-func TestFloatsWithoutLeadingZeros(t *testing.T) {
- _, err := Load("a = .42")
- if err.Error() != "(1, 5): cannot start float with a dot" {
- t.Error("Bad error message:", err.Error())
- }
-
- _, err = Load("a = -.42")
- if err.Error() != "(1, 5): cannot start float with a dot" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestMissingFile(t *testing.T) {
- _, err := LoadFile("foo.toml")
- if err.Error() != "open foo.toml: no such file or directory" &&
- err.Error() != "open foo.toml: The system cannot find the file specified." {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestParseFile(t *testing.T) {
- tree, err := LoadFile("example.toml")
-
- assertTree(t, tree, err, map[string]interface{}{
- "title": "TOML Example",
- "owner": map[string]interface{}{
- "name": "Tom Preston-Werner",
- "organization": "GitHub",
- "bio": "GitHub Cofounder & CEO\nLikes tater tots and beer.",
- "dob": time.Date(1979, time.May, 27, 7, 32, 0, 0, time.UTC),
- },
- "database": map[string]interface{}{
- "server": "192.168.1.1",
- "ports": []int64{8001, 8001, 8002},
- "connection_max": 5000,
- "enabled": true,
- },
- "servers": map[string]interface{}{
- "alpha": map[string]interface{}{
- "ip": "10.0.0.1",
- "dc": "eqdc10",
- },
- "beta": map[string]interface{}{
- "ip": "10.0.0.2",
- "dc": "eqdc10",
- },
- },
- "clients": map[string]interface{}{
- "data": []interface{}{
- []string{"gamma", "delta"},
- []int64{1, 2},
- },
- },
- })
-}
-
-func TestParseFileCRLF(t *testing.T) {
- tree, err := LoadFile("example-crlf.toml")
-
- assertTree(t, tree, err, map[string]interface{}{
- "title": "TOML Example",
- "owner": map[string]interface{}{
- "name": "Tom Preston-Werner",
- "organization": "GitHub",
- "bio": "GitHub Cofounder & CEO\nLikes tater tots and beer.",
- "dob": time.Date(1979, time.May, 27, 7, 32, 0, 0, time.UTC),
- },
- "database": map[string]interface{}{
- "server": "192.168.1.1",
- "ports": []int64{8001, 8001, 8002},
- "connection_max": 5000,
- "enabled": true,
- },
- "servers": map[string]interface{}{
- "alpha": map[string]interface{}{
- "ip": "10.0.0.1",
- "dc": "eqdc10",
- },
- "beta": map[string]interface{}{
- "ip": "10.0.0.2",
- "dc": "eqdc10",
- },
- },
- "clients": map[string]interface{}{
- "data": []interface{}{
- []string{"gamma", "delta"},
- []int64{1, 2},
- },
- },
- })
-}
-
-func TestParseKeyGroupArray(t *testing.T) {
- tree, err := Load("[[foo.bar]] a = 42\n[[foo.bar]] a = 69")
- assertTree(t, tree, err, map[string]interface{}{
- "foo": map[string]interface{}{
- "bar": []map[string]interface{}{
- {"a": int64(42)},
- {"a": int64(69)},
- },
- },
- })
-}
-
-func TestParseKeyGroupArrayUnfinished(t *testing.T) {
- _, err := Load("[[foo.bar]\na = 42")
- if err.Error() != "(1, 10): was expecting token [[, but got unclosed table array key instead" {
- t.Error("Bad error message:", err.Error())
- }
-
- _, err = Load("[[foo.[bar]\na = 42")
- if err.Error() != "(1, 3): unexpected token table array key cannot contain ']', was expecting a table array key" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestParseKeyGroupArrayQueryExample(t *testing.T) {
- tree, err := Load(`
- [[book]]
- title = "The Stand"
- author = "Stephen King"
- [[book]]
- title = "For Whom the Bell Tolls"
- author = "Ernest Hemmingway"
- [[book]]
- title = "Neuromancer"
- author = "William Gibson"
- `)
-
- assertTree(t, tree, err, map[string]interface{}{
- "book": []map[string]interface{}{
- {"title": "The Stand", "author": "Stephen King"},
- {"title": "For Whom the Bell Tolls", "author": "Ernest Hemmingway"},
- {"title": "Neuromancer", "author": "William Gibson"},
- },
- })
-}
-
-func TestParseKeyGroupArraySpec(t *testing.T) {
- tree, err := Load("[[fruit]]\n name=\"apple\"\n [fruit.physical]\n color=\"red\"\n shape=\"round\"\n [[fruit]]\n name=\"banana\"")
- assertTree(t, tree, err, map[string]interface{}{
- "fruit": []map[string]interface{}{
- {"name": "apple", "physical": map[string]interface{}{"color": "red", "shape": "round"}},
- {"name": "banana"},
- },
- })
-}
-
-func TestTomlValueStringRepresentation(t *testing.T) {
- for idx, item := range []struct {
- Value interface{}
- Expect string
- }{
- {int64(12345), "12345"},
- {uint64(50), "50"},
- {float64(123.45), "123.45"},
- {true, "true"},
- {"hello world", "\"hello world\""},
- {"\b\t\n\f\r\"\\", "\"\\b\\t\\n\\f\\r\\\"\\\\\""},
- {"\x05", "\"\\u0005\""},
- {time.Date(1979, time.May, 27, 7, 32, 0, 0, time.UTC),
- "1979-05-27T07:32:00Z"},
- {[]interface{}{"gamma", "delta"},
- "[\"gamma\",\"delta\"]"},
- {nil, ""},
- } {
- result, err := tomlValueStringRepresentation(item.Value, "", false)
- if err != nil {
- t.Errorf("Test %d - unexpected error: %s", idx, err)
- }
- if result != item.Expect {
- t.Errorf("Test %d - got '%s', expected '%s'", idx, result, item.Expect)
- }
- }
-}
-
-func TestToStringMapStringString(t *testing.T) {
- tree, err := TreeFromMap(map[string]interface{}{"m": map[string]interface{}{"v": "abc"}})
- if err != nil {
- t.Fatalf("unexpected error: %s", err)
- }
- want := "\n[m]\n v = \"abc\"\n"
- got := tree.String()
-
- if got != want {
- t.Errorf("want:\n%q\ngot:\n%q", want, got)
- }
-}
-
-func assertPosition(t *testing.T, text string, ref map[string]Position) {
- tree, err := Load(text)
- if err != nil {
- t.Errorf("Error loading document text: `%v`", text)
- t.Errorf("Error: %v", err)
- }
- for path, pos := range ref {
- testPos := tree.GetPosition(path)
- if testPos.Invalid() {
- t.Errorf("Failed to query tree path or path has invalid position: %s", path)
- } else if pos != testPos {
- t.Errorf("Expected position %v, got %v instead", pos, testPos)
- }
- }
-}
-
-func TestDocumentPositions(t *testing.T) {
- assertPosition(t,
- "[foo]\nbar=42\nbaz=69",
- map[string]Position{
- "": {1, 1},
- "foo": {1, 1},
- "foo.bar": {2, 1},
- "foo.baz": {3, 1},
- })
-}
-
-func TestDocumentPositionsWithSpaces(t *testing.T) {
- assertPosition(t,
- " [foo]\n bar=42\n baz=69",
- map[string]Position{
- "": {1, 1},
- "foo": {1, 3},
- "foo.bar": {2, 3},
- "foo.baz": {3, 3},
- })
-}
-
-func TestDocumentPositionsWithGroupArray(t *testing.T) {
- assertPosition(t,
- "[[foo]]\nbar=42\nbaz=69",
- map[string]Position{
- "": {1, 1},
- "foo": {1, 1},
- "foo.bar": {2, 1},
- "foo.baz": {3, 1},
- })
-}
-
-func TestNestedTreePosition(t *testing.T) {
- assertPosition(t,
- "[foo.bar]\na=42\nb=69",
- map[string]Position{
- "": {1, 1},
- "foo": {1, 1},
- "foo.bar": {1, 1},
- "foo.bar.a": {2, 1},
- "foo.bar.b": {3, 1},
- })
-}
-
-func TestInvalidGroupArray(t *testing.T) {
- _, err := Load("[table#key]\nanswer = 42")
- if err == nil {
- t.Error("Should error")
- }
-
- _, err = Load("[foo.[bar]\na = 42")
- if err.Error() != "(1, 2): unexpected token table key cannot contain ']', was expecting a table key" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestDoubleEqual(t *testing.T) {
- _, err := Load("foo= = 2")
- if err.Error() != "(1, 6): cannot have multiple equals for the same key" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestGroupArrayReassign(t *testing.T) {
- _, err := Load("[hello]\n[[hello]]")
- if err.Error() != "(2, 3): key \"hello\" is already assigned and not of type table array" {
- t.Error("Bad error message:", err.Error())
- }
-}
-
-func TestInvalidFloatParsing(t *testing.T) {
- _, err := Load("a=1e_2")
- if err.Error() != "(1, 3): invalid use of _ in number" {
- t.Error("Bad error message:", err.Error())
- }
-
- _, err = Load("a=1e2_")
- if err.Error() != "(1, 3): invalid use of _ in number" {
- t.Error("Bad error message:", err.Error())
- }
-
- _, err = Load("a=1__2")
- if err.Error() != "(1, 3): invalid use of _ in number" {
- t.Error("Bad error message:", err.Error())
- }
-
- _, err = Load("a=_1_2")
- if err.Error() != "(1, 3): cannot start number with underscore" {
- t.Error("Bad error message:", err.Error())
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/position.go b/vendor/github.com/pelletier/go-toml/position.go
deleted file mode 100644
index c17bff87..00000000
--- a/vendor/github.com/pelletier/go-toml/position.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Position support for go-toml
-
-package toml
-
-import (
- "fmt"
-)
-
-// Position of a document element within a TOML document.
-//
-// Line and Col are both 1-indexed positions for the element's line number and
-// column number, respectively. Values of zero or less will cause Invalid(),
-// to return true.
-type Position struct {
- Line int // line within the document
- Col int // column within the line
-}
-
-// String representation of the position.
-// Displays 1-indexed line and column numbers.
-func (p Position) String() string {
- return fmt.Sprintf("(%d, %d)", p.Line, p.Col)
-}
-
-// Invalid returns whether or not the position is valid (i.e. with negative or
-// null values)
-func (p Position) Invalid() bool {
- return p.Line <= 0 || p.Col <= 0
-}
diff --git a/vendor/github.com/pelletier/go-toml/position_test.go b/vendor/github.com/pelletier/go-toml/position_test.go
deleted file mode 100644
index 63ad1afc..00000000
--- a/vendor/github.com/pelletier/go-toml/position_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Testing support for go-toml
-
-package toml
-
-import (
- "testing"
-)
-
-func TestPositionString(t *testing.T) {
- p := Position{123, 456}
- expected := "(123, 456)"
- value := p.String()
-
- if value != expected {
- t.Errorf("Expected %v, got %v instead", expected, value)
- }
-}
-
-func TestInvalid(t *testing.T) {
- for i, v := range []Position{
- {0, 1234},
- {1234, 0},
- {0, 0},
- } {
- if !v.Invalid() {
- t.Errorf("Position at %v is valid: %v", i, v)
- }
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/doc.go b/vendor/github.com/pelletier/go-toml/query/doc.go
deleted file mode 100644
index ed63c110..00000000
--- a/vendor/github.com/pelletier/go-toml/query/doc.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Package query performs JSONPath-like queries on a TOML document.
-//
-// The query path implementation is based loosely on the JSONPath specification:
-// http://goessner.net/articles/JsonPath/.
-//
-// The idea behind a query path is to allow quick access to any element, or set
-// of elements within TOML document, with a single expression.
-//
-// result, err := query.CompileAndExecute("$.foo.bar.baz", tree)
-//
-// This is roughly equivalent to:
-//
-// next := tree.Get("foo")
-// if next != nil {
-// next = next.Get("bar")
-// if next != nil {
-// next = next.Get("baz")
-// }
-// }
-// result := next
-//
-// err is nil if any parsing exception occurs.
-//
-// If no node in the tree matches the query, result will simply contain an empty list of
-// items.
-//
-// As illustrated above, the query path is much more efficient, especially since
-// the structure of the TOML file can vary. Rather than making assumptions about
-// a document's structure, a query allows the programmer to make structured
-// requests into the document, and get zero or more values as a result.
-//
-// Query syntax
-//
-// The syntax of a query begins with a root token, followed by any number
-// sub-expressions:
-//
-// $
-// Root of the TOML tree. This must always come first.
-// .name
-// Selects child of this node, where 'name' is a TOML key
-// name.
-// ['name']
-// Selects child of this node, where 'name' is a string
-// containing a TOML key name.
-// [index]
-// Selcts child array element at 'index'.
-// ..expr
-// Recursively selects all children, filtered by an a union,
-// index, or slice expression.
-// ..*
-// Recursive selection of all nodes at this point in the
-// tree.
-// .*
-// Selects all children of the current node.
-// [expr,expr]
-// Union operator - a logical 'or' grouping of two or more
-// sub-expressions: index, key name, or filter.
-// [start:end:step]
-// Slice operator - selects array elements from start to
-// end-1, at the given step. All three arguments are
-// optional.
-// [?(filter)]
-// Named filter expression - the function 'filter' is
-// used to filter children at this node.
-//
-// Query Indexes And Slices
-//
-// Index expressions perform no bounds checking, and will contribute no
-// values to the result set if the provided index or index range is invalid.
-// Negative indexes represent values from the end of the array, counting backwards.
-//
-// // select the last index of the array named 'foo'
-// query.CompileAndExecute("$.foo[-1]", tree)
-//
-// Slice expressions are supported, by using ':' to separate a start/end index pair.
-//
-// // select up to the first five elements in the array
-// query.CompileAndExecute("$.foo[0:5]", tree)
-//
-// Slice expressions also allow negative indexes for the start and stop
-// arguments.
-//
-// // select all array elements.
-// query.CompileAndExecute("$.foo[0:-1]", tree)
-//
-// Slice expressions may have an optional stride/step parameter:
-//
-// // select every other element
-// query.CompileAndExecute("$.foo[0:-1:2]", tree)
-//
-// Slice start and end parameters are also optional:
-//
-// // these are all equivalent and select all the values in the array
-// query.CompileAndExecute("$.foo[:]", tree)
-// query.CompileAndExecute("$.foo[0:]", tree)
-// query.CompileAndExecute("$.foo[:-1]", tree)
-// query.CompileAndExecute("$.foo[0:-1:]", tree)
-// query.CompileAndExecute("$.foo[::1]", tree)
-// query.CompileAndExecute("$.foo[0::1]", tree)
-// query.CompileAndExecute("$.foo[:-1:1]", tree)
-// query.CompileAndExecute("$.foo[0:-1:1]", tree)
-//
-// Query Filters
-//
-// Query filters are used within a Union [,] or single Filter [] expression.
-// A filter only allows nodes that qualify through to the next expression,
-// and/or into the result set.
-//
-// // returns children of foo that are permitted by the 'bar' filter.
-// query.CompileAndExecute("$.foo[?(bar)]", tree)
-//
-// There are several filters provided with the library:
-//
-// tree
-// Allows nodes of type Tree.
-// int
-// Allows nodes of type int64.
-// float
-// Allows nodes of type float64.
-// string
-// Allows nodes of type string.
-// time
-// Allows nodes of type time.Time.
-// bool
-// Allows nodes of type bool.
-//
-// Query Results
-//
-// An executed query returns a Result object. This contains the nodes
-// in the TOML tree that qualify the query expression. Position information
-// is also available for each value in the set.
-//
-// // display the results of a query
-// results := query.CompileAndExecute("$.foo.bar.baz", tree)
-// for idx, value := results.Values() {
-// fmt.Println("%v: %v", results.Positions()[idx], value)
-// }
-//
-// Compiled Queries
-//
-// Queries may be executed directly on a Tree object, or compiled ahead
-// of time and executed discretely. The former is more convenient, but has the
-// penalty of having to recompile the query expression each time.
-//
-// // basic query
-// results := query.CompileAndExecute("$.foo.bar.baz", tree)
-//
-// // compiled query
-// query, err := toml.Compile("$.foo.bar.baz")
-// results := query.Execute(tree)
-//
-// // run the compiled query again on a different tree
-// moreResults := query.Execute(anotherTree)
-//
-// User Defined Query Filters
-//
-// Filter expressions may also be user defined by using the SetFilter()
-// function on the Query object. The function must return true/false, which
-// signifies if the passed node is kept or discarded, respectively.
-//
-// // create a query that references a user-defined filter
-// query, _ := query.Compile("$[?(bazOnly)]")
-//
-// // define the filter, and assign it to the query
-// query.SetFilter("bazOnly", func(node interface{}) bool{
-// if tree, ok := node.(*Tree); ok {
-// return tree.Has("baz")
-// }
-// return false // reject all other node types
-// })
-//
-// // run the query
-// query.Execute(tree)
-//
-package query
diff --git a/vendor/github.com/pelletier/go-toml/query/lexer.go b/vendor/github.com/pelletier/go-toml/query/lexer.go
deleted file mode 100644
index 2dc31940..00000000
--- a/vendor/github.com/pelletier/go-toml/query/lexer.go
+++ /dev/null
@@ -1,357 +0,0 @@
-// TOML JSONPath lexer.
-//
-// Written using the principles developed by Rob Pike in
-// http://www.youtube.com/watch?v=HxaD_trXwRE
-
-package query
-
-import (
- "fmt"
- "github.com/pelletier/go-toml"
- "strconv"
- "strings"
- "unicode/utf8"
-)
-
-// Lexer state function
-type queryLexStateFn func() queryLexStateFn
-
-// Lexer definition
-type queryLexer struct {
- input string
- start int
- pos int
- width int
- tokens chan token
- depth int
- line int
- col int
- stringTerm string
-}
-
-func (l *queryLexer) run() {
- for state := l.lexVoid; state != nil; {
- state = state()
- }
- close(l.tokens)
-}
-
-func (l *queryLexer) nextStart() {
- // iterate by runes (utf8 characters)
- // search for newlines and advance line/col counts
- for i := l.start; i < l.pos; {
- r, width := utf8.DecodeRuneInString(l.input[i:])
- if r == '\n' {
- l.line++
- l.col = 1
- } else {
- l.col++
- }
- i += width
- }
- // advance start position to next token
- l.start = l.pos
-}
-
-func (l *queryLexer) emit(t tokenType) {
- l.tokens <- token{
- Position: toml.Position{Line: l.line, Col: l.col},
- typ: t,
- val: l.input[l.start:l.pos],
- }
- l.nextStart()
-}
-
-func (l *queryLexer) emitWithValue(t tokenType, value string) {
- l.tokens <- token{
- Position: toml.Position{Line: l.line, Col: l.col},
- typ: t,
- val: value,
- }
- l.nextStart()
-}
-
-func (l *queryLexer) next() rune {
- if l.pos >= len(l.input) {
- l.width = 0
- return eof
- }
- var r rune
- r, l.width = utf8.DecodeRuneInString(l.input[l.pos:])
- l.pos += l.width
- return r
-}
-
-func (l *queryLexer) ignore() {
- l.nextStart()
-}
-
-func (l *queryLexer) backup() {
- l.pos -= l.width
-}
-
-func (l *queryLexer) errorf(format string, args ...interface{}) queryLexStateFn {
- l.tokens <- token{
- Position: toml.Position{Line: l.line, Col: l.col},
- typ: tokenError,
- val: fmt.Sprintf(format, args...),
- }
- return nil
-}
-
-func (l *queryLexer) peek() rune {
- r := l.next()
- l.backup()
- return r
-}
-
-func (l *queryLexer) accept(valid string) bool {
- if strings.ContainsRune(valid, l.next()) {
- return true
- }
- l.backup()
- return false
-}
-
-func (l *queryLexer) follow(next string) bool {
- return strings.HasPrefix(l.input[l.pos:], next)
-}
-
-func (l *queryLexer) lexVoid() queryLexStateFn {
- for {
- next := l.peek()
- switch next {
- case '$':
- l.pos++
- l.emit(tokenDollar)
- continue
- case '.':
- if l.follow("..") {
- l.pos += 2
- l.emit(tokenDotDot)
- } else {
- l.pos++
- l.emit(tokenDot)
- }
- continue
- case '[':
- l.pos++
- l.emit(tokenLeftBracket)
- continue
- case ']':
- l.pos++
- l.emit(tokenRightBracket)
- continue
- case ',':
- l.pos++
- l.emit(tokenComma)
- continue
- case '*':
- l.pos++
- l.emit(tokenStar)
- continue
- case '(':
- l.pos++
- l.emit(tokenLeftParen)
- continue
- case ')':
- l.pos++
- l.emit(tokenRightParen)
- continue
- case '?':
- l.pos++
- l.emit(tokenQuestion)
- continue
- case ':':
- l.pos++
- l.emit(tokenColon)
- continue
- case '\'':
- l.ignore()
- l.stringTerm = string(next)
- return l.lexString
- case '"':
- l.ignore()
- l.stringTerm = string(next)
- return l.lexString
- }
-
- if isSpace(next) {
- l.next()
- l.ignore()
- continue
- }
-
- if isAlphanumeric(next) {
- return l.lexKey
- }
-
- if next == '+' || next == '-' || isDigit(next) {
- return l.lexNumber
- }
-
- if l.next() == eof {
- break
- }
-
- return l.errorf("unexpected char: '%v'", next)
- }
- l.emit(tokenEOF)
- return nil
-}
-
-func (l *queryLexer) lexKey() queryLexStateFn {
- for {
- next := l.peek()
- if !isAlphanumeric(next) {
- l.emit(tokenKey)
- return l.lexVoid
- }
-
- if l.next() == eof {
- break
- }
- }
- l.emit(tokenEOF)
- return nil
-}
-
-func (l *queryLexer) lexString() queryLexStateFn {
- l.pos++
- l.ignore()
- growingString := ""
-
- for {
- if l.follow(l.stringTerm) {
- l.emitWithValue(tokenString, growingString)
- l.pos++
- l.ignore()
- return l.lexVoid
- }
-
- if l.follow("\\\"") {
- l.pos++
- growingString += "\""
- } else if l.follow("\\'") {
- l.pos++
- growingString += "'"
- } else if l.follow("\\n") {
- l.pos++
- growingString += "\n"
- } else if l.follow("\\b") {
- l.pos++
- growingString += "\b"
- } else if l.follow("\\f") {
- l.pos++
- growingString += "\f"
- } else if l.follow("\\/") {
- l.pos++
- growingString += "/"
- } else if l.follow("\\t") {
- l.pos++
- growingString += "\t"
- } else if l.follow("\\r") {
- l.pos++
- growingString += "\r"
- } else if l.follow("\\\\") {
- l.pos++
- growingString += "\\"
- } else if l.follow("\\u") {
- l.pos += 2
- code := ""
- for i := 0; i < 4; i++ {
- c := l.peek()
- l.pos++
- if !isHexDigit(c) {
- return l.errorf("unfinished unicode escape")
- }
- code = code + string(c)
- }
- l.pos--
- intcode, err := strconv.ParseInt(code, 16, 32)
- if err != nil {
- return l.errorf("invalid unicode escape: \\u" + code)
- }
- growingString += string(rune(intcode))
- } else if l.follow("\\U") {
- l.pos += 2
- code := ""
- for i := 0; i < 8; i++ {
- c := l.peek()
- l.pos++
- if !isHexDigit(c) {
- return l.errorf("unfinished unicode escape")
- }
- code = code + string(c)
- }
- l.pos--
- intcode, err := strconv.ParseInt(code, 16, 32)
- if err != nil {
- return l.errorf("invalid unicode escape: \\u" + code)
- }
- growingString += string(rune(intcode))
- } else if l.follow("\\") {
- l.pos++
- return l.errorf("invalid escape sequence: \\" + string(l.peek()))
- } else {
- growingString += string(l.peek())
- }
-
- if l.next() == eof {
- break
- }
- }
-
- return l.errorf("unclosed string")
-}
-
-func (l *queryLexer) lexNumber() queryLexStateFn {
- l.ignore()
- if !l.accept("+") {
- l.accept("-")
- }
- pointSeen := false
- digitSeen := false
- for {
- next := l.next()
- if next == '.' {
- if pointSeen {
- return l.errorf("cannot have two dots in one float")
- }
- if !isDigit(l.peek()) {
- return l.errorf("float cannot end with a dot")
- }
- pointSeen = true
- } else if isDigit(next) {
- digitSeen = true
- } else {
- l.backup()
- break
- }
- if pointSeen && !digitSeen {
- return l.errorf("cannot start float with a dot")
- }
- }
-
- if !digitSeen {
- return l.errorf("no digit in that number")
- }
- if pointSeen {
- l.emit(tokenFloat)
- } else {
- l.emit(tokenInteger)
- }
- return l.lexVoid
-}
-
-// Entry point
-func lexQuery(input string) chan token {
- l := &queryLexer{
- input: input,
- tokens: make(chan token),
- line: 1,
- col: 1,
- }
- go l.run()
- return l.tokens
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/lexer_test.go b/vendor/github.com/pelletier/go-toml/query/lexer_test.go
deleted file mode 100644
index 8ce0501f..00000000
--- a/vendor/github.com/pelletier/go-toml/query/lexer_test.go
+++ /dev/null
@@ -1,179 +0,0 @@
-package query
-
-import (
- "github.com/pelletier/go-toml"
- "testing"
-)
-
-func testQLFlow(t *testing.T, input string, expectedFlow []token) {
- ch := lexQuery(input)
- for idx, expected := range expectedFlow {
- token := <-ch
- if token != expected {
- t.Log("While testing #", idx, ":", input)
- t.Log("compared (got)", token, "to (expected)", expected)
- t.Log("\tvalue:", token.val, "<->", expected.val)
- t.Log("\tvalue as bytes:", []byte(token.val), "<->", []byte(expected.val))
- t.Log("\ttype:", token.typ.String(), "<->", expected.typ.String())
- t.Log("\tline:", token.Line, "<->", expected.Line)
- t.Log("\tcolumn:", token.Col, "<->", expected.Col)
- t.Log("compared", token, "to", expected)
- t.FailNow()
- }
- }
-
- tok, ok := <-ch
- if ok {
- t.Log("channel is not closed!")
- t.Log(len(ch)+1, "tokens remaining:")
-
- t.Log("token ->", tok)
- for token := range ch {
- t.Log("token ->", token)
- }
- t.FailNow()
- }
-}
-
-func TestLexSpecialChars(t *testing.T) {
- testQLFlow(t, " .$[]..()?*", []token{
- {toml.Position{1, 2}, tokenDot, "."},
- {toml.Position{1, 3}, tokenDollar, "$"},
- {toml.Position{1, 4}, tokenLeftBracket, "["},
- {toml.Position{1, 5}, tokenRightBracket, "]"},
- {toml.Position{1, 6}, tokenDotDot, ".."},
- {toml.Position{1, 8}, tokenLeftParen, "("},
- {toml.Position{1, 9}, tokenRightParen, ")"},
- {toml.Position{1, 10}, tokenQuestion, "?"},
- {toml.Position{1, 11}, tokenStar, "*"},
- {toml.Position{1, 12}, tokenEOF, ""},
- })
-}
-
-func TestLexString(t *testing.T) {
- testQLFlow(t, "'foo\n'", []token{
- {toml.Position{1, 2}, tokenString, "foo\n"},
- {toml.Position{2, 2}, tokenEOF, ""},
- })
-}
-
-func TestLexDoubleString(t *testing.T) {
- testQLFlow(t, `"bar"`, []token{
- {toml.Position{1, 2}, tokenString, "bar"},
- {toml.Position{1, 6}, tokenEOF, ""},
- })
-}
-
-func TestLexStringEscapes(t *testing.T) {
- testQLFlow(t, `"foo \" \' \b \f \/ \t \r \\ \u03A9 \U00012345 \n bar"`, []token{
- {toml.Position{1, 2}, tokenString, "foo \" ' \b \f / \t \r \\ \u03A9 \U00012345 \n bar"},
- {toml.Position{1, 55}, tokenEOF, ""},
- })
-}
-
-func TestLexStringUnfinishedUnicode4(t *testing.T) {
- testQLFlow(t, `"\u000"`, []token{
- {toml.Position{1, 2}, tokenError, "unfinished unicode escape"},
- })
-}
-
-func TestLexStringUnfinishedUnicode8(t *testing.T) {
- testQLFlow(t, `"\U0000"`, []token{
- {toml.Position{1, 2}, tokenError, "unfinished unicode escape"},
- })
-}
-
-func TestLexStringInvalidEscape(t *testing.T) {
- testQLFlow(t, `"\x"`, []token{
- {toml.Position{1, 2}, tokenError, "invalid escape sequence: \\x"},
- })
-}
-
-func TestLexStringUnfinished(t *testing.T) {
- testQLFlow(t, `"bar`, []token{
- {toml.Position{1, 2}, tokenError, "unclosed string"},
- })
-}
-
-func TestLexKey(t *testing.T) {
- testQLFlow(t, "foo", []token{
- {toml.Position{1, 1}, tokenKey, "foo"},
- {toml.Position{1, 4}, tokenEOF, ""},
- })
-}
-
-func TestLexRecurse(t *testing.T) {
- testQLFlow(t, "$..*", []token{
- {toml.Position{1, 1}, tokenDollar, "$"},
- {toml.Position{1, 2}, tokenDotDot, ".."},
- {toml.Position{1, 4}, tokenStar, "*"},
- {toml.Position{1, 5}, tokenEOF, ""},
- })
-}
-
-func TestLexBracketKey(t *testing.T) {
- testQLFlow(t, "$[foo]", []token{
- {toml.Position{1, 1}, tokenDollar, "$"},
- {toml.Position{1, 2}, tokenLeftBracket, "["},
- {toml.Position{1, 3}, tokenKey, "foo"},
- {toml.Position{1, 6}, tokenRightBracket, "]"},
- {toml.Position{1, 7}, tokenEOF, ""},
- })
-}
-
-func TestLexSpace(t *testing.T) {
- testQLFlow(t, "foo bar baz", []token{
- {toml.Position{1, 1}, tokenKey, "foo"},
- {toml.Position{1, 5}, tokenKey, "bar"},
- {toml.Position{1, 9}, tokenKey, "baz"},
- {toml.Position{1, 12}, tokenEOF, ""},
- })
-}
-
-func TestLexInteger(t *testing.T) {
- testQLFlow(t, "100 +200 -300", []token{
- {toml.Position{1, 1}, tokenInteger, "100"},
- {toml.Position{1, 5}, tokenInteger, "+200"},
- {toml.Position{1, 10}, tokenInteger, "-300"},
- {toml.Position{1, 14}, tokenEOF, ""},
- })
-}
-
-func TestLexFloat(t *testing.T) {
- testQLFlow(t, "100.0 +200.0 -300.0", []token{
- {toml.Position{1, 1}, tokenFloat, "100.0"},
- {toml.Position{1, 7}, tokenFloat, "+200.0"},
- {toml.Position{1, 14}, tokenFloat, "-300.0"},
- {toml.Position{1, 20}, tokenEOF, ""},
- })
-}
-
-func TestLexFloatWithMultipleDots(t *testing.T) {
- testQLFlow(t, "4.2.", []token{
- {toml.Position{1, 1}, tokenError, "cannot have two dots in one float"},
- })
-}
-
-func TestLexFloatLeadingDot(t *testing.T) {
- testQLFlow(t, "+.1", []token{
- {toml.Position{1, 1}, tokenError, "cannot start float with a dot"},
- })
-}
-
-func TestLexFloatWithTrailingDot(t *testing.T) {
- testQLFlow(t, "42.", []token{
- {toml.Position{1, 1}, tokenError, "float cannot end with a dot"},
- })
-}
-
-func TestLexNumberWithoutDigit(t *testing.T) {
- testQLFlow(t, "+", []token{
- {toml.Position{1, 1}, tokenError, "no digit in that number"},
- })
-}
-
-func TestLexUnknown(t *testing.T) {
- testQLFlow(t, "^", []token{
- {toml.Position{1, 1}, tokenError, "unexpected char: '94'"},
- })
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/match.go b/vendor/github.com/pelletier/go-toml/query/match.go
deleted file mode 100644
index d7bb15a4..00000000
--- a/vendor/github.com/pelletier/go-toml/query/match.go
+++ /dev/null
@@ -1,232 +0,0 @@
-package query
-
-import (
- "fmt"
- "github.com/pelletier/go-toml"
-)
-
-// base match
-type matchBase struct {
- next pathFn
-}
-
-func (f *matchBase) setNext(next pathFn) {
- f.next = next
-}
-
-// terminating functor - gathers results
-type terminatingFn struct {
- // empty
-}
-
-func newTerminatingFn() *terminatingFn {
- return &terminatingFn{}
-}
-
-func (f *terminatingFn) setNext(next pathFn) {
- // do nothing
-}
-
-func (f *terminatingFn) call(node interface{}, ctx *queryContext) {
- ctx.result.appendResult(node, ctx.lastPosition)
-}
-
-// match single key
-type matchKeyFn struct {
- matchBase
- Name string
-}
-
-func newMatchKeyFn(name string) *matchKeyFn {
- return &matchKeyFn{Name: name}
-}
-
-func (f *matchKeyFn) call(node interface{}, ctx *queryContext) {
- if array, ok := node.([]*toml.Tree); ok {
- for _, tree := range array {
- item := tree.Get(f.Name)
- if item != nil {
- ctx.lastPosition = tree.GetPosition(f.Name)
- f.next.call(item, ctx)
- }
- }
- } else if tree, ok := node.(*toml.Tree); ok {
- item := tree.Get(f.Name)
- if item != nil {
- ctx.lastPosition = tree.GetPosition(f.Name)
- f.next.call(item, ctx)
- }
- }
-}
-
-// match single index
-type matchIndexFn struct {
- matchBase
- Idx int
-}
-
-func newMatchIndexFn(idx int) *matchIndexFn {
- return &matchIndexFn{Idx: idx}
-}
-
-func (f *matchIndexFn) call(node interface{}, ctx *queryContext) {
- if arr, ok := node.([]interface{}); ok {
- if f.Idx < len(arr) && f.Idx >= 0 {
- if treesArray, ok := node.([]*toml.Tree); ok {
- if len(treesArray) > 0 {
- ctx.lastPosition = treesArray[0].Position()
- }
- }
- f.next.call(arr[f.Idx], ctx)
- }
- }
-}
-
-// filter by slicing
-type matchSliceFn struct {
- matchBase
- Start, End, Step int
-}
-
-func newMatchSliceFn(start, end, step int) *matchSliceFn {
- return &matchSliceFn{Start: start, End: end, Step: step}
-}
-
-func (f *matchSliceFn) call(node interface{}, ctx *queryContext) {
- if arr, ok := node.([]interface{}); ok {
- // adjust indexes for negative values, reverse ordering
- realStart, realEnd := f.Start, f.End
- if realStart < 0 {
- realStart = len(arr) + realStart
- }
- if realEnd < 0 {
- realEnd = len(arr) + realEnd
- }
- if realEnd < realStart {
- realEnd, realStart = realStart, realEnd // swap
- }
- // loop and gather
- for idx := realStart; idx < realEnd; idx += f.Step {
- if treesArray, ok := node.([]*toml.Tree); ok {
- if len(treesArray) > 0 {
- ctx.lastPosition = treesArray[0].Position()
- }
- }
- f.next.call(arr[idx], ctx)
- }
- }
-}
-
-// match anything
-type matchAnyFn struct {
- matchBase
-}
-
-func newMatchAnyFn() *matchAnyFn {
- return &matchAnyFn{}
-}
-
-func (f *matchAnyFn) call(node interface{}, ctx *queryContext) {
- if tree, ok := node.(*toml.Tree); ok {
- for _, k := range tree.Keys() {
- v := tree.Get(k)
- ctx.lastPosition = tree.GetPosition(k)
- f.next.call(v, ctx)
- }
- }
-}
-
-// filter through union
-type matchUnionFn struct {
- Union []pathFn
-}
-
-func (f *matchUnionFn) setNext(next pathFn) {
- for _, fn := range f.Union {
- fn.setNext(next)
- }
-}
-
-func (f *matchUnionFn) call(node interface{}, ctx *queryContext) {
- for _, fn := range f.Union {
- fn.call(node, ctx)
- }
-}
-
-// match every single last node in the tree
-type matchRecursiveFn struct {
- matchBase
-}
-
-func newMatchRecursiveFn() *matchRecursiveFn {
- return &matchRecursiveFn{}
-}
-
-func (f *matchRecursiveFn) call(node interface{}, ctx *queryContext) {
- originalPosition := ctx.lastPosition
- if tree, ok := node.(*toml.Tree); ok {
- var visit func(tree *toml.Tree)
- visit = func(tree *toml.Tree) {
- for _, k := range tree.Keys() {
- v := tree.Get(k)
- ctx.lastPosition = tree.GetPosition(k)
- f.next.call(v, ctx)
- switch node := v.(type) {
- case *toml.Tree:
- visit(node)
- case []*toml.Tree:
- for _, subtree := range node {
- visit(subtree)
- }
- }
- }
- }
- ctx.lastPosition = originalPosition
- f.next.call(tree, ctx)
- visit(tree)
- }
-}
-
-// match based on an externally provided functional filter
-type matchFilterFn struct {
- matchBase
- Pos toml.Position
- Name string
-}
-
-func newMatchFilterFn(name string, pos toml.Position) *matchFilterFn {
- return &matchFilterFn{Name: name, Pos: pos}
-}
-
-func (f *matchFilterFn) call(node interface{}, ctx *queryContext) {
- fn, ok := (*ctx.filters)[f.Name]
- if !ok {
- panic(fmt.Sprintf("%s: query context does not have filter '%s'",
- f.Pos.String(), f.Name))
- }
- switch castNode := node.(type) {
- case *toml.Tree:
- for _, k := range castNode.Keys() {
- v := castNode.Get(k)
- if fn(v) {
- ctx.lastPosition = castNode.GetPosition(k)
- f.next.call(v, ctx)
- }
- }
- case []*toml.Tree:
- for _, v := range castNode {
- if fn(v) {
- if len(castNode) > 0 {
- ctx.lastPosition = castNode[0].Position()
- }
- f.next.call(v, ctx)
- }
- }
- case []interface{}:
- for _, v := range castNode {
- if fn(v) {
- f.next.call(v, ctx)
- }
- }
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/match_test.go b/vendor/github.com/pelletier/go-toml/query/match_test.go
deleted file mode 100644
index 429b8f6b..00000000
--- a/vendor/github.com/pelletier/go-toml/query/match_test.go
+++ /dev/null
@@ -1,202 +0,0 @@
-package query
-
-import (
- "fmt"
- "github.com/pelletier/go-toml"
- "testing"
-)
-
-// dump path tree to a string
-func pathString(root pathFn) string {
- result := fmt.Sprintf("%T:", root)
- switch fn := root.(type) {
- case *terminatingFn:
- result += "{}"
- case *matchKeyFn:
- result += fmt.Sprintf("{%s}", fn.Name)
- result += pathString(fn.next)
- case *matchIndexFn:
- result += fmt.Sprintf("{%d}", fn.Idx)
- result += pathString(fn.next)
- case *matchSliceFn:
- result += fmt.Sprintf("{%d:%d:%d}",
- fn.Start, fn.End, fn.Step)
- result += pathString(fn.next)
- case *matchAnyFn:
- result += "{}"
- result += pathString(fn.next)
- case *matchUnionFn:
- result += "{["
- for _, v := range fn.Union {
- result += pathString(v) + ", "
- }
- result += "]}"
- case *matchRecursiveFn:
- result += "{}"
- result += pathString(fn.next)
- case *matchFilterFn:
- result += fmt.Sprintf("{%s}", fn.Name)
- result += pathString(fn.next)
- }
- return result
-}
-
-func assertPathMatch(t *testing.T, path, ref *Query) bool {
- pathStr := pathString(path.root)
- refStr := pathString(ref.root)
- if pathStr != refStr {
- t.Errorf("paths do not match")
- t.Log("test:", pathStr)
- t.Log("ref: ", refStr)
- return false
- }
- return true
-}
-
-func assertPath(t *testing.T, query string, ref *Query) {
- path, _ := parseQuery(lexQuery(query))
- assertPathMatch(t, path, ref)
-}
-
-func buildPath(parts ...pathFn) *Query {
- query := newQuery()
- for _, v := range parts {
- query.appendPath(v)
- }
- return query
-}
-
-func TestPathRoot(t *testing.T) {
- assertPath(t,
- "$",
- buildPath(
- // empty
- ))
-}
-
-func TestPathKey(t *testing.T) {
- assertPath(t,
- "$.foo",
- buildPath(
- newMatchKeyFn("foo"),
- ))
-}
-
-func TestPathBracketKey(t *testing.T) {
- assertPath(t,
- "$[foo]",
- buildPath(
- newMatchKeyFn("foo"),
- ))
-}
-
-func TestPathBracketStringKey(t *testing.T) {
- assertPath(t,
- "$['foo']",
- buildPath(
- newMatchKeyFn("foo"),
- ))
-}
-
-func TestPathIndex(t *testing.T) {
- assertPath(t,
- "$[123]",
- buildPath(
- newMatchIndexFn(123),
- ))
-}
-
-func TestPathSliceStart(t *testing.T) {
- assertPath(t,
- "$[123:]",
- buildPath(
- newMatchSliceFn(123, maxInt, 1),
- ))
-}
-
-func TestPathSliceStartEnd(t *testing.T) {
- assertPath(t,
- "$[123:456]",
- buildPath(
- newMatchSliceFn(123, 456, 1),
- ))
-}
-
-func TestPathSliceStartEndColon(t *testing.T) {
- assertPath(t,
- "$[123:456:]",
- buildPath(
- newMatchSliceFn(123, 456, 1),
- ))
-}
-
-func TestPathSliceStartStep(t *testing.T) {
- assertPath(t,
- "$[123::7]",
- buildPath(
- newMatchSliceFn(123, maxInt, 7),
- ))
-}
-
-func TestPathSliceEndStep(t *testing.T) {
- assertPath(t,
- "$[:456:7]",
- buildPath(
- newMatchSliceFn(0, 456, 7),
- ))
-}
-
-func TestPathSliceStep(t *testing.T) {
- assertPath(t,
- "$[::7]",
- buildPath(
- newMatchSliceFn(0, maxInt, 7),
- ))
-}
-
-func TestPathSliceAll(t *testing.T) {
- assertPath(t,
- "$[123:456:7]",
- buildPath(
- newMatchSliceFn(123, 456, 7),
- ))
-}
-
-func TestPathAny(t *testing.T) {
- assertPath(t,
- "$.*",
- buildPath(
- newMatchAnyFn(),
- ))
-}
-
-func TestPathUnion(t *testing.T) {
- assertPath(t,
- "$[foo, bar, baz]",
- buildPath(
- &matchUnionFn{[]pathFn{
- newMatchKeyFn("foo"),
- newMatchKeyFn("bar"),
- newMatchKeyFn("baz"),
- }},
- ))
-}
-
-func TestPathRecurse(t *testing.T) {
- assertPath(t,
- "$..*",
- buildPath(
- newMatchRecursiveFn(),
- ))
-}
-
-func TestPathFilterExpr(t *testing.T) {
- assertPath(t,
- "$[?('foo'),?(bar)]",
- buildPath(
- &matchUnionFn{[]pathFn{
- newMatchFilterFn("foo", toml.Position{}),
- newMatchFilterFn("bar", toml.Position{}),
- }},
- ))
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/parser.go b/vendor/github.com/pelletier/go-toml/query/parser.go
deleted file mode 100644
index 5f69b70d..00000000
--- a/vendor/github.com/pelletier/go-toml/query/parser.go
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- Based on the "jsonpath" spec/concept.
-
- http://goessner.net/articles/JsonPath/
- https://code.google.com/p/json-path/
-*/
-
-package query
-
-import (
- "fmt"
-)
-
-const maxInt = int(^uint(0) >> 1)
-
-type queryParser struct {
- flow chan token
- tokensBuffer []token
- query *Query
- union []pathFn
- err error
-}
-
-type queryParserStateFn func() queryParserStateFn
-
-// Formats and panics an error message based on a token
-func (p *queryParser) parseError(tok *token, msg string, args ...interface{}) queryParserStateFn {
- p.err = fmt.Errorf(tok.Position.String()+": "+msg, args...)
- return nil // trigger parse to end
-}
-
-func (p *queryParser) run() {
- for state := p.parseStart; state != nil; {
- state = state()
- }
-}
-
-func (p *queryParser) backup(tok *token) {
- p.tokensBuffer = append(p.tokensBuffer, *tok)
-}
-
-func (p *queryParser) peek() *token {
- if len(p.tokensBuffer) != 0 {
- return &(p.tokensBuffer[0])
- }
-
- tok, ok := <-p.flow
- if !ok {
- return nil
- }
- p.backup(&tok)
- return &tok
-}
-
-func (p *queryParser) lookahead(types ...tokenType) bool {
- result := true
- buffer := []token{}
-
- for _, typ := range types {
- tok := p.getToken()
- if tok == nil {
- result = false
- break
- }
- buffer = append(buffer, *tok)
- if tok.typ != typ {
- result = false
- break
- }
- }
- // add the tokens back to the buffer, and return
- p.tokensBuffer = append(p.tokensBuffer, buffer...)
- return result
-}
-
-func (p *queryParser) getToken() *token {
- if len(p.tokensBuffer) != 0 {
- tok := p.tokensBuffer[0]
- p.tokensBuffer = p.tokensBuffer[1:]
- return &tok
- }
- tok, ok := <-p.flow
- if !ok {
- return nil
- }
- return &tok
-}
-
-func (p *queryParser) parseStart() queryParserStateFn {
- tok := p.getToken()
-
- if tok == nil || tok.typ == tokenEOF {
- return nil
- }
-
- if tok.typ != tokenDollar {
- return p.parseError(tok, "Expected '$' at start of expression")
- }
-
- return p.parseMatchExpr
-}
-
-// handle '.' prefix, '[]', and '..'
-func (p *queryParser) parseMatchExpr() queryParserStateFn {
- tok := p.getToken()
- switch tok.typ {
- case tokenDotDot:
- p.query.appendPath(&matchRecursiveFn{})
- // nested parse for '..'
- tok := p.getToken()
- switch tok.typ {
- case tokenKey:
- p.query.appendPath(newMatchKeyFn(tok.val))
- return p.parseMatchExpr
- case tokenLeftBracket:
- return p.parseBracketExpr
- case tokenStar:
- // do nothing - the recursive predicate is enough
- return p.parseMatchExpr
- }
-
- case tokenDot:
- // nested parse for '.'
- tok := p.getToken()
- switch tok.typ {
- case tokenKey:
- p.query.appendPath(newMatchKeyFn(tok.val))
- return p.parseMatchExpr
- case tokenStar:
- p.query.appendPath(&matchAnyFn{})
- return p.parseMatchExpr
- }
-
- case tokenLeftBracket:
- return p.parseBracketExpr
-
- case tokenEOF:
- return nil // allow EOF at this stage
- }
- return p.parseError(tok, "expected match expression")
-}
-
-func (p *queryParser) parseBracketExpr() queryParserStateFn {
- if p.lookahead(tokenInteger, tokenColon) {
- return p.parseSliceExpr
- }
- if p.peek().typ == tokenColon {
- return p.parseSliceExpr
- }
- return p.parseUnionExpr
-}
-
-func (p *queryParser) parseUnionExpr() queryParserStateFn {
- var tok *token
-
- // this state can be traversed after some sub-expressions
- // so be careful when setting up state in the parser
- if p.union == nil {
- p.union = []pathFn{}
- }
-
-loop: // labeled loop for easy breaking
- for {
- if len(p.union) > 0 {
- // parse delimiter or terminator
- tok = p.getToken()
- switch tok.typ {
- case tokenComma:
- // do nothing
- case tokenRightBracket:
- break loop
- default:
- return p.parseError(tok, "expected ',' or ']', not '%s'", tok.val)
- }
- }
-
- // parse sub expression
- tok = p.getToken()
- switch tok.typ {
- case tokenInteger:
- p.union = append(p.union, newMatchIndexFn(tok.Int()))
- case tokenKey:
- p.union = append(p.union, newMatchKeyFn(tok.val))
- case tokenString:
- p.union = append(p.union, newMatchKeyFn(tok.val))
- case tokenQuestion:
- return p.parseFilterExpr
- default:
- return p.parseError(tok, "expected union sub expression, not '%s', %d", tok.val, len(p.union))
- }
- }
-
- // if there is only one sub-expression, use that instead
- if len(p.union) == 1 {
- p.query.appendPath(p.union[0])
- } else {
- p.query.appendPath(&matchUnionFn{p.union})
- }
-
- p.union = nil // clear out state
- return p.parseMatchExpr
-}
-
-func (p *queryParser) parseSliceExpr() queryParserStateFn {
- // init slice to grab all elements
- start, end, step := 0, maxInt, 1
-
- // parse optional start
- tok := p.getToken()
- if tok.typ == tokenInteger {
- start = tok.Int()
- tok = p.getToken()
- }
- if tok.typ != tokenColon {
- return p.parseError(tok, "expected ':'")
- }
-
- // parse optional end
- tok = p.getToken()
- if tok.typ == tokenInteger {
- end = tok.Int()
- tok = p.getToken()
- }
- if tok.typ == tokenRightBracket {
- p.query.appendPath(newMatchSliceFn(start, end, step))
- return p.parseMatchExpr
- }
- if tok.typ != tokenColon {
- return p.parseError(tok, "expected ']' or ':'")
- }
-
- // parse optional step
- tok = p.getToken()
- if tok.typ == tokenInteger {
- step = tok.Int()
- if step < 0 {
- return p.parseError(tok, "step must be a positive value")
- }
- tok = p.getToken()
- }
- if tok.typ != tokenRightBracket {
- return p.parseError(tok, "expected ']'")
- }
-
- p.query.appendPath(newMatchSliceFn(start, end, step))
- return p.parseMatchExpr
-}
-
-func (p *queryParser) parseFilterExpr() queryParserStateFn {
- tok := p.getToken()
- if tok.typ != tokenLeftParen {
- return p.parseError(tok, "expected left-parenthesis for filter expression")
- }
- tok = p.getToken()
- if tok.typ != tokenKey && tok.typ != tokenString {
- return p.parseError(tok, "expected key or string for filter function name")
- }
- name := tok.val
- tok = p.getToken()
- if tok.typ != tokenRightParen {
- return p.parseError(tok, "expected right-parenthesis for filter expression")
- }
- p.union = append(p.union, newMatchFilterFn(name, tok.Position))
- return p.parseUnionExpr
-}
-
-func parseQuery(flow chan token) (*Query, error) {
- parser := &queryParser{
- flow: flow,
- tokensBuffer: []token{},
- query: newQuery(),
- }
- parser.run()
- return parser.query, parser.err
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/parser_test.go b/vendor/github.com/pelletier/go-toml/query/parser_test.go
deleted file mode 100644
index 312f51ab..00000000
--- a/vendor/github.com/pelletier/go-toml/query/parser_test.go
+++ /dev/null
@@ -1,482 +0,0 @@
-package query
-
-import (
- "fmt"
- "io/ioutil"
- "sort"
- "strings"
- "testing"
- "time"
-
- "github.com/pelletier/go-toml"
-)
-
-type queryTestNode struct {
- value interface{}
- position toml.Position
-}
-
-func valueString(root interface{}) string {
- result := "" //fmt.Sprintf("%T:", root)
- switch node := root.(type) {
- case *Result:
- items := []string{}
- for i, v := range node.Values() {
- items = append(items, fmt.Sprintf("%s:%s",
- node.Positions()[i].String(), valueString(v)))
- }
- sort.Strings(items)
- result = "[" + strings.Join(items, ", ") + "]"
- case queryTestNode:
- result = fmt.Sprintf("%s:%s",
- node.position.String(), valueString(node.value))
- case []interface{}:
- items := []string{}
- for _, v := range node {
- items = append(items, valueString(v))
- }
- sort.Strings(items)
- result = "[" + strings.Join(items, ", ") + "]"
- case *toml.Tree:
- // workaround for unreliable map key ordering
- items := []string{}
- for _, k := range node.Keys() {
- v := node.GetPath([]string{k})
- items = append(items, k+":"+valueString(v))
- }
- sort.Strings(items)
- result = "{" + strings.Join(items, ", ") + "}"
- case map[string]interface{}:
- // workaround for unreliable map key ordering
- items := []string{}
- for k, v := range node {
- items = append(items, k+":"+valueString(v))
- }
- sort.Strings(items)
- result = "{" + strings.Join(items, ", ") + "}"
- case int64:
- result += fmt.Sprintf("%d", node)
- case string:
- result += "'" + node + "'"
- case float64:
- result += fmt.Sprintf("%f", node)
- case bool:
- result += fmt.Sprintf("%t", node)
- case time.Time:
- result += fmt.Sprintf("'%v'", node)
- }
- return result
-}
-
-func assertValue(t *testing.T, result, ref interface{}) {
- pathStr := valueString(result)
- refStr := valueString(ref)
- if pathStr != refStr {
- t.Errorf("values do not match")
- t.Log("test:", pathStr)
- t.Log("ref: ", refStr)
- }
-}
-
-func assertQueryPositions(t *testing.T, tomlDoc string, query string, ref []interface{}) {
- tree, err := toml.Load(tomlDoc)
- if err != nil {
- t.Errorf("Non-nil toml parse error: %v", err)
- return
- }
- q, err := Compile(query)
- if err != nil {
- t.Error(err)
- return
- }
- results := q.Execute(tree)
- assertValue(t, results, ref)
-}
-
-func TestQueryRoot(t *testing.T) {
- assertQueryPositions(t,
- "a = 42",
- "$",
- []interface{}{
- queryTestNode{
- map[string]interface{}{
- "a": int64(42),
- }, toml.Position{1, 1},
- },
- })
-}
-
-func TestQueryKey(t *testing.T) {
- assertQueryPositions(t,
- "[foo]\na = 42",
- "$.foo.a",
- []interface{}{
- queryTestNode{
- int64(42), toml.Position{2, 1},
- },
- })
-}
-
-func TestQueryKeyString(t *testing.T) {
- assertQueryPositions(t,
- "[foo]\na = 42",
- "$.foo['a']",
- []interface{}{
- queryTestNode{
- int64(42), toml.Position{2, 1},
- },
- })
-}
-
-func TestQueryIndex(t *testing.T) {
- assertQueryPositions(t,
- "[foo]\na = [1,2,3,4,5,6,7,8,9,0]",
- "$.foo.a[5]",
- []interface{}{
- queryTestNode{
- int64(6), toml.Position{2, 1},
- },
- })
-}
-
-func TestQuerySliceRange(t *testing.T) {
- assertQueryPositions(t,
- "[foo]\na = [1,2,3,4,5,6,7,8,9,0]",
- "$.foo.a[0:5]",
- []interface{}{
- queryTestNode{
- int64(1), toml.Position{2, 1},
- },
- queryTestNode{
- int64(2), toml.Position{2, 1},
- },
- queryTestNode{
- int64(3), toml.Position{2, 1},
- },
- queryTestNode{
- int64(4), toml.Position{2, 1},
- },
- queryTestNode{
- int64(5), toml.Position{2, 1},
- },
- })
-}
-
-func TestQuerySliceStep(t *testing.T) {
- assertQueryPositions(t,
- "[foo]\na = [1,2,3,4,5,6,7,8,9,0]",
- "$.foo.a[0:5:2]",
- []interface{}{
- queryTestNode{
- int64(1), toml.Position{2, 1},
- },
- queryTestNode{
- int64(3), toml.Position{2, 1},
- },
- queryTestNode{
- int64(5), toml.Position{2, 1},
- },
- })
-}
-
-func TestQueryAny(t *testing.T) {
- assertQueryPositions(t,
- "[foo.bar]\na=1\nb=2\n[foo.baz]\na=3\nb=4",
- "$.foo.*",
- []interface{}{
- queryTestNode{
- map[string]interface{}{
- "a": int64(1),
- "b": int64(2),
- }, toml.Position{1, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(3),
- "b": int64(4),
- }, toml.Position{4, 1},
- },
- })
-}
-func TestQueryUnionSimple(t *testing.T) {
- assertQueryPositions(t,
- "[foo.bar]\na=1\nb=2\n[baz.foo]\na=3\nb=4\n[gorf.foo]\na=5\nb=6",
- "$.*[bar,foo]",
- []interface{}{
- queryTestNode{
- map[string]interface{}{
- "a": int64(1),
- "b": int64(2),
- }, toml.Position{1, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(3),
- "b": int64(4),
- }, toml.Position{4, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(5),
- "b": int64(6),
- }, toml.Position{7, 1},
- },
- })
-}
-
-func TestQueryRecursionAll(t *testing.T) {
- assertQueryPositions(t,
- "[foo.bar]\na=1\nb=2\n[baz.foo]\na=3\nb=4\n[gorf.foo]\na=5\nb=6",
- "$..*",
- []interface{}{
- queryTestNode{
- map[string]interface{}{
- "foo": map[string]interface{}{
- "bar": map[string]interface{}{
- "a": int64(1),
- "b": int64(2),
- },
- },
- "baz": map[string]interface{}{
- "foo": map[string]interface{}{
- "a": int64(3),
- "b": int64(4),
- },
- },
- "gorf": map[string]interface{}{
- "foo": map[string]interface{}{
- "a": int64(5),
- "b": int64(6),
- },
- },
- }, toml.Position{1, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "bar": map[string]interface{}{
- "a": int64(1),
- "b": int64(2),
- },
- }, toml.Position{1, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(1),
- "b": int64(2),
- }, toml.Position{1, 1},
- },
- queryTestNode{
- int64(1), toml.Position{2, 1},
- },
- queryTestNode{
- int64(2), toml.Position{3, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "foo": map[string]interface{}{
- "a": int64(3),
- "b": int64(4),
- },
- }, toml.Position{4, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(3),
- "b": int64(4),
- }, toml.Position{4, 1},
- },
- queryTestNode{
- int64(3), toml.Position{5, 1},
- },
- queryTestNode{
- int64(4), toml.Position{6, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "foo": map[string]interface{}{
- "a": int64(5),
- "b": int64(6),
- },
- }, toml.Position{7, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(5),
- "b": int64(6),
- }, toml.Position{7, 1},
- },
- queryTestNode{
- int64(5), toml.Position{8, 1},
- },
- queryTestNode{
- int64(6), toml.Position{9, 1},
- },
- })
-}
-
-func TestQueryRecursionUnionSimple(t *testing.T) {
- assertQueryPositions(t,
- "[foo.bar]\na=1\nb=2\n[baz.foo]\na=3\nb=4\n[gorf.foo]\na=5\nb=6",
- "$..['foo','bar']",
- []interface{}{
- queryTestNode{
- map[string]interface{}{
- "bar": map[string]interface{}{
- "a": int64(1),
- "b": int64(2),
- },
- }, toml.Position{1, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(3),
- "b": int64(4),
- }, toml.Position{4, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(1),
- "b": int64(2),
- }, toml.Position{1, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "a": int64(5),
- "b": int64(6),
- }, toml.Position{7, 1},
- },
- })
-}
-
-func TestQueryFilterFn(t *testing.T) {
- buff, err := ioutil.ReadFile("../example.toml")
- if err != nil {
- t.Error(err)
- return
- }
-
- assertQueryPositions(t, string(buff),
- "$..[?(int)]",
- []interface{}{
- queryTestNode{
- int64(8001), toml.Position{13, 1},
- },
- queryTestNode{
- int64(8001), toml.Position{13, 1},
- },
- queryTestNode{
- int64(8002), toml.Position{13, 1},
- },
- queryTestNode{
- int64(5000), toml.Position{14, 1},
- },
- })
-
- assertQueryPositions(t, string(buff),
- "$..[?(string)]",
- []interface{}{
- queryTestNode{
- "TOML Example", toml.Position{3, 1},
- },
- queryTestNode{
- "Tom Preston-Werner", toml.Position{6, 1},
- },
- queryTestNode{
- "GitHub", toml.Position{7, 1},
- },
- queryTestNode{
- "GitHub Cofounder & CEO\nLikes tater tots and beer.",
- toml.Position{8, 1},
- },
- queryTestNode{
- "192.168.1.1", toml.Position{12, 1},
- },
- queryTestNode{
- "10.0.0.1", toml.Position{21, 3},
- },
- queryTestNode{
- "eqdc10", toml.Position{22, 3},
- },
- queryTestNode{
- "10.0.0.2", toml.Position{25, 3},
- },
- queryTestNode{
- "eqdc10", toml.Position{26, 3},
- },
- })
-
- assertQueryPositions(t, string(buff),
- "$..[?(float)]",
- []interface{}{ // no float values in document
- })
-
- tv, _ := time.Parse(time.RFC3339, "1979-05-27T07:32:00Z")
- assertQueryPositions(t, string(buff),
- "$..[?(tree)]",
- []interface{}{
- queryTestNode{
- map[string]interface{}{
- "name": "Tom Preston-Werner",
- "organization": "GitHub",
- "bio": "GitHub Cofounder & CEO\nLikes tater tots and beer.",
- "dob": tv,
- }, toml.Position{5, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "server": "192.168.1.1",
- "ports": []interface{}{int64(8001), int64(8001), int64(8002)},
- "connection_max": int64(5000),
- "enabled": true,
- }, toml.Position{11, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "alpha": map[string]interface{}{
- "ip": "10.0.0.1",
- "dc": "eqdc10",
- },
- "beta": map[string]interface{}{
- "ip": "10.0.0.2",
- "dc": "eqdc10",
- },
- }, toml.Position{17, 1},
- },
- queryTestNode{
- map[string]interface{}{
- "ip": "10.0.0.1",
- "dc": "eqdc10",
- }, toml.Position{20, 3},
- },
- queryTestNode{
- map[string]interface{}{
- "ip": "10.0.0.2",
- "dc": "eqdc10",
- }, toml.Position{24, 3},
- },
- queryTestNode{
- map[string]interface{}{
- "data": []interface{}{
- []interface{}{"gamma", "delta"},
- []interface{}{int64(1), int64(2)},
- },
- }, toml.Position{28, 1},
- },
- })
-
- assertQueryPositions(t, string(buff),
- "$..[?(time)]",
- []interface{}{
- queryTestNode{
- tv, toml.Position{9, 1},
- },
- })
-
- assertQueryPositions(t, string(buff),
- "$..[?(bool)]",
- []interface{}{
- queryTestNode{
- true, toml.Position{15, 1},
- },
- })
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/query.go b/vendor/github.com/pelletier/go-toml/query/query.go
deleted file mode 100644
index 1c6cd801..00000000
--- a/vendor/github.com/pelletier/go-toml/query/query.go
+++ /dev/null
@@ -1,158 +0,0 @@
-package query
-
-import (
- "time"
-
- "github.com/pelletier/go-toml"
-)
-
-// NodeFilterFn represents a user-defined filter function, for use with
-// Query.SetFilter().
-//
-// The return value of the function must indicate if 'node' is to be included
-// at this stage of the TOML path. Returning true will include the node, and
-// returning false will exclude it.
-//
-// NOTE: Care should be taken to write script callbacks such that they are safe
-// to use from multiple goroutines.
-type NodeFilterFn func(node interface{}) bool
-
-// Result is the result of Executing a Query.
-type Result struct {
- items []interface{}
- positions []toml.Position
-}
-
-// appends a value/position pair to the result set.
-func (r *Result) appendResult(node interface{}, pos toml.Position) {
- r.items = append(r.items, node)
- r.positions = append(r.positions, pos)
-}
-
-// Values is a set of values within a Result. The order of values is not
-// guaranteed to be in document order, and may be different each time a query is
-// executed.
-func (r Result) Values() []interface{} {
- return r.items
-}
-
-// Positions is a set of positions for values within a Result. Each index
-// in Positions() corresponds to the entry in Value() of the same index.
-func (r Result) Positions() []toml.Position {
- return r.positions
-}
-
-// runtime context for executing query paths
-type queryContext struct {
- result *Result
- filters *map[string]NodeFilterFn
- lastPosition toml.Position
-}
-
-// generic path functor interface
-type pathFn interface {
- setNext(next pathFn)
- // it is the caller's responsibility to set the ctx.lastPosition before invoking call()
- // node can be one of: *toml.Tree, []*toml.Tree, or a scalar
- call(node interface{}, ctx *queryContext)
-}
-
-// A Query is the representation of a compiled TOML path. A Query is safe
-// for concurrent use by multiple goroutines.
-type Query struct {
- root pathFn
- tail pathFn
- filters *map[string]NodeFilterFn
-}
-
-func newQuery() *Query {
- return &Query{
- root: nil,
- tail: nil,
- filters: &defaultFilterFunctions,
- }
-}
-
-func (q *Query) appendPath(next pathFn) {
- if q.root == nil {
- q.root = next
- } else {
- q.tail.setNext(next)
- }
- q.tail = next
- next.setNext(newTerminatingFn()) // init the next functor
-}
-
-// Compile compiles a TOML path expression. The returned Query can be used
-// to match elements within a Tree and its descendants. See Execute.
-func Compile(path string) (*Query, error) {
- return parseQuery(lexQuery(path))
-}
-
-// Execute executes a query against a Tree, and returns the result of the query.
-func (q *Query) Execute(tree *toml.Tree) *Result {
- result := &Result{
- items: []interface{}{},
- positions: []toml.Position{},
- }
- if q.root == nil {
- result.appendResult(tree, tree.GetPosition(""))
- } else {
- ctx := &queryContext{
- result: result,
- filters: q.filters,
- }
- ctx.lastPosition = tree.Position()
- q.root.call(tree, ctx)
- }
- return result
-}
-
-// CompileAndExecute is a shorthand for Compile(path) followed by Execute(tree).
-func CompileAndExecute(path string, tree *toml.Tree) (*Result, error) {
- query, err := Compile(path)
- if err != nil {
- return nil, err
- }
- return query.Execute(tree), nil
-}
-
-// SetFilter sets a user-defined filter function. These may be used inside
-// "?(..)" query expressions to filter TOML document elements within a query.
-func (q *Query) SetFilter(name string, fn NodeFilterFn) {
- if q.filters == &defaultFilterFunctions {
- // clone the static table
- q.filters = &map[string]NodeFilterFn{}
- for k, v := range defaultFilterFunctions {
- (*q.filters)[k] = v
- }
- }
- (*q.filters)[name] = fn
-}
-
-var defaultFilterFunctions = map[string]NodeFilterFn{
- "tree": func(node interface{}) bool {
- _, ok := node.(*toml.Tree)
- return ok
- },
- "int": func(node interface{}) bool {
- _, ok := node.(int64)
- return ok
- },
- "float": func(node interface{}) bool {
- _, ok := node.(float64)
- return ok
- },
- "string": func(node interface{}) bool {
- _, ok := node.(string)
- return ok
- },
- "time": func(node interface{}) bool {
- _, ok := node.(time.Time)
- return ok
- },
- "bool": func(node interface{}) bool {
- _, ok := node.(bool)
- return ok
- },
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/query_test.go b/vendor/github.com/pelletier/go-toml/query/query_test.go
deleted file mode 100644
index 903a8dc7..00000000
--- a/vendor/github.com/pelletier/go-toml/query/query_test.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package query
-
-import (
- "fmt"
- "testing"
-
- "github.com/pelletier/go-toml"
-)
-
-func assertArrayContainsInAnyOrder(t *testing.T, array []interface{}, objects ...interface{}) {
- if len(array) != len(objects) {
- t.Fatalf("array contains %d objects but %d are expected", len(array), len(objects))
- }
-
- for _, o := range objects {
- found := false
- for _, a := range array {
- if a == o {
- found = true
- break
- }
- }
- if !found {
- t.Fatal(o, "not found in array", array)
- }
- }
-}
-
-func TestQueryExample(t *testing.T) {
- config, _ := toml.Load(`
- [[book]]
- title = "The Stand"
- author = "Stephen King"
- [[book]]
- title = "For Whom the Bell Tolls"
- author = "Ernest Hemmingway"
- [[book]]
- title = "Neuromancer"
- author = "William Gibson"
- `)
- authors, err := CompileAndExecute("$.book.author", config)
- if err != nil {
- t.Fatal("unexpected error:", err)
- }
- names := authors.Values()
- if len(names) != 3 {
- t.Fatalf("query should return 3 names but returned %d", len(names))
- }
- assertArrayContainsInAnyOrder(t, names, "Stephen King", "Ernest Hemmingway", "William Gibson")
-}
-
-func TestQueryReadmeExample(t *testing.T) {
- config, _ := toml.Load(`
-[postgres]
-user = "pelletier"
-password = "mypassword"
-`)
-
- query, err := Compile("$..[user,password]")
- if err != nil {
- t.Fatal("unexpected error:", err)
- }
- results := query.Execute(config)
- values := results.Values()
- if len(values) != 2 {
- t.Fatalf("query should return 2 values but returned %d", len(values))
- }
- assertArrayContainsInAnyOrder(t, values, "pelletier", "mypassword")
-}
-
-func TestQueryPathNotPresent(t *testing.T) {
- config, _ := toml.Load(`a = "hello"`)
- query, err := Compile("$.foo.bar")
- if err != nil {
- t.Fatal("unexpected error:", err)
- }
- results := query.Execute(config)
- if err != nil {
- t.Fatalf("err should be nil. got %s instead", err)
- }
- if len(results.items) != 0 {
- t.Fatalf("no items should be matched. %d matched instead", len(results.items))
- }
-}
-
-func ExampleNodeFilterFn_filterExample() {
- tree, _ := toml.Load(`
- [struct_one]
- foo = "foo"
- bar = "bar"
-
- [struct_two]
- baz = "baz"
- gorf = "gorf"
- `)
-
- // create a query that references a user-defined-filter
- query, _ := Compile("$[?(bazOnly)]")
-
- // define the filter, and assign it to the query
- query.SetFilter("bazOnly", func(node interface{}) bool {
- if tree, ok := node.(*toml.Tree); ok {
- return tree.Has("baz")
- }
- return false // reject all other node types
- })
-
- // results contain only the 'struct_two' Tree
- query.Execute(tree)
-}
-
-func ExampleQuery_queryExample() {
- config, _ := toml.Load(`
- [[book]]
- title = "The Stand"
- author = "Stephen King"
- [[book]]
- title = "For Whom the Bell Tolls"
- author = "Ernest Hemmingway"
- [[book]]
- title = "Neuromancer"
- author = "William Gibson"
- `)
-
- // find and print all the authors in the document
- query, _ := Compile("$.book.author")
- authors := query.Execute(config)
- for _, name := range authors.Values() {
- fmt.Println(name)
- }
-}
-
-func TestTomlQuery(t *testing.T) {
- tree, err := toml.Load("[foo.bar]\na=1\nb=2\n[baz.foo]\na=3\nb=4\n[gorf.foo]\na=5\nb=6")
- if err != nil {
- t.Error(err)
- return
- }
- query, err := Compile("$.foo.bar")
- if err != nil {
- t.Error(err)
- return
- }
- result := query.Execute(tree)
- values := result.Values()
- if len(values) != 1 {
- t.Errorf("Expected resultset of 1, got %d instead: %v", len(values), values)
- }
-
- if tt, ok := values[0].(*toml.Tree); !ok {
- t.Errorf("Expected type of Tree: %T", values[0])
- } else if tt.Get("a") != int64(1) {
- t.Errorf("Expected 'a' with a value 1: %v", tt.Get("a"))
- } else if tt.Get("b") != int64(2) {
- t.Errorf("Expected 'b' with a value 2: %v", tt.Get("b"))
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/query/tokens.go b/vendor/github.com/pelletier/go-toml/query/tokens.go
deleted file mode 100644
index 9ae579de..00000000
--- a/vendor/github.com/pelletier/go-toml/query/tokens.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package query
-
-import (
- "fmt"
- "github.com/pelletier/go-toml"
- "strconv"
- "unicode"
-)
-
-// Define tokens
-type tokenType int
-
-const (
- eof = -(iota + 1)
-)
-
-const (
- tokenError tokenType = iota
- tokenEOF
- tokenKey
- tokenString
- tokenInteger
- tokenFloat
- tokenLeftBracket
- tokenRightBracket
- tokenLeftParen
- tokenRightParen
- tokenComma
- tokenColon
- tokenDollar
- tokenStar
- tokenQuestion
- tokenDot
- tokenDotDot
-)
-
-var tokenTypeNames = []string{
- "Error",
- "EOF",
- "Key",
- "String",
- "Integer",
- "Float",
- "[",
- "]",
- "(",
- ")",
- ",",
- ":",
- "$",
- "*",
- "?",
- ".",
- "..",
-}
-
-type token struct {
- toml.Position
- typ tokenType
- val string
-}
-
-func (tt tokenType) String() string {
- idx := int(tt)
- if idx < len(tokenTypeNames) {
- return tokenTypeNames[idx]
- }
- return "Unknown"
-}
-
-func (t token) Int() int {
- if result, err := strconv.Atoi(t.val); err != nil {
- panic(err)
- } else {
- return result
- }
-}
-
-func (t token) String() string {
- switch t.typ {
- case tokenEOF:
- return "EOF"
- case tokenError:
- return t.val
- }
-
- return fmt.Sprintf("%q", t.val)
-}
-
-func isSpace(r rune) bool {
- return r == ' ' || r == '\t'
-}
-
-func isAlphanumeric(r rune) bool {
- return unicode.IsLetter(r) || r == '_'
-}
-
-func isDigit(r rune) bool {
- return unicode.IsNumber(r)
-}
-
-func isHexDigit(r rune) bool {
- return isDigit(r) ||
- (r >= 'a' && r <= 'f') ||
- (r >= 'A' && r <= 'F')
-}
diff --git a/vendor/github.com/pelletier/go-toml/test.sh b/vendor/github.com/pelletier/go-toml/test.sh
deleted file mode 100755
index ba6adf3f..00000000
--- a/vendor/github.com/pelletier/go-toml/test.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/bash
-# fail out of the script if anything here fails
-set -e
-set -o pipefail
-
-# set the path to the present working directory
-export GOPATH=`pwd`
-
-function git_clone() {
- path=$1
- branch=$2
- version=$3
- if [ ! -d "src/$path" ]; then
- mkdir -p src/$path
- git clone https://$path.git src/$path
- fi
- pushd src/$path
- git checkout "$branch"
- git reset --hard "$version"
- popd
-}
-
-# Remove potential previous runs
-rm -rf src test_program_bin toml-test
-
-go get github.com/pelletier/go-buffruneio
-go get github.com/davecgh/go-spew/spew
-go get gopkg.in/yaml.v2
-go get github.com/BurntSushi/toml
-
-# get code for BurntSushi TOML validation
-# pinning all to 'HEAD' for version 0.3.x work (TODO: pin to commit hash when tests stabilize)
-git_clone github.com/BurntSushi/toml master HEAD
-git_clone github.com/BurntSushi/toml-test master HEAD #was: 0.2.0 HEAD
-
-# build the BurntSushi test application
-go build -o toml-test github.com/BurntSushi/toml-test
-
-# vendorize the current lib for testing
-# NOTE: this basically mocks an install without having to go back out to github for code
-mkdir -p src/github.com/pelletier/go-toml/cmd
-mkdir -p src/github.com/pelletier/go-toml/query
-cp *.go *.toml src/github.com/pelletier/go-toml
-cp -R cmd/* src/github.com/pelletier/go-toml/cmd
-cp -R query/* src/github.com/pelletier/go-toml/query
-go build -o test_program_bin src/github.com/pelletier/go-toml/cmd/test_program.go
-
-# Run basic unit tests
-go test github.com/pelletier/go-toml -covermode=count -coverprofile=coverage.out
-go test github.com/pelletier/go-toml/cmd/tomljson
-go test github.com/pelletier/go-toml/query
-
-# run the entire BurntSushi test suite
-if [[ $# -eq 0 ]] ; then
- echo "Running all BurntSushi tests"
- ./toml-test ./test_program_bin | tee test_out
-else
- # run a specific test
- test=$1
- test_path='src/github.com/BurntSushi/toml-test/tests'
- valid_test="$test_path/valid/$test"
- invalid_test="$test_path/invalid/$test"
-
- if [ -e "$valid_test.toml" ]; then
- echo "Valid Test TOML for $test:"
- echo "===="
- cat "$valid_test.toml"
-
- echo "Valid Test JSON for $test:"
- echo "===="
- cat "$valid_test.json"
-
- echo "Go-TOML Output for $test:"
- echo "===="
- cat "$valid_test.toml" | ./test_program_bin
- fi
-
- if [ -e "$invalid_test.toml" ]; then
- echo "Invalid Test TOML for $test:"
- echo "===="
- cat "$invalid_test.toml"
-
- echo "Go-TOML Output for $test:"
- echo "===="
- echo "go-toml Output:"
- cat "$invalid_test.toml" | ./test_program_bin
- fi
-fi
diff --git a/vendor/github.com/pelletier/go-toml/token.go b/vendor/github.com/pelletier/go-toml/token.go
deleted file mode 100644
index 1a908134..00000000
--- a/vendor/github.com/pelletier/go-toml/token.go
+++ /dev/null
@@ -1,144 +0,0 @@
-package toml
-
-import (
- "fmt"
- "strconv"
- "unicode"
-)
-
-// Define tokens
-type tokenType int
-
-const (
- eof = -(iota + 1)
-)
-
-const (
- tokenError tokenType = iota
- tokenEOF
- tokenComment
- tokenKey
- tokenString
- tokenInteger
- tokenTrue
- tokenFalse
- tokenFloat
- tokenInf
- tokenNan
- tokenEqual
- tokenLeftBracket
- tokenRightBracket
- tokenLeftCurlyBrace
- tokenRightCurlyBrace
- tokenLeftParen
- tokenRightParen
- tokenDoubleLeftBracket
- tokenDoubleRightBracket
- tokenDate
- tokenKeyGroup
- tokenKeyGroupArray
- tokenComma
- tokenColon
- tokenDollar
- tokenStar
- tokenQuestion
- tokenDot
- tokenDotDot
- tokenEOL
-)
-
-var tokenTypeNames = []string{
- "Error",
- "EOF",
- "Comment",
- "Key",
- "String",
- "Integer",
- "True",
- "False",
- "Float",
- "Inf",
- "NaN",
- "=",
- "[",
- "]",
- "{",
- "}",
- "(",
- ")",
- "]]",
- "[[",
- "Date",
- "KeyGroup",
- "KeyGroupArray",
- ",",
- ":",
- "$",
- "*",
- "?",
- ".",
- "..",
- "EOL",
-}
-
-type token struct {
- Position
- typ tokenType
- val string
-}
-
-func (tt tokenType) String() string {
- idx := int(tt)
- if idx < len(tokenTypeNames) {
- return tokenTypeNames[idx]
- }
- return "Unknown"
-}
-
-func (t token) Int() int {
- if result, err := strconv.Atoi(t.val); err != nil {
- panic(err)
- } else {
- return result
- }
-}
-
-func (t token) String() string {
- switch t.typ {
- case tokenEOF:
- return "EOF"
- case tokenError:
- return t.val
- }
-
- return fmt.Sprintf("%q", t.val)
-}
-
-func isSpace(r rune) bool {
- return r == ' ' || r == '\t'
-}
-
-func isAlphanumeric(r rune) bool {
- return unicode.IsLetter(r) || r == '_'
-}
-
-func isKeyChar(r rune) bool {
- // Keys start with the first character that isn't whitespace or [ and end
- // with the last non-whitespace character before the equals sign. Keys
- // cannot contain a # character."
- return !(r == '\r' || r == '\n' || r == eof || r == '=')
-}
-
-func isKeyStartChar(r rune) bool {
- return !(isSpace(r) || r == '\r' || r == '\n' || r == eof || r == '[')
-}
-
-func isDigit(r rune) bool {
- return unicode.IsNumber(r)
-}
-
-func isHexDigit(r rune) bool {
- return isDigit(r) ||
- (r >= 'a' && r <= 'f') ||
- (r >= 'A' && r <= 'F')
-}
diff --git a/vendor/github.com/pelletier/go-toml/token_test.go b/vendor/github.com/pelletier/go-toml/token_test.go
deleted file mode 100644
index 20b560d5..00000000
--- a/vendor/github.com/pelletier/go-toml/token_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package toml
-
-import "testing"
-
-func TestTokenStringer(t *testing.T) {
- var tests = []struct {
- tt tokenType
- expect string
- }{
- {tokenError, "Error"},
- {tokenEOF, "EOF"},
- {tokenComment, "Comment"},
- {tokenKey, "Key"},
- {tokenString, "String"},
- {tokenInteger, "Integer"},
- {tokenTrue, "True"},
- {tokenFalse, "False"},
- {tokenFloat, "Float"},
- {tokenEqual, "="},
- {tokenLeftBracket, "["},
- {tokenRightBracket, "]"},
- {tokenLeftCurlyBrace, "{"},
- {tokenRightCurlyBrace, "}"},
- {tokenLeftParen, "("},
- {tokenRightParen, ")"},
- {tokenDoubleLeftBracket, "]]"},
- {tokenDoubleRightBracket, "[["},
- {tokenDate, "Date"},
- {tokenKeyGroup, "KeyGroup"},
- {tokenKeyGroupArray, "KeyGroupArray"},
- {tokenComma, ","},
- {tokenColon, ":"},
- {tokenDollar, "$"},
- {tokenStar, "*"},
- {tokenQuestion, "?"},
- {tokenDot, "."},
- {tokenDotDot, ".."},
- {tokenEOL, "EOL"},
- {tokenEOL + 1, "Unknown"},
- }
-
- for i, test := range tests {
- got := test.tt.String()
- if got != test.expect {
- t.Errorf("[%d] invalid string of token type; got %q, expected %q", i, got, test.expect)
- }
- }
-}
-
-func TestTokenString(t *testing.T) {
- var tests = []struct {
- tok token
- expect string
- }{
- {token{Position{1, 1}, tokenEOF, ""}, "EOF"},
- {token{Position{1, 1}, tokenError, "Δt"}, "Δt"},
- {token{Position{1, 1}, tokenString, "bar"}, `"bar"`},
- {token{Position{1, 1}, tokenString, "123456789012345"}, `"123456789012345"`},
- }
-
- for i, test := range tests {
- got := test.tok.String()
- if got != test.expect {
- t.Errorf("[%d] invalid of string token; got %q, expected %q", i, got, test.expect)
- }
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/toml.go b/vendor/github.com/pelletier/go-toml/toml.go
deleted file mode 100644
index 98c185ad..00000000
--- a/vendor/github.com/pelletier/go-toml/toml.go
+++ /dev/null
@@ -1,367 +0,0 @@
-package toml
-
-import (
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "runtime"
- "strings"
-)
-
-type tomlValue struct {
- value interface{} // string, int64, uint64, float64, bool, time.Time, [] of any of this list
- comment string
- commented bool
- multiline bool
- position Position
-}
-
-// Tree is the result of the parsing of a TOML file.
-type Tree struct {
- values map[string]interface{} // string -> *tomlValue, *Tree, []*Tree
- comment string
- commented bool
- position Position
-}
-
-func newTree() *Tree {
- return &Tree{
- values: make(map[string]interface{}),
- position: Position{},
- }
-}
-
-// TreeFromMap initializes a new Tree object using the given map.
-func TreeFromMap(m map[string]interface{}) (*Tree, error) {
- result, err := toTree(m)
- if err != nil {
- return nil, err
- }
- return result.(*Tree), nil
-}
-
-// Position returns the position of the tree.
-func (t *Tree) Position() Position {
- return t.position
-}
-
-// Has returns a boolean indicating if the given key exists.
-func (t *Tree) Has(key string) bool {
- if key == "" {
- return false
- }
- return t.HasPath(strings.Split(key, "."))
-}
-
-// HasPath returns true if the given path of keys exists, false otherwise.
-func (t *Tree) HasPath(keys []string) bool {
- return t.GetPath(keys) != nil
-}
-
-// Keys returns the keys of the toplevel tree (does not recurse).
-func (t *Tree) Keys() []string {
- keys := make([]string, len(t.values))
- i := 0
- for k := range t.values {
- keys[i] = k
- i++
- }
- return keys
-}
-
-// Get the value at key in the Tree.
-// Key is a dot-separated path (e.g. a.b.c) without single/double quoted strings.
-// If you need to retrieve non-bare keys, use GetPath.
-// Returns nil if the path does not exist in the tree.
-// If keys is of length zero, the current tree is returned.
-func (t *Tree) Get(key string) interface{} {
- if key == "" {
- return t
- }
- return t.GetPath(strings.Split(key, "."))
-}
-
-// GetPath returns the element in the tree indicated by 'keys'.
-// If keys is of length zero, the current tree is returned.
-func (t *Tree) GetPath(keys []string) interface{} {
- if len(keys) == 0 {
- return t
- }
- subtree := t
- for _, intermediateKey := range keys[:len(keys)-1] {
- value, exists := subtree.values[intermediateKey]
- if !exists {
- return nil
- }
- switch node := value.(type) {
- case *Tree:
- subtree = node
- case []*Tree:
- // go to most recent element
- if len(node) == 0 {
- return nil
- }
- subtree = node[len(node)-1]
- default:
- return nil // cannot navigate through other node types
- }
- }
- // branch based on final node type
- switch node := subtree.values[keys[len(keys)-1]].(type) {
- case *tomlValue:
- return node.value
- default:
- return node
- }
-}
-
-// GetPosition returns the position of the given key.
-func (t *Tree) GetPosition(key string) Position {
- if key == "" {
- return t.position
- }
- return t.GetPositionPath(strings.Split(key, "."))
-}
-
-// GetPositionPath returns the element in the tree indicated by 'keys'.
-// If keys is of length zero, the current tree is returned.
-func (t *Tree) GetPositionPath(keys []string) Position {
- if len(keys) == 0 {
- return t.position
- }
- subtree := t
- for _, intermediateKey := range keys[:len(keys)-1] {
- value, exists := subtree.values[intermediateKey]
- if !exists {
- return Position{0, 0}
- }
- switch node := value.(type) {
- case *Tree:
- subtree = node
- case []*Tree:
- // go to most recent element
- if len(node) == 0 {
- return Position{0, 0}
- }
- subtree = node[len(node)-1]
- default:
- return Position{0, 0}
- }
- }
- // branch based on final node type
- switch node := subtree.values[keys[len(keys)-1]].(type) {
- case *tomlValue:
- return node.position
- case *Tree:
- return node.position
- case []*Tree:
- // go to most recent element
- if len(node) == 0 {
- return Position{0, 0}
- }
- return node[len(node)-1].position
- default:
- return Position{0, 0}
- }
-}
-
-// GetDefault works like Get but with a default value
-func (t *Tree) GetDefault(key string, def interface{}) interface{} {
- val := t.Get(key)
- if val == nil {
- return def
- }
- return val
-}
-
-// SetOptions arguments are supplied to the SetWithOptions and SetPathWithOptions functions to modify marshalling behaviour.
-// The default values within the struct are valid default options.
-type SetOptions struct {
- Comment string
- Commented bool
- Multiline bool
-}
-
-// SetWithOptions is the same as Set, but allows you to provide formatting
-// instructions to the key, that will be used by Marshal().
-func (t *Tree) SetWithOptions(key string, opts SetOptions, value interface{}) {
- t.SetPathWithOptions(strings.Split(key, "."), opts, value)
-}
-
-// SetPathWithOptions is the same as SetPath, but allows you to provide
-// formatting instructions to the key, that will be reused by Marshal().
-func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interface{}) {
- subtree := t
- for _, intermediateKey := range keys[:len(keys)-1] {
- nextTree, exists := subtree.values[intermediateKey]
- if !exists {
- nextTree = newTree()
- subtree.values[intermediateKey] = nextTree // add new element here
- }
- switch node := nextTree.(type) {
- case *Tree:
- subtree = node
- case []*Tree:
- // go to most recent element
- if len(node) == 0 {
- // create element if it does not exist
- subtree.values[intermediateKey] = append(node, newTree())
- }
- subtree = node[len(node)-1]
- }
- }
-
- var toInsert interface{}
-
- switch value.(type) {
- case *Tree:
- tt := value.(*Tree)
- tt.comment = opts.Comment
- toInsert = value
- case []*Tree:
- toInsert = value
- case *tomlValue:
- tt := value.(*tomlValue)
- tt.comment = opts.Comment
- toInsert = tt
- default:
- toInsert = &tomlValue{value: value, comment: opts.Comment, commented: opts.Commented, multiline: opts.Multiline}
- }
-
- subtree.values[keys[len(keys)-1]] = toInsert
-}
-
-// Set an element in the tree.
-// Key is a dot-separated path (e.g. a.b.c).
-// Creates all necessary intermediate trees, if needed.
-func (t *Tree) Set(key string, value interface{}) {
- t.SetWithComment(key, "", false, value)
-}
-
-// SetWithComment is the same as Set, but allows you to provide comment
-// information to the key, that will be reused by Marshal().
-func (t *Tree) SetWithComment(key string, comment string, commented bool, value interface{}) {
- t.SetPathWithComment(strings.Split(key, "."), comment, commented, value)
-}
-
-// SetPath sets an element in the tree.
-// Keys is an array of path elements (e.g. {"a","b","c"}).
-// Creates all necessary intermediate trees, if needed.
-func (t *Tree) SetPath(keys []string, value interface{}) {
- t.SetPathWithComment(keys, "", false, value)
-}
-
-// SetPathWithComment is the same as SetPath, but allows you to provide comment
-// information to the key, that will be reused by Marshal().
-func (t *Tree) SetPathWithComment(keys []string, comment string, commented bool, value interface{}) {
- subtree := t
- for _, intermediateKey := range keys[:len(keys)-1] {
- nextTree, exists := subtree.values[intermediateKey]
- if !exists {
- nextTree = newTree()
- subtree.values[intermediateKey] = nextTree // add new element here
- }
- switch node := nextTree.(type) {
- case *Tree:
- subtree = node
- case []*Tree:
- // go to most recent element
- if len(node) == 0 {
- // create element if it does not exist
- subtree.values[intermediateKey] = append(node, newTree())
- }
- subtree = node[len(node)-1]
- }
- }
-
- var toInsert interface{}
-
- switch value.(type) {
- case *Tree:
- tt := value.(*Tree)
- tt.comment = comment
- toInsert = value
- case []*Tree:
- toInsert = value
- case *tomlValue:
- tt := value.(*tomlValue)
- tt.comment = comment
- toInsert = tt
- default:
- toInsert = &tomlValue{value: value, comment: comment, commented: commented}
- }
-
- subtree.values[keys[len(keys)-1]] = toInsert
-}
-
-// createSubTree takes a tree and a key and create the necessary intermediate
-// subtrees to create a subtree at that point. In-place.
-//
-// e.g. passing a.b.c will create (assuming tree is empty) tree[a], tree[a][b]
-// and tree[a][b][c]
-//
-// Returns nil on success, error object on failure
-func (t *Tree) createSubTree(keys []string, pos Position) error {
- subtree := t
- for _, intermediateKey := range keys {
- nextTree, exists := subtree.values[intermediateKey]
- if !exists {
- tree := newTree()
- tree.position = pos
- subtree.values[intermediateKey] = tree
- nextTree = tree
- }
-
- switch node := nextTree.(type) {
- case []*Tree:
- subtree = node[len(node)-1]
- case *Tree:
- subtree = node
- default:
- return fmt.Errorf("unknown type for path %s (%s): %T (%#v)",
- strings.Join(keys, "."), intermediateKey, nextTree, nextTree)
- }
- }
- return nil
-}
-
-// LoadBytes creates a Tree from a []byte.
-func LoadBytes(b []byte) (tree *Tree, err error) {
- defer func() {
- if r := recover(); r != nil {
- if _, ok := r.(runtime.Error); ok {
- panic(r)
- }
- err = errors.New(r.(string))
- }
- }()
- tree = parseToml(lexToml(b))
- return
-}
-
-// LoadReader creates a Tree from any io.Reader.
-func LoadReader(reader io.Reader) (tree *Tree, err error) {
- inputBytes, err := ioutil.ReadAll(reader)
- if err != nil {
- return
- }
- tree, err = LoadBytes(inputBytes)
- return
-}
-
-// Load creates a Tree from a string.
-func Load(content string) (tree *Tree, err error) {
- return LoadBytes([]byte(content))
-}
-
-// LoadFile creates a Tree from a file.
-func LoadFile(path string) (tree *Tree, err error) {
- file, err := os.Open(path)
- if err != nil {
- return nil, err
- }
- defer file.Close()
- return LoadReader(file)
-}
diff --git a/vendor/github.com/pelletier/go-toml/toml_test.go b/vendor/github.com/pelletier/go-toml/toml_test.go
deleted file mode 100644
index ab9c2425..00000000
--- a/vendor/github.com/pelletier/go-toml/toml_test.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Testing support for go-toml
-
-package toml
-
-import (
- "testing"
-)
-
-func TestTomlHas(t *testing.T) {
- tree, _ := Load(`
- [test]
- key = "value"
- `)
-
- if !tree.Has("test.key") {
- t.Errorf("Has - expected test.key to exists")
- }
-
- if tree.Has("") {
- t.Errorf("Should return false if the key is not provided")
- }
-}
-
-func TestTomlGet(t *testing.T) {
- tree, _ := Load(`
- [test]
- key = "value"
- `)
-
- if tree.Get("") != tree {
- t.Errorf("Get should return the tree itself when given an empty path")
- }
-
- if tree.Get("test.key") != "value" {
- t.Errorf("Get should return the value")
- }
- if tree.Get(`\`) != nil {
- t.Errorf("should return nil when the key is malformed")
- }
-}
-
-func TestTomlGetDefault(t *testing.T) {
- tree, _ := Load(`
- [test]
- key = "value"
- `)
-
- if tree.GetDefault("", "hello") != tree {
- t.Error("GetDefault should return the tree itself when given an empty path")
- }
-
- if tree.GetDefault("test.key", "hello") != "value" {
- t.Error("Get should return the value")
- }
-
- if tree.GetDefault("whatever", "hello") != "hello" {
- t.Error("GetDefault should return the default value if the key does not exist")
- }
-}
-
-func TestTomlHasPath(t *testing.T) {
- tree, _ := Load(`
- [test]
- key = "value"
- `)
-
- if !tree.HasPath([]string{"test", "key"}) {
- t.Errorf("HasPath - expected test.key to exists")
- }
-}
-
-func TestTomlGetPath(t *testing.T) {
- node := newTree()
- //TODO: set other node data
-
- for idx, item := range []struct {
- Path []string
- Expected *Tree
- }{
- { // empty path test
- []string{},
- node,
- },
- } {
- result := node.GetPath(item.Path)
- if result != item.Expected {
- t.Errorf("GetPath[%d] %v - expected %v, got %v instead.", idx, item.Path, item.Expected, result)
- }
- }
-
- tree, _ := Load("[foo.bar]\na=1\nb=2\n[baz.foo]\na=3\nb=4\n[gorf.foo]\na=5\nb=6")
- if tree.GetPath([]string{"whatever"}) != nil {
- t.Error("GetPath should return nil when the key does not exist")
- }
-}
-
-func TestTomlFromMap(t *testing.T) {
- simpleMap := map[string]interface{}{"hello": 42}
- tree, err := TreeFromMap(simpleMap)
- if err != nil {
- t.Fatal("unexpected error:", err)
- }
- if tree.Get("hello") != int64(42) {
- t.Fatal("hello should be 42, not", tree.Get("hello"))
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/tomltree_create.go b/vendor/github.com/pelletier/go-toml/tomltree_create.go
deleted file mode 100644
index 79610e9b..00000000
--- a/vendor/github.com/pelletier/go-toml/tomltree_create.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package toml
-
-import (
- "fmt"
- "reflect"
- "time"
-)
-
-var kindToType = [reflect.String + 1]reflect.Type{
- reflect.Bool: reflect.TypeOf(true),
- reflect.String: reflect.TypeOf(""),
- reflect.Float32: reflect.TypeOf(float64(1)),
- reflect.Float64: reflect.TypeOf(float64(1)),
- reflect.Int: reflect.TypeOf(int64(1)),
- reflect.Int8: reflect.TypeOf(int64(1)),
- reflect.Int16: reflect.TypeOf(int64(1)),
- reflect.Int32: reflect.TypeOf(int64(1)),
- reflect.Int64: reflect.TypeOf(int64(1)),
- reflect.Uint: reflect.TypeOf(uint64(1)),
- reflect.Uint8: reflect.TypeOf(uint64(1)),
- reflect.Uint16: reflect.TypeOf(uint64(1)),
- reflect.Uint32: reflect.TypeOf(uint64(1)),
- reflect.Uint64: reflect.TypeOf(uint64(1)),
-}
-
-// typeFor returns a reflect.Type for a reflect.Kind, or nil if none is found.
-// supported values:
-// string, bool, int64, uint64, float64, time.Time, int, int8, int16, int32, uint, uint8, uint16, uint32, float32
-func typeFor(k reflect.Kind) reflect.Type {
- if k > 0 && int(k) < len(kindToType) {
- return kindToType[k]
- }
- return nil
-}
-
-func simpleValueCoercion(object interface{}) (interface{}, error) {
- switch original := object.(type) {
- case string, bool, int64, uint64, float64, time.Time:
- return original, nil
- case int:
- return int64(original), nil
- case int8:
- return int64(original), nil
- case int16:
- return int64(original), nil
- case int32:
- return int64(original), nil
- case uint:
- return uint64(original), nil
- case uint8:
- return uint64(original), nil
- case uint16:
- return uint64(original), nil
- case uint32:
- return uint64(original), nil
- case float32:
- return float64(original), nil
- case fmt.Stringer:
- return original.String(), nil
- default:
- return nil, fmt.Errorf("cannot convert type %T to Tree", object)
- }
-}
-
-func sliceToTree(object interface{}) (interface{}, error) {
- // arrays are a bit tricky, since they can represent either a
- // collection of simple values, which is represented by one
- // *tomlValue, or an array of tables, which is represented by an
- // array of *Tree.
-
- // holding the assumption that this function is called from toTree only when value.Kind() is Array or Slice
- value := reflect.ValueOf(object)
- insideType := value.Type().Elem()
- length := value.Len()
- if length > 0 {
- insideType = reflect.ValueOf(value.Index(0).Interface()).Type()
- }
- if insideType.Kind() == reflect.Map {
- // this is considered as an array of tables
- tablesArray := make([]*Tree, 0, length)
- for i := 0; i < length; i++ {
- table := value.Index(i)
- tree, err := toTree(table.Interface())
- if err != nil {
- return nil, err
- }
- tablesArray = append(tablesArray, tree.(*Tree))
- }
- return tablesArray, nil
- }
-
- sliceType := typeFor(insideType.Kind())
- if sliceType == nil {
- sliceType = insideType
- }
-
- arrayValue := reflect.MakeSlice(reflect.SliceOf(sliceType), 0, length)
-
- for i := 0; i < length; i++ {
- val := value.Index(i).Interface()
- simpleValue, err := simpleValueCoercion(val)
- if err != nil {
- return nil, err
- }
- arrayValue = reflect.Append(arrayValue, reflect.ValueOf(simpleValue))
- }
- return &tomlValue{value: arrayValue.Interface(), position: Position{}}, nil
-}
-
-func toTree(object interface{}) (interface{}, error) {
- value := reflect.ValueOf(object)
-
- if value.Kind() == reflect.Map {
- values := map[string]interface{}{}
- keys := value.MapKeys()
- for _, key := range keys {
- if key.Kind() != reflect.String {
- if _, ok := key.Interface().(string); !ok {
- return nil, fmt.Errorf("map key needs to be a string, not %T (%v)", key.Interface(), key.Kind())
- }
- }
-
- v := value.MapIndex(key)
- newValue, err := toTree(v.Interface())
- if err != nil {
- return nil, err
- }
- values[key.String()] = newValue
- }
- return &Tree{values: values, position: Position{}}, nil
- }
-
- if value.Kind() == reflect.Array || value.Kind() == reflect.Slice {
- return sliceToTree(object)
- }
-
- simpleValue, err := simpleValueCoercion(object)
- if err != nil {
- return nil, err
- }
- return &tomlValue{value: simpleValue, position: Position{}}, nil
-}
diff --git a/vendor/github.com/pelletier/go-toml/tomltree_create_test.go b/vendor/github.com/pelletier/go-toml/tomltree_create_test.go
deleted file mode 100644
index 3465a106..00000000
--- a/vendor/github.com/pelletier/go-toml/tomltree_create_test.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package toml
-
-import (
- "strconv"
- "testing"
- "time"
-)
-
-type customString string
-
-type stringer struct{}
-
-func (s stringer) String() string {
- return "stringer"
-}
-
-func validate(t *testing.T, path string, object interface{}) {
- switch o := object.(type) {
- case *Tree:
- for key, tree := range o.values {
- validate(t, path+"."+key, tree)
- }
- case []*Tree:
- for index, tree := range o {
- validate(t, path+"."+strconv.Itoa(index), tree)
- }
- case *tomlValue:
- switch o.value.(type) {
- case int64, uint64, bool, string, float64, time.Time,
- []int64, []uint64, []bool, []string, []float64, []time.Time:
- default:
- t.Fatalf("tomlValue at key %s containing incorrect type %T", path, o.value)
- }
- default:
- t.Fatalf("value at key %s is of incorrect type %T", path, object)
- }
- t.Logf("validation ok %s as %T", path, object)
-}
-
-func validateTree(t *testing.T, tree *Tree) {
- validate(t, "", tree)
-}
-
-func TestTreeCreateToTree(t *testing.T) {
- data := map[string]interface{}{
- "a_string": "bar",
- "an_int": 42,
- "time": time.Now(),
- "int8": int8(2),
- "int16": int16(2),
- "int32": int32(2),
- "uint8": uint8(2),
- "uint16": uint16(2),
- "uint32": uint32(2),
- "float32": float32(2),
- "a_bool": false,
- "stringer": stringer{},
- "nested": map[string]interface{}{
- "foo": "bar",
- },
- "array": []string{"a", "b", "c"},
- "array_uint": []uint{uint(1), uint(2)},
- "array_table": []map[string]interface{}{{"sub_map": 52}},
- "array_times": []time.Time{time.Now(), time.Now()},
- "map_times": map[string]time.Time{"now": time.Now()},
- "custom_string_map_key": map[customString]interface{}{customString("custom"): "custom"},
- }
- tree, err := TreeFromMap(data)
- if err != nil {
- t.Fatal("unexpected error:", err)
- }
- validateTree(t, tree)
-}
-
-func TestTreeCreateToTreeInvalidLeafType(t *testing.T) {
- _, err := TreeFromMap(map[string]interface{}{"foo": t})
- expected := "cannot convert type *testing.T to Tree"
- if err.Error() != expected {
- t.Fatalf("expected error %s, got %s", expected, err.Error())
- }
-}
-
-func TestTreeCreateToTreeInvalidMapKeyType(t *testing.T) {
- _, err := TreeFromMap(map[string]interface{}{"foo": map[int]interface{}{2: 1}})
- expected := "map key needs to be a string, not int (int)"
- if err.Error() != expected {
- t.Fatalf("expected error %s, got %s", expected, err.Error())
- }
-}
-
-func TestTreeCreateToTreeInvalidArrayMemberType(t *testing.T) {
- _, err := TreeFromMap(map[string]interface{}{"foo": []*testing.T{t}})
- expected := "cannot convert type *testing.T to Tree"
- if err.Error() != expected {
- t.Fatalf("expected error %s, got %s", expected, err.Error())
- }
-}
-
-func TestTreeCreateToTreeInvalidTableGroupType(t *testing.T) {
- _, err := TreeFromMap(map[string]interface{}{"foo": []map[string]interface{}{{"hello": t}}})
- expected := "cannot convert type *testing.T to Tree"
- if err.Error() != expected {
- t.Fatalf("expected error %s, got %s", expected, err.Error())
- }
-}
-
-func TestRoundTripArrayOfTables(t *testing.T) {
- orig := "\n[[stuff]]\n name = \"foo\"\n things = [\"a\",\"b\"]\n"
- tree, err := Load(orig)
- if err != nil {
- t.Fatalf("unexpected error: %s", err)
- }
-
- m := tree.ToMap()
-
- tree, err = TreeFromMap(m)
- if err != nil {
- t.Fatalf("unexpected error: %s", err)
- }
- want := orig
- got := tree.String()
-
- if got != want {
- t.Errorf("want:\n%s\ngot:\n%s", want, got)
- }
-}
diff --git a/vendor/github.com/pelletier/go-toml/tomltree_write.go b/vendor/github.com/pelletier/go-toml/tomltree_write.go
deleted file mode 100644
index e4049e29..00000000
--- a/vendor/github.com/pelletier/go-toml/tomltree_write.go
+++ /dev/null
@@ -1,333 +0,0 @@
-package toml
-
-import (
- "bytes"
- "fmt"
- "io"
- "math"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "time"
-)
-
-// Encodes a string to a TOML-compliant multi-line string value
-// This function is a clone of the existing encodeTomlString function, except that whitespace characters
-// are preserved. Quotation marks and backslashes are also not escaped.
-func encodeMultilineTomlString(value string) string {
- var b bytes.Buffer
-
- for _, rr := range value {
- switch rr {
- case '\b':
- b.WriteString(`\b`)
- case '\t':
- b.WriteString("\t")
- case '\n':
- b.WriteString("\n")
- case '\f':
- b.WriteString(`\f`)
- case '\r':
- b.WriteString("\r")
- case '"':
- b.WriteString(`"`)
- case '\\':
- b.WriteString(`\`)
- default:
- intRr := uint16(rr)
- if intRr < 0x001F {
- b.WriteString(fmt.Sprintf("\\u%0.4X", intRr))
- } else {
- b.WriteRune(rr)
- }
- }
- }
- return b.String()
-}
-
-// Encodes a string to a TOML-compliant string value
-func encodeTomlString(value string) string {
- var b bytes.Buffer
-
- for _, rr := range value {
- switch rr {
- case '\b':
- b.WriteString(`\b`)
- case '\t':
- b.WriteString(`\t`)
- case '\n':
- b.WriteString(`\n`)
- case '\f':
- b.WriteString(`\f`)
- case '\r':
- b.WriteString(`\r`)
- case '"':
- b.WriteString(`\"`)
- case '\\':
- b.WriteString(`\\`)
- default:
- intRr := uint16(rr)
- if intRr < 0x001F {
- b.WriteString(fmt.Sprintf("\\u%0.4X", intRr))
- } else {
- b.WriteRune(rr)
- }
- }
- }
- return b.String()
-}
-
-func tomlValueStringRepresentation(v interface{}, indent string, arraysOneElementPerLine bool) (string, error) {
- // this interface check is added to dereference the change made in the writeTo function.
- // That change was made to allow this function to see formatting options.
- tv, ok := v.(*tomlValue)
- if ok {
- v = tv.value
- } else {
- tv = &tomlValue{}
- }
-
- switch value := v.(type) {
- case uint64:
- return strconv.FormatUint(value, 10), nil
- case int64:
- return strconv.FormatInt(value, 10), nil
- case float64:
- // Ensure a round float does contain a decimal point. Otherwise feeding
- // the output back to the parser would convert to an integer.
- if math.Trunc(value) == value {
- return strings.ToLower(strconv.FormatFloat(value, 'f', 1, 32)), nil
- }
- return strings.ToLower(strconv.FormatFloat(value, 'f', -1, 32)), nil
- case string:
- if tv.multiline {
- return "\"\"\"\n" + encodeMultilineTomlString(value) + "\"\"\"", nil
- }
- return "\"" + encodeTomlString(value) + "\"", nil
- case []byte:
- b, _ := v.([]byte)
- return tomlValueStringRepresentation(string(b), indent, arraysOneElementPerLine)
- case bool:
- if value {
- return "true", nil
- }
- return "false", nil
- case time.Time:
- return value.Format(time.RFC3339), nil
- case nil:
- return "", nil
- }
-
- rv := reflect.ValueOf(v)
-
- if rv.Kind() == reflect.Slice {
- var values []string
- for i := 0; i < rv.Len(); i++ {
- item := rv.Index(i).Interface()
- itemRepr, err := tomlValueStringRepresentation(item, indent, arraysOneElementPerLine)
- if err != nil {
- return "", err
- }
- values = append(values, itemRepr)
- }
- if arraysOneElementPerLine && len(values) > 1 {
- stringBuffer := bytes.Buffer{}
- valueIndent := indent + ` ` // TODO: move that to a shared encoder state
-
- stringBuffer.WriteString("[\n")
-
- for _, value := range values {
- stringBuffer.WriteString(valueIndent)
- stringBuffer.WriteString(value)
- stringBuffer.WriteString(`,`)
- stringBuffer.WriteString("\n")
- }
-
- stringBuffer.WriteString(indent + "]")
-
- return stringBuffer.String(), nil
- }
- return "[" + strings.Join(values, ",") + "]", nil
- }
- return "", fmt.Errorf("unsupported value type %T: %v", v, v)
-}
-
-func (t *Tree) writeTo(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool) (int64, error) {
- simpleValuesKeys := make([]string, 0)
- complexValuesKeys := make([]string, 0)
-
- for k := range t.values {
- v := t.values[k]
- switch v.(type) {
- case *Tree, []*Tree:
- complexValuesKeys = append(complexValuesKeys, k)
- default:
- simpleValuesKeys = append(simpleValuesKeys, k)
- }
- }
-
- sort.Strings(simpleValuesKeys)
- sort.Strings(complexValuesKeys)
-
- for _, k := range simpleValuesKeys {
- v, ok := t.values[k].(*tomlValue)
- if !ok {
- return bytesCount, fmt.Errorf("invalid value type at %s: %T", k, t.values[k])
- }
-
- repr, err := tomlValueStringRepresentation(v, indent, arraysOneElementPerLine)
- if err != nil {
- return bytesCount, err
- }
-
- if v.comment != "" {
- comment := strings.Replace(v.comment, "\n", "\n"+indent+"#", -1)
- start := "# "
- if strings.HasPrefix(comment, "#") {
- start = ""
- }
- writtenBytesCountComment, errc := writeStrings(w, "\n", indent, start, comment, "\n")
- bytesCount += int64(writtenBytesCountComment)
- if errc != nil {
- return bytesCount, errc
- }
- }
-
- var commented string
- if v.commented {
- commented = "# "
- }
- writtenBytesCount, err := writeStrings(w, indent, commented, k, " = ", repr, "\n")
- bytesCount += int64(writtenBytesCount)
- if err != nil {
- return bytesCount, err
- }
- }
-
- for _, k := range complexValuesKeys {
- v := t.values[k]
-
- combinedKey := k
- if keyspace != "" {
- combinedKey = keyspace + "." + combinedKey
- }
- var commented string
- if t.commented {
- commented = "# "
- }
-
- switch node := v.(type) {
- // node has to be of those two types given how keys are sorted above
- case *Tree:
- tv, ok := t.values[k].(*Tree)
- if !ok {
- return bytesCount, fmt.Errorf("invalid value type at %s: %T", k, t.values[k])
- }
- if tv.comment != "" {
- comment := strings.Replace(tv.comment, "\n", "\n"+indent+"#", -1)
- start := "# "
- if strings.HasPrefix(comment, "#") {
- start = ""
- }
- writtenBytesCountComment, errc := writeStrings(w, "\n", indent, start, comment)
- bytesCount += int64(writtenBytesCountComment)
- if errc != nil {
- return bytesCount, errc
- }
- }
- writtenBytesCount, err := writeStrings(w, "\n", indent, commented, "[", combinedKey, "]\n")
- bytesCount += int64(writtenBytesCount)
- if err != nil {
- return bytesCount, err
- }
- bytesCount, err = node.writeTo(w, indent+" ", combinedKey, bytesCount, arraysOneElementPerLine)
- if err != nil {
- return bytesCount, err
- }
- case []*Tree:
- for _, subTree := range node {
- writtenBytesCount, err := writeStrings(w, "\n", indent, commented, "[[", combinedKey, "]]\n")
- bytesCount += int64(writtenBytesCount)
- if err != nil {
- return bytesCount, err
- }
-
- bytesCount, err = subTree.writeTo(w, indent+" ", combinedKey, bytesCount, arraysOneElementPerLine)
- if err != nil {
- return bytesCount, err
- }
- }
- }
- }
-
- return bytesCount, nil
-}
-
-func writeStrings(w io.Writer, s ...string) (int, error) {
- var n int
- for i := range s {
- b, err := io.WriteString(w, s[i])
- n += b
- if err != nil {
- return n, err
- }
- }
- return n, nil
-}
-
-// WriteTo encode the Tree as Toml and writes it to the writer w.
-// Returns the number of bytes written in case of success, or an error if anything happened.
-func (t *Tree) WriteTo(w io.Writer) (int64, error) {
- return t.writeTo(w, "", "", 0, false)
-}
-
-// ToTomlString generates a human-readable representation of the current tree.
-// Output spans multiple lines, and is suitable for ingest by a TOML parser.
-// If the conversion cannot be performed, ToString returns a non-nil error.
-func (t *Tree) ToTomlString() (string, error) {
- var buf bytes.Buffer
- _, err := t.WriteTo(&buf)
- if err != nil {
- return "", err
- }
- return buf.String(), nil
-}
-
-// String generates a human-readable representation of the current tree.
-// Alias of ToString. Present to implement the fmt.Stringer interface.
-func (t *Tree) String() string {
- result, _ := t.ToTomlString()
- return result
-}
-
-// ToMap recursively generates a representation of the tree using Go built-in structures.
-// The following types are used:
-//
-// * bool
-// * float64
-// * int64
-// * string
-// * uint64
-// * time.Time
-// * map[string]interface{} (where interface{} is any of this list)
-// * []interface{} (where interface{} is any of this list)
-func (t *Tree) ToMap() map[string]interface{} {
- result := map[string]interface{}{}
-
- for k, v := range t.values {
- switch node := v.(type) {
- case []*Tree:
- var array []interface{}
- for _, item := range node {
- array = append(array, item.ToMap())
- }
- result[k] = array
- case *Tree:
- result[k] = node.ToMap()
- case *tomlValue:
- result[k] = node.value
- }
- }
- return result
-}
diff --git a/vendor/github.com/pelletier/go-toml/tomltree_write_test.go b/vendor/github.com/pelletier/go-toml/tomltree_write_test.go
deleted file mode 100644
index 206203b8..00000000
--- a/vendor/github.com/pelletier/go-toml/tomltree_write_test.go
+++ /dev/null
@@ -1,376 +0,0 @@
-package toml
-
-import (
- "bytes"
- "errors"
- "fmt"
- "reflect"
- "strings"
- "testing"
- "time"
-)
-
-type failingWriter struct {
- failAt int
- written int
- buffer bytes.Buffer
-}
-
-func (f *failingWriter) Write(p []byte) (n int, err error) {
- count := len(p)
- toWrite := f.failAt - (count + f.written)
- if toWrite < 0 {
- toWrite = 0
- }
- if toWrite > count {
- f.written += count
- f.buffer.Write(p)
- return count, nil
- }
-
- f.buffer.Write(p[:toWrite])
- f.written = f.failAt
- return toWrite, fmt.Errorf("failingWriter failed after writing %d bytes", f.written)
-}
-
-func assertErrorString(t *testing.T, expected string, err error) {
- expectedErr := errors.New(expected)
- if err == nil || err.Error() != expectedErr.Error() {
- t.Errorf("expecting error %s, but got %s instead", expected, err)
- }
-}
-
-func TestTreeWriteToEmptyTable(t *testing.T) {
- doc := `[[empty-tables]]
-[[empty-tables]]`
-
- toml, err := Load(doc)
- if err != nil {
- t.Fatal("Unexpected Load error:", err)
- }
- tomlString, err := toml.ToTomlString()
- if err != nil {
- t.Fatal("Unexpected ToTomlString error:", err)
- }
-
- expected := `
-[[empty-tables]]
-
-[[empty-tables]]
-`
-
- if tomlString != expected {
- t.Fatalf("Expected:\n%s\nGot:\n%s", expected, tomlString)
- }
-}
-
-func TestTreeWriteToTomlString(t *testing.T) {
- toml, err := Load(`name = { first = "Tom", last = "Preston-Werner" }
-points = { x = 1, y = 2 }`)
-
- if err != nil {
- t.Fatal("Unexpected error:", err)
- }
-
- tomlString, _ := toml.ToTomlString()
- reparsedTree, err := Load(tomlString)
-
- assertTree(t, reparsedTree, err, map[string]interface{}{
- "name": map[string]interface{}{
- "first": "Tom",
- "last": "Preston-Werner",
- },
- "points": map[string]interface{}{
- "x": int64(1),
- "y": int64(2),
- },
- })
-}
-
-func TestTreeWriteToTomlStringSimple(t *testing.T) {
- tree, err := Load("[foo]\n\n[[foo.bar]]\na = 42\n\n[[foo.bar]]\na = 69\n")
- if err != nil {
- t.Errorf("Test failed to parse: %v", err)
- return
- }
- result, err := tree.ToTomlString()
- if err != nil {
- t.Errorf("Unexpected error: %s", err)
- }
- expected := "\n[foo]\n\n [[foo.bar]]\n a = 42\n\n [[foo.bar]]\n a = 69\n"
- if result != expected {
- t.Errorf("Expected got '%s', expected '%s'", result, expected)
- }
-}
-
-func TestTreeWriteToTomlStringKeysOrders(t *testing.T) {
- for i := 0; i < 100; i++ {
- tree, _ := Load(`
- foobar = true
- bar = "baz"
- foo = 1
- [qux]
- foo = 1
- bar = "baz2"`)
-
- stringRepr, _ := tree.ToTomlString()
-
- t.Log("Intermediate string representation:")
- t.Log(stringRepr)
-
- r := strings.NewReader(stringRepr)
- toml, err := LoadReader(r)
-
- if err != nil {
- t.Fatal("Unexpected error:", err)
- }
-
- assertTree(t, toml, err, map[string]interface{}{
- "foobar": true,
- "bar": "baz",
- "foo": 1,
- "qux": map[string]interface{}{
- "foo": 1,
- "bar": "baz2",
- },
- })
- }
-}
-
-func testMaps(t *testing.T, actual, expected map[string]interface{}) {
- if !reflect.DeepEqual(actual, expected) {
- t.Fatal("trees aren't equal.\n", "Expected:\n", expected, "\nActual:\n", actual)
- }
-}
-
-func TestTreeWriteToMapSimple(t *testing.T) {
- tree, _ := Load("a = 42\nb = 17")
-
- expected := map[string]interface{}{
- "a": int64(42),
- "b": int64(17),
- }
-
- testMaps(t, tree.ToMap(), expected)
-}
-
-func TestTreeWriteToInvalidTreeSimpleValue(t *testing.T) {
- tree := Tree{values: map[string]interface{}{"foo": int8(1)}}
- _, err := tree.ToTomlString()
- assertErrorString(t, "invalid value type at foo: int8", err)
-}
-
-func TestTreeWriteToInvalidTreeTomlValue(t *testing.T) {
- tree := Tree{values: map[string]interface{}{"foo": &tomlValue{value: int8(1), comment: "", position: Position{}}}}
- _, err := tree.ToTomlString()
- assertErrorString(t, "unsupported value type int8: 1", err)
-}
-
-func TestTreeWriteToInvalidTreeTomlValueArray(t *testing.T) {
- tree := Tree{values: map[string]interface{}{"foo": &tomlValue{value: int8(1), comment: "", position: Position{}}}}
- _, err := tree.ToTomlString()
- assertErrorString(t, "unsupported value type int8: 1", err)
-}
-
-func TestTreeWriteToFailingWriterInSimpleValue(t *testing.T) {
- toml, _ := Load(`a = 2`)
- writer := failingWriter{failAt: 0, written: 0}
- _, err := toml.WriteTo(&writer)
- assertErrorString(t, "failingWriter failed after writing 0 bytes", err)
-}
-
-func TestTreeWriteToFailingWriterInTable(t *testing.T) {
- toml, _ := Load(`
-[b]
-a = 2`)
- writer := failingWriter{failAt: 2, written: 0}
- _, err := toml.WriteTo(&writer)
- assertErrorString(t, "failingWriter failed after writing 2 bytes", err)
-
- writer = failingWriter{failAt: 13, written: 0}
- _, err = toml.WriteTo(&writer)
- assertErrorString(t, "failingWriter failed after writing 13 bytes", err)
-}
-
-func TestTreeWriteToFailingWriterInArray(t *testing.T) {
- toml, _ := Load(`
-[[b]]
-a = 2`)
- writer := failingWriter{failAt: 2, written: 0}
- _, err := toml.WriteTo(&writer)
- assertErrorString(t, "failingWriter failed after writing 2 bytes", err)
-
- writer = failingWriter{failAt: 15, written: 0}
- _, err = toml.WriteTo(&writer)
- assertErrorString(t, "failingWriter failed after writing 15 bytes", err)
-}
-
-func TestTreeWriteToMapExampleFile(t *testing.T) {
- tree, _ := LoadFile("example.toml")
- expected := map[string]interface{}{
- "title": "TOML Example",
- "owner": map[string]interface{}{
- "name": "Tom Preston-Werner",
- "organization": "GitHub",
- "bio": "GitHub Cofounder & CEO\nLikes tater tots and beer.",
- "dob": time.Date(1979, time.May, 27, 7, 32, 0, 0, time.UTC),
- },
- "database": map[string]interface{}{
- "server": "192.168.1.1",
- "ports": []interface{}{int64(8001), int64(8001), int64(8002)},
- "connection_max": int64(5000),
- "enabled": true,
- },
- "servers": map[string]interface{}{
- "alpha": map[string]interface{}{
- "ip": "10.0.0.1",
- "dc": "eqdc10",
- },
- "beta": map[string]interface{}{
- "ip": "10.0.0.2",
- "dc": "eqdc10",
- },
- },
- "clients": map[string]interface{}{
- "data": []interface{}{
- []interface{}{"gamma", "delta"},
- []interface{}{int64(1), int64(2)},
- },
- },
- }
- testMaps(t, tree.ToMap(), expected)
-}
-
-func TestTreeWriteToMapWithTablesInMultipleChunks(t *testing.T) {
- tree, _ := Load(`
- [[menu.main]]
- a = "menu 1"
- b = "menu 2"
- [[menu.main]]
- c = "menu 3"
- d = "menu 4"`)
- expected := map[string]interface{}{
- "menu": map[string]interface{}{
- "main": []interface{}{
- map[string]interface{}{"a": "menu 1", "b": "menu 2"},
- map[string]interface{}{"c": "menu 3", "d": "menu 4"},
- },
- },
- }
- treeMap := tree.ToMap()
-
- testMaps(t, treeMap, expected)
-}
-
-func TestTreeWriteToMapWithArrayOfInlineTables(t *testing.T) {
- tree, _ := Load(`
- [params]
- language_tabs = [
- { key = "shell", name = "Shell" },
- { key = "ruby", name = "Ruby" },
- { key = "python", name = "Python" }
- ]`)
-
- expected := map[string]interface{}{
- "params": map[string]interface{}{
- "language_tabs": []interface{}{
- map[string]interface{}{
- "key": "shell",
- "name": "Shell",
- },
- map[string]interface{}{
- "key": "ruby",
- "name": "Ruby",
- },
- map[string]interface{}{
- "key": "python",
- "name": "Python",
- },
- },
- },
- }
-
- treeMap := tree.ToMap()
- testMaps(t, treeMap, expected)
-}
-
-func TestTreeWriteToFloat(t *testing.T) {
- tree, err := Load(`a = 3.0`)
- if err != nil {
- t.Fatal(err)
- }
- str, err := tree.ToTomlString()
- if err != nil {
- t.Fatal(err)
- }
- expected := `a = 3.0`
- if strings.TrimSpace(str) != strings.TrimSpace(expected) {
- t.Fatalf("Expected:\n%s\nGot:\n%s", expected, str)
- }
-}
-
-func TestTreeWriteToSpecialFloat(t *testing.T) {
- expected := `a = +inf
-b = -inf
-c = nan`
-
- tree, err := Load(expected)
- if err != nil {
- t.Fatal(err)
- }
- str, err := tree.ToTomlString()
- if err != nil {
- t.Fatal(err)
- }
- if strings.TrimSpace(str) != strings.TrimSpace(expected) {
- t.Fatalf("Expected:\n%s\nGot:\n%s", expected, str)
- }
-}
-
-func BenchmarkTreeToTomlString(b *testing.B) {
- toml, err := Load(sampleHard)
- if err != nil {
- b.Fatal("Unexpected error:", err)
- }
-
- for i := 0; i < b.N; i++ {
- _, err := toml.ToTomlString()
- if err != nil {
- b.Fatal(err)
- }
- }
-}
-
-var sampleHard = `# Test file for TOML
-# Only this one tries to emulate a TOML file written by a user of the kind of parser writers probably hate
-# This part you'll really hate
-
-[the]
-test_string = "You'll hate me after this - #" # " Annoying, isn't it?
-
- [the.hard]
- test_array = [ "] ", " # "] # ] There you go, parse this!
- test_array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ]
- # You didn't think it'd as easy as chucking out the last #, did you?
- another_test_string = " Same thing, but with a string #"
- harder_test_string = " And when \"'s are in the string, along with # \"" # "and comments are there too"
- # Things will get harder
-
- [the.hard."bit#"]
- "what?" = "You don't think some user won't do that?"
- multi_line_array = [
- "]",
- # ] Oh yes I did
- ]
-
-# Each of the following keygroups/key value pairs should produce an error. Uncomment to them to test
-
-#[error] if you didn't catch this, your parser is broken
-#string = "Anything other than tabs, spaces and newline after a keygroup or key value pair has ended should produce an error unless it is a comment" like this
-#array = [
-# "This might most likely happen in multiline arrays",
-# Like here,
-# "or here,
-# and here"
-# ] End of array comment, forgot the #
-#number = 3.14 pi <--again forgot the # `
diff --git a/vendor/github.com/russross/blackfriday/.gitignore b/vendor/github.com/russross/blackfriday/.gitignore
deleted file mode 100644
index 75623dcc..00000000
--- a/vendor/github.com/russross/blackfriday/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-*.out
-*.swp
-*.8
-*.6
-_obj
-_test*
-markdown
-tags
diff --git a/vendor/github.com/russross/blackfriday/.travis.yml b/vendor/github.com/russross/blackfriday/.travis.yml
deleted file mode 100644
index a1687f17..00000000
--- a/vendor/github.com/russross/blackfriday/.travis.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.5.4
- - 1.6.2
- - tip
-matrix:
- include:
- - go: 1.2.2
- script:
- - go get -t -v ./...
- - go test -v -race ./...
- - go: 1.3.3
- script:
- - go get -t -v ./...
- - go test -v -race ./...
- - go: 1.4.3
- script:
- - go get -t -v ./...
- - go test -v -race ./...
- allow_failures:
- - go: tip
- fast_finish: true
-install:
- - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
-script:
- - go get -t -v ./...
- - diff -u <(echo -n) <(gofmt -d -s .)
- - go tool vet .
- - go test -v -race ./...
diff --git a/vendor/github.com/russross/blackfriday/LICENSE.txt b/vendor/github.com/russross/blackfriday/LICENSE.txt
deleted file mode 100644
index 2885af36..00000000
--- a/vendor/github.com/russross/blackfriday/LICENSE.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-Blackfriday is distributed under the Simplified BSD License:
-
-> Copyright © 2011 Russ Ross
-> All rights reserved.
->
-> Redistribution and use in source and binary forms, with or without
-> modification, are permitted provided that the following conditions
-> are met:
->
-> 1. Redistributions of source code must retain the above copyright
-> notice, this list of conditions and the following disclaimer.
->
-> 2. Redistributions in binary form must reproduce the above
-> copyright notice, this list of conditions and the following
-> disclaimer in the documentation and/or other materials provided with
-> the distribution.
->
-> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-> "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-> FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-> COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-> INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-> BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-> LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-> ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-> POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/russross/blackfriday/README.md b/vendor/github.com/russross/blackfriday/README.md
deleted file mode 100644
index a6c94b79..00000000
--- a/vendor/github.com/russross/blackfriday/README.md
+++ /dev/null
@@ -1,363 +0,0 @@
-Blackfriday
-[![Build Status][BuildSVG]][BuildURL]
-[![Godoc][GodocV2SVG]][GodocV2URL]
-===========
-
-Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It
-is paranoid about its input (so you can safely feed it user-supplied
-data), it is fast, it supports common extensions (tables, smart
-punctuation substitutions, etc.), and it is safe for all utf-8
-(unicode) input.
-
-HTML output is currently supported, along with Smartypants
-extensions.
-
-It started as a translation from C of [Sundown][3].
-
-
-Installation
-------------
-
-Blackfriday is compatible with any modern Go release. With Go and git installed:
-
- go get -u gopkg.in/russross/blackfriday.v2
-
-will download, compile, and install the package into your `$GOPATH` directory
-hierarchy.
-
-
-Versions
---------
-
-Currently maintained and recommended version of Blackfriday is `v2`. It's being
-developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the
-documentation is available at
-https://godoc.org/gopkg.in/russross/blackfriday.v2.
-
-It is `go get`-able via via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`,
-but we highly recommend using package management tool like [dep][7] or
-[Glide][8] and make use of semantic versioning. With package management you
-should import `github.com/russross/blackfriday` and specify that you're using
-version 2.0.0.
-
-Version 2 offers a number of improvements over v1:
-
-* Cleaned up API
-* A separate call to [`Parse`][4], which produces an abstract syntax tree for
- the document
-* Latest bug fixes
-* Flexibility to easily add your own rendering extensions
-
-Potential drawbacks:
-
-* Our benchmarks show v2 to be slightly slower than v1. Currently in the
- ballpark of around 15%.
-* API breakage. If you can't afford modifying your code to adhere to the new API
- and don't care too much about the new features, v2 is probably not for you.
-* Several bug fixes are trailing behind and still need to be forward-ported to
- v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for
- tracking.
-
-If you are still interested in the legacy `v1`, you can import it from
-`github.com/russross/blackfriday`. Documentation for the legacy v1 can be found
-here: https://godoc.org/github.com/russross/blackfriday
-
-### Known issue with `dep`
-
-There is a known problem with using Blackfriday v1 _transitively_ and `dep`.
-Currently `dep` prioritizes semver versions over anything else, and picks the
-latest one, plus it does not apply a `[[constraint]]` specifier to transitively
-pulled in packages. So if you're using something that uses Blackfriday v1, but
-that something does not use `dep` yet, you will get Blackfriday v2 pulled in and
-your first dependency will fail to build.
-
-There are couple of fixes for it, documented here:
-https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-constrain-a-transitive-dependencys-version
-
-Meanwhile, `dep` team is working on a more general solution to the constraints
-on transitive dependencies problem: https://github.com/golang/dep/issues/1124.
-
-
-Usage
------
-
-### v1
-
-For basic usage, it is as simple as getting your input into a byte
-slice and calling:
-
- output := blackfriday.MarkdownBasic(input)
-
-This renders it with no extensions enabled. To get a more useful
-feature set, use this instead:
-
- output := blackfriday.MarkdownCommon(input)
-
-### v2
-
-For the most sensible markdown processing, it is as simple as getting your input
-into a byte slice and calling:
-
-```go
-output := blackfriday.Run(input)
-```
-
-Your input will be parsed and the output rendered with a set of most popular
-extensions enabled. If you want the most basic feature set, corresponding with
-the bare Markdown specification, use:
-
-```go
-output := blackfriday.Run(input, blackfriday.WithNoExtensions())
-```
-
-### Sanitize untrusted content
-
-Blackfriday itself does nothing to protect against malicious content. If you are
-dealing with user-supplied markdown, we recommend running Blackfriday's output
-through HTML sanitizer such as [Bluemonday][5].
-
-Here's an example of simple usage of Blackfriday together with Bluemonday:
-
-```go
-import (
- "github.com/microcosm-cc/bluemonday"
- "gopkg.in/russross/blackfriday.v2"
-)
-
-// ...
-unsafe := blackfriday.Run(input)
-html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
-```
-
-### Custom options, v1
-
-If you want to customize the set of options, first get a renderer
-(currently only the HTML output engine), then use it to
-call the more general `Markdown` function. For examples, see the
-implementations of `MarkdownBasic` and `MarkdownCommon` in
-`markdown.go`.
-
-### Custom options, v2
-
-If you want to customize the set of options, use `blackfriday.WithExtensions`,
-`blackfriday.WithRenderer` and `blackfriday.WithRefOverride`.
-
-### `blackfriday-tool`
-
-You can also check out `blackfriday-tool` for a more complete example
-of how to use it. Download and install it using:
-
- go get github.com/russross/blackfriday-tool
-
-This is a simple command-line tool that allows you to process a
-markdown file using a standalone program. You can also browse the
-source directly on github if you are just looking for some example
-code:
-
-*
-
-Note that if you have not already done so, installing
-`blackfriday-tool` will be sufficient to download and install
-blackfriday in addition to the tool itself. The tool binary will be
-installed in `$GOPATH/bin`. This is a statically-linked binary that
-can be copied to wherever you need it without worrying about
-dependencies and library versions.
-
-### Sanitized anchor names
-
-Blackfriday includes an algorithm for creating sanitized anchor names
-corresponding to a given input text. This algorithm is used to create
-anchors for headings when `EXTENSION_AUTO_HEADER_IDS` is enabled. The
-algorithm has a specification, so that other packages can create
-compatible anchor names and links to those anchors.
-
-The specification is located at https://godoc.org/github.com/russross/blackfriday#hdr-Sanitized_Anchor_Names.
-
-[`SanitizedAnchorName`](https://godoc.org/github.com/russross/blackfriday#SanitizedAnchorName) exposes this functionality, and can be used to
-create compatible links to the anchor names generated by blackfriday.
-This algorithm is also implemented in a small standalone package at
-[`github.com/shurcooL/sanitized_anchor_name`](https://godoc.org/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients
-that want a small package and don't need full functionality of blackfriday.
-
-
-Features
---------
-
-All features of Sundown are supported, including:
-
-* **Compatibility**. The Markdown v1.0.3 test suite passes with
- the `--tidy` option. Without `--tidy`, the differences are
- mostly in whitespace and entity escaping, where blackfriday is
- more consistent and cleaner.
-
-* **Common extensions**, including table support, fenced code
- blocks, autolinks, strikethroughs, non-strict emphasis, etc.
-
-* **Safety**. Blackfriday is paranoid when parsing, making it safe
- to feed untrusted user input without fear of bad things
- happening. The test suite stress tests this and there are no
- known inputs that make it crash. If you find one, please let me
- know and send me the input that does it.
-
- NOTE: "safety" in this context means *runtime safety only*. In order to
- protect yourself against JavaScript injection in untrusted content, see
- [this example](https://github.com/russross/blackfriday#sanitize-untrusted-content).
-
-* **Fast processing**. It is fast enough to render on-demand in
- most web applications without having to cache the output.
-
-* **Thread safety**. You can run multiple parsers in different
- goroutines without ill effect. There is no dependence on global
- shared state.
-
-* **Minimal dependencies**. Blackfriday only depends on standard
- library packages in Go. The source code is pretty
- self-contained, so it is easy to add to any project, including
- Google App Engine projects.
-
-* **Standards compliant**. Output successfully validates using the
- W3C validation tool for HTML 4.01 and XHTML 1.0 Transitional.
-
-
-Extensions
-----------
-
-In addition to the standard markdown syntax, this package
-implements the following extensions:
-
-* **Intra-word emphasis supression**. The `_` character is
- commonly used inside words when discussing code, so having
- markdown interpret it as an emphasis command is usually the
- wrong thing. Blackfriday lets you treat all emphasis markers as
- normal characters when they occur inside a word.
-
-* **Tables**. Tables can be created by drawing them in the input
- using a simple syntax:
-
- ```
- Name | Age
- --------|------
- Bob | 27
- Alice | 23
- ```
-
-* **Fenced code blocks**. In addition to the normal 4-space
- indentation to mark code blocks, you can explicitly mark them
- and supply a language (to make syntax highlighting simple). Just
- mark it like this:
-
- ``` go
- func getTrue() bool {
- return true
- }
- ```
-
- You can use 3 or more backticks to mark the beginning of the
- block, and the same number to mark the end of the block.
-
- To preserve classes of fenced code blocks while using the bluemonday
- HTML sanitizer, use the following policy:
-
- ``` go
- p := bluemonday.UGCPolicy()
- p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code")
- html := p.SanitizeBytes(unsafe)
- ```
-
-* **Definition lists**. A simple definition list is made of a single-line
- term followed by a colon and the definition for that term.
-
- Cat
- : Fluffy animal everyone likes
-
- Internet
- : Vector of transmission for pictures of cats
-
- Terms must be separated from the previous definition by a blank line.
-
-* **Footnotes**. A marker in the text that will become a superscript number;
- a footnote definition that will be placed in a list of footnotes at the
- end of the document. A footnote looks like this:
-
- This is a footnote.[^1]
-
- [^1]: the footnote text.
-
-* **Autolinking**. Blackfriday can find URLs that have not been
- explicitly marked as links and turn them into links.
-
-* **Strikethrough**. Use two tildes (`~~`) to mark text that
- should be crossed out.
-
-* **Hard line breaks**. With this extension enabled (it is off by
- default in the `MarkdownBasic` and `MarkdownCommon` convenience
- functions), newlines in the input translate into line breaks in
- the output.
-
-* **Smart quotes**. Smartypants-style punctuation substitution is
- supported, turning normal double- and single-quote marks into
- curly quotes, etc.
-
-* **LaTeX-style dash parsing** is an additional option, where `--`
- is translated into `–`, and `---` is translated into
- `—`. This differs from most smartypants processors, which
- turn a single hyphen into an ndash and a double hyphen into an
- mdash.
-
-* **Smart fractions**, where anything that looks like a fraction
- is translated into suitable HTML (instead of just a few special
- cases like most smartypant processors). For example, `4/5`
- becomes `4⁄5`, which renders as
- 4⁄5.
-
-
-Other renderers
----------------
-
-Blackfriday is structured to allow alternative rendering engines. Here
-are a few of note:
-
-* [github_flavored_markdown](https://godoc.org/github.com/shurcooL/github_flavored_markdown):
- provides a GitHub Flavored Markdown renderer with fenced code block
- highlighting, clickable heading anchor links.
-
- It's not customizable, and its goal is to produce HTML output
- equivalent to the [GitHub Markdown API endpoint](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode),
- except the rendering is performed locally.
-
-* [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt,
- but for markdown.
-
-* [LaTeX output](https://bitbucket.org/ambrevar/blackfriday-latex):
- renders output as LaTeX.
-
-
-TODO
-----
-
-* More unit testing
-* Improve Unicode support. It does not understand all Unicode
- rules (about what constitutes a letter, a punctuation symbol,
- etc.), so it may fail to detect word boundaries correctly in
- some instances. It is safe on all UTF-8 input.
-
-
-License
--------
-
-[Blackfriday is distributed under the Simplified BSD License](LICENSE.txt)
-
-
- [1]: https://daringfireball.net/projects/markdown/ "Markdown"
- [2]: https://golang.org/ "Go Language"
- [3]: https://github.com/vmg/sundown "Sundown"
- [4]: https://godoc.org/gopkg.in/russross/blackfriday.v2#Parse "Parse func"
- [5]: https://github.com/microcosm-cc/bluemonday "Bluemonday"
- [6]: https://labix.org/gopkg.in "gopkg.in"
- [7]: https://github.com/golang/dep/ "dep"
- [8]: https://github.com/Masterminds/glide "Glide"
-
- [BuildSVG]: https://travis-ci.org/russross/blackfriday.svg?branch=master
- [BuildURL]: https://travis-ci.org/russross/blackfriday
- [GodocV2SVG]: https://godoc.org/gopkg.in/russross/blackfriday.v2?status.svg
- [GodocV2URL]: https://godoc.org/gopkg.in/russross/blackfriday.v2
diff --git a/vendor/github.com/russross/blackfriday/block.go b/vendor/github.com/russross/blackfriday/block.go
deleted file mode 100644
index 7fc731d5..00000000
--- a/vendor/github.com/russross/blackfriday/block.go
+++ /dev/null
@@ -1,1450 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross .
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-// Functions to parse block-level elements.
-//
-
-package blackfriday
-
-import (
- "bytes"
- "unicode"
-)
-
-// Parse block-level data.
-// Note: this function and many that it calls assume that
-// the input buffer ends with a newline.
-func (p *parser) block(out *bytes.Buffer, data []byte) {
- if len(data) == 0 || data[len(data)-1] != '\n' {
- panic("block input is missing terminating newline")
- }
-
- // this is called recursively: enforce a maximum depth
- if p.nesting >= p.maxNesting {
- return
- }
- p.nesting++
-
- // parse out one block-level construct at a time
- for len(data) > 0 {
- // prefixed header:
- //
- // # Header 1
- // ## Header 2
- // ...
- // ###### Header 6
- if p.isPrefixHeader(data) {
- data = data[p.prefixHeader(out, data):]
- continue
- }
-
- // block of preformatted HTML:
- //
- //
- // ...
- //
- if data[0] == '<' {
- if i := p.html(out, data, true); i > 0 {
- data = data[i:]
- continue
- }
- }
-
- // title block
- //
- // % stuff
- // % more stuff
- // % even more stuff
- if p.flags&EXTENSION_TITLEBLOCK != 0 {
- if data[0] == '%' {
- if i := p.titleBlock(out, data, true); i > 0 {
- data = data[i:]
- continue
- }
- }
- }
-
- // blank lines. note: returns the # of bytes to skip
- if i := p.isEmpty(data); i > 0 {
- data = data[i:]
- continue
- }
-
- // indented code block:
- //
- // func max(a, b int) int {
- // if a > b {
- // return a
- // }
- // return b
- // }
- if p.codePrefix(data) > 0 {
- data = data[p.code(out, data):]
- continue
- }
-
- // fenced code block:
- //
- // ``` go
- // func fact(n int) int {
- // if n <= 1 {
- // return n
- // }
- // return n * fact(n-1)
- // }
- // ```
- if p.flags&EXTENSION_FENCED_CODE != 0 {
- if i := p.fencedCodeBlock(out, data, true); i > 0 {
- data = data[i:]
- continue
- }
- }
-
- // horizontal rule:
- //
- // ------
- // or
- // ******
- // or
- // ______
- if p.isHRule(data) {
- p.r.HRule(out)
- var i int
- for i = 0; data[i] != '\n'; i++ {
- }
- data = data[i:]
- continue
- }
-
- // block quote:
- //
- // > A big quote I found somewhere
- // > on the web
- if p.quotePrefix(data) > 0 {
- data = data[p.quote(out, data):]
- continue
- }
-
- // table:
- //
- // Name | Age | Phone
- // ------|-----|---------
- // Bob | 31 | 555-1234
- // Alice | 27 | 555-4321
- if p.flags&EXTENSION_TABLES != 0 {
- if i := p.table(out, data); i > 0 {
- data = data[i:]
- continue
- }
- }
-
- // an itemized/unordered list:
- //
- // * Item 1
- // * Item 2
- //
- // also works with + or -
- if p.uliPrefix(data) > 0 {
- data = data[p.list(out, data, 0):]
- continue
- }
-
- // a numbered/ordered list:
- //
- // 1. Item 1
- // 2. Item 2
- if p.oliPrefix(data) > 0 {
- data = data[p.list(out, data, LIST_TYPE_ORDERED):]
- continue
- }
-
- // definition lists:
- //
- // Term 1
- // : Definition a
- // : Definition b
- //
- // Term 2
- // : Definition c
- if p.flags&EXTENSION_DEFINITION_LISTS != 0 {
- if p.dliPrefix(data) > 0 {
- data = data[p.list(out, data, LIST_TYPE_DEFINITION):]
- continue
- }
- }
-
- // anything else must look like a normal paragraph
- // note: this finds underlined headers, too
- data = data[p.paragraph(out, data):]
- }
-
- p.nesting--
-}
-
-func (p *parser) isPrefixHeader(data []byte) bool {
- if data[0] != '#' {
- return false
- }
-
- if p.flags&EXTENSION_SPACE_HEADERS != 0 {
- level := 0
- for level < 6 && data[level] == '#' {
- level++
- }
- if data[level] != ' ' {
- return false
- }
- }
- return true
-}
-
-func (p *parser) prefixHeader(out *bytes.Buffer, data []byte) int {
- level := 0
- for level < 6 && data[level] == '#' {
- level++
- }
- i := skipChar(data, level, ' ')
- end := skipUntilChar(data, i, '\n')
- skip := end
- id := ""
- if p.flags&EXTENSION_HEADER_IDS != 0 {
- j, k := 0, 0
- // find start/end of header id
- for j = i; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ {
- }
- for k = j + 1; k < end && data[k] != '}'; k++ {
- }
- // extract header id iff found
- if j < end && k < end {
- id = string(data[j+2 : k])
- end = j
- skip = k + 1
- for end > 0 && data[end-1] == ' ' {
- end--
- }
- }
- }
- for end > 0 && data[end-1] == '#' {
- if isBackslashEscaped(data, end-1) {
- break
- }
- end--
- }
- for end > 0 && data[end-1] == ' ' {
- end--
- }
- if end > i {
- if id == "" && p.flags&EXTENSION_AUTO_HEADER_IDS != 0 {
- id = SanitizedAnchorName(string(data[i:end]))
- }
- work := func() bool {
- p.inline(out, data[i:end])
- return true
- }
- p.r.Header(out, work, level, id)
- }
- return skip
-}
-
-func (p *parser) isUnderlinedHeader(data []byte) int {
- // test of level 1 header
- if data[0] == '=' {
- i := skipChar(data, 1, '=')
- i = skipChar(data, i, ' ')
- if data[i] == '\n' {
- return 1
- } else {
- return 0
- }
- }
-
- // test of level 2 header
- if data[0] == '-' {
- i := skipChar(data, 1, '-')
- i = skipChar(data, i, ' ')
- if data[i] == '\n' {
- return 2
- } else {
- return 0
- }
- }
-
- return 0
-}
-
-func (p *parser) titleBlock(out *bytes.Buffer, data []byte, doRender bool) int {
- if data[0] != '%' {
- return 0
- }
- splitData := bytes.Split(data, []byte("\n"))
- var i int
- for idx, b := range splitData {
- if !bytes.HasPrefix(b, []byte("%")) {
- i = idx // - 1
- break
- }
- }
-
- data = bytes.Join(splitData[0:i], []byte("\n"))
- p.r.TitleBlock(out, data)
-
- return len(data)
-}
-
-func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int {
- var i, j int
-
- // identify the opening tag
- if data[0] != '<' {
- return 0
- }
- curtag, tagfound := p.htmlFindTag(data[1:])
-
- // handle special cases
- if !tagfound {
- // check for an HTML comment
- if size := p.htmlComment(out, data, doRender); size > 0 {
- return size
- }
-
- // check for an
tag
- if size := p.htmlHr(out, data, doRender); size > 0 {
- return size
- }
-
- // check for HTML CDATA
- if size := p.htmlCDATA(out, data, doRender); size > 0 {
- return size
- }
-
- // no special case recognized
- return 0
- }
-
- // look for an unindented matching closing tag
- // followed by a blank line
- found := false
- /*
- closetag := []byte("\n" + curtag + ">")
- j = len(curtag) + 1
- for !found {
- // scan for a closing tag at the beginning of a line
- if skip := bytes.Index(data[j:], closetag); skip >= 0 {
- j += skip + len(closetag)
- } else {
- break
- }
-
- // see if it is the only thing on the line
- if skip := p.isEmpty(data[j:]); skip > 0 {
- // see if it is followed by a blank line/eof
- j += skip
- if j >= len(data) {
- found = true
- i = j
- } else {
- if skip := p.isEmpty(data[j:]); skip > 0 {
- j += skip
- found = true
- i = j
- }
- }
- }
- }
- */
-
- // if not found, try a second pass looking for indented match
- // but not if tag is "ins" or "del" (following original Markdown.pl)
- if !found && curtag != "ins" && curtag != "del" {
- i = 1
- for i < len(data) {
- i++
- for i < len(data) && !(data[i-1] == '<' && data[i] == '/') {
- i++
- }
-
- if i+2+len(curtag) >= len(data) {
- break
- }
-
- j = p.htmlFindEnd(curtag, data[i-1:])
-
- if j > 0 {
- i += j - 1
- found = true
- break
- }
- }
- }
-
- if !found {
- return 0
- }
-
- // the end of the block has been found
- if doRender {
- // trim newlines
- end := i
- for end > 0 && data[end-1] == '\n' {
- end--
- }
- p.r.BlockHtml(out, data[:end])
- }
-
- return i
-}
-
-func (p *parser) renderHTMLBlock(out *bytes.Buffer, data []byte, start int, doRender bool) int {
- // html block needs to end with a blank line
- if i := p.isEmpty(data[start:]); i > 0 {
- size := start + i
- if doRender {
- // trim trailing newlines
- end := size
- for end > 0 && data[end-1] == '\n' {
- end--
- }
- p.r.BlockHtml(out, data[:end])
- }
- return size
- }
- return 0
-}
-
-// HTML comment, lax form
-func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int {
- i := p.inlineHTMLComment(out, data)
- return p.renderHTMLBlock(out, data, i, doRender)
-}
-
-// HTML CDATA section
-func (p *parser) htmlCDATA(out *bytes.Buffer, data []byte, doRender bool) int {
- const cdataTag = "') {
- i++
- }
- i++
- // no end-of-comment marker
- if i >= len(data) {
- return 0
- }
- return p.renderHTMLBlock(out, data, i, doRender)
-}
-
-// HR, which is the only self-closing block tag considered
-func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int {
- if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') {
- return 0
- }
- if data[3] != ' ' && data[3] != '/' && data[3] != '>' {
- // not an
tag after all; at least not a valid one
- return 0
- }
-
- i := 3
- for data[i] != '>' && data[i] != '\n' {
- i++
- }
-
- if data[i] == '>' {
- return p.renderHTMLBlock(out, data, i+1, doRender)
- }
-
- return 0
-}
-
-func (p *parser) htmlFindTag(data []byte) (string, bool) {
- i := 0
- for isalnum(data[i]) {
- i++
- }
- key := string(data[:i])
- if _, ok := blockTags[key]; ok {
- return key, true
- }
- return "", false
-}
-
-func (p *parser) htmlFindEnd(tag string, data []byte) int {
- // assume data[0] == '<' && data[1] == '/' already tested
-
- // check if tag is a match
- closetag := []byte("" + tag + ">")
- if !bytes.HasPrefix(data, closetag) {
- return 0
- }
- i := len(closetag)
-
- // check that the rest of the line is blank
- skip := 0
- if skip = p.isEmpty(data[i:]); skip == 0 {
- return 0
- }
- i += skip
- skip = 0
-
- if i >= len(data) {
- return i
- }
-
- if p.flags&EXTENSION_LAX_HTML_BLOCKS != 0 {
- return i
- }
- if skip = p.isEmpty(data[i:]); skip == 0 {
- // following line must be blank
- return 0
- }
-
- return i + skip
-}
-
-func (*parser) isEmpty(data []byte) int {
- // it is okay to call isEmpty on an empty buffer
- if len(data) == 0 {
- return 0
- }
-
- var i int
- for i = 0; i < len(data) && data[i] != '\n'; i++ {
- if data[i] != ' ' && data[i] != '\t' {
- return 0
- }
- }
- return i + 1
-}
-
-func (*parser) isHRule(data []byte) bool {
- i := 0
-
- // skip up to three spaces
- for i < 3 && data[i] == ' ' {
- i++
- }
-
- // look at the hrule char
- if data[i] != '*' && data[i] != '-' && data[i] != '_' {
- return false
- }
- c := data[i]
-
- // the whole line must be the char or whitespace
- n := 0
- for data[i] != '\n' {
- switch {
- case data[i] == c:
- n++
- case data[i] != ' ':
- return false
- }
- i++
- }
-
- return n >= 3
-}
-
-// isFenceLine checks if there's a fence line (e.g., ``` or ``` go) at the beginning of data,
-// and returns the end index if so, or 0 otherwise. It also returns the marker found.
-// If syntax is not nil, it gets set to the syntax specified in the fence line.
-// A final newline is mandatory to recognize the fence line, unless newlineOptional is true.
-func isFenceLine(data []byte, syntax *string, oldmarker string, newlineOptional bool) (end int, marker string) {
- i, size := 0, 0
-
- // skip up to three spaces
- for i < len(data) && i < 3 && data[i] == ' ' {
- i++
- }
-
- // check for the marker characters: ~ or `
- if i >= len(data) {
- return 0, ""
- }
- if data[i] != '~' && data[i] != '`' {
- return 0, ""
- }
-
- c := data[i]
-
- // the whole line must be the same char or whitespace
- for i < len(data) && data[i] == c {
- size++
- i++
- }
-
- // the marker char must occur at least 3 times
- if size < 3 {
- return 0, ""
- }
- marker = string(data[i-size : i])
-
- // if this is the end marker, it must match the beginning marker
- if oldmarker != "" && marker != oldmarker {
- return 0, ""
- }
-
- // TODO(shurcooL): It's probably a good idea to simplify the 2 code paths here
- // into one, always get the syntax, and discard it if the caller doesn't care.
- if syntax != nil {
- syn := 0
- i = skipChar(data, i, ' ')
-
- if i >= len(data) {
- if newlineOptional && i == len(data) {
- return i, marker
- }
- return 0, ""
- }
-
- syntaxStart := i
-
- if data[i] == '{' {
- i++
- syntaxStart++
-
- for i < len(data) && data[i] != '}' && data[i] != '\n' {
- syn++
- i++
- }
-
- if i >= len(data) || data[i] != '}' {
- return 0, ""
- }
-
- // strip all whitespace at the beginning and the end
- // of the {} block
- for syn > 0 && isspace(data[syntaxStart]) {
- syntaxStart++
- syn--
- }
-
- for syn > 0 && isspace(data[syntaxStart+syn-1]) {
- syn--
- }
-
- i++
- } else {
- for i < len(data) && !isspace(data[i]) {
- syn++
- i++
- }
- }
-
- *syntax = string(data[syntaxStart : syntaxStart+syn])
- }
-
- i = skipChar(data, i, ' ')
- if i >= len(data) || data[i] != '\n' {
- if newlineOptional && i == len(data) {
- return i, marker
- }
- return 0, ""
- }
-
- return i + 1, marker // Take newline into account.
-}
-
-// fencedCodeBlock returns the end index if data contains a fenced code block at the beginning,
-// or 0 otherwise. It writes to out if doRender is true, otherwise it has no side effects.
-// If doRender is true, a final newline is mandatory to recognize the fenced code block.
-func (p *parser) fencedCodeBlock(out *bytes.Buffer, data []byte, doRender bool) int {
- var syntax string
- beg, marker := isFenceLine(data, &syntax, "", false)
- if beg == 0 || beg >= len(data) {
- return 0
- }
-
- var work bytes.Buffer
-
- for {
- // safe to assume beg < len(data)
-
- // check for the end of the code block
- newlineOptional := !doRender
- fenceEnd, _ := isFenceLine(data[beg:], nil, marker, newlineOptional)
- if fenceEnd != 0 {
- beg += fenceEnd
- break
- }
-
- // copy the current line
- end := skipUntilChar(data, beg, '\n') + 1
-
- // did we reach the end of the buffer without a closing marker?
- if end >= len(data) {
- return 0
- }
-
- // verbatim copy to the working buffer
- if doRender {
- work.Write(data[beg:end])
- }
- beg = end
- }
-
- if doRender {
- p.r.BlockCode(out, work.Bytes(), syntax)
- }
-
- return beg
-}
-
-func (p *parser) table(out *bytes.Buffer, data []byte) int {
- var header bytes.Buffer
- i, columns := p.tableHeader(&header, data)
- if i == 0 {
- return 0
- }
-
- var body bytes.Buffer
-
- for i < len(data) {
- pipes, rowStart := 0, i
- for ; data[i] != '\n'; i++ {
- if data[i] == '|' {
- pipes++
- }
- }
-
- if pipes == 0 {
- i = rowStart
- break
- }
-
- // include the newline in data sent to tableRow
- i++
- p.tableRow(&body, data[rowStart:i], columns, false)
- }
-
- p.r.Table(out, header.Bytes(), body.Bytes(), columns)
-
- return i
-}
-
-// check if the specified position is preceded by an odd number of backslashes
-func isBackslashEscaped(data []byte, i int) bool {
- backslashes := 0
- for i-backslashes-1 >= 0 && data[i-backslashes-1] == '\\' {
- backslashes++
- }
- return backslashes&1 == 1
-}
-
-func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns []int) {
- i := 0
- colCount := 1
- for i = 0; data[i] != '\n'; i++ {
- if data[i] == '|' && !isBackslashEscaped(data, i) {
- colCount++
- }
- }
-
- // doesn't look like a table header
- if colCount == 1 {
- return
- }
-
- // include the newline in the data sent to tableRow
- header := data[:i+1]
-
- // column count ignores pipes at beginning or end of line
- if data[0] == '|' {
- colCount--
- }
- if i > 2 && data[i-1] == '|' && !isBackslashEscaped(data, i-1) {
- colCount--
- }
-
- columns = make([]int, colCount)
-
- // move on to the header underline
- i++
- if i >= len(data) {
- return
- }
-
- if data[i] == '|' && !isBackslashEscaped(data, i) {
- i++
- }
- i = skipChar(data, i, ' ')
-
- // each column header is of form: / *:?-+:? *|/ with # dashes + # colons >= 3
- // and trailing | optional on last column
- col := 0
- for data[i] != '\n' {
- dashes := 0
-
- if data[i] == ':' {
- i++
- columns[col] |= TABLE_ALIGNMENT_LEFT
- dashes++
- }
- for data[i] == '-' {
- i++
- dashes++
- }
- if data[i] == ':' {
- i++
- columns[col] |= TABLE_ALIGNMENT_RIGHT
- dashes++
- }
- for data[i] == ' ' {
- i++
- }
-
- // end of column test is messy
- switch {
- case dashes < 3:
- // not a valid column
- return
-
- case data[i] == '|' && !isBackslashEscaped(data, i):
- // marker found, now skip past trailing whitespace
- col++
- i++
- for data[i] == ' ' {
- i++
- }
-
- // trailing junk found after last column
- if col >= colCount && data[i] != '\n' {
- return
- }
-
- case (data[i] != '|' || isBackslashEscaped(data, i)) && col+1 < colCount:
- // something else found where marker was required
- return
-
- case data[i] == '\n':
- // marker is optional for the last column
- col++
-
- default:
- // trailing junk found after last column
- return
- }
- }
- if col != colCount {
- return
- }
-
- p.tableRow(out, header, columns, true)
- size = i + 1
- return
-}
-
-func (p *parser) tableRow(out *bytes.Buffer, data []byte, columns []int, header bool) {
- i, col := 0, 0
- var rowWork bytes.Buffer
-
- if data[i] == '|' && !isBackslashEscaped(data, i) {
- i++
- }
-
- for col = 0; col < len(columns) && i < len(data); col++ {
- for data[i] == ' ' {
- i++
- }
-
- cellStart := i
-
- for (data[i] != '|' || isBackslashEscaped(data, i)) && data[i] != '\n' {
- i++
- }
-
- cellEnd := i
-
- // skip the end-of-cell marker, possibly taking us past end of buffer
- i++
-
- for cellEnd > cellStart && data[cellEnd-1] == ' ' {
- cellEnd--
- }
-
- var cellWork bytes.Buffer
- p.inline(&cellWork, data[cellStart:cellEnd])
-
- if header {
- p.r.TableHeaderCell(&rowWork, cellWork.Bytes(), columns[col])
- } else {
- p.r.TableCell(&rowWork, cellWork.Bytes(), columns[col])
- }
- }
-
- // pad it out with empty columns to get the right number
- for ; col < len(columns); col++ {
- if header {
- p.r.TableHeaderCell(&rowWork, nil, columns[col])
- } else {
- p.r.TableCell(&rowWork, nil, columns[col])
- }
- }
-
- // silently ignore rows with too many cells
-
- p.r.TableRow(out, rowWork.Bytes())
-}
-
-// returns blockquote prefix length
-func (p *parser) quotePrefix(data []byte) int {
- i := 0
- for i < 3 && data[i] == ' ' {
- i++
- }
- if data[i] == '>' {
- if data[i+1] == ' ' {
- return i + 2
- }
- return i + 1
- }
- return 0
-}
-
-// blockquote ends with at least one blank line
-// followed by something without a blockquote prefix
-func (p *parser) terminateBlockquote(data []byte, beg, end int) bool {
- if p.isEmpty(data[beg:]) <= 0 {
- return false
- }
- if end >= len(data) {
- return true
- }
- return p.quotePrefix(data[end:]) == 0 && p.isEmpty(data[end:]) == 0
-}
-
-// parse a blockquote fragment
-func (p *parser) quote(out *bytes.Buffer, data []byte) int {
- var raw bytes.Buffer
- beg, end := 0, 0
- for beg < len(data) {
- end = beg
- // Step over whole lines, collecting them. While doing that, check for
- // fenced code and if one's found, incorporate it altogether,
- // irregardless of any contents inside it
- for data[end] != '\n' {
- if p.flags&EXTENSION_FENCED_CODE != 0 {
- if i := p.fencedCodeBlock(out, data[end:], false); i > 0 {
- // -1 to compensate for the extra end++ after the loop:
- end += i - 1
- break
- }
- }
- end++
- }
- end++
-
- if pre := p.quotePrefix(data[beg:]); pre > 0 {
- // skip the prefix
- beg += pre
- } else if p.terminateBlockquote(data, beg, end) {
- break
- }
-
- // this line is part of the blockquote
- raw.Write(data[beg:end])
- beg = end
- }
-
- var cooked bytes.Buffer
- p.block(&cooked, raw.Bytes())
- p.r.BlockQuote(out, cooked.Bytes())
- return end
-}
-
-// returns prefix length for block code
-func (p *parser) codePrefix(data []byte) int {
- if data[0] == ' ' && data[1] == ' ' && data[2] == ' ' && data[3] == ' ' {
- return 4
- }
- return 0
-}
-
-func (p *parser) code(out *bytes.Buffer, data []byte) int {
- var work bytes.Buffer
-
- i := 0
- for i < len(data) {
- beg := i
- for data[i] != '\n' {
- i++
- }
- i++
-
- blankline := p.isEmpty(data[beg:i]) > 0
- if pre := p.codePrefix(data[beg:i]); pre > 0 {
- beg += pre
- } else if !blankline {
- // non-empty, non-prefixed line breaks the pre
- i = beg
- break
- }
-
- // verbatim copy to the working buffeu
- if blankline {
- work.WriteByte('\n')
- } else {
- work.Write(data[beg:i])
- }
- }
-
- // trim all the \n off the end of work
- workbytes := work.Bytes()
- eol := len(workbytes)
- for eol > 0 && workbytes[eol-1] == '\n' {
- eol--
- }
- if eol != len(workbytes) {
- work.Truncate(eol)
- }
-
- work.WriteByte('\n')
-
- p.r.BlockCode(out, work.Bytes(), "")
-
- return i
-}
-
-// returns unordered list item prefix
-func (p *parser) uliPrefix(data []byte) int {
- i := 0
-
- // start with up to 3 spaces
- for i < 3 && data[i] == ' ' {
- i++
- }
-
- // need a *, +, or - followed by a space
- if (data[i] != '*' && data[i] != '+' && data[i] != '-') ||
- data[i+1] != ' ' {
- return 0
- }
- return i + 2
-}
-
-// returns ordered list item prefix
-func (p *parser) oliPrefix(data []byte) int {
- i := 0
-
- // start with up to 3 spaces
- for i < 3 && data[i] == ' ' {
- i++
- }
-
- // count the digits
- start := i
- for data[i] >= '0' && data[i] <= '9' {
- i++
- }
-
- // we need >= 1 digits followed by a dot and a space
- if start == i || data[i] != '.' || data[i+1] != ' ' {
- return 0
- }
- return i + 2
-}
-
-// returns definition list item prefix
-func (p *parser) dliPrefix(data []byte) int {
- i := 0
-
- // need a : followed by a spaces
- if data[i] != ':' || data[i+1] != ' ' {
- return 0
- }
- for data[i] == ' ' {
- i++
- }
- return i + 2
-}
-
-// parse ordered or unordered list block
-func (p *parser) list(out *bytes.Buffer, data []byte, flags int) int {
- i := 0
- flags |= LIST_ITEM_BEGINNING_OF_LIST
- work := func() bool {
- for i < len(data) {
- skip := p.listItem(out, data[i:], &flags)
- i += skip
-
- if skip == 0 || flags&LIST_ITEM_END_OF_LIST != 0 {
- break
- }
- flags &= ^LIST_ITEM_BEGINNING_OF_LIST
- }
- return true
- }
-
- p.r.List(out, work, flags)
- return i
-}
-
-// Parse a single list item.
-// Assumes initial prefix is already removed if this is a sublist.
-func (p *parser) listItem(out *bytes.Buffer, data []byte, flags *int) int {
- // keep track of the indentation of the first line
- itemIndent := 0
- for itemIndent < 3 && data[itemIndent] == ' ' {
- itemIndent++
- }
-
- i := p.uliPrefix(data)
- if i == 0 {
- i = p.oliPrefix(data)
- }
- if i == 0 {
- i = p.dliPrefix(data)
- // reset definition term flag
- if i > 0 {
- *flags &= ^LIST_TYPE_TERM
- }
- }
- if i == 0 {
- // if in defnition list, set term flag and continue
- if *flags&LIST_TYPE_DEFINITION != 0 {
- *flags |= LIST_TYPE_TERM
- } else {
- return 0
- }
- }
-
- // skip leading whitespace on first line
- for data[i] == ' ' {
- i++
- }
-
- // find the end of the line
- line := i
- for i > 0 && data[i-1] != '\n' {
- i++
- }
-
- // get working buffer
- var raw bytes.Buffer
-
- // put the first line into the working buffer
- raw.Write(data[line:i])
- line = i
-
- // process the following lines
- containsBlankLine := false
- sublist := 0
-
-gatherlines:
- for line < len(data) {
- i++
-
- // find the end of this line
- for data[i-1] != '\n' {
- i++
- }
-
- // if it is an empty line, guess that it is part of this item
- // and move on to the next line
- if p.isEmpty(data[line:i]) > 0 {
- containsBlankLine = true
- raw.Write(data[line:i])
- line = i
- continue
- }
-
- // calculate the indentation
- indent := 0
- for indent < 4 && line+indent < i && data[line+indent] == ' ' {
- indent++
- }
-
- chunk := data[line+indent : i]
-
- // evaluate how this line fits in
- switch {
- // is this a nested list item?
- case (p.uliPrefix(chunk) > 0 && !p.isHRule(chunk)) ||
- p.oliPrefix(chunk) > 0 ||
- p.dliPrefix(chunk) > 0:
-
- if containsBlankLine {
- // end the list if the type changed after a blank line
- if indent <= itemIndent &&
- ((*flags&LIST_TYPE_ORDERED != 0 && p.uliPrefix(chunk) > 0) ||
- (*flags&LIST_TYPE_ORDERED == 0 && p.oliPrefix(chunk) > 0)) {
-
- *flags |= LIST_ITEM_END_OF_LIST
- break gatherlines
- }
- *flags |= LIST_ITEM_CONTAINS_BLOCK
- }
-
- // to be a nested list, it must be indented more
- // if not, it is the next item in the same list
- if indent <= itemIndent {
- break gatherlines
- }
-
- // is this the first item in the nested list?
- if sublist == 0 {
- sublist = raw.Len()
- }
-
- // is this a nested prefix header?
- case p.isPrefixHeader(chunk):
- // if the header is not indented, it is not nested in the list
- // and thus ends the list
- if containsBlankLine && indent < 4 {
- *flags |= LIST_ITEM_END_OF_LIST
- break gatherlines
- }
- *flags |= LIST_ITEM_CONTAINS_BLOCK
-
- // anything following an empty line is only part
- // of this item if it is indented 4 spaces
- // (regardless of the indentation of the beginning of the item)
- case containsBlankLine && indent < 4:
- if *flags&LIST_TYPE_DEFINITION != 0 && i < len(data)-1 {
- // is the next item still a part of this list?
- next := i
- for data[next] != '\n' {
- next++
- }
- for next < len(data)-1 && data[next] == '\n' {
- next++
- }
- if i < len(data)-1 && data[i] != ':' && data[next] != ':' {
- *flags |= LIST_ITEM_END_OF_LIST
- }
- } else {
- *flags |= LIST_ITEM_END_OF_LIST
- }
- break gatherlines
-
- // a blank line means this should be parsed as a block
- case containsBlankLine:
- *flags |= LIST_ITEM_CONTAINS_BLOCK
- }
-
- containsBlankLine = false
-
- // add the line into the working buffer without prefix
- raw.Write(data[line+indent : i])
-
- line = i
- }
-
- // If reached end of data, the Renderer.ListItem call we're going to make below
- // is definitely the last in the list.
- if line >= len(data) {
- *flags |= LIST_ITEM_END_OF_LIST
- }
-
- rawBytes := raw.Bytes()
-
- // render the contents of the list item
- var cooked bytes.Buffer
- if *flags&LIST_ITEM_CONTAINS_BLOCK != 0 && *flags&LIST_TYPE_TERM == 0 {
- // intermediate render of block item, except for definition term
- if sublist > 0 {
- p.block(&cooked, rawBytes[:sublist])
- p.block(&cooked, rawBytes[sublist:])
- } else {
- p.block(&cooked, rawBytes)
- }
- } else {
- // intermediate render of inline item
- if sublist > 0 {
- p.inline(&cooked, rawBytes[:sublist])
- p.block(&cooked, rawBytes[sublist:])
- } else {
- p.inline(&cooked, rawBytes)
- }
- }
-
- // render the actual list item
- cookedBytes := cooked.Bytes()
- parsedEnd := len(cookedBytes)
-
- // strip trailing newlines
- for parsedEnd > 0 && cookedBytes[parsedEnd-1] == '\n' {
- parsedEnd--
- }
- p.r.ListItem(out, cookedBytes[:parsedEnd], *flags)
-
- return line
-}
-
-// render a single paragraph that has already been parsed out
-func (p *parser) renderParagraph(out *bytes.Buffer, data []byte) {
- if len(data) == 0 {
- return
- }
-
- // trim leading spaces
- beg := 0
- for data[beg] == ' ' {
- beg++
- }
-
- // trim trailing newline
- end := len(data) - 1
-
- // trim trailing spaces
- for end > beg && data[end-1] == ' ' {
- end--
- }
-
- work := func() bool {
- p.inline(out, data[beg:end])
- return true
- }
- p.r.Paragraph(out, work)
-}
-
-func (p *parser) paragraph(out *bytes.Buffer, data []byte) int {
- // prev: index of 1st char of previous line
- // line: index of 1st char of current line
- // i: index of cursor/end of current line
- var prev, line, i int
-
- // keep going until we find something to mark the end of the paragraph
- for i < len(data) {
- // mark the beginning of the current line
- prev = line
- current := data[i:]
- line = i
-
- // did we find a blank line marking the end of the paragraph?
- if n := p.isEmpty(current); n > 0 {
- // did this blank line followed by a definition list item?
- if p.flags&EXTENSION_DEFINITION_LISTS != 0 {
- if i < len(data)-1 && data[i+1] == ':' {
- return p.list(out, data[prev:], LIST_TYPE_DEFINITION)
- }
- }
-
- p.renderParagraph(out, data[:i])
- return i + n
- }
-
- // an underline under some text marks a header, so our paragraph ended on prev line
- if i > 0 {
- if level := p.isUnderlinedHeader(current); level > 0 {
- // render the paragraph
- p.renderParagraph(out, data[:prev])
-
- // ignore leading and trailing whitespace
- eol := i - 1
- for prev < eol && data[prev] == ' ' {
- prev++
- }
- for eol > prev && data[eol-1] == ' ' {
- eol--
- }
-
- // render the header
- // this ugly double closure avoids forcing variables onto the heap
- work := func(o *bytes.Buffer, pp *parser, d []byte) func() bool {
- return func() bool {
- pp.inline(o, d)
- return true
- }
- }(out, p, data[prev:eol])
-
- id := ""
- if p.flags&EXTENSION_AUTO_HEADER_IDS != 0 {
- id = SanitizedAnchorName(string(data[prev:eol]))
- }
-
- p.r.Header(out, work, level, id)
-
- // find the end of the underline
- for data[i] != '\n' {
- i++
- }
- return i
- }
- }
-
- // if the next line starts a block of HTML, then the paragraph ends here
- if p.flags&EXTENSION_LAX_HTML_BLOCKS != 0 {
- if data[i] == '<' && p.html(out, current, false) > 0 {
- // rewind to before the HTML block
- p.renderParagraph(out, data[:i])
- return i
- }
- }
-
- // if there's a prefixed header or a horizontal rule after this, paragraph is over
- if p.isPrefixHeader(current) || p.isHRule(current) {
- p.renderParagraph(out, data[:i])
- return i
- }
-
- // if there's a fenced code block, paragraph is over
- if p.flags&EXTENSION_FENCED_CODE != 0 {
- if p.fencedCodeBlock(out, current, false) > 0 {
- p.renderParagraph(out, data[:i])
- return i
- }
- }
-
- // if there's a definition list item, prev line is a definition term
- if p.flags&EXTENSION_DEFINITION_LISTS != 0 {
- if p.dliPrefix(current) != 0 {
- return p.list(out, data[prev:], LIST_TYPE_DEFINITION)
- }
- }
-
- // if there's a list after this, paragraph is over
- if p.flags&EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK != 0 {
- if p.uliPrefix(current) != 0 ||
- p.oliPrefix(current) != 0 ||
- p.quotePrefix(current) != 0 ||
- p.codePrefix(current) != 0 {
- p.renderParagraph(out, data[:i])
- return i
- }
- }
-
- // otherwise, scan to the beginning of the next line
- for data[i] != '\n' {
- i++
- }
- i++
- }
-
- p.renderParagraph(out, data[:i])
- return i
-}
-
-// SanitizedAnchorName returns a sanitized anchor name for the given text.
-//
-// It implements the algorithm specified in the package comment.
-func SanitizedAnchorName(text string) string {
- var anchorName []rune
- futureDash := false
- for _, r := range text {
- switch {
- case unicode.IsLetter(r) || unicode.IsNumber(r):
- if futureDash && len(anchorName) > 0 {
- anchorName = append(anchorName, '-')
- }
- futureDash = false
- anchorName = append(anchorName, unicode.ToLower(r))
- default:
- futureDash = true
- }
- }
- return string(anchorName)
-}
diff --git a/vendor/github.com/russross/blackfriday/block_test.go b/vendor/github.com/russross/blackfriday/block_test.go
deleted file mode 100644
index 89d57754..00000000
--- a/vendor/github.com/russross/blackfriday/block_test.go
+++ /dev/null
@@ -1,1781 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross .
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-// Unit tests for block parsing
-//
-
-package blackfriday
-
-import (
- "strings"
- "testing"
-)
-
-func runMarkdownBlockWithRenderer(input string, extensions int, renderer Renderer) string {
- return string(Markdown([]byte(input), renderer, extensions))
-}
-
-func runMarkdownBlock(input string, extensions int) string {
- htmlFlags := 0
- htmlFlags |= HTML_USE_XHTML
-
- renderer := HtmlRenderer(htmlFlags, "", "")
-
- return runMarkdownBlockWithRenderer(input, extensions, renderer)
-}
-
-func runnerWithRendererParameters(parameters HtmlRendererParameters) func(string, int) string {
- return func(input string, extensions int) string {
- htmlFlags := 0
- htmlFlags |= HTML_USE_XHTML
-
- renderer := HtmlRendererWithParameters(htmlFlags, "", "", parameters)
-
- return runMarkdownBlockWithRenderer(input, extensions, renderer)
- }
-}
-
-func doTestsBlock(t *testing.T, tests []string, extensions int) {
- doTestsBlockWithRunner(t, tests, extensions, runMarkdownBlock)
-}
-
-func doTestsBlockWithRunner(t *testing.T, tests []string, extensions int, runner func(string, int) string) {
- // catch and report panics
- var candidate string
- defer func() {
- if err := recover(); err != nil {
- t.Errorf("\npanic while processing [%#v]: %s\n", candidate, err)
- }
- }()
-
- for i := 0; i+1 < len(tests); i += 2 {
- input := tests[i]
- candidate = input
- expected := tests[i+1]
- actual := runner(candidate, extensions)
- if actual != expected {
- t.Errorf("\nInput [%#v]\nExpected[%#v]\nActual [%#v]",
- candidate, expected, actual)
- }
-
- // now test every substring to stress test bounds checking
- if !testing.Short() {
- for start := 0; start < len(input); start++ {
- for end := start + 1; end <= len(input); end++ {
- candidate = input[start:end]
- _ = runMarkdownBlock(candidate, extensions)
- }
- }
- }
- }
-}
-
-func TestPrefixHeaderNoExtensions(t *testing.T) {
- var tests = []string{
- "# Header 1\n",
- "Header 1
\n",
-
- "## Header 2\n",
- "Header 2
\n",
-
- "### Header 3\n",
- "Header 3
\n",
-
- "#### Header 4\n",
- "Header 4
\n",
-
- "##### Header 5\n",
- "Header 5
\n",
-
- "###### Header 6\n",
- "Header 6
\n",
-
- "####### Header 7\n",
- "# Header 7
\n",
-
- "#Header 1\n",
- "Header 1
\n",
-
- "##Header 2\n",
- "Header 2
\n",
-
- "###Header 3\n",
- "Header 3
\n",
-
- "####Header 4\n",
- "Header 4
\n",
-
- "#####Header 5\n",
- "Header 5
\n",
-
- "######Header 6\n",
- "Header 6
\n",
-
- "#######Header 7\n",
- "#Header 7
\n",
-
- "Hello\n# Header 1\nGoodbye\n",
- "Hello
\n\nHeader 1
\n\nGoodbye
\n",
-
- "* List\n# Header\n* List\n",
- "\nList
\n\nHeader
\n\nList
\n
\n",
-
- "* List\n#Header\n* List\n",
- "\nList
\n\nHeader
\n\nList
\n
\n",
-
- "* List\n * Nested list\n # Nested header\n",
- "\nList
\n\n\nNested list
\n\n" +
- "Nested header
\n
\n
\n",
-
- "#Header 1 \\#\n",
- "Header 1 #
\n",
-
- "#Header 1 \\# foo\n",
- "Header 1 # foo
\n",
-
- "#Header 1 #\\##\n",
- "Header 1 ##
\n",
- }
- doTestsBlock(t, tests, 0)
-}
-
-func TestPrefixHeaderSpaceExtension(t *testing.T) {
- var tests = []string{
- "# Header 1\n",
- "Header 1
\n",
-
- "## Header 2\n",
- "Header 2
\n",
-
- "### Header 3\n",
- "Header 3
\n",
-
- "#### Header 4\n",
- "Header 4
\n",
-
- "##### Header 5\n",
- "Header 5
\n",
-
- "###### Header 6\n",
- "Header 6
\n",
-
- "####### Header 7\n",
- "####### Header 7
\n",
-
- "#Header 1\n",
- "#Header 1
\n",
-
- "##Header 2\n",
- "##Header 2
\n",
-
- "###Header 3\n",
- "###Header 3
\n",
-
- "####Header 4\n",
- "####Header 4
\n",
-
- "#####Header 5\n",
- "#####Header 5
\n",
-
- "######Header 6\n",
- "######Header 6
\n",
-
- "#######Header 7\n",
- "#######Header 7
\n",
-
- "Hello\n# Header 1\nGoodbye\n",
- "Hello
\n\nHeader 1
\n\nGoodbye
\n",
-
- "* List\n# Header\n* List\n",
- "\nList
\n\nHeader
\n\nList
\n
\n",
-
- "* List\n#Header\n* List\n",
- "\n",
-
- "* List\n * Nested list\n # Nested header\n",
- "\nList
\n\n\nNested list
\n\n" +
- "Nested header
\n
\n
\n",
- }
- doTestsBlock(t, tests, EXTENSION_SPACE_HEADERS)
-}
-
-func TestPrefixHeaderIdExtension(t *testing.T) {
- var tests = []string{
- "# Header 1 {#someid}\n",
- "Header 1
\n",
-
- "# Header 1 {#someid} \n",
- "Header 1
\n",
-
- "# Header 1 {#someid}\n",
- "Header 1
\n",
-
- "# Header 1 {#someid\n",
- "Header 1 {#someid
\n",
-
- "# Header 1 {#someid\n",
- "Header 1 {#someid
\n",
-
- "# Header 1 {#someid}}\n",
- "Header 1
\n\n}
\n",
-
- "## Header 2 {#someid}\n",
- "Header 2
\n",
-
- "### Header 3 {#someid}\n",
- "Header 3
\n",
-
- "#### Header 4 {#someid}\n",
- "Header 4
\n",
-
- "##### Header 5 {#someid}\n",
- "Header 5
\n",
-
- "###### Header 6 {#someid}\n",
- "Header 6
\n",
-
- "####### Header 7 {#someid}\n",
- "# Header 7
\n",
-
- "# Header 1 # {#someid}\n",
- "Header 1
\n",
-
- "## Header 2 ## {#someid}\n",
- "Header 2
\n",
-
- "Hello\n# Header 1\nGoodbye\n",
- "Hello
\n\nHeader 1
\n\nGoodbye
\n",
-
- "* List\n# Header {#someid}\n* List\n",
- "\nList
\n\nHeader
\n\nList
\n
\n",
-
- "* List\n#Header {#someid}\n* List\n",
- "\nList
\n\nHeader
\n\nList
\n
\n",
-
- "* List\n * Nested list\n # Nested header {#someid}\n",
- "\nList
\n\n\nNested list
\n\n" +
- "Nested header
\n
\n
\n",
- }
- doTestsBlock(t, tests, EXTENSION_HEADER_IDS)
-}
-
-func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
- var tests = []string{
- "# header 1 {#someid}\n",
- "header 1
\n",
-
- "## header 2 {#someid}\n",
- "header 2
\n",
-
- "### header 3 {#someid}\n",
- "header 3
\n",
-
- "#### header 4 {#someid}\n",
- "header 4
\n",
-
- "##### header 5 {#someid}\n",
- "header 5
\n",
-
- "###### header 6 {#someid}\n",
- "header 6
\n",
-
- "####### header 7 {#someid}\n",
- "# header 7
\n",
-
- "# header 1 # {#someid}\n",
- "header 1
\n",
-
- "## header 2 ## {#someid}\n",
- "header 2
\n",
-
- "* List\n# Header {#someid}\n* List\n",
- "\nList
\n\nHeader
\n\nList
\n
\n",
-
- "* List\n#Header {#someid}\n* List\n",
- "\nList
\n\nHeader
\n\nList
\n
\n",
-
- "* List\n * Nested list\n # Nested header {#someid}\n",
- "\nList
\n\n\nNested list
\n\n" +
- "Nested header
\n
\n
\n",
- }
-
- parameters := HtmlRendererParameters{
- HeaderIDPrefix: "PRE:",
- HeaderIDSuffix: ":POST",
- }
-
- doTestsBlockWithRunner(t, tests, EXTENSION_HEADER_IDS, runnerWithRendererParameters(parameters))
-}
-
-func TestPrefixAutoHeaderIdExtension(t *testing.T) {
- var tests = []string{
- "# Header 1\n",
- "\n",
-
- "# Header 1 \n",
- "\n",
-
- "## Header 2\n",
- "\n",
-
- "### Header 3\n",
- "\n",
-
- "#### Header 4\n",
- "\n",
-
- "##### Header 5\n",
- "\n",
-
- "###### Header 6\n",
- "\n",
-
- "####### Header 7\n",
- "\n",
-
- "Hello\n# Header 1\nGoodbye\n",
- "Hello
\n\n\n\nGoodbye
\n",
-
- "* List\n# Header\n* List\n",
- "\n",
-
- "* List\n#Header\n* List\n",
- "\n",
-
- "* List\n * Nested list\n # Nested header\n",
- "\nList
\n\n\nNested list
\n\n" +
- " \n
\n
\n",
-
- "# Header\n\n# Header\n",
- "\n\n\n",
-
- "# Header 1\n\n# Header 1",
- "\n\n\n",
-
- "# Header\n\n# Header 1\n\n# Header\n\n# Header",
- "\n\n\n\n\n\n\n",
- }
- doTestsBlock(t, tests, EXTENSION_AUTO_HEADER_IDS)
-}
-
-func TestPrefixAutoHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
- var tests = []string{
- "# Header 1\n",
- "\n",
-
- "# Header 1 \n",
- "\n",
-
- "## Header 2\n",
- "\n",
-
- "### Header 3\n",
- "\n",
-
- "#### Header 4\n",
- "\n",
-
- "##### Header 5\n",
- "\n",
-
- "###### Header 6\n",
- "\n",
-
- "####### Header 7\n",
- "\n",
-
- "Hello\n# Header 1\nGoodbye\n",
- "Hello
\n\n\n\nGoodbye
\n",
-
- "* List\n# Header\n* List\n",
- "\n",
-
- "* List\n#Header\n* List\n",
- "\n",
-
- "* List\n * Nested list\n # Nested header\n",
- "\nList
\n\n\nNested list
\n\n" +
- " \n
\n
\n",
-
- "# Header\n\n# Header\n",
- "\n\n\n",
-
- "# Header 1\n\n# Header 1",
- "\n\n\n",
-
- "# Header\n\n# Header 1\n\n# Header\n\n# Header",
- "\n\n\n\n\n\n\n",
- }
-
- parameters := HtmlRendererParameters{
- HeaderIDPrefix: "PRE:",
- HeaderIDSuffix: ":POST",
- }
-
- doTestsBlockWithRunner(t, tests, EXTENSION_AUTO_HEADER_IDS, runnerWithRendererParameters(parameters))
-}
-
-func TestPrefixMultipleHeaderExtensions(t *testing.T) {
- var tests = []string{
- "# Header\n\n# Header {#header}\n\n# Header 1",
- "\n\n\n\n\n",
- }
- doTestsBlock(t, tests, EXTENSION_AUTO_HEADER_IDS|EXTENSION_HEADER_IDS)
-}
-
-func TestUnderlineHeaders(t *testing.T) {
- var tests = []string{
- "Header 1\n========\n",
- "Header 1
\n",
-
- "Header 2\n--------\n",
- "Header 2
\n",
-
- "A\n=\n",
- "A
\n",
-
- "B\n-\n",
- "B
\n",
-
- "Paragraph\nHeader\n=\n",
- "Paragraph
\n\nHeader
\n",
-
- "Header\n===\nParagraph\n",
- "Header
\n\nParagraph
\n",
-
- "Header\n===\nAnother header\n---\n",
- "Header
\n\nAnother header
\n",
-
- " Header\n======\n",
- "Header
\n",
-
- " Code\n========\n",
- "Code\n
\n\n========
\n",
-
- "Header with *inline*\n=====\n",
- "Header with inline
\n",
-
- "* List\n * Sublist\n Not a header\n ------\n",
- "\n- List\n\n
\n- Sublist\nNot a header\n------
\n
\n
\n",
-
- "Paragraph\n\n\n\n\nHeader\n===\n",
- "Paragraph
\n\nHeader
\n",
-
- "Trailing space \n==== \n\n",
- "Trailing space
\n",
-
- "Trailing spaces\n==== \n\n",
- "Trailing spaces
\n",
-
- "Double underline\n=====\n=====\n",
- "Double underline
\n\n=====
\n",
- }
- doTestsBlock(t, tests, 0)
-}
-
-func TestUnderlineHeadersAutoIDs(t *testing.T) {
- var tests = []string{
- "Header 1\n========\n",
- "\n",
-
- "Header 2\n--------\n",
- "\n",
-
- "A\n=\n",
- "A
\n",
-
- "B\n-\n",
- "B
\n",
-
- "Paragraph\nHeader\n=\n",
- "Paragraph
\n\n\n",
-
- "Header\n===\nParagraph\n",
- "\n\nParagraph
\n",
-
- "Header\n===\nAnother header\n---\n",
- "\n\n\n",
-
- " Header\n======\n",
- "\n",
-
- "Header with *inline*\n=====\n",
- "\n",
-
- "Paragraph\n\n\n\n\nHeader\n===\n",
- "Paragraph
\n\n\n",
-
- "Trailing space \n==== \n\n",
- "Trailing space
\n",
-
- "Trailing spaces\n==== \n\n",
- "Trailing spaces
\n",
-
- "Double underline\n=====\n=====\n",
- "Double underline
\n\n=====
\n",
-
- "Header\n======\n\nHeader\n======\n",
- "\n\n\n",
-
- "Header 1\n========\n\nHeader 1\n========\n",
- "\n\n\n",
- }
- doTestsBlock(t, tests, EXTENSION_AUTO_HEADER_IDS)
-}
-
-func TestHorizontalRule(t *testing.T) {
- var tests = []string{
- "-\n",
- "-
\n",
-
- "--\n",
- "--
\n",
-
- "---\n",
- "
\n",
-
- "----\n",
- "
\n",
-
- "*\n",
- "*
\n",
-
- "**\n",
- "**
\n",
-
- "***\n",
- "
\n",
-
- "****\n",
- "
\n",
-
- "_\n",
- "_
\n",
-
- "__\n",
- "__
\n",
-
- "___\n",
- "
\n",
-
- "____\n",
- "
\n",
-
- "-*-\n",
- "-*-
\n",
-
- "- - -\n",
- "
\n",
-
- "* * *\n",
- "
\n",
-
- "_ _ _\n",
- "
\n",
-
- "-----*\n",
- "-----*
\n",
-
- " ------ \n",
- "
\n",
-
- "Hello\n***\n",
- "Hello
\n\n
\n",
-
- "---\n***\n___\n",
- "
\n\n
\n\n
\n",
- }
- doTestsBlock(t, tests, 0)
-}
-
-func TestUnorderedList(t *testing.T) {
- var tests = []string{
- "* Hello\n",
- "\n",
-
- "* Yin\n* Yang\n",
- "\n",
-
- "* Ting\n* Bong\n* Goo\n",
- "\n",
-
- "* Yin\n\n* Yang\n",
- "\n",
-
- "* Ting\n\n* Bong\n* Goo\n",
- "\n",
-
- "+ Hello\n",
- "\n",
-
- "+ Yin\n+ Yang\n",
- "\n",
-
- "+ Ting\n+ Bong\n+ Goo\n",
- "\n",
-
- "+ Yin\n\n+ Yang\n",
- "\n",
-
- "+ Ting\n\n+ Bong\n+ Goo\n",
- "\n",
-
- "- Hello\n",
- "\n",
-
- "- Yin\n- Yang\n",
- "\n",
-
- "- Ting\n- Bong\n- Goo\n",
- "\n",
-
- "- Yin\n\n- Yang\n",
- "\n",
-
- "- Ting\n\n- Bong\n- Goo\n",
- "\n",
-
- "*Hello\n",
- "*Hello
\n",
-
- "* Hello \n",
- "\n",
-
- "* Hello \n Next line \n",
- "\n",
-
- "Paragraph\n* No linebreak\n",
- "Paragraph\n* No linebreak
\n",
-
- "Paragraph\n\n* Linebreak\n",
- "Paragraph
\n\n\n",
-
- "* List\n\n1. Spacer Mixed listing\n",
- "\n\n\n- Spacer Mixed listing
\n
\n",
-
- "* List\n * Nested list\n",
- "\n",
-
- "* List\n\n * Nested list\n",
- "\n",
-
- "* List\n Second line\n\n + Nested\n",
- "\nList\nSecond line
\n\n \n
\n",
-
- "* List\n + Nested\n\n Continued\n",
- "\nList
\n\n\n\nContinued
\n
\n",
-
- "* List\n * shallow indent\n",
- "\n",
-
- "* List\n" +
- " * shallow indent\n" +
- " * part of second list\n" +
- " * still second\n" +
- " * almost there\n" +
- " * third level\n",
- "\n" +
- "- List\n\n" +
- "
\n" +
- "- shallow indent
\n" +
- "- part of second list
\n" +
- "- still second
\n" +
- "- almost there\n\n" +
- "
\n" +
- "- third level
\n" +
- "
\n" +
- "
\n" +
- "
\n",
-
- "* List\n extra indent, same paragraph\n",
- "\n- List\n extra indent, same paragraph
\n
\n",
-
- "* List\n\n code block\n",
- "\n",
-
- "* List\n\n code block with spaces\n",
- "\nList
\n\n code block with spaces\n
\n
\n",
-
- "* List\n\n * sublist\n\n normal text\n\n * another sublist\n",
- "\nList
\n\n\n\nnormal text
\n\n \n
\n",
-
- `* Foo
-
- bar
-
- qux
-`,
- `
-`,
- }
- doTestsBlock(t, tests, 0)
-}
-
-func TestFencedCodeBlockWithinList(t *testing.T) {
- doTestsBlock(t, []string{
- "* Foo\n\n ```\n bar\n\n qux\n ```\n",
- `
-`,
- }, EXTENSION_FENCED_CODE)
-}
-
-func TestOrderedList(t *testing.T) {
- var tests = []string{
- "1. Hello\n",
- "\n- Hello
\n
\n",
-
- "1. Yin\n2. Yang\n",
- "\n- Yin
\n- Yang
\n
\n",
-
- "1. Ting\n2. Bong\n3. Goo\n",
- "\n- Ting
\n- Bong
\n- Goo
\n
\n",
-
- "1. Yin\n\n2. Yang\n",
- "\nYin
\n\nYang
\n
\n",
-
- "1. Ting\n\n2. Bong\n3. Goo\n",
- "\nTing
\n\nBong
\n\nGoo
\n
\n",
-
- "1 Hello\n",
- "1 Hello
\n",
-
- "1.Hello\n",
- "1.Hello
\n",
-
- "1. Hello \n",
- "\n- Hello
\n
\n",
-
- "1. Hello \n Next line \n",
- "\n- Hello\nNext line
\n
\n",
-
- "Paragraph\n1. No linebreak\n",
- "Paragraph\n1. No linebreak
\n",
-
- "Paragraph\n\n1. Linebreak\n",
- "Paragraph
\n\n\n- Linebreak
\n
\n",
-
- "1. List\n 1. Nested list\n",
- "\n- List\n\n
\n- Nested list
\n
\n
\n",
-
- "1. List\n\n 1. Nested list\n",
- "\nList
\n\n\n- Nested list
\n
\n
\n",
-
- "1. List\n Second line\n\n 1. Nested\n",
- "\nList\nSecond line
\n\n\n- Nested
\n
\n
\n",
-
- "1. List\n 1. Nested\n\n Continued\n",
- "\nList
\n\n\n- Nested
\n
\n\nContinued
\n
\n",
-
- "1. List\n 1. shallow indent\n",
- "\n- List\n\n
\n- shallow indent
\n
\n
\n",
-
- "1. List\n" +
- " 1. shallow indent\n" +
- " 2. part of second list\n" +
- " 3. still second\n" +
- " 4. almost there\n" +
- " 1. third level\n",
- "\n" +
- "- List\n\n" +
- "
\n" +
- "- shallow indent
\n" +
- "- part of second list
\n" +
- "- still second
\n" +
- "- almost there\n\n" +
- "
\n" +
- "- third level
\n" +
- "
\n" +
- "
\n" +
- "
\n",
-
- "1. List\n extra indent, same paragraph\n",
- "\n- List\n extra indent, same paragraph
\n
\n",
-
- "1. List\n\n code block\n",
- "\nList
\n\ncode block\n
\n
\n",
-
- "1. List\n\n code block with spaces\n",
- "\nList
\n\n code block with spaces\n
\n
\n",
-
- "1. List\n\n* Spacer Mixed listing\n",
- "\n- List
\n
\n\n\n",
-
- "1. List\n* Mixed listing\n",
- "\n- List
\n- Mixed listing
\n
\n",
-
- "1. List\n * Mixted list\n",
- "\n- List\n\n
\n
\n",
-
- "1. List\n * Mixed list\n",
- "\n- List\n\n
\n
\n",
-
- "* Start with unordered\n 1. Ordered\n",
- "\n- Start with unordered\n\n
\n- Ordered
\n
\n
\n",
-
- "* Start with unordered\n 1. Ordered\n",
- "\n- Start with unordered\n\n
\n- Ordered
\n
\n
\n",
-
- "1. numbers\n1. are ignored\n",
- "\n- numbers
\n- are ignored
\n
\n",
-
- `1. Foo
-
- bar
-
-
-
- qux
-`,
- `
-Foo
-
-bar
-
-
-
-qux
-
-
-`,
- }
- doTestsBlock(t, tests, 0)
-}
-
-func TestDefinitionList(t *testing.T) {
- var tests = []string{
- "Term 1\n: Definition a\n",
- "\n- Term 1
\n- Definition a
\n
\n",
-
- "Term 1\n: Definition a \n",
- "\n- Term 1
\n- Definition a
\n
\n",
-
- "Term 1\n: Definition a\n: Definition b\n",
- "\n- Term 1
\n- Definition a
\n- Definition b
\n
\n",
-
- "Term 1\n: Definition a\n\nTerm 2\n: Definition b\n",
- "\n" +
- "- Term 1
\n" +
- "- Definition a
\n" +
- "- Term 2
\n" +
- "- Definition b
\n" +
- "
\n",
-
- "Term 1\n: Definition a\n\nTerm 2\n: Definition b\n\nTerm 3\n: Definition c\n",
- "\n" +
- "- Term 1
\n" +
- "- Definition a
\n" +
- "- Term 2
\n" +
- "- Definition b
\n" +
- "- Term 3
\n" +
- "- Definition c
\n" +
- "
\n",
-
- "Term 1\n: Definition a\n: Definition b\n\nTerm 2\n: Definition c\n",
- "\n" +
- "- Term 1
\n" +
- "- Definition a
\n" +
- "- Definition b
\n" +
- "- Term 2
\n" +
- "- Definition c
\n" +
- "
\n",
-
- "Term 1\n\n: Definition a\n\nTerm 2\n\n: Definition b\n",
- "\n" +
- "- Term 1
\n" +
- "Definition a
\n" +
- "- Term 2
\n" +
- "Definition b
\n" +
- "
\n",
-
- "Term 1\n\n: Definition a\n\n: Definition b\n\nTerm 2\n\n: Definition c\n",
- "\n" +
- "- Term 1
\n" +
- "Definition a
\n" +
- "Definition b
\n" +
- "- Term 2
\n" +
- "Definition c
\n" +
- "
\n",
-
- "Term 1\n: Definition a\nNext line\n",
- "\n- Term 1
\n- Definition a\nNext line
\n
\n",
-
- "Term 1\n: Definition a\n Next line\n",
- "\n- Term 1
\n- Definition a\nNext line
\n
\n",
-
- "Term 1\n: Definition a \n Next line \n",
- "\n- Term 1
\n- Definition a\nNext line
\n
\n",
-
- "Term 1\n: Definition a\nNext line\n\nTerm 2\n: Definition b",
- "\n" +
- "- Term 1
\n" +
- "- Definition a\nNext line
\n" +
- "- Term 2
\n" +
- "- Definition b
\n" +
- "
\n",
-
- "Term 1\n: Definition a\n",
- "\n- Term 1
\n- Definition a
\n
\n",
-
- "Term 1\n:Definition a\n",
- "Term 1\n:Definition a
\n",
-
- "Term 1\n\n: Definition a\n\nTerm 2\n\n: Definition b\n\nText 1",
- "\n" +
- "- Term 1
\n" +
- "Definition a
\n" +
- "- Term 2
\n" +
- "Definition b
\n" +
- "
\n" +
- "\nText 1
\n",
-
- "Term 1\n\n: Definition a\n\nText 1\n\nTerm 2\n\n: Definition b\n\nText 2",
- "\n" +
- "- Term 1
\n" +
- "Definition a
\n" +
- "
\n" +
- "\nText 1
\n" +
- "\n\n" +
- "- Term 2
\n" +
- "Definition b
\n" +
- "
\n" +
- "\nText 2
\n",
-
- "Term 1\n: Definition a\n\n Text 1\n\n 1. First\n 2. Second",
- "\n" +
- "- Term 1
\n" +
- "Definition a
\n\n" +
- "Text 1
\n\n" +
- "\n- First
\n- Second
\n
\n" +
- "
\n",
- }
- doTestsBlock(t, tests, EXTENSION_DEFINITION_LISTS)
-}
-
-func TestPreformattedHtml(t *testing.T) {
- var tests = []string{
- "\n",
- "\n",
-
- "\n
\n",
- "\n
\n",
-
- "\n
\nParagraph\n",
- "\n
\nParagraph
\n",
-
- "\n
\n",
- "\n
\n",
-
- "\nAnything here\n
\n",
- "\nAnything here\n
\n",
-
- "\n Anything here\n
\n",
- "\n Anything here\n
\n",
-
- "\nAnything here\n
\n",
- "\nAnything here\n
\n",
-
- "\nThis is *not* &proceessed\n
\n",
- "\nThis is *not* &proceessed\n
\n",
-
- "\n Something\n\n",
- "\n Something\n
\n",
-
- "\n Something here\n\n",
- "
\n Something here\n\n",
-
- "Paragraph\n
\nHere? >&<\n
\n",
- "
Paragraph\n
\nHere? >&<\n
\n",
-
- "Paragraph\n\n
\nHow about here? >&<\n
\n",
- "
Paragraph
\n\n
\nHow about here? >&<\n
\n",
-
- "Paragraph\n
\nHere? >&<\n
\nAnd here?\n",
- "
Paragraph\n
\nHere? >&<\n
\nAnd here?\n",
-
- "Paragraph\n\n
\nHow about here? >&<\n
\nAnd here?\n",
- "
Paragraph
\n\n
\nHow about here? >&<\n
\nAnd here?\n",
-
- "Paragraph\n
\nHere? >&<\n
\n\nAnd here?\n",
- "
Paragraph\n
\nHere? >&<\n
\n\n
And here?
\n",
-
- "Paragraph\n\n
\nHow about here? >&<\n
\n\nAnd here?\n",
- "
Paragraph
\n\n
\nHow about here? >&<\n
\n\n
And here?
\n",
- }
- doTestsBlock(t, tests, 0)
-}
-
-func TestPreformattedHtmlLax(t *testing.T) {
- var tests = []string{
- "Paragraph\n
\nHere? >&<\n
\n",
- "
Paragraph
\n\n
\nHere? >&<\n
\n",
-
- "Paragraph\n\n
\nHow about here? >&<\n
\n",
- "
Paragraph
\n\n
\nHow about here? >&<\n
\n",
-
- "Paragraph\n
\nHere? >&<\n
\nAnd here?\n",
- "
Paragraph
\n\n
\nHere? >&<\n
\n\n
And here?
\n",
-
- "Paragraph\n\n
\nHow about here? >&<\n
\nAnd here?\n",
- "
Paragraph
\n\n
\nHow about here? >&<\n
\n\n
And here?
\n",
-
- "Paragraph\n
\nHere? >&<\n
\n\nAnd here?\n",
- "
Paragraph
\n\n
\nHere? >&<\n
\n\n
And here?
\n",
-
- "Paragraph\n\n
\nHow about here? >&<\n
\n\nAnd here?\n",
- "
Paragraph
\n\n
\nHow about here? >&<\n
\n\n
And here?
\n",
- }
- doTestsBlock(t, tests, EXTENSION_LAX_HTML_BLOCKS)
-}
-
-func TestFencedCodeBlock(t *testing.T) {
- var tests = []string{
- "``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
- "
func foo() bool {\n\treturn true;\n}\n
\n",
-
- "``` c\n/* special & char < > \" escaping */\n```\n",
- "
/* special & char < > " escaping */\n
\n",
-
- "``` c\nno *inline* processing ~~of text~~\n```\n",
- "
no *inline* processing ~~of text~~\n
\n",
-
- "```\nNo language\n```\n",
- "
No language\n
\n",
-
- "``` {ocaml}\nlanguage in braces\n```\n",
- "
language in braces\n
\n",
-
- "``` {ocaml} \nwith extra whitespace\n```\n",
- "
with extra whitespace\n
\n",
-
- "```{ ocaml }\nwith extra whitespace\n```\n",
- "
with extra whitespace\n
\n",
-
- "~ ~~ java\nWith whitespace\n~~~\n",
- "
~ ~~ java\nWith whitespace\n~~~
\n",
-
- "~~\nonly two\n~~\n",
- "
~~\nonly two\n~~
\n",
-
- "```` python\nextra\n````\n",
- "
extra\n
\n",
-
- "~~~ perl\nthree to start, four to end\n~~~~\n",
- "
~~~ perl\nthree to start, four to end\n~~~~
\n",
-
- "~~~~ perl\nfour to start, three to end\n~~~\n",
- "
~~~~ perl\nfour to start, three to end\n~~~
\n",
-
- "~~~ bash\ntildes\n~~~\n",
- "
tildes\n
\n",
-
- "``` lisp\nno ending\n",
- "
``` lisp\nno ending
\n",
-
- "~~~ lisp\nend with language\n~~~ lisp\n",
- "
~~~ lisp\nend with language\n~~~ lisp
\n",
-
- "```\nmismatched begin and end\n~~~\n",
- "
```\nmismatched begin and end\n~~~
\n",
-
- "~~~\nmismatched begin and end\n```\n",
- "
~~~\nmismatched begin and end\n```
\n",
-
- " ``` oz\nleading spaces\n```\n",
- "
leading spaces\n
\n",
-
- " ``` oz\nleading spaces\n ```\n",
- "
leading spaces\n
\n",
-
- " ``` oz\nleading spaces\n ```\n",
- "
leading spaces\n
\n",
-
- "``` oz\nleading spaces\n ```\n",
- "
leading spaces\n
\n",
-
- " ``` oz\nleading spaces\n ```\n",
- "
``` oz\n
\n\n
leading spaces\n ```
\n",
-
- "Bla bla\n\n``` oz\ncode blocks breakup paragraphs\n```\n\nBla Bla\n",
- "
Bla bla
\n\n
code blocks breakup paragraphs\n
\n\n
Bla Bla
\n",
-
- "Some text before a fenced code block\n``` oz\ncode blocks breakup paragraphs\n```\nAnd some text after a fenced code block",
- "
Some text before a fenced code block
\n\n
code blocks breakup paragraphs\n
\n\n
And some text after a fenced code block
\n",
-
- "`",
- "
`
\n",
-
- "Bla bla\n\n``` oz\ncode blocks breakup paragraphs\n```\n\nBla Bla\n\n``` oz\nmultiple code blocks work okay\n```\n\nBla Bla\n",
- "
Bla bla
\n\n
code blocks breakup paragraphs\n
\n\n
Bla Bla
\n\n
multiple code blocks work okay\n
\n\n
Bla Bla
\n",
-
- "Some text before a fenced code block\n``` oz\ncode blocks breakup paragraphs\n```\nSome text in between\n``` oz\nmultiple code blocks work okay\n```\nAnd some text after a fenced code block",
- "
Some text before a fenced code block
\n\n
code blocks breakup paragraphs\n
\n\n
Some text in between
\n\n
multiple code blocks work okay\n
\n\n
And some text after a fenced code block
\n",
-
- "```\n[]:()\n```\n",
- "
[]:()\n
\n",
-
- "```\n[]:()\n[]:)\n[]:(\n[]:x\n[]:testing\n[:testing\n\n[]:\nlinebreak\n[]()\n\n[]:\n[]()\n```",
- "
[]:()\n[]:)\n[]:(\n[]:x\n[]:testing\n[:testing\n\n[]:\nlinebreak\n[]()\n\n[]:\n[]()\n
\n",
- }
- doTestsBlock(t, tests, EXTENSION_FENCED_CODE)
-}
-
-func TestFencedCodeInsideBlockquotes(t *testing.T) {
- cat := func(s ...string) string { return strings.Join(s, "\n") }
- var tests = []string{
- cat("> ```go",
- "package moo",
- "",
- "```",
- ""),
- `
-package moo
-
-
-
-`,
- // -------------------------------------------
- cat("> foo",
- "> ",
- "> ```go",
- "package moo",
- "```",
- "> ",
- "> goo.",
- ""),
- `
-foo
-
-package moo
-
-
-goo.
-
-`,
- // -------------------------------------------
- cat("> foo",
- "> ",
- "> quote",
- "continues",
- "```",
- ""),
- `
-foo
-
-quote
-continues
-` + "```" + `
-
-`,
- // -------------------------------------------
- cat("> foo",
- "> ",
- "> ```go",
- "package moo",
- "```",
- "> ",
- "> goo.",
- "> ",
- "> ```go",
- "package zoo",
- "```",
- "> ",
- "> woo.",
- ""),
- `
-foo
-
-package moo
-
-
-goo.
-
-package zoo
-
-
-woo.
-
-`,
- }
-
- // These 2 alternative forms of blockquoted fenced code blocks should produce same output.
- forms := [2]string{
- cat("> plain quoted text",
- "> ```fenced",
- "code",
- " with leading single space correctly preserved",
- "okay",
- "```",
- "> rest of quoted text"),
- cat("> plain quoted text",
- "> ```fenced",
- "> code",
- "> with leading single space correctly preserved",
- "> okay",
- "> ```",
- "> rest of quoted text"),
- }
- want := `
-plain quoted text
-
-code
- with leading single space correctly preserved
-okay
-
-
-rest of quoted text
-
-`
- tests = append(tests, forms[0], want)
- tests = append(tests, forms[1], want)
-
- doTestsBlock(t, tests, EXTENSION_FENCED_CODE)
-}
-
-func TestTable(t *testing.T) {
- var tests = []string{
- "a | b\n---|---\nc | d\n",
- "
\n\n\na | \nb | \n
\n\n\n" +
- "\n\nc | \nd | \n
\n\n
\n",
-
- "a | b\n---|--\nc | d\n",
- "
a | b\n---|--\nc | d
\n",
-
- "|a|b|c|d|\n|----|----|----|---|\n|e|f|g|h|\n",
- "
\n\n\na | \nb | \nc | \nd | \n
\n\n\n" +
- "\n\ne | \nf | \ng | \nh | \n
\n\n
\n",
-
- "*a*|__b__|[c](C)|d\n---|---|---|---\ne|f|g|h\n",
- "
\n\n\na | \nb | \nc | \nd | \n
\n\n\n" +
- "\n\ne | \nf | \ng | \nh | \n
\n\n
\n",
-
- "a|b|c\n---|---|---\nd|e|f\ng|h\ni|j|k|l|m\nn|o|p\n",
- "
\n\n\na | \nb | \nc | \n
\n\n\n" +
- "\n\nd | \ne | \nf | \n
\n\n" +
- "\ng | \nh | \n | \n
\n\n" +
- "\ni | \nj | \nk | \n
\n\n" +
- "\nn | \no | \np | \n
\n\n
\n",
-
- "a|b|c\n---|---|---\n*d*|__e__|f\n",
- "
\n\n\na | \nb | \nc | \n
\n\n\n" +
- "\n\nd | \ne | \nf | \n
\n\n
\n",
-
- "a|b|c|d\n:--|--:|:-:|---\ne|f|g|h\n",
- "
\n\n\na | \nb | \n" +
- "c | \nd | \n
\n\n\n" +
- "\n\ne | \nf | \n" +
- "g | \nh | \n
\n\n
\n",
-
- "a|b|c\n---|---|---\n",
- "
\n\n\na | \nb | \nc | \n
\n\n\n\n\n
\n",
-
- "a| b|c | d | e\n---|---|---|---|---\nf| g|h | i |j\n",
- "
\n\n\na | \nb | \nc | \nd | \ne | \n
\n\n\n" +
- "\n\nf | \ng | \nh | \ni | \nj | \n
\n\n
\n",
-
- "a|b\\|c|d\n---|---|---\nf|g\\|h|i\n",
- "
\n\n\na | \nb|c | \nd | \n
\n\n\n\n\nf | \ng|h | \ni | \n
\n\n
\n",
- }
- doTestsBlock(t, tests, EXTENSION_TABLES)
-}
-
-func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
- var tests = []string{
- "* Hello\n",
- "
\n",
-
- "* Yin\n* Yang\n",
- "
\n",
-
- "* Ting\n* Bong\n* Goo\n",
- "
\n",
-
- "* Yin\n\n* Yang\n",
- "
\n",
-
- "* Ting\n\n* Bong\n* Goo\n",
- "
\n",
-
- "+ Hello\n",
- "
\n",
-
- "+ Yin\n+ Yang\n",
- "
\n",
-
- "+ Ting\n+ Bong\n+ Goo\n",
- "
\n",
-
- "+ Yin\n\n+ Yang\n",
- "
\n",
-
- "+ Ting\n\n+ Bong\n+ Goo\n",
- "
\n",
-
- "- Hello\n",
- "
\n",
-
- "- Yin\n- Yang\n",
- "
\n",
-
- "- Ting\n- Bong\n- Goo\n",
- "
\n",
-
- "- Yin\n\n- Yang\n",
- "
\n",
-
- "- Ting\n\n- Bong\n- Goo\n",
- "
\n",
-
- "*Hello\n",
- "
*Hello
\n",
-
- "* Hello \n",
- "
\n",
-
- "* Hello \n Next line \n",
- "
\n",
-
- "Paragraph\n* No linebreak\n",
- "
Paragraph
\n\n
\n",
-
- "Paragraph\n\n* Linebreak\n",
- "
Paragraph
\n\n
\n",
-
- "* List\n * Nested list\n",
- "
\n",
-
- "* List\n\n * Nested list\n",
- "
\n",
-
- "* List\n Second line\n\n + Nested\n",
- "
\nList\nSecond line
\n\n \n
\n",
-
- "* List\n + Nested\n\n Continued\n",
- "
\nList
\n\n\n\nContinued
\n
\n",
-
- "* List\n * shallow indent\n",
- "
\n",
-
- "* List\n" +
- " * shallow indent\n" +
- " * part of second list\n" +
- " * still second\n" +
- " * almost there\n" +
- " * third level\n",
- "
\n" +
- "- List\n\n" +
- "
\n" +
- "- shallow indent
\n" +
- "- part of second list
\n" +
- "- still second
\n" +
- "- almost there\n\n" +
- "
\n" +
- "- third level
\n" +
- "
\n" +
- "
\n" +
- "
\n",
-
- "* List\n extra indent, same paragraph\n",
- "
\n- List\n extra indent, same paragraph
\n
\n",
-
- "* List\n\n code block\n",
- "
\n",
-
- "* List\n\n code block with spaces\n",
- "
\nList
\n\n code block with spaces\n
\n
\n",
-
- "* List\n\n * sublist\n\n normal text\n\n * another sublist\n",
- "
\nList
\n\n\n\nnormal text
\n\n \n
\n",
- }
- doTestsBlock(t, tests, EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK)
-}
-
-func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
- var tests = []string{
- "1. Hello\n",
- "
\n- Hello
\n
\n",
-
- "1. Yin\n2. Yang\n",
- "
\n- Yin
\n- Yang
\n
\n",
-
- "1. Ting\n2. Bong\n3. Goo\n",
- "
\n- Ting
\n- Bong
\n- Goo
\n
\n",
-
- "1. Yin\n\n2. Yang\n",
- "
\nYin
\n\nYang
\n
\n",
-
- "1. Ting\n\n2. Bong\n3. Goo\n",
- "
\nTing
\n\nBong
\n\nGoo
\n
\n",
-
- "1 Hello\n",
- "
1 Hello
\n",
-
- "1.Hello\n",
- "
1.Hello
\n",
-
- "1. Hello \n",
- "
\n- Hello
\n
\n",
-
- "1. Hello \n Next line \n",
- "
\n- Hello\nNext line
\n
\n",
-
- "Paragraph\n1. No linebreak\n",
- "
Paragraph
\n\n
\n- No linebreak
\n
\n",
-
- "Paragraph\n\n1. Linebreak\n",
- "
Paragraph
\n\n
\n- Linebreak
\n
\n",
-
- "1. List\n 1. Nested list\n",
- "
\n- List\n\n
\n- Nested list
\n
\n
\n",
-
- "1. List\n\n 1. Nested list\n",
- "
\nList
\n\n\n- Nested list
\n
\n
\n",
-
- "1. List\n Second line\n\n 1. Nested\n",
- "
\nList\nSecond line
\n\n\n- Nested
\n
\n
\n",
-
- "1. List\n 1. Nested\n\n Continued\n",
- "
\nList
\n\n\n- Nested
\n
\n\nContinued
\n
\n",
-
- "1. List\n 1. shallow indent\n",
- "
\n- List\n\n
\n- shallow indent
\n
\n
\n",
-
- "1. List\n" +
- " 1. shallow indent\n" +
- " 2. part of second list\n" +
- " 3. still second\n" +
- " 4. almost there\n" +
- " 1. third level\n",
- "
\n" +
- "- List\n\n" +
- "
\n" +
- "- shallow indent
\n" +
- "- part of second list
\n" +
- "- still second
\n" +
- "- almost there\n\n" +
- "
\n" +
- "- third level
\n" +
- "
\n" +
- "
\n" +
- "
\n",
-
- "1. List\n extra indent, same paragraph\n",
- "
\n- List\n extra indent, same paragraph
\n
\n",
-
- "1. List\n\n code block\n",
- "
\nList
\n\ncode block\n
\n
\n",
-
- "1. List\n\n code block with spaces\n",
- "
\nList
\n\n code block with spaces\n
\n
\n",
-
- "1. List\n * Mixted list\n",
- "
\n- List\n\n
\n
\n",
-
- "1. List\n * Mixed list\n",
- "
\n- List\n\n
\n
\n",
-
- "* Start with unordered\n 1. Ordered\n",
- "
\n- Start with unordered\n\n
\n- Ordered
\n
\n
\n",
-
- "* Start with unordered\n 1. Ordered\n",
- "
\n- Start with unordered\n\n
\n- Ordered
\n
\n
\n",
-
- "1. numbers\n1. are ignored\n",
- "
\n- numbers
\n- are ignored
\n
\n",
- }
- doTestsBlock(t, tests, EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK)
-}
-
-func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
- var tests = []string{
- "``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
- "
func foo() bool {\n\treturn true;\n}\n
\n",
-
- "``` c\n/* special & char < > \" escaping */\n```\n",
- "
/* special & char < > " escaping */\n
\n",
-
- "``` c\nno *inline* processing ~~of text~~\n```\n",
- "
no *inline* processing ~~of text~~\n
\n",
-
- "```\nNo language\n```\n",
- "
No language\n
\n",
-
- "``` {ocaml}\nlanguage in braces\n```\n",
- "
language in braces\n
\n",
-
- "``` {ocaml} \nwith extra whitespace\n```\n",
- "
with extra whitespace\n
\n",
-
- "```{ ocaml }\nwith extra whitespace\n```\n",
- "
with extra whitespace\n
\n",
-
- "~ ~~ java\nWith whitespace\n~~~\n",
- "
~ ~~ java\nWith whitespace\n~~~
\n",
-
- "~~\nonly two\n~~\n",
- "
~~\nonly two\n~~
\n",
-
- "```` python\nextra\n````\n",
- "
extra\n
\n",
-
- "~~~ perl\nthree to start, four to end\n~~~~\n",
- "
~~~ perl\nthree to start, four to end\n~~~~
\n",
-
- "~~~~ perl\nfour to start, three to end\n~~~\n",
- "
~~~~ perl\nfour to start, three to end\n~~~
\n",
-
- "~~~ bash\ntildes\n~~~\n",
- "
tildes\n
\n",
-
- "``` lisp\nno ending\n",
- "
``` lisp\nno ending
\n",
-
- "~~~ lisp\nend with language\n~~~ lisp\n",
- "
~~~ lisp\nend with language\n~~~ lisp
\n",
-
- "```\nmismatched begin and end\n~~~\n",
- "
```\nmismatched begin and end\n~~~
\n",
-
- "~~~\nmismatched begin and end\n```\n",
- "
~~~\nmismatched begin and end\n```
\n",
-
- " ``` oz\nleading spaces\n```\n",
- "
leading spaces\n
\n",
-
- " ``` oz\nleading spaces\n ```\n",
- "
leading spaces\n
\n",
-
- " ``` oz\nleading spaces\n ```\n",
- "
leading spaces\n
\n",
-
- "``` oz\nleading spaces\n ```\n",
- "
leading spaces\n
\n",
-
- " ``` oz\nleading spaces\n ```\n",
- "
``` oz\n
\n\n
leading spaces
\n\n
```\n
\n",
- }
- doTestsBlock(t, tests, EXTENSION_FENCED_CODE|EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK)
-}
-
-func TestTitleBlock_EXTENSION_TITLEBLOCK(t *testing.T) {
- var tests = []string{
- "% Some title\n" +
- "% Another title line\n" +
- "% Yep, more here too\n",
- "
" +
- "Some title\n" +
- "Another title line\n" +
- "Yep, more here too\n" +
- "
",
- }
- doTestsBlock(t, tests, EXTENSION_TITLEBLOCK)
-}
-
-func TestBlockComments(t *testing.T) {
- var tests = []string{
- "Some text\n\n\n",
- "
Some text
\n\n\n",
-
- "Some text\n\n\n",
- "
Some text
\n\n\n",
-
- "Some text\n\n\n",
- "
Some text
\n\n\n",
- }
- doTestsBlock(t, tests, 0)
-}
-
-func TestCDATA(t *testing.T) {
- var tests = []string{
- "Some text\n\n\n",
- "
Some text
\n\n\n",
-
- "CDATA ]]\n\n\n",
- "
CDATA ]]
\n\n\n",
-
- "CDATA >\n\n]]>\n",
- "
CDATA >
\n\n]]>\n",
-
- "Lots of text\n\n
\n",
- "Lots of text
\n\n\n",
-
- "]]>\n",
- "]]>\n",
- }
- doTestsBlock(t, tests, 0)
- doTestsBlock(t, []string{
- "``` html\n\n```\n",
- "<![CDATA[foo]]>\n
\n",
-
- "\n",
- "\n",
-
- ` def func():
-> pass
-]]>
-`,
- ` def func():
-> pass
-]]>
-`,
- }, EXTENSION_FENCED_CODE)
-}
-
-func TestIsFenceLine(t *testing.T) {
- tests := []struct {
- data []byte
- syntaxRequested bool
- newlineOptional bool
- wantEnd int
- wantMarker string
- wantSyntax string
- }{
- {
- data: []byte("```"),
- wantEnd: 0,
- },
- {
- data: []byte("```\nstuff here\n"),
- wantEnd: 4,
- wantMarker: "```",
- },
- {
- data: []byte("```\nstuff here\n"),
- syntaxRequested: true,
- wantEnd: 4,
- wantMarker: "```",
- },
- {
- data: []byte("stuff here\n```\n"),
- wantEnd: 0,
- },
- {
- data: []byte("```"),
- newlineOptional: true,
- wantEnd: 3,
- wantMarker: "```",
- },
- {
- data: []byte("```"),
- syntaxRequested: true,
- newlineOptional: true,
- wantEnd: 3,
- wantMarker: "```",
- },
- {
- data: []byte("``` go"),
- syntaxRequested: true,
- newlineOptional: true,
- wantEnd: 6,
- wantMarker: "```",
- wantSyntax: "go",
- },
- }
-
- for _, test := range tests {
- var syntax *string
- if test.syntaxRequested {
- syntax = new(string)
- }
- end, marker := isFenceLine(test.data, syntax, "```", test.newlineOptional)
- if got, want := end, test.wantEnd; got != want {
- t.Errorf("got end %v, want %v", got, want)
- }
- if got, want := marker, test.wantMarker; got != want {
- t.Errorf("got marker %q, want %q", got, want)
- }
- if test.syntaxRequested {
- if got, want := *syntax, test.wantSyntax; got != want {
- t.Errorf("got syntax %q, want %q", got, want)
- }
- }
- }
-}
-
-func TestJoinLines(t *testing.T) {
- input := `# 标题
-
-第一
-行文字。
-
-第
-二
-行文字。
-`
- result := `标题
-
-第一行文字。
-
-第二行文字。
-`
- opt := Options{Extensions: commonExtensions | EXTENSION_JOIN_LINES}
- renderer := HtmlRenderer(commonHtmlFlags, "", "")
- output := MarkdownOptions([]byte(input), renderer, opt)
-
- if string(output) != result {
- t.Error("output dose not match.")
- }
-}
-
-func TestSanitizedAnchorName(t *testing.T) {
- tests := []struct {
- text string
- want string
- }{
- {
- text: "This is a header",
- want: "this-is-a-header",
- },
- {
- text: "This is also a header",
- want: "this-is-also-a-header",
- },
- {
- text: "main.go",
- want: "main-go",
- },
- {
- text: "Article 123",
- want: "article-123",
- },
- {
- text: "<- Let's try this, shall we?",
- want: "let-s-try-this-shall-we",
- },
- {
- text: " ",
- want: "",
- },
- {
- text: "Hello, 世界",
- want: "hello-世界",
- },
- }
- for _, test := range tests {
- if got := SanitizedAnchorName(test.text); got != test.want {
- t.Errorf("SanitizedAnchorName(%q):\ngot %q\nwant %q", test.text, got, test.want)
- }
- }
-}
diff --git a/vendor/github.com/russross/blackfriday/doc.go b/vendor/github.com/russross/blackfriday/doc.go
deleted file mode 100644
index 9656c42a..00000000
--- a/vendor/github.com/russross/blackfriday/doc.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Package blackfriday is a Markdown processor.
-//
-// It translates plain text with simple formatting rules into HTML or LaTeX.
-//
-// Sanitized Anchor Names
-//
-// Blackfriday includes an algorithm for creating sanitized anchor names
-// corresponding to a given input text. This algorithm is used to create
-// anchors for headings when EXTENSION_AUTO_HEADER_IDS is enabled. The
-// algorithm is specified below, so that other packages can create
-// compatible anchor names and links to those anchors.
-//
-// The algorithm iterates over the input text, interpreted as UTF-8,
-// one Unicode code point (rune) at a time. All runes that are letters (category L)
-// or numbers (category N) are considered valid characters. They are mapped to
-// lower case, and included in the output. All other runes are considered
-// invalid characters. Invalid characters that preceed the first valid character,
-// as well as invalid character that follow the last valid character
-// are dropped completely. All other sequences of invalid characters
-// between two valid characters are replaced with a single dash character '-'.
-//
-// SanitizedAnchorName exposes this functionality, and can be used to
-// create compatible links to the anchor names generated by blackfriday.
-// This algorithm is also implemented in a small standalone package at
-// github.com/shurcooL/sanitized_anchor_name. It can be useful for clients
-// that want a small package and don't need full functionality of blackfriday.
-package blackfriday
-
-// NOTE: Keep Sanitized Anchor Name algorithm in sync with package
-// github.com/shurcooL/sanitized_anchor_name.
-// Otherwise, users of sanitized_anchor_name will get anchor names
-// that are incompatible with those generated by blackfriday.
diff --git a/vendor/github.com/russross/blackfriday/html.go b/vendor/github.com/russross/blackfriday/html.go
deleted file mode 100644
index c917c7d3..00000000
--- a/vendor/github.com/russross/blackfriday/html.go
+++ /dev/null
@@ -1,950 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross .
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-//
-// HTML rendering backend
-//
-//
-
-package blackfriday
-
-import (
- "bytes"
- "fmt"
- "regexp"
- "strconv"
- "strings"
-)
-
-// Html renderer configuration options.
-const (
- HTML_SKIP_HTML = 1 << iota // skip preformatted HTML blocks
- HTML_SKIP_STYLE // skip embedded