From 6b7d6dcc49c6cbd83af70d97d01b700c8fb0c393 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Wed, 22 Aug 2018 03:17:59 +0000 Subject: add analytics via segment again --- cmd/site/html.go | 9 + cmd/site/main.go | 18 + go.mod | 26 +- go.sum | 7 + vendor/github.com/Xe/jsonfeed/jsonfeed_test.go | 43 - vendor/github.com/Xe/jsonfeed/testdata/feed.json | 21 - vendor/github.com/Xe/ln/logger_test.go | 111 -- vendor/github.com/davecgh/go-spew/spew/bypass.go | 152 -- .../github.com/davecgh/go-spew/spew/bypasssafe.go | 38 - vendor/github.com/davecgh/go-spew/spew/common.go | 341 ---- .../github.com/davecgh/go-spew/spew/common_test.go | 298 ---- vendor/github.com/davecgh/go-spew/spew/config.go | 306 ---- vendor/github.com/davecgh/go-spew/spew/doc.go | 211 --- vendor/github.com/davecgh/go-spew/spew/dump.go | 509 ------ .../github.com/davecgh/go-spew/spew/dump_test.go | 1042 ------------ .../davecgh/go-spew/spew/dumpcgo_test.go | 99 -- .../davecgh/go-spew/spew/dumpnocgo_test.go | 26 - .../davecgh/go-spew/spew/example_test.go | 226 --- vendor/github.com/davecgh/go-spew/spew/format.go | 419 ----- .../github.com/davecgh/go-spew/spew/format_test.go | 1558 ----------------- .../davecgh/go-spew/spew/internal_test.go | 87 - .../davecgh/go-spew/spew/internalunsafe_test.go | 102 -- vendor/github.com/davecgh/go-spew/spew/spew.go | 148 -- .../github.com/davecgh/go-spew/spew/spew_test.go | 320 ---- .../davecgh/go-spew/spew/testdata/dumpcgo.go | 82 - vendor/github.com/google/gops/LICENSE | 27 + vendor/github.com/google/gops/agent/agent_test.go | 67 - vendor/github.com/gorilla/feeds/feed_test.go | 254 --- vendor/github.com/gorilla/feeds/uuid_test.go | 19 - vendor/github.com/kardianos/osext/osext_test.go | 203 --- vendor/github.com/kr/pretty/.gitignore | 4 - vendor/github.com/kr/pretty/License | 21 - vendor/github.com/kr/pretty/Readme | 9 - vendor/github.com/kr/pretty/diff.go | 265 --- vendor/github.com/kr/pretty/diff_test.go | 213 --- vendor/github.com/kr/pretty/example_test.go | 20 - vendor/github.com/kr/pretty/formatter.go | 328 ---- vendor/github.com/kr/pretty/formatter_test.go | 288 ---- vendor/github.com/kr/pretty/go.mod | 3 - vendor/github.com/kr/pretty/pretty.go | 108 -- vendor/github.com/kr/pretty/zero.go | 41 - vendor/github.com/kr/text/License | 19 - vendor/github.com/kr/text/Readme | 3 - vendor/github.com/kr/text/doc.go | 3 - vendor/github.com/kr/text/go.mod | 3 - vendor/github.com/kr/text/indent.go | 74 - vendor/github.com/kr/text/indent_test.go | 119 -- vendor/github.com/kr/text/wrap.go | 86 - vendor/github.com/kr/text/wrap_test.go | 62 - vendor/github.com/pkg/errors/bench_test.go | 59 - vendor/github.com/pkg/errors/errors_test.go | 226 --- vendor/github.com/pkg/errors/example_test.go | 205 --- vendor/github.com/pkg/errors/format_test.go | 535 ------ vendor/github.com/pkg/errors/stack_test.go | 292 ---- .../pmezard/go-difflib/difflib/difflib.go | 772 --------- .../pmezard/go-difflib/difflib/difflib_test.go | 426 ----- .../github.com/russross/blackfriday/block_test.go | 1691 ------------------ vendor/github.com/russross/blackfriday/esc_test.go | 48 - .../russross/blackfriday/helpers_test.go | 186 -- .../github.com/russross/blackfriday/inline_test.go | 1176 ------------- .../russross/blackfriday/markdown_test.go | 38 - vendor/github.com/russross/blackfriday/ref_test.go | 124 -- .../testdata/Amps and angle encoding.html | 17 - .../testdata/Amps and angle encoding.text | 21 - .../russross/blackfriday/testdata/Auto links.html | 18 - .../russross/blackfriday/testdata/Auto links.text | 13 - .../blackfriday/testdata/Backslash escapes.html | 123 -- .../blackfriday/testdata/Backslash escapes.text | 126 -- .../testdata/Blockquotes with code blocks.html | 15 - .../testdata/Blockquotes with code blocks.text | 11 - .../russross/blackfriday/testdata/Code Blocks.html | 18 - .../russross/blackfriday/testdata/Code Blocks.text | 14 - .../russross/blackfriday/testdata/Code Spans.html | 5 - .../russross/blackfriday/testdata/Code Spans.text | 6 - ...list-like lines no empty line before block.html | 14 - ...list-like lines no empty line before block.text | 8 - ...rd-wrapped paragraphs with list-like lines.html | 8 - ...rd-wrapped paragraphs with list-like lines.text | 8 - .../blackfriday/testdata/Horizontal rules.html | 71 - .../blackfriday/testdata/Horizontal rules.text | 67 - .../testdata/Inline HTML (Advanced).html | 15 - .../testdata/Inline HTML (Advanced).text | 15 - .../blackfriday/testdata/Inline HTML (Simple).html | 72 - .../blackfriday/testdata/Inline HTML (Simple).text | 69 - .../blackfriday/testdata/Inline HTML comments.html | 13 - .../blackfriday/testdata/Inline HTML comments.text | 13 - .../blackfriday/testdata/Links, inline style.html | 11 - .../blackfriday/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 - .../testdata/Markdown Documentation - Basics.html | 314 ---- .../testdata/Markdown Documentation - Basics.text | 306 ---- .../testdata/Markdown Documentation - Syntax.html | 946 ----------- .../testdata/Markdown Documentation - Syntax.text | 888 ---------- .../blackfriday/testdata/Nested blockquotes.html | 9 - .../blackfriday/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 - .../russross/blackfriday/testdata/Tidyness.html | 9 - .../russross/blackfriday/testdata/Tidyness.text | 5 - vendor/github.com/segmentio/backo-go/.gitmodules | 3 + vendor/github.com/segmentio/backo-go/README.md | 80 + vendor/github.com/segmentio/backo-go/backo.go | 83 + .../shurcooL/sanitized_anchor_name/main_test.go | 35 - vendor/github.com/st3fan/jsonfeed/.travis.yml | 17 - vendor/github.com/st3fan/jsonfeed/LICENSE | 363 ---- vendor/github.com/st3fan/jsonfeed/README.md | 8 - vendor/github.com/st3fan/jsonfeed/jsonfeed.go | 73 - vendor/github.com/st3fan/jsonfeed/jsonfeed_test.go | 43 - .../github.com/st3fan/jsonfeed/testdata/feed.json | 21 - .../stretchr/testify/assert/assertion_format.go | 484 ------ .../testify/assert/assertion_format.go.tmpl | 5 - .../stretchr/testify/assert/assertion_forward.go | 956 ----------- .../testify/assert/assertion_forward.go.tmpl | 5 - .../stretchr/testify/assert/assertions.go | 1394 --------------- .../stretchr/testify/assert/assertions_test.go | 1793 -------------------- vendor/github.com/stretchr/testify/assert/doc.go | 45 - .../github.com/stretchr/testify/assert/errors.go | 10 - .../stretchr/testify/assert/forward_assertions.go | 16 - .../testify/assert/forward_assertions_test.go | 611 ------- .../stretchr/testify/assert/http_assertions.go | 143 -- .../testify/assert/http_assertions_test.go | 146 -- vendor/github.com/tj/front/front_test.go | 42 - vendor/github.com/xtgo/uuid/AUTHORS | 5 + vendor/github.com/xtgo/uuid/LICENSE | 27 + vendor/github.com/xtgo/uuid/uuid.go | 204 +++ vendor/gopkg.in/check.v1/.gitignore | 4 - vendor/gopkg.in/check.v1/.travis.yml | 3 - vendor/gopkg.in/check.v1/LICENSE | 25 - vendor/gopkg.in/check.v1/README.md | 20 - vendor/gopkg.in/check.v1/TODO | 2 - vendor/gopkg.in/check.v1/benchmark.go | 187 -- vendor/gopkg.in/check.v1/benchmark_test.go | 91 - vendor/gopkg.in/check.v1/bootstrap_test.go | 82 - vendor/gopkg.in/check.v1/check.go | 882 ---------- vendor/gopkg.in/check.v1/check_test.go | 207 --- vendor/gopkg.in/check.v1/checkers.go | 524 ------ vendor/gopkg.in/check.v1/checkers_test.go | 287 ---- vendor/gopkg.in/check.v1/export_test.go | 19 - vendor/gopkg.in/check.v1/fixture_test.go | 484 ------ vendor/gopkg.in/check.v1/foundation_test.go | 335 ---- vendor/gopkg.in/check.v1/helpers.go | 231 --- vendor/gopkg.in/check.v1/helpers_test.go | 519 ------ vendor/gopkg.in/check.v1/integration_test.go | 94 - vendor/gopkg.in/check.v1/printer.go | 168 -- vendor/gopkg.in/check.v1/printer_test.go | 104 -- vendor/gopkg.in/check.v1/reporter.go | 88 - vendor/gopkg.in/check.v1/reporter_test.go | 159 -- vendor/gopkg.in/check.v1/run.go | 175 -- vendor/gopkg.in/check.v1/run_test.go | 419 ----- .../gopkg.in/segmentio/analytics-go.v3/.gitignore | 32 + .../gopkg.in/segmentio/analytics-go.v3/.gitmodules | 6 + .../gopkg.in/segmentio/analytics-go.v3/History.md | 70 + .../gopkg.in/segmentio/analytics-go.v3/License.md | 21 + vendor/gopkg.in/segmentio/analytics-go.v3/Makefile | 26 + .../gopkg.in/segmentio/analytics-go.v3/Readme.md | 55 + vendor/gopkg.in/segmentio/analytics-go.v3/alias.go | 38 + .../segmentio/analytics-go.v3/analytics.go | 388 +++++ .../gopkg.in/segmentio/analytics-go.v3/config.go | 173 ++ .../gopkg.in/segmentio/analytics-go.v3/context.go | 148 ++ vendor/gopkg.in/segmentio/analytics-go.v3/error.go | 60 + .../gopkg.in/segmentio/analytics-go.v3/executor.go | 53 + vendor/gopkg.in/segmentio/analytics-go.v3/group.go | 40 + .../gopkg.in/segmentio/analytics-go.v3/identify.go | 31 + .../segmentio/analytics-go.v3/integrations.go | 44 + vendor/gopkg.in/segmentio/analytics-go.v3/json.go | 87 + .../gopkg.in/segmentio/analytics-go.v3/logger.go | 47 + .../gopkg.in/segmentio/analytics-go.v3/message.go | 128 ++ vendor/gopkg.in/segmentio/analytics-go.v3/page.go | 32 + .../segmentio/analytics-go.v3/properties.go | 117 ++ .../gopkg.in/segmentio/analytics-go.v3/screen.go | 32 + .../segmentio/analytics-go.v3/timeout_15.go | 16 + .../segmentio/analytics-go.v3/timeout_16.go | 10 + vendor/gopkg.in/segmentio/analytics-go.v3/track.go | 40 + .../gopkg.in/segmentio/analytics-go.v3/traits.go | 89 + vendor/gopkg.in/yaml.v1/decode_test.go | 703 -------- vendor/gopkg.in/yaml.v1/encode_test.go | 433 ----- vendor/gopkg.in/yaml.v1/suite_test.go | 12 - vendor/modules.txt | 30 + vendor/vgo.list | 39 - 188 files changed, 2291 insertions(+), 30431 deletions(-) delete mode 100644 vendor/github.com/Xe/jsonfeed/jsonfeed_test.go delete mode 100644 vendor/github.com/Xe/jsonfeed/testdata/feed.json delete mode 100644 vendor/github.com/Xe/ln/logger_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/bypass.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/bypasssafe.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/common.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/common_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/config.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/doc.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/dump.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/dump_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/dumpcgo_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/dumpnocgo_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/example_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/format.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/format_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/internal_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/internalunsafe_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/spew.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/spew_test.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/testdata/dumpcgo.go create mode 100644 vendor/github.com/google/gops/LICENSE delete mode 100644 vendor/github.com/google/gops/agent/agent_test.go delete mode 100644 vendor/github.com/gorilla/feeds/feed_test.go delete mode 100644 vendor/github.com/gorilla/feeds/uuid_test.go delete mode 100644 vendor/github.com/kardianos/osext/osext_test.go delete mode 100644 vendor/github.com/kr/pretty/.gitignore delete mode 100644 vendor/github.com/kr/pretty/License delete mode 100644 vendor/github.com/kr/pretty/Readme delete mode 100644 vendor/github.com/kr/pretty/diff.go delete mode 100644 vendor/github.com/kr/pretty/diff_test.go delete mode 100644 vendor/github.com/kr/pretty/example_test.go delete mode 100644 vendor/github.com/kr/pretty/formatter.go delete mode 100644 vendor/github.com/kr/pretty/formatter_test.go delete mode 100644 vendor/github.com/kr/pretty/go.mod delete mode 100644 vendor/github.com/kr/pretty/pretty.go delete mode 100644 vendor/github.com/kr/pretty/zero.go delete mode 100644 vendor/github.com/kr/text/License delete mode 100644 vendor/github.com/kr/text/Readme delete mode 100644 vendor/github.com/kr/text/doc.go delete mode 100644 vendor/github.com/kr/text/go.mod delete mode 100644 vendor/github.com/kr/text/indent.go delete mode 100644 vendor/github.com/kr/text/indent_test.go delete mode 100644 vendor/github.com/kr/text/wrap.go delete mode 100644 vendor/github.com/kr/text/wrap_test.go delete mode 100644 vendor/github.com/pkg/errors/bench_test.go delete mode 100644 vendor/github.com/pkg/errors/errors_test.go delete mode 100644 vendor/github.com/pkg/errors/example_test.go delete mode 100644 vendor/github.com/pkg/errors/format_test.go delete mode 100644 vendor/github.com/pkg/errors/stack_test.go delete mode 100644 vendor/github.com/pmezard/go-difflib/difflib/difflib.go delete mode 100644 vendor/github.com/pmezard/go-difflib/difflib/difflib_test.go delete mode 100644 vendor/github.com/russross/blackfriday/block_test.go delete mode 100644 vendor/github.com/russross/blackfriday/esc_test.go delete mode 100644 vendor/github.com/russross/blackfriday/helpers_test.go delete mode 100644 vendor/github.com/russross/blackfriday/inline_test.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/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 create mode 100644 vendor/github.com/segmentio/backo-go/.gitmodules create mode 100644 vendor/github.com/segmentio/backo-go/README.md create mode 100644 vendor/github.com/segmentio/backo-go/backo.go delete mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/main_test.go delete mode 100644 vendor/github.com/st3fan/jsonfeed/.travis.yml delete mode 100644 vendor/github.com/st3fan/jsonfeed/LICENSE delete mode 100644 vendor/github.com/st3fan/jsonfeed/README.md delete mode 100644 vendor/github.com/st3fan/jsonfeed/jsonfeed.go delete mode 100644 vendor/github.com/st3fan/jsonfeed/jsonfeed_test.go delete mode 100644 vendor/github.com/st3fan/jsonfeed/testdata/feed.json delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_format.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_forward.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl delete mode 100644 vendor/github.com/stretchr/testify/assert/assertions.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertions_test.go delete mode 100644 vendor/github.com/stretchr/testify/assert/doc.go delete mode 100644 vendor/github.com/stretchr/testify/assert/errors.go delete mode 100644 vendor/github.com/stretchr/testify/assert/forward_assertions.go delete mode 100644 vendor/github.com/stretchr/testify/assert/forward_assertions_test.go delete mode 100644 vendor/github.com/stretchr/testify/assert/http_assertions.go delete mode 100644 vendor/github.com/stretchr/testify/assert/http_assertions_test.go delete mode 100644 vendor/github.com/tj/front/front_test.go create mode 100644 vendor/github.com/xtgo/uuid/AUTHORS create mode 100644 vendor/github.com/xtgo/uuid/LICENSE create mode 100644 vendor/github.com/xtgo/uuid/uuid.go delete mode 100644 vendor/gopkg.in/check.v1/.gitignore delete mode 100644 vendor/gopkg.in/check.v1/.travis.yml delete mode 100644 vendor/gopkg.in/check.v1/LICENSE delete mode 100644 vendor/gopkg.in/check.v1/README.md delete mode 100644 vendor/gopkg.in/check.v1/TODO delete mode 100644 vendor/gopkg.in/check.v1/benchmark.go delete mode 100644 vendor/gopkg.in/check.v1/benchmark_test.go delete mode 100644 vendor/gopkg.in/check.v1/bootstrap_test.go delete mode 100644 vendor/gopkg.in/check.v1/check.go delete mode 100644 vendor/gopkg.in/check.v1/check_test.go delete mode 100644 vendor/gopkg.in/check.v1/checkers.go delete mode 100644 vendor/gopkg.in/check.v1/checkers_test.go delete mode 100644 vendor/gopkg.in/check.v1/export_test.go delete mode 100644 vendor/gopkg.in/check.v1/fixture_test.go delete mode 100644 vendor/gopkg.in/check.v1/foundation_test.go delete mode 100644 vendor/gopkg.in/check.v1/helpers.go delete mode 100644 vendor/gopkg.in/check.v1/helpers_test.go delete mode 100644 vendor/gopkg.in/check.v1/integration_test.go delete mode 100644 vendor/gopkg.in/check.v1/printer.go delete mode 100644 vendor/gopkg.in/check.v1/printer_test.go delete mode 100644 vendor/gopkg.in/check.v1/reporter.go delete mode 100644 vendor/gopkg.in/check.v1/reporter_test.go delete mode 100644 vendor/gopkg.in/check.v1/run.go delete mode 100644 vendor/gopkg.in/check.v1/run_test.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/.gitignore create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/.gitmodules create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/History.md create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/License.md create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/Makefile create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/Readme.md create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/alias.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/analytics.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/config.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/context.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/error.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/executor.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/group.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/identify.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/integrations.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/json.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/logger.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/message.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/page.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/properties.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/screen.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/timeout_15.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/timeout_16.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/track.go create mode 100644 vendor/gopkg.in/segmentio/analytics-go.v3/traits.go delete mode 100644 vendor/gopkg.in/yaml.v1/decode_test.go delete mode 100644 vendor/gopkg.in/yaml.v1/encode_test.go delete mode 100644 vendor/gopkg.in/yaml.v1/suite_test.go create mode 100644 vendor/modules.txt delete mode 100644 vendor/vgo.list diff --git a/cmd/site/html.go b/cmd/site/html.go index ba304c5..20be7de 100644 --- a/cmd/site/html.go +++ b/cmd/site/html.go @@ -8,6 +8,7 @@ import ( "time" "github.com/Xe/ln" + analytics "gopkg.in/segmentio/analytics-go.v3" ) func logTemplateTime(name string, from time.Time) { @@ -70,4 +71,12 @@ func (s *Site) showPost(w http.ResponseWriter, r *http.Request) { } s.renderTemplatePage("blogpost.html", p).ServeHTTP(w, r) + + if s.segment != nil { + s.segment.Enqueue(&analytics.Track{ + UserId: Hash(r.RemoteAddr, r.Header.Get("X-Forwarded-For")), + Event: "Post Viewed", + Properties: analytics.NewProperties().SetURL(r.RequestURI).SetTitle(p.Title), + }) + } } diff --git a/cmd/site/main.go b/cmd/site/main.go index bad297e..7dbe9bc 100644 --- a/cmd/site/main.go +++ b/cmd/site/main.go @@ -17,6 +17,7 @@ import ( "github.com/gorilla/feeds" blackfriday "github.com/russross/blackfriday" "github.com/tj/front" + "gopkg.in/segmentio/analytics-go.v3" ) var port = os.Getenv("PORT") @@ -47,11 +48,24 @@ type Site struct { templates map[string]*template.Template tlock sync.RWMutex + + segment analytics.Client } func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request) { ln.Log(r.Context(), ln.F{"action": "Site.ServeHTTP", "user_ip_address": r.RemoteAddr, "path": r.RequestURI}) + s.mux.ServeHTTP(w, r) + + if s.segment != nil { + if !strings.HasPrefix(r.RequestURI, "/blog/") { + s.segment.Enqueue(&analytics.Track{ + UserId: Hash(r.RemoteAddr, r.Header.Get("X-Forwarded-For")), + Event: "Page Viewed", + Properties: analytics.NewProperties().SetURL(r.RequestURI), + }) + } + } } // Build creates a new Site instance or fails. @@ -88,6 +102,10 @@ func Build() (*Site, error) { templates: map[string]*template.Template{}, } + if wk := os.Getenv("SEGMENT_WRITE_KEY"); wk != "" { + s.segment = analytics.New(wk) + } + err := filepath.Walk("./blog/", func(path string, info os.FileInfo, err error) error { if err != nil { return err diff --git a/go.mod b/go.mod index 150491a..ce5e6d5 100644 --- a/go.mod +++ b/go.mod @@ -1,22 +1,26 @@ module github.com/Xe/site require ( - github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da + github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da // indirect github.com/Xe/gopreload v0.0.0-20170326043426-a00a8beb369c github.com/Xe/jsonfeed v0.0.0-20170520170432-e21591505612 github.com/Xe/ln v0.0.0-20170921000907-466e05b2ef3e - github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb + github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb // indirect github.com/google/gops v0.3.2 github.com/gorilla/feeds v1.0.0 - github.com/jtolds/qod v0.0.0-20170925014538-3abb44dfc7ba - github.com/kr/pretty v0.1.0 - github.com/magefile/mage v0.0.0-20171025021237-ab3ca2f6f855 - github.com/pkg/errors v0.8.0 + github.com/jtolds/qod v0.0.0-20170925014538-3abb44dfc7ba // indirect + github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/magefile/mage v0.0.0-20171025021237-ab3ca2f6f855 // indirect + github.com/pkg/errors v0.8.0 // indirect github.com/russross/blackfriday v0.0.0-20170806171014-cadec560ec52 - github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 - github.com/st3fan/jsonfeed v0.0.0-20170519104842-498b2850d26b - github.com/stretchr/testify v1.2.2 + github.com/segmentio/backo-go v0.0.0-20160424052352-204274ad699c // indirect + github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 // indirect + github.com/st3fan/jsonfeed v0.0.0-20170519104842-498b2850d26b // indirect + github.com/stretchr/testify v1.2.2 // indirect github.com/tj/front v0.0.0-20170212063142-739be213b0a1 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 - gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 + github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + gopkg.in/segmentio/analytics-go.v3 v3.0.0-20180814014620-14e03163be03 + gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 // indirect ) diff --git a/go.sum b/go.sum index d11e45c..dc390b8 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,7 @@ github.com/gorilla/feeds v1.0.0 h1:EbkEvaYf+PXhYNHS20heBG7Rl2X6Zy8l11ZBWAHkWqE= github.com/gorilla/feeds v1.0.0/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBbaightA= github.com/jtolds/qod v0.0.0-20170925014538-3abb44dfc7ba/go.mod h1:CC0XsLGDIrizqHTsUEJh89QHzv2u2mix/O9xl4+LqSw= github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro= +github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -24,6 +25,8 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/russross/blackfriday v0.0.0-20170806171014-cadec560ec52 h1:xZ0R4UuR0EDx7m0OmvsqZaomfqCeYJ/PyLm94WLhnIM= github.com/russross/blackfriday v0.0.0-20170806171014-cadec560ec52/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/segmentio/backo-go v0.0.0-20160424052352-204274ad699c h1:rsRTAcCR5CeNLkvgBVSjQoDGRRt6kggsE6XYBqCv2KQ= +github.com/segmentio/backo-go v0.0.0-20160424052352-204274ad699c/go.mod h1:kJ9mm9YmoWSkk+oQ+5Cj8DEoRCX2JT6As4kEtIIOp1M= github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 h1:/vdW8Cb7EXrkqWGufVMES1OH2sU9gKVb2n9/1y5NMBY= github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/st3fan/jsonfeed v0.0.0-20170519104842-498b2850d26b h1:i9Wk9W2bjrMvUf59rJKX4/lvZXy3L3lcX7g18c8AveU= @@ -32,7 +35,11 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/tj/front v0.0.0-20170212063142-739be213b0a1 h1:lA+aPRvltlx2fwv/BnxyYSDQo3pIeqzHgMO5GvK0T9E= github.com/tj/front v0.0.0-20170212063142-739be213b0a1/go.mod h1:deJrtusCTptAW4EUn5vBLpl3dhNqPqUwEjWJz5UNxpQ= +github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c h1:3lbZUMbMiGUW/LMkfsEABsc5zNT9+b1CvsJx47JzJ8g= +github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c/go.mod h1:UrdRz5enIKZ63MEE3IF9l2/ebyx59GyGgPi+tICQdmM= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/segmentio/analytics-go.v3 v3.0.0-20180814014620-14e03163be03 h1:VE9ONTFmnLVqBF4kx4jy+IsK8fCQCy7cIff269RITxs= +gopkg.in/segmentio/analytics-go.v3 v3.0.0-20180814014620-14e03163be03/go.mod h1:4QqqlTlSSpVlWA9/9nDcPw+FkM2yv1NQoYjUbL9/JAw= gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU= gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= diff --git a/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go b/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go deleted file mode 100644 index 29d9165..0000000 --- a/vendor/github.com/Xe/jsonfeed/jsonfeed_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// 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/ - -package jsonfeed_test - -import ( - "os" - "testing" - "time" - - "github.com/st3fan/jsonfeed" - "github.com/stretchr/testify/assert" -) - -func Test_ParseSimple(t *testing.T) { - r, err := os.Open("testdata/feed.json") - assert.NoError(t, err, "Could not open testdata/feed.json") - - feed, err := jsonfeed.Parse(r) - assert.NoError(t, err, "Could not parse testdata/feed.json") - - assert.Equal(t, "https://jsonfeed.org/version/1", feed.Version) - assert.Equal(t, "JSON Feed", feed.Title) - assert.Equal(t, "JSON Feed is a ...", feed.Description) - assert.Equal(t, "https://jsonfeed.org/", feed.HomePageURL) - assert.Equal(t, "https://jsonfeed.org/feed.json", feed.FeedURL) - assert.Equal(t, "This feed allows ...", feed.UserComment) - assert.Equal(t, "https://jsonfeed.org/graphics/icon.png", feed.Favicon) - assert.Equal(t, "Brent Simmons and Manton Reece", feed.Author.Name) - - assert.Equal(t, 1, len(feed.Items)) - - assert.Equal(t, "https://jsonfeed.org/2017/05/17/announcing_json_feed", feed.Items[0].ID) - assert.Equal(t, "https://jsonfeed.org/2017/05/17/announcing_json_feed", feed.Items[0].URL) - assert.Equal(t, "Announcing JSON Feed", feed.Items[0].Title) - assert.Equal(t, "

We ...", feed.Items[0].ContentHTML) - - datePublished, err := time.Parse("2006-01-02T15:04:05-07:00", "2017-05-17T08:02:12-07:00") - assert.NoError(t, err, "Could not parse timestamp") - - assert.Equal(t, datePublished, feed.Items[0].DatePublished) -} diff --git a/vendor/github.com/Xe/jsonfeed/testdata/feed.json b/vendor/github.com/Xe/jsonfeed/testdata/feed.json deleted file mode 100644 index ad4bbe1..0000000 --- a/vendor/github.com/Xe/jsonfeed/testdata/feed.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "https://jsonfeed.org/version/1", - "title": "JSON Feed", - "description": "JSON Feed is a ...", - "home_page_url": "https://jsonfeed.org/", - "feed_url": "https://jsonfeed.org/feed.json", - "user_comment": "This feed allows ...", - "favicon": "https://jsonfeed.org/graphics/icon.png", - "author": { - "name": "Brent Simmons and Manton Reece" - }, - "items": [ - { - "id": "https://jsonfeed.org/2017/05/17/announcing_json_feed", - "url": "https://jsonfeed.org/2017/05/17/announcing_json_feed", - "title": "Announcing JSON Feed", - "content_html": "

We ...", - "date_published": "2017-05-17T08:02:12-07:00" - } - ] -} diff --git a/vendor/github.com/Xe/ln/logger_test.go b/vendor/github.com/Xe/ln/logger_test.go deleted file mode 100644 index 800ed90..0000000 --- a/vendor/github.com/Xe/ln/logger_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package ln - -import ( - "bytes" - "context" - "fmt" - "testing" - "time" -) - -var ctx context.Context - -func setup(t *testing.T) (*bytes.Buffer, func()) { - ctx = context.Background() - - out := bytes.Buffer{} - oldFilters := DefaultLogger.Filters - DefaultLogger.Filters = []Filter{NewWriterFilter(&out, nil)} - return &out, func() { - DefaultLogger.Filters = oldFilters - } -} - -func TestSimpleError(t *testing.T) { - out, teardown := setup(t) - defer teardown() - - Log(ctx, F{"err": fmt.Errorf("This is an Error!!!")}, F{"msg": "fooey", "bar": "foo"}) - data := []string{ - `err="This is an Error!!!"`, - `fooey`, - `bar=foo`, - } - - for _, line := range data { - if !bytes.Contains(out.Bytes(), []byte(line)) { - t.Fatalf("Bytes: %s not in %s", line, out.Bytes()) - } - } -} - -func TestTimeConversion(t *testing.T) { - out, teardown := setup(t) - defer teardown() - - var zeroTime time.Time - - Log(ctx, F{"zero": zeroTime}) - data := []string{ - `zero=0001-01-01T00:00:00Z`, - } - - for _, line := range data { - if !bytes.Contains(out.Bytes(), []byte(line)) { - t.Fatalf("Bytes: %s not in %s", line, out.Bytes()) - } - } -} - -func TestDebug(t *testing.T) { - out, teardown := setup(t) - defer teardown() - - // set priority to Debug - Error(ctx, fmt.Errorf("This is an Error!!!"), F{}) - - data := []string{ - `err="This is an Error!!!"`, - `_lineno=`, - `_function=ln.TestDebug`, - `_filename=github.com/Xe/ln/logger_test.go`, - `cause="This is an Error!!!"`, - } - - for _, line := range data { - if !bytes.Contains(out.Bytes(), []byte(line)) { - t.Fatalf("Bytes: %s not in %s", line, out.Bytes()) - } - } -} - -func TestFer(t *testing.T) { - out, teardown := setup(t) - defer teardown() - - underTest := foobar{Foo: 1, Bar: "quux"} - - Log(ctx, underTest) - data := []string{ - `foo=1`, - `bar=quux`, - } - - for _, line := range data { - if !bytes.Contains(out.Bytes(), []byte(line)) { - t.Fatalf("Bytes: %s not in %s", line, out.Bytes()) - } - } -} - -type foobar struct { - Foo int - Bar string -} - -func (f foobar) F() F { - return F{ - "foo": f.Foo, - "bar": f.Bar, - } -} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go deleted file mode 100644 index 8a4a658..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is not running on Google App Engine, compiled by GopherJS, and -// "-tags safe" is not added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// +build !js,!appengine,!safe,!disableunsafe - -package spew - -import ( - "reflect" - "unsafe" -) - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = false - - // ptrSize is the size of a pointer on the current arch. - ptrSize = unsafe.Sizeof((*byte)(nil)) -) - -var ( - // offsetPtr, offsetScalar, and offsetFlag are the offsets for the - // internal reflect.Value fields. These values are valid before golang - // commit ecccf07e7f9d which changed the format. The are also valid - // after commit 82f48826c6c7 which changed the format again to mirror - // the original format. Code in the init function updates these offsets - // as necessary. - offsetPtr = uintptr(ptrSize) - offsetScalar = uintptr(0) - offsetFlag = uintptr(ptrSize * 2) - - // flagKindWidth and flagKindShift indicate various bits that the - // reflect package uses internally to track kind information. - // - // flagRO indicates whether or not the value field of a reflect.Value is - // read-only. - // - // flagIndir indicates whether the value field of a reflect.Value is - // the actual data or a pointer to the data. - // - // These values are valid before golang commit 90a7c3c86944 which - // changed their positions. Code in the init function updates these - // flags as necessary. - flagKindWidth = uintptr(5) - flagKindShift = uintptr(flagKindWidth - 1) - flagRO = uintptr(1 << 0) - flagIndir = uintptr(1 << 1) -) - -func init() { - // Older versions of reflect.Value stored small integers directly in the - // ptr field (which is named val in the older versions). Versions - // between commits ecccf07e7f9d and 82f48826c6c7 added a new field named - // scalar for this purpose which unfortunately came before the flag - // field, so the offset of the flag field is different for those - // versions. - // - // This code constructs a new reflect.Value from a known small integer - // and checks if the size of the reflect.Value struct indicates it has - // the scalar field. When it does, the offsets are updated accordingly. - vv := reflect.ValueOf(0xf00) - if unsafe.Sizeof(vv) == (ptrSize * 4) { - offsetScalar = ptrSize * 2 - offsetFlag = ptrSize * 3 - } - - // Commit 90a7c3c86944 changed the flag positions such that the low - // order bits are the kind. This code extracts the kind from the flags - // field and ensures it's the correct type. When it's not, the flag - // order has been changed to the newer format, so the flags are updated - // accordingly. - upf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag) - upfv := *(*uintptr)(upf) - flagKindMask := uintptr((1<>flagKindShift != uintptr(reflect.Int) { - flagKindShift = 0 - flagRO = 1 << 5 - flagIndir = 1 << 6 - - // Commit adf9b30e5594 modified the flags to separate the - // flagRO flag into two bits which specifies whether or not the - // field is embedded. This causes flagIndir to move over a bit - // and means that flagRO is the combination of either of the - // original flagRO bit and the new bit. - // - // This code detects the change by extracting what used to be - // the indirect bit to ensure it's set. When it's not, the flag - // order has been changed to the newer format, so the flags are - // updated accordingly. - if upfv&flagIndir == 0 { - flagRO = 3 << 5 - flagIndir = 1 << 7 - } - } -} - -// unsafeReflectValue converts the passed reflect.Value into a one that bypasses -// the typical safety restrictions preventing access to unaddressable and -// unexported data. It works by digging the raw pointer to the underlying -// value out of the protected value and generating a new unprotected (unsafe) -// reflect.Value to it. -// -// This allows us to check for implementations of the Stringer and error -// interfaces to be used for pretty printing ordinarily unaddressable and -// inaccessible values such as unexported struct fields. -func unsafeReflectValue(v reflect.Value) (rv reflect.Value) { - indirects := 1 - vt := v.Type() - upv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr) - rvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag)) - if rvf&flagIndir != 0 { - vt = reflect.PtrTo(v.Type()) - indirects++ - } else if offsetScalar != 0 { - // The value is in the scalar field when it's not one of the - // reference types. - switch vt.Kind() { - case reflect.Uintptr: - case reflect.Chan: - case reflect.Func: - case reflect.Map: - case reflect.Ptr: - case reflect.UnsafePointer: - default: - upv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + - offsetScalar) - } - } - - pv := reflect.NewAt(vt, upv) - rv = pv - for i := 0; i < indirects; i++ { - rv = rv.Elem() - } - return rv -} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go deleted file mode 100644 index 1fe3cf3..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is running on Google App Engine, compiled by GopherJS, or -// "-tags safe" is added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// +build js appengine safe disableunsafe - -package spew - -import "reflect" - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = true -) - -// unsafeReflectValue typically converts the passed reflect.Value into a one -// that bypasses the typical safety restrictions preventing access to -// unaddressable and unexported data. However, doing this relies on access to -// the unsafe package. This is a stub version which simply returns the passed -// reflect.Value when the unsafe package is not available. -func unsafeReflectValue(v reflect.Value) reflect.Value { - return v -} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go deleted file mode 100644 index 7c519ff..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/common.go +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "reflect" - "sort" - "strconv" -) - -// Some constants in the form of bytes to avoid string overhead. This mirrors -// the technique used in the fmt package. -var ( - panicBytes = []byte("(PANIC=") - plusBytes = []byte("+") - iBytes = []byte("i") - trueBytes = []byte("true") - falseBytes = []byte("false") - interfaceBytes = []byte("(interface {})") - commaNewlineBytes = []byte(",\n") - newlineBytes = []byte("\n") - openBraceBytes = []byte("{") - openBraceNewlineBytes = []byte("{\n") - closeBraceBytes = []byte("}") - asteriskBytes = []byte("*") - colonBytes = []byte(":") - colonSpaceBytes = []byte(": ") - openParenBytes = []byte("(") - closeParenBytes = []byte(")") - spaceBytes = []byte(" ") - pointerChainBytes = []byte("->") - nilAngleBytes = []byte("") - maxNewlineBytes = []byte("\n") - maxShortBytes = []byte("") - circularBytes = []byte("") - circularShortBytes = []byte("") - invalidAngleBytes = []byte("") - openBracketBytes = []byte("[") - closeBracketBytes = []byte("]") - percentBytes = []byte("%") - precisionBytes = []byte(".") - openAngleBytes = []byte("<") - closeAngleBytes = []byte(">") - openMapBytes = []byte("map[") - closeMapBytes = []byte("]") - lenEqualsBytes = []byte("len=") - capEqualsBytes = []byte("cap=") -) - -// hexDigits is used to map a decimal value to a hex digit. -var hexDigits = "0123456789abcdef" - -// catchPanic handles any panics that might occur during the handleMethods -// calls. -func catchPanic(w io.Writer, v reflect.Value) { - if err := recover(); err != nil { - w.Write(panicBytes) - fmt.Fprintf(w, "%v", err) - w.Write(closeParenBytes) - } -} - -// handleMethods attempts to call the Error and String methods on the underlying -// type the passed reflect.Value represents and outputes the result to Writer w. -// -// It handles panics in any called methods by catching and displaying the error -// as the formatted value. -func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { - // We need an interface to check if the type implements the error or - // Stringer interface. However, the reflect package won't give us an - // interface on certain things like unexported struct fields in order - // to enforce visibility rules. We use unsafe, when it's available, - // to bypass these restrictions since this package does not mutate the - // values. - if !v.CanInterface() { - if UnsafeDisabled { - return false - } - - v = unsafeReflectValue(v) - } - - // Choose whether or not to do error and Stringer interface lookups against - // the base type or a pointer to the base type depending on settings. - // Technically calling one of these methods with a pointer receiver can - // mutate the value, however, types which choose to satisify an error or - // Stringer interface with a pointer receiver should not be mutating their - // state inside these interface methods. - if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { - v = unsafeReflectValue(v) - } - if v.CanAddr() { - v = v.Addr() - } - - // Is it an error or Stringer? - switch iface := v.Interface().(type) { - case error: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.Error())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - - w.Write([]byte(iface.Error())) - return true - - case fmt.Stringer: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.String())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - w.Write([]byte(iface.String())) - return true - } - return false -} - -// printBool outputs a boolean value as true or false to Writer w. -func printBool(w io.Writer, val bool) { - if val { - w.Write(trueBytes) - } else { - w.Write(falseBytes) - } -} - -// printInt outputs a signed integer value to Writer w. -func printInt(w io.Writer, val int64, base int) { - w.Write([]byte(strconv.FormatInt(val, base))) -} - -// printUint outputs an unsigned integer value to Writer w. -func printUint(w io.Writer, val uint64, base int) { - w.Write([]byte(strconv.FormatUint(val, base))) -} - -// printFloat outputs a floating point value using the specified precision, -// which is expected to be 32 or 64bit, to Writer w. -func printFloat(w io.Writer, val float64, precision int) { - w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) -} - -// printComplex outputs a complex value using the specified float precision -// for the real and imaginary parts to Writer w. -func printComplex(w io.Writer, c complex128, floatPrecision int) { - r := real(c) - w.Write(openParenBytes) - w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) - i := imag(c) - if i >= 0 { - w.Write(plusBytes) - } - w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) - w.Write(iBytes) - w.Write(closeParenBytes) -} - -// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x' -// prefix to Writer w. -func printHexPtr(w io.Writer, p uintptr) { - // Null pointer. - num := uint64(p) - if num == 0 { - w.Write(nilAngleBytes) - return - } - - // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix - buf := make([]byte, 18) - - // It's simpler to construct the hex string right to left. - base := uint64(16) - i := len(buf) - 1 - for num >= base { - buf[i] = hexDigits[num%base] - num /= base - i-- - } - buf[i] = hexDigits[num] - - // Add '0x' prefix. - i-- - buf[i] = 'x' - i-- - buf[i] = '0' - - // Strip unused leading bytes. - buf = buf[i:] - w.Write(buf) -} - -// valuesSorter implements sort.Interface to allow a slice of reflect.Value -// elements to be sorted. -type valuesSorter struct { - values []reflect.Value - strings []string // either nil or same len and values - cs *ConfigState -} - -// newValuesSorter initializes a valuesSorter instance, which holds a set of -// surrogate keys on which the data should be sorted. It uses flags in -// ConfigState to decide if and how to populate those surrogate keys. -func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { - vs := &valuesSorter{values: values, cs: cs} - if canSortSimply(vs.values[0].Kind()) { - return vs - } - if !cs.DisableMethods { - vs.strings = make([]string, len(values)) - for i := range vs.values { - b := bytes.Buffer{} - if !handleMethods(cs, &b, vs.values[i]) { - vs.strings = nil - break - } - vs.strings[i] = b.String() - } - } - if vs.strings == nil && cs.SpewKeys { - vs.strings = make([]string, len(values)) - for i := range vs.values { - vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) - } - } - return vs -} - -// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted -// directly, or whether it should be considered for sorting by surrogate keys -// (if the ConfigState allows it). -func canSortSimply(kind reflect.Kind) bool { - // This switch parallels valueSortLess, except for the default case. - switch kind { - case reflect.Bool: - return true - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return true - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return true - case reflect.Float32, reflect.Float64: - return true - case reflect.String: - return true - case reflect.Uintptr: - return true - case reflect.Array: - return true - } - return false -} - -// Len returns the number of values in the slice. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Len() int { - return len(s.values) -} - -// Swap swaps the values at the passed indices. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Swap(i, j int) { - s.values[i], s.values[j] = s.values[j], s.values[i] - if s.strings != nil { - s.strings[i], s.strings[j] = s.strings[j], s.strings[i] - } -} - -// valueSortLess returns whether the first value should sort before the second -// value. It is used by valueSorter.Less as part of the sort.Interface -// implementation. -func valueSortLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Bool: - return !a.Bool() && b.Bool() - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return a.Int() < b.Int() - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return a.Uint() < b.Uint() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.String: - return a.String() < b.String() - case reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Array: - // Compare the contents of both arrays. - l := a.Len() - for i := 0; i < l; i++ { - av := a.Index(i) - bv := b.Index(i) - if av.Interface() == bv.Interface() { - continue - } - return valueSortLess(av, bv) - } - } - return a.String() < b.String() -} - -// Less returns whether the value at index i should sort before the -// value at index j. It is part of the sort.Interface implementation. -func (s *valuesSorter) Less(i, j int) bool { - if s.strings == nil { - return valueSortLess(s.values[i], s.values[j]) - } - return s.strings[i] < s.strings[j] -} - -// sortValues is a sort function that handles both native types and any type that -// can be converted to error or Stringer. Other inputs are sorted according to -// their Value.String() value to ensure display stability. -func sortValues(values []reflect.Value, cs *ConfigState) { - if len(values) == 0 { - return - } - sort.Sort(newValuesSorter(values, cs)) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/common_test.go b/vendor/github.com/davecgh/go-spew/spew/common_test.go deleted file mode 100644 index 0f5ce47..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/common_test.go +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew_test - -import ( - "fmt" - "reflect" - "testing" - - "github.com/davecgh/go-spew/spew" -) - -// custom type to test Stinger interface on non-pointer receiver. -type stringer string - -// String implements the Stringer interface for testing invocation of custom -// stringers on types with non-pointer receivers. -func (s stringer) String() string { - return "stringer " + string(s) -} - -// custom type to test Stinger interface on pointer receiver. -type pstringer string - -// String implements the Stringer interface for testing invocation of custom -// stringers on types with only pointer receivers. -func (s *pstringer) String() string { - return "stringer " + string(*s) -} - -// xref1 and xref2 are cross referencing structs for testing circular reference -// detection. -type xref1 struct { - ps2 *xref2 -} -type xref2 struct { - ps1 *xref1 -} - -// indirCir1, indirCir2, and indirCir3 are used to generate an indirect circular -// reference for testing detection. -type indirCir1 struct { - ps2 *indirCir2 -} -type indirCir2 struct { - ps3 *indirCir3 -} -type indirCir3 struct { - ps1 *indirCir1 -} - -// embed is used to test embedded structures. -type embed struct { - a string -} - -// embedwrap is used to test embedded structures. -type embedwrap struct { - *embed - e *embed -} - -// panicer is used to intentionally cause a panic for testing spew properly -// handles them -type panicer int - -func (p panicer) String() string { - panic("test panic") -} - -// customError is used to test custom error interface invocation. -type customError int - -func (e customError) Error() string { - return fmt.Sprintf("error: %d", int(e)) -} - -// stringizeWants converts a slice of wanted test output into a format suitable -// for a test error message. -func stringizeWants(wants []string) string { - s := "" - for i, want := range wants { - if i > 0 { - s += fmt.Sprintf("want%d: %s", i+1, want) - } else { - s += "want: " + want - } - } - return s -} - -// testFailed returns whether or not a test failed by checking if the result -// of the test is in the slice of wanted strings. -func testFailed(result string, wants []string) bool { - for _, want := range wants { - if result == want { - return false - } - } - return true -} - -type sortableStruct struct { - x int -} - -func (ss sortableStruct) String() string { - return fmt.Sprintf("ss.%d", ss.x) -} - -type unsortableStruct struct { - x int -} - -type sortTestCase struct { - input []reflect.Value - expected []reflect.Value -} - -func helpTestSortValues(tests []sortTestCase, cs *spew.ConfigState, t *testing.T) { - getInterfaces := func(values []reflect.Value) []interface{} { - interfaces := []interface{}{} - for _, v := range values { - interfaces = append(interfaces, v.Interface()) - } - return interfaces - } - - for _, test := range tests { - spew.SortValues(test.input, cs) - // reflect.DeepEqual cannot really make sense of reflect.Value, - // probably because of all the pointer tricks. For instance, - // v(2.0) != v(2.0) on a 32-bits system. Turn them into interface{} - // instead. - input := getInterfaces(test.input) - expected := getInterfaces(test.expected) - if !reflect.DeepEqual(input, expected) { - t.Errorf("Sort mismatch:\n %v != %v", input, expected) - } - } -} - -// TestSortValues ensures the sort functionality for relect.Value based sorting -// works as intended. -func TestSortValues(t *testing.T) { - v := reflect.ValueOf - - a := v("a") - b := v("b") - c := v("c") - embedA := v(embed{"a"}) - embedB := v(embed{"b"}) - embedC := v(embed{"c"}) - tests := []sortTestCase{ - // No values. - { - []reflect.Value{}, - []reflect.Value{}, - }, - // Bools. - { - []reflect.Value{v(false), v(true), v(false)}, - []reflect.Value{v(false), v(false), v(true)}, - }, - // Ints. - { - []reflect.Value{v(2), v(1), v(3)}, - []reflect.Value{v(1), v(2), v(3)}, - }, - // Uints. - { - []reflect.Value{v(uint8(2)), v(uint8(1)), v(uint8(3))}, - []reflect.Value{v(uint8(1)), v(uint8(2)), v(uint8(3))}, - }, - // Floats. - { - []reflect.Value{v(2.0), v(1.0), v(3.0)}, - []reflect.Value{v(1.0), v(2.0), v(3.0)}, - }, - // Strings. - { - []reflect.Value{b, a, c}, - []reflect.Value{a, b, c}, - }, - // Array - { - []reflect.Value{v([3]int{3, 2, 1}), v([3]int{1, 3, 2}), v([3]int{1, 2, 3})}, - []reflect.Value{v([3]int{1, 2, 3}), v([3]int{1, 3, 2}), v([3]int{3, 2, 1})}, - }, - // Uintptrs. - { - []reflect.Value{v(uintptr(2)), v(uintptr(1)), v(uintptr(3))}, - []reflect.Value{v(uintptr(1)), v(uintptr(2)), v(uintptr(3))}, - }, - // SortableStructs. - { - // Note: not sorted - DisableMethods is set. - []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})}, - []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})}, - }, - // UnsortableStructs. - { - // Note: not sorted - SpewKeys is false. - []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})}, - []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})}, - }, - // Invalid. - { - []reflect.Value{embedB, embedA, embedC}, - []reflect.Value{embedB, embedA, embedC}, - }, - } - cs := spew.ConfigState{DisableMethods: true, SpewKeys: false} - helpTestSortValues(tests, &cs, t) -} - -// TestSortValuesWithMethods ensures the sort functionality for relect.Value -// based sorting works as intended when using string methods. -func TestSortValuesWithMethods(t *testing.T) { - v := reflect.ValueOf - - a := v("a") - b := v("b") - c := v("c") - tests := []sortTestCase{ - // Ints. - { - []reflect.Value{v(2), v(1), v(3)}, - []reflect.Value{v(1), v(2), v(3)}, - }, - // Strings. - { - []reflect.Value{b, a, c}, - []reflect.Value{a, b, c}, - }, - // SortableStructs. - { - []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})}, - []reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})}, - }, - // UnsortableStructs. - { - // Note: not sorted - SpewKeys is false. - []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})}, - []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})}, - }, - } - cs := spew.ConfigState{DisableMethods: false, SpewKeys: false} - helpTestSortValues(tests, &cs, t) -} - -// TestSortValuesWithSpew ensures the sort functionality for relect.Value -// based sorting works as intended when using spew to stringify keys. -func TestSortValuesWithSpew(t *testing.T) { - v := reflect.ValueOf - - a := v("a") - b := v("b") - c := v("c") - tests := []sortTestCase{ - // Ints. - { - []reflect.Value{v(2), v(1), v(3)}, - []reflect.Value{v(1), v(2), v(3