ires 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -45
- data/ext/Gopkg.lock +31 -1
- data/ext/ires/image.go +227 -0
- data/ext/ires/ires.go +47 -59
- data/ext/ires/uri.go +143 -0
- data/ext/main.go +18 -9
- data/ext/vendor/github.com/PuerkitoBio/purell/LICENSE +12 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/README.md +187 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/bench_test.go +57 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/benchmarks/v0.1.0 +9 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/example_test.go +35 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/purell.go +379 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/purell_test.go +768 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/urlnorm_test.go +53 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/LICENSE +27 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/README.md +16 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/urlesc.go +180 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/urlesc_test.go +641 -0
- data/ext/vendor/github.com/{satori/go.uuid → goware/urlx}/LICENSE +3 -1
- data/ext/vendor/github.com/goware/urlx/README.md +172 -0
- data/ext/vendor/github.com/goware/urlx/urlx.go +196 -0
- data/ext/vendor/github.com/goware/urlx/urlx_test.go +232 -0
- data/ext/vendor/golang.org/x/net/AUTHORS +3 -0
- data/ext/vendor/golang.org/x/net/CONTRIBUTING.md +31 -0
- data/ext/vendor/golang.org/x/net/CONTRIBUTORS +3 -0
- data/ext/vendor/golang.org/x/net/LICENSE +27 -0
- data/ext/vendor/golang.org/x/net/PATENTS +22 -0
- data/ext/vendor/golang.org/x/net/README.md +16 -0
- data/ext/vendor/golang.org/x/net/bpf/asm.go +41 -0
- data/ext/vendor/golang.org/x/net/bpf/constants.go +218 -0
- data/ext/vendor/golang.org/x/net/bpf/doc.go +82 -0
- data/ext/vendor/golang.org/x/net/bpf/instructions.go +704 -0
- data/ext/vendor/golang.org/x/net/bpf/instructions_test.go +525 -0
- data/ext/vendor/golang.org/x/net/bpf/setter.go +10 -0
- data/ext/vendor/golang.org/x/net/bpf/testdata/all_instructions.bpf +1 -0
- data/ext/vendor/golang.org/x/net/bpf/testdata/all_instructions.txt +79 -0
- data/ext/vendor/golang.org/x/net/bpf/vm.go +140 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_aluop_test.go +512 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_bpf_test.go +192 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_extension_test.go +49 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_instructions.go +174 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_jump_test.go +380 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_load_test.go +246 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_ret_test.go +115 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_scratch_test.go +247 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_test.go +144 -0
- data/ext/vendor/golang.org/x/net/codereview.cfg +1 -0
- data/ext/vendor/golang.org/x/net/context/context.go +54 -0
- data/ext/vendor/golang.org/x/net/context/context_test.go +583 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go +74 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go +29 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go +147 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17_test.go +79 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_test.go +105 -0
- data/ext/vendor/golang.org/x/net/context/go17.go +72 -0
- data/ext/vendor/golang.org/x/net/context/go19.go +20 -0
- data/ext/vendor/golang.org/x/net/context/pre_go17.go +300 -0
- data/ext/vendor/golang.org/x/net/context/pre_go19.go +109 -0
- data/ext/vendor/golang.org/x/net/context/withtimeout_test.go +31 -0
- data/ext/vendor/golang.org/x/net/dict/dict.go +210 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/example_test.go +132 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/message.go +1997 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/message_test.go +1116 -0
- data/ext/vendor/golang.org/x/net/html/atom/atom.go +78 -0
- data/ext/vendor/golang.org/x/net/html/atom/atom_test.go +109 -0
- data/ext/vendor/golang.org/x/net/html/atom/gen.go +709 -0
- data/ext/vendor/golang.org/x/net/html/atom/table.go +777 -0
- data/ext/vendor/golang.org/x/net/html/atom/table_test.go +373 -0
- data/ext/vendor/golang.org/x/net/html/charset/charset.go +257 -0
- data/ext/vendor/golang.org/x/net/html/charset/charset_test.go +237 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-charset.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-UTF-8-BOM.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-meta-charset.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-meta-content.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/No-encoding-declaration.html +47 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/README +9 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-16BE-BOM.html +0 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-16LE-BOM.html +0 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-8-BOM-vs-meta-charset.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-8-BOM-vs-meta-content.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/meta-charset-attribute.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/meta-content-attribute.html +48 -0
- data/ext/vendor/golang.org/x/net/html/const.go +104 -0
- data/ext/vendor/golang.org/x/net/html/doc.go +106 -0
- data/ext/vendor/golang.org/x/net/html/doctype.go +156 -0
- data/ext/vendor/golang.org/x/net/html/entity.go +2253 -0
- data/ext/vendor/golang.org/x/net/html/entity_test.go +29 -0
- data/ext/vendor/golang.org/x/net/html/escape.go +258 -0
- data/ext/vendor/golang.org/x/net/html/escape_test.go +97 -0
- data/ext/vendor/golang.org/x/net/html/example_test.go +40 -0
- data/ext/vendor/golang.org/x/net/html/foreign.go +226 -0
- data/ext/vendor/golang.org/x/net/html/node.go +193 -0
- data/ext/vendor/golang.org/x/net/html/node_test.go +146 -0
- data/ext/vendor/golang.org/x/net/html/parse.go +2094 -0
- data/ext/vendor/golang.org/x/net/html/parse_test.go +388 -0
- data/ext/vendor/golang.org/x/net/html/render.go +271 -0
- data/ext/vendor/golang.org/x/net/html/render_test.go +156 -0
- data/ext/vendor/golang.org/x/net/html/testdata/go1.html +2237 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/README +28 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/adoption01.dat +194 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/adoption02.dat +31 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/comments01.dat +135 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/doctype01.dat +370 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/entities01.dat +603 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/entities02.dat +249 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/html5test-com.dat +246 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/inbody01.dat +43 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/isindex.dat +40 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/pending-spec-changes-plain-text-unsafe.dat +0 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/pending-spec-changes.dat +52 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/plain-text-unsafe.dat +0 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scriptdata01.dat +308 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scripted/adoption01.dat +15 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scripted/webkit01.dat +28 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tables01.dat +212 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests1.dat +1952 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests10.dat +799 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests11.dat +482 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests12.dat +62 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests14.dat +74 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests15.dat +208 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests16.dat +2299 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests17.dat +153 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests18.dat +269 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests19.dat +1237 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests2.dat +763 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests20.dat +455 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests21.dat +221 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests22.dat +157 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests23.dat +155 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests24.dat +79 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests25.dat +219 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests26.dat +313 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests3.dat +305 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests4.dat +59 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests5.dat +191 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests6.dat +663 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests7.dat +390 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests8.dat +148 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests9.dat +457 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests_innerHTML_1.dat +741 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tricky01.dat +261 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/webkit01.dat +610 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/webkit02.dat +159 -0
- data/ext/vendor/golang.org/x/net/html/token.go +1219 -0
- data/ext/vendor/golang.org/x/net/html/token_test.go +748 -0
- data/ext/vendor/golang.org/x/net/http2/Dockerfile +51 -0
- data/ext/vendor/golang.org/x/net/http2/Makefile +3 -0
- data/ext/vendor/golang.org/x/net/http2/README +20 -0
- data/ext/vendor/golang.org/x/net/http2/ciphers.go +641 -0
- data/ext/vendor/golang.org/x/net/http2/ciphers_test.go +309 -0
- data/ext/vendor/golang.org/x/net/http2/client_conn_pool.go +256 -0
- data/ext/vendor/golang.org/x/net/http2/configure_transport.go +80 -0
- data/ext/vendor/golang.org/x/net/http2/databuffer.go +146 -0
- data/ext/vendor/golang.org/x/net/http2/databuffer_test.go +157 -0
- data/ext/vendor/golang.org/x/net/http2/errors.go +133 -0
- data/ext/vendor/golang.org/x/net/http2/errors_test.go +24 -0
- data/ext/vendor/golang.org/x/net/http2/flow.go +50 -0
- data/ext/vendor/golang.org/x/net/http2/flow_test.go +53 -0
- data/ext/vendor/golang.org/x/net/http2/frame.go +1579 -0
- data/ext/vendor/golang.org/x/net/http2/frame_test.go +1191 -0
- data/ext/vendor/golang.org/x/net/http2/go16.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/go17.go +106 -0
- data/ext/vendor/golang.org/x/net/http2/go17_not18.go +36 -0
- data/ext/vendor/golang.org/x/net/http2/go18.go +56 -0
- data/ext/vendor/golang.org/x/net/http2/go18_test.go +79 -0
- data/ext/vendor/golang.org/x/net/http2/go19.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/go19_test.go +60 -0
- data/ext/vendor/golang.org/x/net/http2/gotrack.go +170 -0
- data/ext/vendor/golang.org/x/net/http2/gotrack_test.go +33 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/Makefile +8 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/README +16 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/h2demo.go +538 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/launch.go +302 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.key +27 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.pem +26 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.srl +1 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/server.crt +20 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/server.key +27 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/tmpl.go +1991 -0
- data/ext/vendor/golang.org/x/net/http2/h2i/README.md +97 -0
- data/ext/vendor/golang.org/x/net/http2/h2i/h2i.go +522 -0
- data/ext/vendor/golang.org/x/net/http2/headermap.go +78 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/encode.go +240 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/encode_test.go +386 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/hpack.go +490 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/hpack_test.go +722 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/huffman.go +212 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/tables.go +479 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/tables_test.go +214 -0
- data/ext/vendor/golang.org/x/net/http2/http2.go +391 -0
- data/ext/vendor/golang.org/x/net/http2/http2_test.go +199 -0
- data/ext/vendor/golang.org/x/net/http2/not_go16.go +21 -0
- data/ext/vendor/golang.org/x/net/http2/not_go17.go +87 -0
- data/ext/vendor/golang.org/x/net/http2/not_go18.go +29 -0
- data/ext/vendor/golang.org/x/net/http2/not_go19.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/pipe.go +163 -0
- data/ext/vendor/golang.org/x/net/http2/pipe_test.go +130 -0
- data/ext/vendor/golang.org/x/net/http2/server.go +2857 -0
- data/ext/vendor/golang.org/x/net/http2/server_push_test.go +521 -0
- data/ext/vendor/golang.org/x/net/http2/server_test.go +3721 -0
- data/ext/vendor/golang.org/x/net/http2/testdata/draft-ietf-httpbis-http2.xml +5021 -0
- data/ext/vendor/golang.org/x/net/http2/transport.go +2285 -0
- data/ext/vendor/golang.org/x/net/http2/transport_test.go +3714 -0
- data/ext/vendor/golang.org/x/net/http2/write.go +370 -0
- data/ext/vendor/golang.org/x/net/http2/writesched.go +242 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_priority.go +452 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_priority_test.go +541 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_random.go +72 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_random_test.go +44 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_test.go +125 -0
- data/ext/vendor/golang.org/x/net/http2/z_spec_test.go +356 -0
- data/ext/vendor/golang.org/x/net/icmp/dstunreach.go +41 -0
- data/ext/vendor/golang.org/x/net/icmp/echo.go +45 -0
- data/ext/vendor/golang.org/x/net/icmp/endpoint.go +113 -0
- data/ext/vendor/golang.org/x/net/icmp/example_test.go +63 -0
- data/ext/vendor/golang.org/x/net/icmp/extension.go +89 -0
- data/ext/vendor/golang.org/x/net/icmp/extension_test.go +259 -0
- data/ext/vendor/golang.org/x/net/icmp/helper_posix.go +75 -0
- data/ext/vendor/golang.org/x/net/icmp/interface.go +236 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv4.go +61 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv4_test.go +83 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv6.go +23 -0
- data/ext/vendor/golang.org/x/net/icmp/listen_posix.go +100 -0
- data/ext/vendor/golang.org/x/net/icmp/listen_stub.go +33 -0
- data/ext/vendor/golang.org/x/net/icmp/message.go +152 -0
- data/ext/vendor/golang.org/x/net/icmp/message_test.go +134 -0
- data/ext/vendor/golang.org/x/net/icmp/messagebody.go +41 -0
- data/ext/vendor/golang.org/x/net/icmp/mpls.go +77 -0
- data/ext/vendor/golang.org/x/net/icmp/multipart.go +109 -0
- data/ext/vendor/golang.org/x/net/icmp/multipart_test.go +442 -0
- data/ext/vendor/golang.org/x/net/icmp/packettoobig.go +43 -0
- data/ext/vendor/golang.org/x/net/icmp/paramprob.go +63 -0
- data/ext/vendor/golang.org/x/net/icmp/ping_test.go +200 -0
- data/ext/vendor/golang.org/x/net/icmp/sys_freebsd.go +11 -0
- data/ext/vendor/golang.org/x/net/icmp/timeexceeded.go +39 -0
- data/ext/vendor/golang.org/x/net/idna/example_test.go +70 -0
- data/ext/vendor/golang.org/x/net/idna/idna.go +680 -0
- data/ext/vendor/golang.org/x/net/idna/idna_test.go +108 -0
- data/ext/vendor/golang.org/x/net/idna/punycode.go +203 -0
- data/ext/vendor/golang.org/x/net/idna/punycode_test.go +198 -0
- data/ext/vendor/golang.org/x/net/idna/tables.go +4477 -0
- data/ext/vendor/golang.org/x/net/idna/trie.go +72 -0
- data/ext/vendor/golang.org/x/net/idna/trieval.go +114 -0
- data/ext/vendor/golang.org/x/net/internal/iana/const.go +180 -0
- data/ext/vendor/golang.org/x/net/internal/iana/gen.go +293 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_bsd.go +53 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_nobsd.go +15 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_posix.go +31 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_stub.go +32 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_unix.go +29 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_windows.go +42 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/interface.go +94 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/rlimit.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/stack.go +147 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go +13 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go +17 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_darwin.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_dragonfly.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_freebsd.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_linux.go +49 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_netbsd.go +47 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_openbsd.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_solaris.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/error_unix.go +31 -0
- data/ext/vendor/golang.org/x/net/internal/socket/error_windows.go +26 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_32bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_64bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_stub.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go +42 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go +39 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go +16 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux.go +36 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go +24 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go +24 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go +36 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_stub.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go +74 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_msg.go +77 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go +18 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go +18 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/internal/socket/reflect.go +62 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket.go +285 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket_go1_9_test.go +259 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket_test.go +46 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys.go +33 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_bsd.go +17 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_darwin.go +7 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go +7 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux.go +27 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_386.go +55 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_386.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_arm.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go +55 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_netbsd.go +25 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_posix.go +168 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_solaris.go +71 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_stub.go +64 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_unix.go +33 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_windows.go +70 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go +65 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go +68 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go +60 -0
- data/ext/vendor/golang.org/x/net/internal/timeseries/timeseries.go +525 -0
- data/ext/vendor/golang.org/x/net/internal/timeseries/timeseries_test.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv4/batch.go +191 -0
- data/ext/vendor/golang.org/x/net/ipv4/bpf_test.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/control.go +144 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_bsd.go +40 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_pktinfo.go +39 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_test.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_unix.go +73 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_windows.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_darwin.go +77 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_dragonfly.go +38 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_freebsd.go +75 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_linux.go +122 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_netbsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_openbsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_solaris.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv4/dgramopt.go +265 -0
- data/ext/vendor/golang.org/x/net/ipv4/doc.go +244 -0
- data/ext/vendor/golang.org/x/net/ipv4/endpoint.go +187 -0
- data/ext/vendor/golang.org/x/net/ipv4/example_test.go +224 -0
- data/ext/vendor/golang.org/x/net/ipv4/gen.go +199 -0
- data/ext/vendor/golang.org/x/net/ipv4/genericopt.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/header.go +159 -0
- data/ext/vendor/golang.org/x/net/ipv4/header_test.go +228 -0
- data/ext/vendor/golang.org/x/net/ipv4/helper.go +63 -0
- data/ext/vendor/golang.org/x/net/ipv4/iana.go +34 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_linux.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_test.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicast_test.go +334 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicastlistener_test.go +265 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicastsockopt_test.go +195 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet.go +69 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet_go1_8.go +56 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet_go1_9.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg.go +36 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_8.go +59 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_9.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_nocmsg.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_go1_8_test.go +248 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_go1_9_test.go +388 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_test.go +140 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt.go +44 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt_posix.go +71 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt_stub.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreq.go +119 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreqn.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bpf.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_darwin.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_dragonfly.go +35 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_freebsd.go +76 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_linux.go +59 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_solaris.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_ssmreq.go +54 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_windows.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/unicast_test.go +247 -0
- data/ext/vendor/golang.org/x/net/ipv4/unicastsockopt_test.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_darwin.go +99 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go +31 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_386.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_netbsd.go +30 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_openbsd.go +30 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_solaris.go +100 -0
- data/ext/vendor/golang.org/x/net/ipv6/batch.go +119 -0
- data/ext/vendor/golang.org/x/net/ipv6/bpf_test.go +96 -0
- data/ext/vendor/golang.org/x/net/ipv6/control.go +187 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go +48 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_rfc3542_unix.go +94 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_test.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_unix.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_windows.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_darwin.go +112 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_dragonfly.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_freebsd.go +105 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_linux.go +147 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_netbsd.go +80 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_openbsd.go +89 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_solaris.go +114 -0
- data/ext/vendor/golang.org/x/net/ipv6/dgramopt.go +302 -0
- data/ext/vendor/golang.org/x/net/ipv6/doc.go +243 -0
- data/ext/vendor/golang.org/x/net/ipv6/endpoint.go +128 -0
- data/ext/vendor/golang.org/x/net/ipv6/example_test.go +216 -0
- data/ext/vendor/golang.org/x/net/ipv6/gen.go +199 -0
- data/ext/vendor/golang.org/x/net/ipv6/genericopt.go +58 -0
- data/ext/vendor/golang.org/x/net/ipv6/header.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/header_test.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/helper.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/iana.go +82 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp.go +60 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_bsd.go +29 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_linux.go +27 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_solaris.go +27 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_stub.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_test.go +96 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_windows.go +22 -0
- data/ext/vendor/golang.org/x/net/ipv6/mocktransponder_test.go +32 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicast_test.go +264 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicastlistener_test.go +261 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicastsockopt_test.go +157 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg.go +35 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_8.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_9.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_nocmsg.go +41 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_go1_8_test.go +242 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_go1_9_test.go +373 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_test.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt.go +43 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_posix.go +87 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_stub.go +46 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_test.go +133 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_asmreq.go +24 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go +17 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bpf.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bsd.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_darwin.go +106 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_freebsd.go +92 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_linux.go +74 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_solaris.go +74 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_ssmreq.go +54 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_windows.go +75 -0
- data/ext/vendor/golang.org/x/net/ipv6/unicast_test.go +184 -0
- data/ext/vendor/golang.org/x/net/ipv6/unicastsockopt_test.go +120 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_darwin.go +131 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go +88 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go +122 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go +124 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go +124 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_386.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_netbsd.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_openbsd.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_solaris.go +131 -0
- data/ext/vendor/golang.org/x/net/lex/httplex/httplex.go +351 -0
- data/ext/vendor/golang.org/x/net/lex/httplex/httplex_test.go +119 -0
- data/ext/vendor/golang.org/x/net/lif/address.go +105 -0
- data/ext/vendor/golang.org/x/net/lif/address_test.go +123 -0
- data/ext/vendor/golang.org/x/net/lif/binary.go +115 -0
- data/ext/vendor/golang.org/x/net/lif/defs_solaris.go +90 -0
- data/ext/vendor/golang.org/x/net/lif/lif.go +43 -0
- data/ext/vendor/golang.org/x/net/lif/link.go +126 -0
- data/ext/vendor/golang.org/x/net/lif/link_test.go +63 -0
- data/ext/vendor/golang.org/x/net/lif/sys.go +21 -0
- data/ext/vendor/golang.org/x/net/lif/sys_solaris_amd64.s +8 -0
- data/ext/vendor/golang.org/x/net/lif/syscall.go +28 -0
- data/ext/vendor/golang.org/x/net/lif/zsys_solaris_amd64.go +103 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest.go +456 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_go16.go +24 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_go17.go +24 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_test.go +76 -0
- data/ext/vendor/golang.org/x/net/netutil/listen.go +48 -0
- data/ext/vendor/golang.org/x/net/netutil/listen_test.go +101 -0
- data/ext/vendor/golang.org/x/net/proxy/direct.go +18 -0
- data/ext/vendor/golang.org/x/net/proxy/per_host.go +140 -0
- data/ext/vendor/golang.org/x/net/proxy/per_host_test.go +55 -0
- data/ext/vendor/golang.org/x/net/proxy/proxy.go +134 -0
- data/ext/vendor/golang.org/x/net/proxy/proxy_test.go +215 -0
- data/ext/vendor/golang.org/x/net/proxy/socks5.go +214 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/gen.go +713 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/list.go +135 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/list_test.go +416 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/table.go +9419 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/table_test.go +16756 -0
- data/ext/vendor/golang.org/x/net/route/address.go +425 -0
- data/ext/vendor/golang.org/x/net/route/address_darwin_test.go +63 -0
- data/ext/vendor/golang.org/x/net/route/address_test.go +103 -0
- data/ext/vendor/golang.org/x/net/route/binary.go +90 -0
- data/ext/vendor/golang.org/x/net/route/defs_darwin.go +114 -0
- data/ext/vendor/golang.org/x/net/route/defs_dragonfly.go +113 -0
- data/ext/vendor/golang.org/x/net/route/defs_freebsd.go +337 -0
- data/ext/vendor/golang.org/x/net/route/defs_netbsd.go +112 -0
- data/ext/vendor/golang.org/x/net/route/defs_openbsd.go +116 -0
- data/ext/vendor/golang.org/x/net/route/interface.go +64 -0
- data/ext/vendor/golang.org/x/net/route/interface_announce.go +32 -0
- data/ext/vendor/golang.org/x/net/route/interface_classic.go +66 -0
- data/ext/vendor/golang.org/x/net/route/interface_freebsd.go +78 -0
- data/ext/vendor/golang.org/x/net/route/interface_multicast.go +30 -0
- data/ext/vendor/golang.org/x/net/route/interface_openbsd.go +90 -0
- data/ext/vendor/golang.org/x/net/route/message.go +72 -0
- data/ext/vendor/golang.org/x/net/route/message_darwin_test.go +34 -0
- data/ext/vendor/golang.org/x/net/route/message_freebsd_test.go +92 -0
- data/ext/vendor/golang.org/x/net/route/message_test.go +239 -0
- data/ext/vendor/golang.org/x/net/route/route.go +123 -0
- data/ext/vendor/golang.org/x/net/route/route_classic.go +67 -0
- data/ext/vendor/golang.org/x/net/route/route_openbsd.go +65 -0
- data/ext/vendor/golang.org/x/net/route/route_test.go +390 -0
- data/ext/vendor/golang.org/x/net/route/sys.go +39 -0
- data/ext/vendor/golang.org/x/net/route/sys_darwin.go +87 -0
- data/ext/vendor/golang.org/x/net/route/sys_dragonfly.go +76 -0
- data/ext/vendor/golang.org/x/net/route/sys_freebsd.go +155 -0
- data/ext/vendor/golang.org/x/net/route/sys_netbsd.go +71 -0
- data/ext/vendor/golang.org/x/net/route/sys_openbsd.go +80 -0
- data/ext/vendor/golang.org/x/net/route/syscall.go +28 -0
- data/ext/vendor/golang.org/x/net/route/zsys_darwin.go +99 -0
- data/ext/vendor/golang.org/x/net/route/zsys_dragonfly.go +98 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_386.go +126 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go +123 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_arm.go +123 -0
- data/ext/vendor/golang.org/x/net/route/zsys_netbsd.go +97 -0
- data/ext/vendor/golang.org/x/net/route/zsys_openbsd.go +101 -0
- data/ext/vendor/golang.org/x/net/trace/events.go +532 -0
- data/ext/vendor/golang.org/x/net/trace/histogram.go +365 -0
- data/ext/vendor/golang.org/x/net/trace/histogram_test.go +325 -0
- data/ext/vendor/golang.org/x/net/trace/trace.go +1082 -0
- data/ext/vendor/golang.org/x/net/trace/trace_go16.go +21 -0
- data/ext/vendor/golang.org/x/net/trace/trace_go17.go +21 -0
- data/ext/vendor/golang.org/x/net/trace/trace_test.go +178 -0
- data/ext/vendor/golang.org/x/net/webdav/file.go +796 -0
- data/ext/vendor/golang.org/x/net/webdav/file_go1.6.go +17 -0
- data/ext/vendor/golang.org/x/net/webdav/file_go1.7.go +16 -0
- data/ext/vendor/golang.org/x/net/webdav/file_test.go +1184 -0
- data/ext/vendor/golang.org/x/net/webdav/if.go +173 -0
- data/ext/vendor/golang.org/x/net/webdav/if_test.go +322 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/README +11 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/atom_test.go +56 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/example_test.go +151 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/marshal.go +1223 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/marshal_test.go +1939 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/read.go +692 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/read_test.go +744 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/typeinfo.go +371 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/xml.go +1998 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/xml_test.go +752 -0
- data/ext/vendor/golang.org/x/net/webdav/litmus_test_server.go +94 -0
- data/ext/vendor/golang.org/x/net/webdav/lock.go +445 -0
- data/ext/vendor/golang.org/x/net/webdav/lock_test.go +731 -0
- data/ext/vendor/golang.org/x/net/webdav/prop.go +418 -0
- data/ext/vendor/golang.org/x/net/webdav/prop_test.go +613 -0
- data/ext/vendor/golang.org/x/net/webdav/webdav.go +702 -0
- data/ext/vendor/golang.org/x/net/webdav/webdav_test.go +344 -0
- data/ext/vendor/golang.org/x/net/webdav/xml.go +519 -0
- data/ext/vendor/golang.org/x/net/webdav/xml_test.go +906 -0
- data/ext/vendor/golang.org/x/net/websocket/client.go +106 -0
- data/ext/vendor/golang.org/x/net/websocket/dial.go +24 -0
- data/ext/vendor/golang.org/x/net/websocket/dial_test.go +43 -0
- data/ext/vendor/golang.org/x/net/websocket/exampledial_test.go +31 -0
- data/ext/vendor/golang.org/x/net/websocket/examplehandler_test.go +26 -0
- data/ext/vendor/golang.org/x/net/websocket/hybi.go +583 -0
- data/ext/vendor/golang.org/x/net/websocket/hybi_test.go +608 -0
- data/ext/vendor/golang.org/x/net/websocket/server.go +113 -0
- data/ext/vendor/golang.org/x/net/websocket/websocket.go +448 -0
- data/ext/vendor/golang.org/x/net/websocket/websocket_test.go +665 -0
- data/ext/vendor/golang.org/x/net/xsrftoken/xsrf.go +94 -0
- data/ext/vendor/golang.org/x/net/xsrftoken/xsrf_test.go +83 -0
- data/ext/vendor/golang.org/x/text/AUTHORS +3 -0
- data/ext/vendor/golang.org/x/text/CONTRIBUTING.md +31 -0
- data/ext/vendor/golang.org/x/text/CONTRIBUTORS +3 -0
- data/ext/vendor/golang.org/x/text/LICENSE +27 -0
- data/ext/vendor/golang.org/x/text/PATENTS +22 -0
- data/ext/vendor/golang.org/x/text/README.md +91 -0
- data/ext/vendor/golang.org/x/text/cases/cases.go +162 -0
- data/ext/vendor/golang.org/x/text/cases/context.go +376 -0
- data/ext/vendor/golang.org/x/text/cases/context_test.go +438 -0
- data/ext/vendor/golang.org/x/text/cases/example_test.go +53 -0
- data/ext/vendor/golang.org/x/text/cases/fold.go +34 -0
- data/ext/vendor/golang.org/x/text/cases/fold_test.go +51 -0
- data/ext/vendor/golang.org/x/text/cases/gen.go +839 -0
- data/ext/vendor/golang.org/x/text/cases/gen_trieval.go +219 -0
- data/ext/vendor/golang.org/x/text/cases/icu.go +61 -0
- data/ext/vendor/golang.org/x/text/cases/icu_test.go +210 -0
- data/ext/vendor/golang.org/x/text/cases/info.go +82 -0
- data/ext/vendor/golang.org/x/text/cases/map.go +816 -0
- data/ext/vendor/golang.org/x/text/cases/map_test.go +950 -0
- data/ext/vendor/golang.org/x/text/cases/tables.go +2251 -0
- data/ext/vendor/golang.org/x/text/cases/tables_test.go +1158 -0
- data/ext/vendor/golang.org/x/text/cases/trieval.go +215 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/doc.go +35 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/extract.go +195 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/main.go +356 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/message.go +127 -0
- data/ext/vendor/golang.org/x/text/codereview.cfg +1 -0
- data/ext/vendor/golang.org/x/text/collate/build/builder.go +702 -0
- data/ext/vendor/golang.org/x/text/collate/build/builder_test.go +290 -0
- data/ext/vendor/golang.org/x/text/collate/build/colelem.go +294 -0
- data/ext/vendor/golang.org/x/text/collate/build/colelem_test.go +215 -0
- data/ext/vendor/golang.org/x/text/collate/build/contract.go +309 -0
- data/ext/vendor/golang.org/x/text/collate/build/contract_test.go +266 -0
- data/ext/vendor/golang.org/x/text/collate/build/order.go +393 -0
- data/ext/vendor/golang.org/x/text/collate/build/order_test.go +229 -0
- data/ext/vendor/golang.org/x/text/collate/build/table.go +81 -0
- data/ext/vendor/golang.org/x/text/collate/build/trie.go +290 -0
- data/ext/vendor/golang.org/x/text/collate/build/trie_test.go +107 -0
- data/ext/vendor/golang.org/x/text/collate/collate.go +403 -0
- data/ext/vendor/golang.org/x/text/collate/collate_test.go +482 -0
- data/ext/vendor/golang.org/x/text/collate/export_test.go +51 -0
- data/ext/vendor/golang.org/x/text/collate/index.go +32 -0
- data/ext/vendor/golang.org/x/text/collate/maketables.go +553 -0
- data/ext/vendor/golang.org/x/text/collate/option.go +239 -0
- data/ext/vendor/golang.org/x/text/collate/option_test.go +209 -0
- data/ext/vendor/golang.org/x/text/collate/reg_test.go +230 -0
- data/ext/vendor/golang.org/x/text/collate/sort.go +81 -0
- data/ext/vendor/golang.org/x/text/collate/sort_test.go +55 -0
- data/ext/vendor/golang.org/x/text/collate/table_test.go +291 -0
- data/ext/vendor/golang.org/x/text/collate/tables.go +73789 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/Makefile +7 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/chars.go +1156 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/col.go +97 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/colcmp.go +529 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/darwin.go +111 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/gen.go +183 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/icu.go +209 -0
- data/ext/vendor/golang.org/x/text/currency/common.go +66 -0
- data/ext/vendor/golang.org/x/text/currency/currency.go +185 -0
- data/ext/vendor/golang.org/x/text/currency/currency_test.go +171 -0
- data/ext/vendor/golang.org/x/text/currency/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/currency/format.go +215 -0
- data/ext/vendor/golang.org/x/text/currency/format_test.go +70 -0
- data/ext/vendor/golang.org/x/text/currency/gen.go +400 -0
- data/ext/vendor/golang.org/x/text/currency/gen_common.go +70 -0
- data/ext/vendor/golang.org/x/text/currency/query.go +152 -0
- data/ext/vendor/golang.org/x/text/currency/query_test.go +107 -0
- data/ext/vendor/golang.org/x/text/currency/tables.go +2574 -0
- data/ext/vendor/golang.org/x/text/currency/tables_test.go +93 -0
- data/ext/vendor/golang.org/x/text/doc.go +13 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/charmap.go +249 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/charmap_test.go +258 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/maketables.go +556 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/tables.go +7410 -0
- data/ext/vendor/golang.org/x/text/encoding/encoding.go +335 -0
- data/ext/vendor/golang.org/x/text/encoding/encoding_test.go +290 -0
- data/ext/vendor/golang.org/x/text/encoding/example_test.go +42 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/gen.go +173 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go +86 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go +144 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/map.go +105 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/tables.go +352 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/gen.go +192 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go +209 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go +192 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/tables.go +2348 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go +180 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/gen.go +137 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go +81 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/mib.go +1621 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/internal.go +75 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/all.go +12 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/all_test.go +248 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/eucjp.go +225 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go +299 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/maketables.go +161 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/shiftjis.go +189 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/tables.go +26971 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/all_test.go +94 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/euckr.go +177 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/maketables.go +143 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/tables.go +34152 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/all.go +12 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go +143 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go +269 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go +245 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/maketables.go +161 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/tables.go +43999 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-gb18030.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-16le.txt +0 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-32be.txt +0 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-8.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-windows-1252.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-euc-jp.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-iso-2022-jp.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-shift-jis.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-utf-8.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-hz-gb2312.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-utf-8.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-gbk.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-utf-8.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-big5.txt +106 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-utf-8.txt +106 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-euc-kr.txt +175 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-utf-8.txt +175 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go +114 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go +199 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/maketables.go +140 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/tables.go +37142 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/override.go +82 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/unicode.go +434 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/unicode_test.go +499 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/utf32/utf32.go +296 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go +248 -0
- data/ext/vendor/golang.org/x/text/feature/plural/common.go +70 -0
- data/ext/vendor/golang.org/x/text/feature/plural/data_test.go +190 -0
- data/ext/vendor/golang.org/x/text/feature/plural/example_test.go +46 -0
- data/ext/vendor/golang.org/x/text/feature/plural/gen.go +513 -0
- data/ext/vendor/golang.org/x/text/feature/plural/gen_common.go +74 -0
- data/ext/vendor/golang.org/x/text/feature/plural/message.go +244 -0
- data/ext/vendor/golang.org/x/text/feature/plural/message_test.go +197 -0
- data/ext/vendor/golang.org/x/text/feature/plural/plural.go +258 -0
- data/ext/vendor/golang.org/x/text/feature/plural/plural_test.go +216 -0
- data/ext/vendor/golang.org/x/text/feature/plural/tables.go +540 -0
- data/ext/vendor/golang.org/x/text/gen.go +318 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/catmsg.go +366 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go +316 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/codec.go +407 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/varint.go +62 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/varint_test.go +123 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collate_test.go +121 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collelem.go +371 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collelem_test.go +183 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/colltab.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/colltab_test.go +64 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/contract.go +145 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/contract_test.go +131 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/iter.go +178 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/iter_test.go +63 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/numeric.go +236 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/numeric_test.go +159 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/table.go +275 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/trie.go +159 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/trie_test.go +106 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/weighter.go +31 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/weighter_test.go +42 -0
- data/ext/vendor/golang.org/x/text/internal/export/README +4 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/common_test.go +55 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/example_test.go +68 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen.go +276 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_common.go +59 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_test.go +91 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_trieval.go +123 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/idna.go +717 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/idna_test.go +308 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/punycode.go +201 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/punycode_test.go +198 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/tables.go +4557 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/trie.go +70 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/trieval.go +119 -0
- data/ext/vendor/golang.org/x/text/internal/format/format.go +41 -0
- data/ext/vendor/golang.org/x/text/internal/gen.go +52 -0
- data/ext/vendor/golang.org/x/text/internal/gen/code.go +351 -0
- data/ext/vendor/golang.org/x/text/internal/gen/gen.go +281 -0
- data/ext/vendor/golang.org/x/text/internal/gen_test.go +38 -0
- data/ext/vendor/golang.org/x/text/internal/internal.go +51 -0
- data/ext/vendor/golang.org/x/text/internal/internal_test.go +38 -0
- data/ext/vendor/golang.org/x/text/internal/match.go +67 -0
- data/ext/vendor/golang.org/x/text/internal/match_test.go +56 -0
- data/ext/vendor/golang.org/x/text/internal/number/common.go +40 -0
- data/ext/vendor/golang.org/x/text/internal/number/decimal.go +498 -0
- data/ext/vendor/golang.org/x/text/internal/number/decimal_test.go +329 -0
- data/ext/vendor/golang.org/x/text/internal/number/format.go +540 -0
- data/ext/vendor/golang.org/x/text/internal/number/format_test.go +522 -0
- data/ext/vendor/golang.org/x/text/internal/number/gen.go +458 -0
- data/ext/vendor/golang.org/x/text/internal/number/gen_common.go +44 -0
- data/ext/vendor/golang.org/x/text/internal/number/number.go +154 -0
- data/ext/vendor/golang.org/x/text/internal/number/number_test.go +100 -0
- data/ext/vendor/golang.org/x/text/internal/number/pattern.go +485 -0
- data/ext/vendor/golang.org/x/text/internal/number/pattern_test.go +438 -0
- data/ext/vendor/golang.org/x/text/internal/number/roundingmode_string.go +16 -0
- data/ext/vendor/golang.org/x/text/internal/number/tables.go +1154 -0
- data/ext/vendor/golang.org/x/text/internal/number/tables_test.go +125 -0
- data/ext/vendor/golang.org/x/text/internal/stringset/set.go +86 -0
- data/ext/vendor/golang.org/x/text/internal/stringset/set_test.go +53 -0
- data/ext/vendor/golang.org/x/text/internal/tables.go +117 -0
- data/ext/vendor/golang.org/x/text/internal/tag/tag.go +100 -0
- data/ext/vendor/golang.org/x/text/internal/tag/tag_test.go +67 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/codesize.go +53 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/flag.go +22 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/gc.go +14 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/gccgo.go +11 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/go1_6.go +23 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/go1_7.go +17 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/text.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/compact.go +58 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/data_test.go +875 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/example_compact_test.go +71 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/example_test.go +148 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/gen_test.go +68 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/print.go +251 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/triegen.go +494 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/example_test.go +81 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/ucd.go +371 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/ucd_test.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/utf8internal/utf8internal.go +87 -0
- data/ext/vendor/golang.org/x/text/language/Makefile +16 -0
- data/ext/vendor/golang.org/x/text/language/common.go +16 -0
- data/ext/vendor/golang.org/x/text/language/coverage.go +197 -0
- data/ext/vendor/golang.org/x/text/language/coverage_test.go +154 -0
- data/ext/vendor/golang.org/x/text/language/display/dict.go +92 -0
- data/ext/vendor/golang.org/x/text/language/display/dict_test.go +39 -0
- data/ext/vendor/golang.org/x/text/language/display/display.go +420 -0
- data/ext/vendor/golang.org/x/text/language/display/display_test.go +705 -0
- data/ext/vendor/golang.org/x/text/language/display/examples_test.go +116 -0
- data/ext/vendor/golang.org/x/text/language/display/lookup.go +251 -0
- data/ext/vendor/golang.org/x/text/language/display/maketables.go +602 -0
- data/ext/vendor/golang.org/x/text/language/display/tables.go +50344 -0
- data/ext/vendor/golang.org/x/text/language/doc.go +102 -0
- data/ext/vendor/golang.org/x/text/language/examples_test.go +413 -0
- data/ext/vendor/golang.org/x/text/language/gen.go +1706 -0
- data/ext/vendor/golang.org/x/text/language/gen_common.go +20 -0
- data/ext/vendor/golang.org/x/text/language/gen_index.go +162 -0
- data/ext/vendor/golang.org/x/text/language/go1_1.go +38 -0
- data/ext/vendor/golang.org/x/text/language/go1_2.go +11 -0
- data/ext/vendor/golang.org/x/text/language/httpexample_test.go +48 -0
- data/ext/vendor/golang.org/x/text/language/index.go +769 -0
- data/ext/vendor/golang.org/x/text/language/language.go +887 -0
- data/ext/vendor/golang.org/x/text/language/language_test.go +878 -0
- data/ext/vendor/golang.org/x/text/language/lookup.go +396 -0
- data/ext/vendor/golang.org/x/text/language/lookup_test.go +457 -0
- data/ext/vendor/golang.org/x/text/language/match.go +933 -0
- data/ext/vendor/golang.org/x/text/language/match_test.go +505 -0
- data/ext/vendor/golang.org/x/text/language/parse.go +859 -0
- data/ext/vendor/golang.org/x/text/language/parse_test.go +517 -0
- data/ext/vendor/golang.org/x/text/language/tables.go +3675 -0
- data/ext/vendor/golang.org/x/text/language/tags.go +143 -0
- data/ext/vendor/golang.org/x/text/language/testdata/CLDRLocaleMatcherTest.txt +389 -0
- data/ext/vendor/golang.org/x/text/language/testdata/GoLocaleMatcherTest.txt +226 -0
- data/ext/vendor/golang.org/x/text/message/catalog.go +28 -0
- data/ext/vendor/golang.org/x/text/message/catalog/catalog.go +292 -0
- data/ext/vendor/golang.org/x/text/message/catalog/catalog_test.go +194 -0
- data/ext/vendor/golang.org/x/text/message/catalog/dict.go +90 -0
- data/ext/vendor/golang.org/x/text/message/doc.go +100 -0
- data/ext/vendor/golang.org/x/text/message/examples_test.go +42 -0
- data/ext/vendor/golang.org/x/text/message/fmt_test.go +1889 -0
- data/ext/vendor/golang.org/x/text/message/format.go +532 -0
- data/ext/vendor/golang.org/x/text/message/message.go +169 -0
- data/ext/vendor/golang.org/x/text/message/message_test.go +181 -0
- data/ext/vendor/golang.org/x/text/message/print.go +1194 -0
- data/ext/vendor/golang.org/x/text/number/doc.go +28 -0
- data/ext/vendor/golang.org/x/text/number/examples_test.go +28 -0
- data/ext/vendor/golang.org/x/text/number/format.go +122 -0
- data/ext/vendor/golang.org/x/text/number/format_test.go +107 -0
- data/ext/vendor/golang.org/x/text/number/number.go +77 -0
- data/ext/vendor/golang.org/x/text/number/number_test.go +190 -0
- data/ext/vendor/golang.org/x/text/number/option.go +177 -0
- data/ext/vendor/golang.org/x/text/runes/cond.go +187 -0
- data/ext/vendor/golang.org/x/text/runes/cond_test.go +282 -0
- data/ext/vendor/golang.org/x/text/runes/example_test.go +60 -0
- data/ext/vendor/golang.org/x/text/runes/runes.go +355 -0
- data/ext/vendor/golang.org/x/text/runes/runes_test.go +664 -0
- data/ext/vendor/golang.org/x/text/search/index.go +35 -0
- data/ext/vendor/golang.org/x/text/search/pattern.go +155 -0
- data/ext/vendor/golang.org/x/text/search/pattern_test.go +357 -0
- data/ext/vendor/golang.org/x/text/search/search.go +237 -0
- data/ext/vendor/golang.org/x/text/search/tables.go +12448 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bench_test.go +54 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bidirule.go +340 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go +851 -0
- data/ext/vendor/golang.org/x/text/secure/doc.go +6 -0
- data/ext/vendor/golang.org/x/text/secure/precis/benchmark_test.go +82 -0
- data/ext/vendor/golang.org/x/text/secure/precis/class.go +36 -0
- data/ext/vendor/golang.org/x/text/secure/precis/class_test.go +50 -0
- data/ext/vendor/golang.org/x/text/secure/precis/context.go +139 -0
- data/ext/vendor/golang.org/x/text/secure/precis/doc.go +14 -0
- data/ext/vendor/golang.org/x/text/secure/precis/enforce_test.go +396 -0
- data/ext/vendor/golang.org/x/text/secure/precis/gen.go +310 -0
- data/ext/vendor/golang.org/x/text/secure/precis/gen_trieval.go +68 -0
- data/ext/vendor/golang.org/x/text/secure/precis/nickname.go +72 -0
- data/ext/vendor/golang.org/x/text/secure/precis/options.go +157 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profile.go +402 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profile_test.go +149 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profiles.go +78 -0
- data/ext/vendor/golang.org/x/text/secure/precis/tables.go +3887 -0
- data/ext/vendor/golang.org/x/text/secure/precis/tables_test.go +69 -0
- data/ext/vendor/golang.org/x/text/secure/precis/transformer.go +32 -0
- data/ext/vendor/golang.org/x/text/secure/precis/trieval.go +64 -0
- data/ext/vendor/golang.org/x/text/transform/examples_test.go +37 -0
- data/ext/vendor/golang.org/x/text/transform/transform.go +705 -0
- data/ext/vendor/golang.org/x/text/transform/transform_test.go +1317 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/bidi.go +198 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/bracket.go +335 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/core.go +1058 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/core_test.go +224 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen.go +133 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen_ranges.go +57 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen_trieval.go +64 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/prop.go +206 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/ranges_test.go +53 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/tables.go +1813 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/tables_test.go +82 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/trieval.go +60 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/base.go +100 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/cldr.go +130 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/cldr_test.go +27 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/collate.go +359 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/collate_test.go +275 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/data_test.go +186 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/decode.go +171 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/examples_test.go +21 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/makexml.go +400 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/resolve.go +602 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/resolve_test.go +368 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/slice.go +144 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/slice_test.go +175 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/xml.go +1487 -0
- data/ext/vendor/golang.org/x/text/unicode/doc.go +8 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/composition.go +508 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/composition_test.go +130 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/example_iter_test.go +82 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/forminfo.go +259 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/forminfo_test.go +54 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/input.go +109 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/iter.go +457 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/iter_test.go +98 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/maketables.go +976 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/norm_test.go +14 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/normalize.go +609 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/normalize_test.go +1287 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/readwriter.go +125 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/readwriter_test.go +56 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/tables.go +7651 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/transform.go +88 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/transform_test.go +101 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/trie.go +54 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/triegen.go +117 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/ucd_test.go +275 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/gen.go +115 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/merge.go +260 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/merge_test.go +184 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/rangetable.go +70 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go +55 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/tables.go +6376 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/bits.go +59 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/example_test.go +118 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/gen.go +195 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/gen_bits.go +63 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/runenames.go +48 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/runenames_test.go +46 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/tables.go +15514 -0
- data/ext/vendor/golang.org/x/text/width/common_test.go +92 -0
- data/ext/vendor/golang.org/x/text/width/example_test.go +52 -0
- data/ext/vendor/golang.org/x/text/width/gen.go +115 -0
- data/ext/vendor/golang.org/x/text/width/gen_common.go +96 -0
- data/ext/vendor/golang.org/x/text/width/gen_trieval.go +34 -0
- data/ext/vendor/golang.org/x/text/width/kind_string.go +16 -0
- data/ext/vendor/golang.org/x/text/width/runes_test.go +461 -0
- data/ext/vendor/golang.org/x/text/width/tables.go +1316 -0
- data/ext/vendor/golang.org/x/text/width/tables_test.go +59 -0
- data/ext/vendor/golang.org/x/text/width/transform.go +239 -0
- data/ext/vendor/golang.org/x/text/width/transform_test.go +701 -0
- data/ext/vendor/golang.org/x/text/width/trieval.go +30 -0
- data/ext/vendor/golang.org/x/text/width/width.go +206 -0
- data/lib/ires/version.rb +1 -1
- data/shared/darwin/ires.so +0 -0
- data/shared/linux/ires.so +0 -0
- metadata +1011 -23
- data/ext/operate/image.go +0 -176
- data/ext/util/uri/uri.go +0 -105
- data/ext/vendor/github.com/satori/go.uuid/README.md +0 -65
- data/ext/vendor/github.com/satori/go.uuid/benchmarks_test.go +0 -121
- data/ext/vendor/github.com/satori/go.uuid/uuid.go +0 -488
- data/ext/vendor/github.com/satori/go.uuid/uuid_test.go +0 -633
@@ -0,0 +1,169 @@
|
|
1
|
+
// Copyright 2015 The Go Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style
|
3
|
+
// license that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
package message // import "golang.org/x/text/message"
|
6
|
+
|
7
|
+
import (
|
8
|
+
"io"
|
9
|
+
"os"
|
10
|
+
|
11
|
+
"golang.org/x/text/language"
|
12
|
+
"golang.org/x/text/message/catalog"
|
13
|
+
)
|
14
|
+
|
15
|
+
// TODO: allow more than one goroutine per printer. This will allow porting from
|
16
|
+
// fmt much less error prone.
|
17
|
+
|
18
|
+
// A Printer implements language-specific formatted I/O analogous to the fmt
|
19
|
+
// package. Only one goroutine may use a Printer at the same time.
|
20
|
+
type Printer struct {
|
21
|
+
// Wrap the fields in a hidden type to hide some of the implemented methods.
|
22
|
+
printer printer
|
23
|
+
|
24
|
+
// NOTE: limiting one goroutine per Printer allows for many optimizations
|
25
|
+
// and simplifications. We can consider removing this restriction down the
|
26
|
+
// road if it the benefits do not seem to outweigh the disadvantages.
|
27
|
+
}
|
28
|
+
|
29
|
+
type options struct {
|
30
|
+
cat *catalog.Catalog
|
31
|
+
// TODO:
|
32
|
+
// - allow %s to print integers in written form (tables are likely too large
|
33
|
+
// to enable this by default).
|
34
|
+
// - list behavior
|
35
|
+
//
|
36
|
+
}
|
37
|
+
|
38
|
+
// An Option defines an option of a Printer.
|
39
|
+
type Option func(o *options)
|
40
|
+
|
41
|
+
// Catalog defines the catalog to be used.
|
42
|
+
func Catalog(c *catalog.Catalog) Option {
|
43
|
+
return func(o *options) { o.cat = c }
|
44
|
+
}
|
45
|
+
|
46
|
+
// NewPrinter returns a Printer that formats messages tailored to language t.
|
47
|
+
func NewPrinter(t language.Tag, opts ...Option) *Printer {
|
48
|
+
options := &options{
|
49
|
+
cat: defaultCatalog,
|
50
|
+
}
|
51
|
+
for _, o := range opts {
|
52
|
+
o(options)
|
53
|
+
}
|
54
|
+
p := &Printer{printer{
|
55
|
+
tag: t,
|
56
|
+
}}
|
57
|
+
p.printer.toDecimal.InitDecimal(t)
|
58
|
+
p.printer.toScientific.InitScientific(t)
|
59
|
+
p.printer.catContext = options.cat.Context(t, &p.printer)
|
60
|
+
return p
|
61
|
+
}
|
62
|
+
|
63
|
+
// Sprint is like fmt.Sprint, but using language-specific formatting.
|
64
|
+
func (p *Printer) Sprint(a ...interface{}) string {
|
65
|
+
p.printer.reset()
|
66
|
+
p.printer.doPrint(a)
|
67
|
+
return p.printer.String()
|
68
|
+
}
|
69
|
+
|
70
|
+
// Fprint is like fmt.Fprint, but using language-specific formatting.
|
71
|
+
func (p *Printer) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
|
72
|
+
p.printer.reset()
|
73
|
+
p.printer.doPrint(a)
|
74
|
+
n64, err := io.Copy(w, &p.printer.Buffer)
|
75
|
+
return int(n64), err
|
76
|
+
}
|
77
|
+
|
78
|
+
// Print is like fmt.Print, but using language-specific formatting.
|
79
|
+
func (p *Printer) Print(a ...interface{}) (n int, err error) {
|
80
|
+
return p.Fprint(os.Stdout, a...)
|
81
|
+
}
|
82
|
+
|
83
|
+
// Sprintln is like fmt.Sprintln, but using language-specific formatting.
|
84
|
+
func (p *Printer) Sprintln(a ...interface{}) string {
|
85
|
+
p.printer.reset()
|
86
|
+
p.printer.doPrintln(a)
|
87
|
+
return p.printer.String()
|
88
|
+
}
|
89
|
+
|
90
|
+
// Fprintln is like fmt.Fprintln, but using language-specific formatting.
|
91
|
+
func (p *Printer) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
|
92
|
+
p.printer.reset()
|
93
|
+
p.printer.doPrintln(a)
|
94
|
+
n64, err := io.Copy(w, &p.printer.Buffer)
|
95
|
+
return int(n64), err
|
96
|
+
}
|
97
|
+
|
98
|
+
// Println is like fmt.Println, but using language-specific formatting.
|
99
|
+
func (p *Printer) Println(a ...interface{}) (n int, err error) {
|
100
|
+
return p.Fprintln(os.Stdout, a...)
|
101
|
+
}
|
102
|
+
|
103
|
+
// Sprintf is like fmt.Sprintf, but using language-specific formatting.
|
104
|
+
func (p *Printer) Sprintf(key Reference, a ...interface{}) string {
|
105
|
+
lookupAndFormat(p, key, a)
|
106
|
+
return p.printer.String()
|
107
|
+
}
|
108
|
+
|
109
|
+
// Fprintf is like fmt.Fprintf, but using language-specific formatting.
|
110
|
+
func (p *Printer) Fprintf(w io.Writer, key Reference, a ...interface{}) (n int, err error) {
|
111
|
+
lookupAndFormat(p, key, a)
|
112
|
+
return w.Write(p.printer.Bytes())
|
113
|
+
}
|
114
|
+
|
115
|
+
// Printf is like fmt.Printf, but using language-specific formatting.
|
116
|
+
func (p *Printer) Printf(key Reference, a ...interface{}) (n int, err error) {
|
117
|
+
lookupAndFormat(p, key, a)
|
118
|
+
return os.Stdout.Write(p.printer.Bytes())
|
119
|
+
}
|
120
|
+
|
121
|
+
func lookupAndFormat(p *Printer, r Reference, a []interface{}) {
|
122
|
+
p.printer.reset()
|
123
|
+
p.printer.args = a
|
124
|
+
var id, msg string
|
125
|
+
switch v := r.(type) {
|
126
|
+
case string:
|
127
|
+
id, msg = v, v
|
128
|
+
case key:
|
129
|
+
id, msg = v.id, v.fallback
|
130
|
+
default:
|
131
|
+
panic("key argument is not a Reference")
|
132
|
+
}
|
133
|
+
|
134
|
+
if p.printer.catContext.Execute(id) == catalog.ErrNotFound {
|
135
|
+
if p.printer.catContext.Execute(msg) == catalog.ErrNotFound {
|
136
|
+
p.printer.Render(msg)
|
137
|
+
return
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
// Arg implements catmsg.Renderer.
|
143
|
+
func (p *printer) Arg(i int) interface{} { // TODO, also return "ok" bool
|
144
|
+
i--
|
145
|
+
if uint(i) < uint(len(p.args)) {
|
146
|
+
return p.args[i]
|
147
|
+
}
|
148
|
+
return nil
|
149
|
+
}
|
150
|
+
|
151
|
+
// Render implements catmsg.Renderer.
|
152
|
+
func (p *printer) Render(msg string) {
|
153
|
+
p.doPrintf(msg)
|
154
|
+
}
|
155
|
+
|
156
|
+
// A Reference is a string or a message reference.
|
157
|
+
type Reference interface {
|
158
|
+
// TODO: also allow []string
|
159
|
+
}
|
160
|
+
|
161
|
+
// Key creates a message Reference for a message where the given id is used for
|
162
|
+
// message lookup and the fallback is returned when no matches are found.
|
163
|
+
func Key(id string, fallback string) Reference {
|
164
|
+
return key{id, fallback}
|
165
|
+
}
|
166
|
+
|
167
|
+
type key struct {
|
168
|
+
id, fallback string
|
169
|
+
}
|
@@ -0,0 +1,181 @@
|
|
1
|
+
// Copyright 2015 The Go Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style
|
3
|
+
// license that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
package message
|
6
|
+
|
7
|
+
import (
|
8
|
+
"bytes"
|
9
|
+
"fmt"
|
10
|
+
"io"
|
11
|
+
"testing"
|
12
|
+
|
13
|
+
"golang.org/x/text/internal"
|
14
|
+
"golang.org/x/text/internal/format"
|
15
|
+
"golang.org/x/text/language"
|
16
|
+
"golang.org/x/text/message/catalog"
|
17
|
+
)
|
18
|
+
|
19
|
+
type formatFunc func(s fmt.State, v rune)
|
20
|
+
|
21
|
+
func (f formatFunc) Format(s fmt.State, v rune) { f(s, v) }
|
22
|
+
|
23
|
+
func TestBinding(t *testing.T) {
|
24
|
+
testCases := []struct {
|
25
|
+
tag string
|
26
|
+
value interface{}
|
27
|
+
want string
|
28
|
+
}{
|
29
|
+
{"en", 1, "1"},
|
30
|
+
{"en", "2", "2"},
|
31
|
+
{ // Language is passed.
|
32
|
+
"en",
|
33
|
+
formatFunc(func(fs fmt.State, v rune) {
|
34
|
+
s := fs.(format.State)
|
35
|
+
io.WriteString(s, s.Language().String())
|
36
|
+
}),
|
37
|
+
"en",
|
38
|
+
},
|
39
|
+
}
|
40
|
+
for i, tc := range testCases {
|
41
|
+
p := NewPrinter(language.MustParse(tc.tag))
|
42
|
+
if got := p.Sprint(tc.value); got != tc.want {
|
43
|
+
t.Errorf("%d:%s:Sprint(%v) = %q; want %q", i, tc.tag, tc.value, got, tc.want)
|
44
|
+
}
|
45
|
+
var buf bytes.Buffer
|
46
|
+
p.Fprint(&buf, tc.value)
|
47
|
+
if got := buf.String(); got != tc.want {
|
48
|
+
t.Errorf("%d:%s:Fprint(%v) = %q; want %q", i, tc.tag, tc.value, got, tc.want)
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
func TestLocalization(t *testing.T) {
|
54
|
+
type test struct {
|
55
|
+
tag string
|
56
|
+
key Reference
|
57
|
+
args []interface{}
|
58
|
+
want string
|
59
|
+
}
|
60
|
+
args := func(x ...interface{}) []interface{} { return x }
|
61
|
+
empty := []interface{}{}
|
62
|
+
joe := []interface{}{"Joe"}
|
63
|
+
joeAndMary := []interface{}{"Joe", "Mary"}
|
64
|
+
|
65
|
+
testCases := []struct {
|
66
|
+
desc string
|
67
|
+
cat []entry
|
68
|
+
test []test
|
69
|
+
}{{
|
70
|
+
desc: "empty",
|
71
|
+
test: []test{
|
72
|
+
{"en", "key", empty, "key"},
|
73
|
+
{"en", "", empty, ""},
|
74
|
+
{"nl", "", empty, ""},
|
75
|
+
},
|
76
|
+
}, {
|
77
|
+
desc: "hierarchical languages",
|
78
|
+
cat: []entry{
|
79
|
+
{"en", "hello %s", "Hello %s!"},
|
80
|
+
{"en-GB", "hello %s", "Hellø %s!"},
|
81
|
+
{"en-US", "hello %s", "Howdy %s!"},
|
82
|
+
{"en", "greetings %s and %s", "Greetings %s and %s!"},
|
83
|
+
},
|
84
|
+
test: []test{
|
85
|
+
{"und", "hello %s", joe, "hello Joe"},
|
86
|
+
{"nl", "hello %s", joe, "hello Joe"},
|
87
|
+
{"en", "hello %s", joe, "Hello Joe!"},
|
88
|
+
{"en-US", "hello %s", joe, "Howdy Joe!"},
|
89
|
+
{"en-GB", "hello %s", joe, "Hellø Joe!"},
|
90
|
+
{"en-oxendict", "hello %s", joe, "Hello Joe!"},
|
91
|
+
{"en-US-oxendict-u-ms-metric", "hello %s", joe, "Howdy Joe!"},
|
92
|
+
|
93
|
+
{"und", "greetings %s and %s", joeAndMary, "greetings Joe and Mary"},
|
94
|
+
{"nl", "greetings %s and %s", joeAndMary, "greetings Joe and Mary"},
|
95
|
+
{"en", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
|
96
|
+
{"en-US", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
|
97
|
+
{"en-GB", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
|
98
|
+
{"en-oxendict", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
|
99
|
+
{"en-US-oxendict-u-ms-metric", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
|
100
|
+
},
|
101
|
+
}, {
|
102
|
+
desc: "references",
|
103
|
+
cat: []entry{
|
104
|
+
{"en", "hello", "Hello!"},
|
105
|
+
},
|
106
|
+
test: []test{
|
107
|
+
{"en", "hello", empty, "Hello!"},
|
108
|
+
{"en", Key("hello", "fallback"), empty, "Hello!"},
|
109
|
+
{"en", Key("xxx", "fallback"), empty, "fallback"},
|
110
|
+
{"und", Key("hello", "fallback"), empty, "fallback"},
|
111
|
+
},
|
112
|
+
}, {
|
113
|
+
desc: "zero substitution", // work around limitation of fmt
|
114
|
+
cat: []entry{
|
115
|
+
{"en", "hello %s", "Hello!"},
|
116
|
+
{"en", "hi %s and %s", "Hello %[2]s!"},
|
117
|
+
},
|
118
|
+
test: []test{
|
119
|
+
{"en", "hello %s", joe, "Hello!"},
|
120
|
+
{"en", "hello %s", joeAndMary, "Hello!"},
|
121
|
+
{"en", "hi %s and %s", joeAndMary, "Hello Mary!"},
|
122
|
+
// The following tests resolve to the fallback string.
|
123
|
+
{"und", "hello", joeAndMary, "hello"},
|
124
|
+
{"und", "hello %%%%", joeAndMary, "hello %%"},
|
125
|
+
{"und", "hello %#%%4.2% ", joeAndMary, "hello %% "},
|
126
|
+
{"und", "hello %s", joeAndMary, "hello Joe%!(EXTRA string=Mary)"},
|
127
|
+
{"und", "hello %+%%s", joeAndMary, "hello %Joe%!(EXTRA string=Mary)"},
|
128
|
+
{"und", "hello %-42%%s ", joeAndMary, "hello %Joe %!(EXTRA string=Mary)"},
|
129
|
+
},
|
130
|
+
}, {
|
131
|
+
desc: "number formatting", // work around limitation of fmt
|
132
|
+
cat: []entry{
|
133
|
+
{"und", "files", "%d files left"},
|
134
|
+
{"und", "meters", "%.2f meters"},
|
135
|
+
{"de", "files", "%d Dateien übrig"},
|
136
|
+
},
|
137
|
+
test: []test{
|
138
|
+
{"en", "meters", args(3000.2), "3,000.20 meters"},
|
139
|
+
{"en-u-nu-gujr", "files", args(123456), "૧૨૩,૪૫૬ files left"},
|
140
|
+
{"de", "files", args(1234), "1.234 Dateien übrig"},
|
141
|
+
{"de-CH", "files", args(1234), "1’234 Dateien übrig"},
|
142
|
+
{"de-CH-u-nu-mong", "files", args(1234), "᠑’᠒᠓᠔ Dateien übrig"},
|
143
|
+
},
|
144
|
+
}}
|
145
|
+
|
146
|
+
for _, tc := range testCases {
|
147
|
+
cat, _ := initCat(tc.cat)
|
148
|
+
|
149
|
+
for i, pt := range tc.test {
|
150
|
+
t.Run(fmt.Sprintf("%s:%d", tc.desc, i), func(t *testing.T) {
|
151
|
+
p := NewPrinter(language.MustParse(pt.tag), Catalog(cat))
|
152
|
+
|
153
|
+
if got := p.Sprintf(pt.key, pt.args...); got != pt.want {
|
154
|
+
t.Errorf("Sprintf(%q, %v) = %s; want %s",
|
155
|
+
pt.key, pt.args, got, pt.want)
|
156
|
+
return // Next error will likely be the same.
|
157
|
+
}
|
158
|
+
|
159
|
+
w := &bytes.Buffer{}
|
160
|
+
p.Fprintf(w, pt.key, pt.args...)
|
161
|
+
if got := w.String(); got != pt.want {
|
162
|
+
t.Errorf("Fprintf(%q, %v) = %s; want %s",
|
163
|
+
pt.key, pt.args, got, pt.want)
|
164
|
+
}
|
165
|
+
})
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
type entry struct{ tag, key, msg string }
|
171
|
+
|
172
|
+
func initCat(entries []entry) (*catalog.Catalog, []language.Tag) {
|
173
|
+
tags := []language.Tag{}
|
174
|
+
cat := catalog.New()
|
175
|
+
for _, e := range entries {
|
176
|
+
tag := language.MustParse(e.tag)
|
177
|
+
tags = append(tags, tag)
|
178
|
+
cat.SetString(tag, e.key, e.msg)
|
179
|
+
}
|
180
|
+
return cat, internal.UniqueTags(tags)
|
181
|
+
}
|
@@ -0,0 +1,1194 @@
|
|
1
|
+
// Copyright 2017 The Go Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style
|
3
|
+
// license that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
package message
|
6
|
+
|
7
|
+
import (
|
8
|
+
"bytes"
|
9
|
+
"fmt" // TODO: consider copying interfaces from package fmt to avoid dependency.
|
10
|
+
"math"
|
11
|
+
"reflect"
|
12
|
+
"unicode/utf8"
|
13
|
+
|
14
|
+
"golang.org/x/text/internal/format"
|
15
|
+
"golang.org/x/text/internal/number"
|
16
|
+
"golang.org/x/text/language"
|
17
|
+
"golang.org/x/text/message/catalog"
|
18
|
+
)
|
19
|
+
|
20
|
+
// Strings for use with buffer.WriteString.
|
21
|
+
// This is less overhead than using buffer.Write with byte arrays.
|
22
|
+
const (
|
23
|
+
commaSpaceString = ", "
|
24
|
+
nilAngleString = "<nil>"
|
25
|
+
nilParenString = "(nil)"
|
26
|
+
nilString = "nil"
|
27
|
+
mapString = "map["
|
28
|
+
percentBangString = "%!"
|
29
|
+
missingString = "(MISSING)"
|
30
|
+
badIndexString = "(BADINDEX)"
|
31
|
+
panicString = "(PANIC="
|
32
|
+
extraString = "%!(EXTRA "
|
33
|
+
badWidthString = "%!(BADWIDTH)"
|
34
|
+
badPrecString = "%!(BADPREC)"
|
35
|
+
noVerbString = "%!(NOVERB)"
|
36
|
+
|
37
|
+
invReflectString = "<invalid reflect.Value>"
|
38
|
+
)
|
39
|
+
|
40
|
+
// printer is used to store a printer's state.
|
41
|
+
// It implements "golang.org/x/text/internal/format".State.
|
42
|
+
type printer struct {
|
43
|
+
// the context for looking up message translations
|
44
|
+
catContext *catalog.Context
|
45
|
+
// the language
|
46
|
+
tag language.Tag
|
47
|
+
|
48
|
+
// buffer for accumulating output.
|
49
|
+
bytes.Buffer
|
50
|
+
|
51
|
+
// retain arguments across calls.
|
52
|
+
args []interface{}
|
53
|
+
// retain current argument number across calls
|
54
|
+
argNum int
|
55
|
+
// arg holds the current item, as an interface{}.
|
56
|
+
arg interface{}
|
57
|
+
// value is used instead of arg for reflect values.
|
58
|
+
value reflect.Value
|
59
|
+
|
60
|
+
// fmt is used to format basic items such as integers or strings.
|
61
|
+
fmt formatInfo
|
62
|
+
|
63
|
+
// reordered records whether the format string used argument reordering.
|
64
|
+
reordered bool
|
65
|
+
// goodArgNum records whether the most recent reordering directive was valid.
|
66
|
+
goodArgNum bool
|
67
|
+
// panicking is set by catchPanic to avoid infinite panic, recover, panic, ... recursion.
|
68
|
+
panicking bool
|
69
|
+
// erroring is set when printing an error string to guard against calling handleMethods.
|
70
|
+
erroring bool
|
71
|
+
|
72
|
+
toDecimal number.Formatter
|
73
|
+
toScientific number.Formatter
|
74
|
+
}
|
75
|
+
|
76
|
+
func (p *printer) reset() {
|
77
|
+
p.Buffer.Reset()
|
78
|
+
p.argNum = 0
|
79
|
+
p.reordered = false
|
80
|
+
p.panicking = false
|
81
|
+
p.erroring = false
|
82
|
+
p.fmt.init(&p.Buffer)
|
83
|
+
}
|
84
|
+
|
85
|
+
// Language implements "golang.org/x/text/internal/format".State.
|
86
|
+
func (p *printer) Language() language.Tag { return p.tag }
|
87
|
+
|
88
|
+
func (p *printer) Width() (wid int, ok bool) { return p.fmt.wid, p.fmt.widPresent }
|
89
|
+
|
90
|
+
func (p *printer) Precision() (prec int, ok bool) { return p.fmt.prec, p.fmt.precPresent }
|
91
|
+
|
92
|
+
func (p *printer) Flag(b int) bool {
|
93
|
+
switch b {
|
94
|
+
case '-':
|
95
|
+
return p.fmt.minus
|
96
|
+
case '+':
|
97
|
+
return p.fmt.plus || p.fmt.plusV
|
98
|
+
case '#':
|
99
|
+
return p.fmt.sharp || p.fmt.sharpV
|
100
|
+
case ' ':
|
101
|
+
return p.fmt.space
|
102
|
+
case '0':
|
103
|
+
return p.fmt.zero
|
104
|
+
}
|
105
|
+
return false
|
106
|
+
}
|
107
|
+
|
108
|
+
// getField gets the i'th field of the struct value.
|
109
|
+
// If the field is itself is an interface, return a value for
|
110
|
+
// the thing inside the interface, not the interface itself.
|
111
|
+
func getField(v reflect.Value, i int) reflect.Value {
|
112
|
+
val := v.Field(i)
|
113
|
+
if val.Kind() == reflect.Interface && !val.IsNil() {
|
114
|
+
val = val.Elem()
|
115
|
+
}
|
116
|
+
return val
|
117
|
+
}
|
118
|
+
|
119
|
+
// tooLarge reports whether the magnitude of the integer is
|
120
|
+
// too large to be used as a formatting width or precision.
|
121
|
+
func tooLarge(x int) bool {
|
122
|
+
const max int = 1e6
|
123
|
+
return x > max || x < -max
|
124
|
+
}
|
125
|
+
|
126
|
+
// parsenum converts ASCII to integer. num is 0 (and isnum is false) if no number present.
|
127
|
+
func parsenum(s string, start, end int) (num int, isnum bool, newi int) {
|
128
|
+
if start >= end {
|
129
|
+
return 0, false, end
|
130
|
+
}
|
131
|
+
for newi = start; newi < end && '0' <= s[newi] && s[newi] <= '9'; newi++ {
|
132
|
+
if tooLarge(num) {
|
133
|
+
return 0, false, end // Overflow; crazy long number most likely.
|
134
|
+
}
|
135
|
+
num = num*10 + int(s[newi]-'0')
|
136
|
+
isnum = true
|
137
|
+
}
|
138
|
+
return
|
139
|
+
}
|
140
|
+
|
141
|
+
func (p *printer) unknownType(v reflect.Value) {
|
142
|
+
if !v.IsValid() {
|
143
|
+
p.WriteString(nilAngleString)
|
144
|
+
return
|
145
|
+
}
|
146
|
+
p.WriteByte('?')
|
147
|
+
p.WriteString(v.Type().String())
|
148
|
+
p.WriteByte('?')
|
149
|
+
}
|
150
|
+
|
151
|
+
func (p *printer) badVerb(verb rune) {
|
152
|
+
p.erroring = true
|
153
|
+
p.WriteString(percentBangString)
|
154
|
+
p.WriteRune(verb)
|
155
|
+
p.WriteByte('(')
|
156
|
+
switch {
|
157
|
+
case p.arg != nil:
|
158
|
+
p.WriteString(reflect.TypeOf(p.arg).String())
|
159
|
+
p.WriteByte('=')
|
160
|
+
p.printArg(p.arg, 'v')
|
161
|
+
case p.value.IsValid():
|
162
|
+
p.WriteString(p.value.Type().String())
|
163
|
+
p.WriteByte('=')
|
164
|
+
p.printValue(p.value, 'v', 0)
|
165
|
+
default:
|
166
|
+
p.WriteString(nilAngleString)
|
167
|
+
}
|
168
|
+
p.WriteByte(')')
|
169
|
+
p.erroring = false
|
170
|
+
}
|
171
|
+
|
172
|
+
func (p *printer) fmtBool(v bool, verb rune) {
|
173
|
+
switch verb {
|
174
|
+
case 't', 'v':
|
175
|
+
p.fmt.fmt_boolean(v)
|
176
|
+
default:
|
177
|
+
p.badVerb(verb)
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
// fmt0x64 formats a uint64 in hexadecimal and prefixes it with 0x or
|
182
|
+
// not, as requested, by temporarily setting the sharp flag.
|
183
|
+
func (p *printer) fmt0x64(v uint64, leading0x bool) {
|
184
|
+
sharp := p.fmt.sharp
|
185
|
+
p.fmt.sharp = leading0x
|
186
|
+
p.fmt.fmt_integer(v, 16, unsigned, ldigits)
|
187
|
+
p.fmt.sharp = sharp
|
188
|
+
}
|
189
|
+
|
190
|
+
// fmtInteger formats a signed or unsigned integer.
|
191
|
+
func (p *printer) fmtInteger(v uint64, isSigned bool, verb rune) {
|
192
|
+
switch verb {
|
193
|
+
case 'v':
|
194
|
+
if p.fmt.sharpV && !isSigned {
|
195
|
+
p.fmt0x64(v, true)
|
196
|
+
return
|
197
|
+
}
|
198
|
+
fallthrough
|
199
|
+
case 'd':
|
200
|
+
if p.fmt.sharp || p.fmt.sharpV {
|
201
|
+
p.fmt.fmt_integer(v, 10, isSigned, ldigits)
|
202
|
+
} else {
|
203
|
+
p.fmtDecimalInt(v, isSigned)
|
204
|
+
}
|
205
|
+
case 'b':
|
206
|
+
p.fmt.fmt_integer(v, 2, isSigned, ldigits)
|
207
|
+
case 'o':
|
208
|
+
p.fmt.fmt_integer(v, 8, isSigned, ldigits)
|
209
|
+
case 'x':
|
210
|
+
p.fmt.fmt_integer(v, 16, isSigned, ldigits)
|
211
|
+
case 'X':
|
212
|
+
p.fmt.fmt_integer(v, 16, isSigned, udigits)
|
213
|
+
case 'c':
|
214
|
+
p.fmt.fmt_c(v)
|
215
|
+
case 'q':
|
216
|
+
if v <= utf8.MaxRune {
|
217
|
+
p.fmt.fmt_qc(v)
|
218
|
+
} else {
|
219
|
+
p.badVerb(verb)
|
220
|
+
}
|
221
|
+
case 'U':
|
222
|
+
p.fmt.fmt_unicode(v)
|
223
|
+
default:
|
224
|
+
p.badVerb(verb)
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
// fmtFloat formats a float. The default precision for each verb
|
229
|
+
// is specified as last argument in the call to fmt_float.
|
230
|
+
func (p *printer) fmtFloat(v float64, size int, verb rune) {
|
231
|
+
switch verb {
|
232
|
+
case 'b':
|
233
|
+
p.fmt.fmt_float(v, size, verb, -1)
|
234
|
+
case 'v':
|
235
|
+
verb = 'g'
|
236
|
+
fallthrough
|
237
|
+
case 'g', 'G':
|
238
|
+
if p.fmt.sharp || p.fmt.sharpV {
|
239
|
+
p.fmt.fmt_float(v, size, verb, -1)
|
240
|
+
} else {
|
241
|
+
p.fmtVariableFloat(v, size)
|
242
|
+
}
|
243
|
+
case 'e', 'E':
|
244
|
+
if p.fmt.sharp || p.fmt.sharpV {
|
245
|
+
p.fmt.fmt_float(v, size, verb, 6)
|
246
|
+
} else {
|
247
|
+
p.fmtScientific(v, size, 6)
|
248
|
+
}
|
249
|
+
case 'f', 'F':
|
250
|
+
if p.fmt.sharp || p.fmt.sharpV {
|
251
|
+
p.fmt.fmt_float(v, size, verb, 6)
|
252
|
+
} else {
|
253
|
+
p.fmtDecimalFloat(v, size, 6)
|
254
|
+
}
|
255
|
+
default:
|
256
|
+
p.badVerb(verb)
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
260
|
+
func (p *printer) setFlags(f *number.Formatter) {
|
261
|
+
f.Flags &^= number.ElideSign
|
262
|
+
if p.fmt.plus || p.fmt.space {
|
263
|
+
f.Flags |= number.AlwaysSign
|
264
|
+
if !p.fmt.plus {
|
265
|
+
f.Flags |= number.ElideSign
|
266
|
+
}
|
267
|
+
} else {
|
268
|
+
f.Flags &^= number.AlwaysSign
|
269
|
+
}
|
270
|
+
}
|
271
|
+
|
272
|
+
func (p *printer) updatePadding(f *number.Formatter) {
|
273
|
+
f.Flags &^= number.PadMask
|
274
|
+
if p.fmt.minus {
|
275
|
+
f.Flags |= number.PadAfterSuffix
|
276
|
+
} else {
|
277
|
+
f.Flags |= number.PadBeforePrefix
|
278
|
+
}
|
279
|
+
f.PadRune = ' '
|
280
|
+
f.FormatWidth = uint16(p.fmt.wid)
|
281
|
+
}
|
282
|
+
|
283
|
+
func (p *printer) initDecimal(minFrac, maxFrac int) {
|
284
|
+
f := &p.toDecimal
|
285
|
+
f.MinIntegerDigits = 1
|
286
|
+
f.MaxIntegerDigits = 0
|
287
|
+
f.MinFractionDigits = uint8(minFrac)
|
288
|
+
f.MaxFractionDigits = int16(maxFrac)
|
289
|
+
p.setFlags(f)
|
290
|
+
f.PadRune = 0
|
291
|
+
if p.fmt.widPresent {
|
292
|
+
if p.fmt.zero {
|
293
|
+
wid := p.fmt.wid
|
294
|
+
// Use significant integers for this.
|
295
|
+
// TODO: this is not the same as width, but so be it.
|
296
|
+
if f.MinFractionDigits > 0 {
|
297
|
+
wid -= 1 + int(f.MinFractionDigits)
|
298
|
+
}
|
299
|
+
if p.fmt.plus || p.fmt.space {
|
300
|
+
wid--
|
301
|
+
}
|
302
|
+
if wid > 0 && wid > int(f.MinIntegerDigits) {
|
303
|
+
f.MinIntegerDigits = uint8(wid)
|
304
|
+
}
|
305
|
+
}
|
306
|
+
p.updatePadding(f)
|
307
|
+
}
|
308
|
+
}
|
309
|
+
|
310
|
+
func (p *printer) initScientific(minFrac, maxFrac int) {
|
311
|
+
f := &p.toScientific
|
312
|
+
if maxFrac < 0 {
|
313
|
+
f.SetPrecision(maxFrac)
|
314
|
+
} else {
|
315
|
+
f.SetPrecision(maxFrac + 1)
|
316
|
+
f.MinFractionDigits = uint8(minFrac)
|
317
|
+
f.MaxFractionDigits = int16(maxFrac)
|
318
|
+
}
|
319
|
+
f.MinExponentDigits = 2
|
320
|
+
p.setFlags(f)
|
321
|
+
f.PadRune = 0
|
322
|
+
if p.fmt.widPresent {
|
323
|
+
f.Flags &^= number.PadMask
|
324
|
+
if p.fmt.zero {
|
325
|
+
f.PadRune = f.Digit(0)
|
326
|
+
f.Flags |= number.PadAfterPrefix
|
327
|
+
} else {
|
328
|
+
f.PadRune = ' '
|
329
|
+
f.Flags |= number.PadBeforePrefix
|
330
|
+
}
|
331
|
+
p.updatePadding(f)
|
332
|
+
}
|
333
|
+
}
|
334
|
+
|
335
|
+
func (p *printer) fmtDecimalInt(v uint64, isSigned bool) {
|
336
|
+
var d number.Decimal
|
337
|
+
|
338
|
+
f := &p.toDecimal
|
339
|
+
if p.fmt.precPresent {
|
340
|
+
p.setFlags(f)
|
341
|
+
f.MinIntegerDigits = uint8(p.fmt.prec)
|
342
|
+
f.MaxIntegerDigits = 0
|
343
|
+
f.MinFractionDigits = 0
|
344
|
+
f.MaxFractionDigits = 0
|
345
|
+
if p.fmt.widPresent {
|
346
|
+
p.updatePadding(f)
|
347
|
+
}
|
348
|
+
} else {
|
349
|
+
p.initDecimal(0, 0)
|
350
|
+
}
|
351
|
+
d.ConvertInt(p.toDecimal.RoundingContext, isSigned, v)
|
352
|
+
|
353
|
+
out := p.toDecimal.Format([]byte(nil), &d)
|
354
|
+
p.Buffer.Write(out)
|
355
|
+
}
|
356
|
+
|
357
|
+
func (p *printer) fmtDecimalFloat(v float64, size, prec int) {
|
358
|
+
var d number.Decimal
|
359
|
+
if p.fmt.precPresent {
|
360
|
+
prec = p.fmt.prec
|
361
|
+
}
|
362
|
+
p.initDecimal(prec, prec)
|
363
|
+
d.ConvertFloat(p.toDecimal.RoundingContext, v, size)
|
364
|
+
|
365
|
+
out := p.toDecimal.Format([]byte(nil), &d)
|
366
|
+
p.Buffer.Write(out)
|
367
|
+
}
|
368
|
+
|
369
|
+
func (p *printer) fmtVariableFloat(v float64, size int) {
|
370
|
+
prec := -1
|
371
|
+
if p.fmt.precPresent {
|
372
|
+
prec = p.fmt.prec
|
373
|
+
}
|
374
|
+
var d number.Decimal
|
375
|
+
p.initScientific(0, prec)
|
376
|
+
d.ConvertFloat(p.toScientific.RoundingContext, v, size)
|
377
|
+
|
378
|
+
// Copy logic of 'g' formatting from strconv. It is simplified a bit as
|
379
|
+
// we don't have to mind having prec > len(d.Digits).
|
380
|
+
shortest := prec < 0
|
381
|
+
ePrec := prec
|
382
|
+
if shortest {
|
383
|
+
prec = len(d.Digits)
|
384
|
+
ePrec = 6
|
385
|
+
} else if prec == 0 {
|
386
|
+
prec = 1
|
387
|
+
ePrec = 1
|
388
|
+
}
|
389
|
+
exp := int(d.Exp) - 1
|
390
|
+
if exp < -4 || exp >= ePrec {
|
391
|
+
p.initScientific(0, prec)
|
392
|
+
|
393
|
+
out := p.toScientific.Format([]byte(nil), &d)
|
394
|
+
p.Buffer.Write(out)
|
395
|
+
} else {
|
396
|
+
if prec > int(d.Exp) {
|
397
|
+
prec = len(d.Digits)
|
398
|
+
}
|
399
|
+
if prec -= int(d.Exp); prec < 0 {
|
400
|
+
prec = 0
|
401
|
+
}
|
402
|
+
p.initDecimal(0, prec)
|
403
|
+
|
404
|
+
out := p.toDecimal.Format([]byte(nil), &d)
|
405
|
+
p.Buffer.Write(out)
|
406
|
+
}
|
407
|
+
}
|
408
|
+
|
409
|
+
func (p *printer) fmtScientific(v float64, size, prec int) {
|
410
|
+
var d number.Decimal
|
411
|
+
if p.fmt.precPresent {
|
412
|
+
prec = p.fmt.prec
|
413
|
+
}
|
414
|
+
p.initScientific(prec, prec)
|
415
|
+
rc := p.toScientific.RoundingContext
|
416
|
+
d.ConvertFloat(rc, v, size)
|
417
|
+
|
418
|
+
out := p.toScientific.Format([]byte(nil), &d)
|
419
|
+
p.Buffer.Write(out)
|
420
|
+
|
421
|
+
}
|
422
|
+
|
423
|
+
// fmtComplex formats a complex number v with
|
424
|
+
// r = real(v) and j = imag(v) as (r+ji) using
|
425
|
+
// fmtFloat for r and j formatting.
|
426
|
+
func (p *printer) fmtComplex(v complex128, size int, verb rune) {
|
427
|
+
// Make sure any unsupported verbs are found before the
|
428
|
+
// calls to fmtFloat to not generate an incorrect error string.
|
429
|
+
switch verb {
|
430
|
+
case 'v', 'b', 'g', 'G', 'f', 'F', 'e', 'E':
|
431
|
+
p.WriteByte('(')
|
432
|
+
p.fmtFloat(real(v), size/2, verb)
|
433
|
+
// Imaginary part always has a sign.
|
434
|
+
if math.IsNaN(imag(v)) {
|
435
|
+
// By CLDR's rules, NaNs do not use patterns or signs. As this code
|
436
|
+
// relies on AlwaysSign working for imaginary parts, we need to
|
437
|
+
// manually handle NaNs.
|
438
|
+
f := &p.toScientific
|
439
|
+
p.setFlags(f)
|
440
|
+
p.updatePadding(f)
|
441
|
+
p.setFlags(f)
|
442
|
+
nan := f.Symbol(number.SymNan)
|
443
|
+
extra := 0
|
444
|
+
if w, ok := p.Width(); ok {
|
445
|
+
extra = w - utf8.RuneCountInString(nan) - 1
|
446
|
+
}
|
447
|
+
if f.Flags&number.PadAfterNumber == 0 {
|
448
|
+
for ; extra > 0; extra-- {
|
449
|
+
p.WriteRune(f.PadRune)
|
450
|
+
}
|
451
|
+
}
|
452
|
+
p.WriteString(f.Symbol(number.SymPlusSign))
|
453
|
+
p.WriteString(nan)
|
454
|
+
for ; extra > 0; extra-- {
|
455
|
+
p.WriteRune(f.PadRune)
|
456
|
+
}
|
457
|
+
p.WriteString("i)")
|
458
|
+
return
|
459
|
+
}
|
460
|
+
oldPlus := p.fmt.plus
|
461
|
+
p.fmt.plus = true
|
462
|
+
p.fmtFloat(imag(v), size/2, verb)
|
463
|
+
p.WriteString("i)") // TODO: use symbol?
|
464
|
+
p.fmt.plus = oldPlus
|
465
|
+
default:
|
466
|
+
p.badVerb(verb)
|
467
|
+
}
|
468
|
+
}
|
469
|
+
|
470
|
+
func (p *printer) fmtString(v string, verb rune) {
|
471
|
+
switch verb {
|
472
|
+
case 'v':
|
473
|
+
if p.fmt.sharpV {
|
474
|
+
p.fmt.fmt_q(v)
|
475
|
+
} else {
|
476
|
+
p.fmt.fmt_s(v)
|
477
|
+
}
|
478
|
+
case 's':
|
479
|
+
p.fmt.fmt_s(v)
|
480
|
+
case 'x':
|
481
|
+
p.fmt.fmt_sx(v, ldigits)
|
482
|
+
case 'X':
|
483
|
+
p.fmt.fmt_sx(v, udigits)
|
484
|
+
case 'q':
|
485
|
+
p.fmt.fmt_q(v)
|
486
|
+
default:
|
487
|
+
p.badVerb(verb)
|
488
|
+
}
|
489
|
+
}
|
490
|
+
|
491
|
+
func (p *printer) fmtBytes(v []byte, verb rune, typeString string) {
|
492
|
+
switch verb {
|
493
|
+
case 'v', 'd':
|
494
|
+
if p.fmt.sharpV {
|
495
|
+
p.WriteString(typeString)
|
496
|
+
if v == nil {
|
497
|
+
p.WriteString(nilParenString)
|
498
|
+
return
|
499
|
+
}
|
500
|
+
p.WriteByte('{')
|
501
|
+
for i, c := range v {
|
502
|
+
if i > 0 {
|
503
|
+
p.WriteString(commaSpaceString)
|
504
|
+
}
|
505
|
+
p.fmt0x64(uint64(c), true)
|
506
|
+
}
|
507
|
+
p.WriteByte('}')
|
508
|
+
} else {
|
509
|
+
p.WriteByte('[')
|
510
|
+
for i, c := range v {
|
511
|
+
if i > 0 {
|
512
|
+
p.WriteByte(' ')
|
513
|
+
}
|
514
|
+
p.fmt.fmt_integer(uint64(c), 10, unsigned, ldigits)
|
515
|
+
}
|
516
|
+
p.WriteByte(']')
|
517
|
+
}
|
518
|
+
case 's':
|
519
|
+
p.fmt.fmt_s(string(v))
|
520
|
+
case 'x':
|
521
|
+
p.fmt.fmt_bx(v, ldigits)
|
522
|
+
case 'X':
|
523
|
+
p.fmt.fmt_bx(v, udigits)
|
524
|
+
case 'q':
|
525
|
+
p.fmt.fmt_q(string(v))
|
526
|
+
default:
|
527
|
+
p.printValue(reflect.ValueOf(v), verb, 0)
|
528
|
+
}
|
529
|
+
}
|
530
|
+
|
531
|
+
func (p *printer) fmtPointer(value reflect.Value, verb rune) {
|
532
|
+
var u uintptr
|
533
|
+
switch value.Kind() {
|
534
|
+
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:
|
535
|
+
u = value.Pointer()
|
536
|
+
default:
|
537
|
+
p.badVerb(verb)
|
538
|
+
return
|
539
|
+
}
|
540
|
+
|
541
|
+
switch verb {
|
542
|
+
case 'v':
|
543
|
+
if p.fmt.sharpV {
|
544
|
+
p.WriteByte('(')
|
545
|
+
p.WriteString(value.Type().String())
|
546
|
+
p.WriteString(")(")
|
547
|
+
if u == 0 {
|
548
|
+
p.WriteString(nilString)
|
549
|
+
} else {
|
550
|
+
p.fmt0x64(uint64(u), true)
|
551
|
+
}
|
552
|
+
p.WriteByte(')')
|
553
|
+
} else {
|
554
|
+
if u == 0 {
|
555
|
+
p.fmt.padString(nilAngleString)
|
556
|
+
} else {
|
557
|
+
p.fmt0x64(uint64(u), !p.fmt.sharp)
|
558
|
+
}
|
559
|
+
}
|
560
|
+
case 'p':
|
561
|
+
p.fmt0x64(uint64(u), !p.fmt.sharp)
|
562
|
+
case 'b', 'o', 'd', 'x', 'X':
|
563
|
+
if verb == 'd' {
|
564
|
+
p.fmt.sharp = true // Print as standard go. TODO: does this make sense?
|
565
|
+
}
|
566
|
+
p.fmtInteger(uint64(u), unsigned, verb)
|
567
|
+
default:
|
568
|
+
p.badVerb(verb)
|
569
|
+
}
|
570
|
+
}
|
571
|
+
|
572
|
+
func (p *printer) catchPanic(arg interface{}, verb rune) {
|
573
|
+
if err := recover(); err != nil {
|
574
|
+
// If it's a nil pointer, just say "<nil>". The likeliest causes are a
|
575
|
+
// Stringer that fails to guard against nil or a nil pointer for a
|
576
|
+
// value receiver, and in either case, "<nil>" is a nice result.
|
577
|
+
if v := reflect.ValueOf(arg); v.Kind() == reflect.Ptr && v.IsNil() {
|
578
|
+
p.WriteString(nilAngleString)
|
579
|
+
return
|
580
|
+
}
|
581
|
+
// Otherwise print a concise panic message. Most of the time the panic
|
582
|
+
// value will print itself nicely.
|
583
|
+
if p.panicking {
|
584
|
+
// Nested panics; the recursion in printArg cannot succeed.
|
585
|
+
panic(err)
|
586
|
+
}
|
587
|
+
|
588
|
+
oldFlags := p.fmt.fmtFlags
|
589
|
+
// For this output we want default behavior.
|
590
|
+
p.fmt.clearflags()
|
591
|
+
|
592
|
+
p.WriteString(percentBangString)
|
593
|
+
p.WriteRune(verb)
|
594
|
+
p.WriteString(panicString)
|
595
|
+
p.panicking = true
|
596
|
+
p.printArg(err, 'v')
|
597
|
+
p.panicking = false
|
598
|
+
p.WriteByte(')')
|
599
|
+
|
600
|
+
p.fmt.fmtFlags = oldFlags
|
601
|
+
}
|
602
|
+
}
|
603
|
+
|
604
|
+
func (p *printer) handleMethods(verb rune) (handled bool) {
|
605
|
+
if p.erroring {
|
606
|
+
return
|
607
|
+
}
|
608
|
+
// Is it a Formatter?
|
609
|
+
if formatter, ok := p.arg.(format.Formatter); ok {
|
610
|
+
handled = true
|
611
|
+
defer p.catchPanic(p.arg, verb)
|
612
|
+
formatter.Format(p, verb)
|
613
|
+
return
|
614
|
+
}
|
615
|
+
if formatter, ok := p.arg.(fmt.Formatter); ok {
|
616
|
+
handled = true
|
617
|
+
defer p.catchPanic(p.arg, verb)
|
618
|
+
formatter.Format(p, verb)
|
619
|
+
return
|
620
|
+
}
|
621
|
+
|
622
|
+
// If we're doing Go syntax and the argument knows how to supply it, take care of it now.
|
623
|
+
if p.fmt.sharpV {
|
624
|
+
if stringer, ok := p.arg.(fmt.GoStringer); ok {
|
625
|
+
handled = true
|
626
|
+
defer p.catchPanic(p.arg, verb)
|
627
|
+
// Print the result of GoString unadorned.
|
628
|
+
p.fmt.fmt_s(stringer.GoString())
|
629
|
+
return
|
630
|
+
}
|
631
|
+
} else {
|
632
|
+
// If a string is acceptable according to the format, see if
|
633
|
+
// the value satisfies one of the string-valued interfaces.
|
634
|
+
// Println etc. set verb to %v, which is "stringable".
|
635
|
+
switch verb {
|
636
|
+
case 'v', 's', 'x', 'X', 'q':
|
637
|
+
// Is it an error or Stringer?
|
638
|
+
// The duplication in the bodies is necessary:
|
639
|
+
// setting handled and deferring catchPanic
|
640
|
+
// must happen before calling the method.
|
641
|
+
switch v := p.arg.(type) {
|
642
|
+
case error:
|
643
|
+
handled = true
|
644
|
+
defer p.catchPanic(p.arg, verb)
|
645
|
+
p.fmtString(v.Error(), verb)
|
646
|
+
return
|
647
|
+
|
648
|
+
case fmt.Stringer:
|
649
|
+
handled = true
|
650
|
+
defer p.catchPanic(p.arg, verb)
|
651
|
+
p.fmtString(v.String(), verb)
|
652
|
+
return
|
653
|
+
}
|
654
|
+
}
|
655
|
+
}
|
656
|
+
return false
|
657
|
+
}
|
658
|
+
|
659
|
+
func (p *printer) printArg(arg interface{}, verb rune) {
|
660
|
+
p.arg = arg
|
661
|
+
p.value = reflect.Value{}
|
662
|
+
|
663
|
+
if arg == nil {
|
664
|
+
switch verb {
|
665
|
+
case 'T', 'v':
|
666
|
+
p.fmt.padString(nilAngleString)
|
667
|
+
default:
|
668
|
+
p.badVerb(verb)
|
669
|
+
}
|
670
|
+
return
|
671
|
+
}
|
672
|
+
|
673
|
+
// Special processing considerations.
|
674
|
+
// %T (the value's type) and %p (its address) are special; we always do them first.
|
675
|
+
switch verb {
|
676
|
+
case 'T':
|
677
|
+
p.fmt.fmt_s(reflect.TypeOf(arg).String())
|
678
|
+
return
|
679
|
+
case 'p':
|
680
|
+
p.fmtPointer(reflect.ValueOf(arg), 'p')
|
681
|
+
return
|
682
|
+
}
|
683
|
+
|
684
|
+
// Some types can be done without reflection.
|
685
|
+
switch f := arg.(type) {
|
686
|
+
case bool:
|
687
|
+
p.fmtBool(f, verb)
|
688
|
+
case float32:
|
689
|
+
p.fmtFloat(float64(f), 32, verb)
|
690
|
+
case float64:
|
691
|
+
p.fmtFloat(f, 64, verb)
|
692
|
+
case complex64:
|
693
|
+
p.fmtComplex(complex128(f), 64, verb)
|
694
|
+
case complex128:
|
695
|
+
p.fmtComplex(f, 128, verb)
|
696
|
+
case int:
|
697
|
+
p.fmtInteger(uint64(f), signed, verb)
|
698
|
+
case int8:
|
699
|
+
p.fmtInteger(uint64(f), signed, verb)
|
700
|
+
case int16:
|
701
|
+
p.fmtInteger(uint64(f), signed, verb)
|
702
|
+
case int32:
|
703
|
+
p.fmtInteger(uint64(f), signed, verb)
|
704
|
+
case int64:
|
705
|
+
p.fmtInteger(uint64(f), signed, verb)
|
706
|
+
case uint:
|
707
|
+
p.fmtInteger(uint64(f), unsigned, verb)
|
708
|
+
case uint8:
|
709
|
+
p.fmtInteger(uint64(f), unsigned, verb)
|
710
|
+
case uint16:
|
711
|
+
p.fmtInteger(uint64(f), unsigned, verb)
|
712
|
+
case uint32:
|
713
|
+
p.fmtInteger(uint64(f), unsigned, verb)
|
714
|
+
case uint64:
|
715
|
+
p.fmtInteger(f, unsigned, verb)
|
716
|
+
case uintptr:
|
717
|
+
p.fmtInteger(uint64(f), unsigned, verb)
|
718
|
+
case string:
|
719
|
+
p.fmtString(f, verb)
|
720
|
+
case []byte:
|
721
|
+
p.fmtBytes(f, verb, "[]byte")
|
722
|
+
case reflect.Value:
|
723
|
+
// Handle extractable values with special methods
|
724
|
+
// since printValue does not handle them at depth 0.
|
725
|
+
if f.IsValid() && f.CanInterface() {
|
726
|
+
p.arg = f.Interface()
|
727
|
+
if p.handleMethods(verb) {
|
728
|
+
return
|
729
|
+
}
|
730
|
+
}
|
731
|
+
p.printValue(f, verb, 0)
|
732
|
+
default:
|
733
|
+
// If the type is not simple, it might have methods.
|
734
|
+
if !p.handleMethods(verb) {
|
735
|
+
// Need to use reflection, since the type had no
|
736
|
+
// interface methods that could be used for formatting.
|
737
|
+
p.printValue(reflect.ValueOf(f), verb, 0)
|
738
|
+
}
|
739
|
+
}
|
740
|
+
}
|
741
|
+
|
742
|
+
// printValue is similar to printArg but starts with a reflect value, not an interface{} value.
|
743
|
+
// It does not handle 'p' and 'T' verbs because these should have been already handled by printArg.
|
744
|
+
func (p *printer) printValue(value reflect.Value, verb rune, depth int) {
|
745
|
+
// Handle values with special methods if not already handled by printArg (depth == 0).
|
746
|
+
if depth > 0 && value.IsValid() && value.CanInterface() {
|
747
|
+
p.arg = value.Interface()
|
748
|
+
if p.handleMethods(verb) {
|
749
|
+
return
|
750
|
+
}
|
751
|
+
}
|
752
|
+
p.arg = nil
|
753
|
+
p.value = value
|
754
|
+
|
755
|
+
switch f := value; value.Kind() {
|
756
|
+
case reflect.Invalid:
|
757
|
+
if depth == 0 {
|
758
|
+
p.WriteString(invReflectString)
|
759
|
+
} else {
|
760
|
+
switch verb {
|
761
|
+
case 'v':
|
762
|
+
p.WriteString(nilAngleString)
|
763
|
+
default:
|
764
|
+
p.badVerb(verb)
|
765
|
+
}
|
766
|
+
}
|
767
|
+
case reflect.Bool:
|
768
|
+
p.fmtBool(f.Bool(), verb)
|
769
|
+
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
770
|
+
p.fmtInteger(uint64(f.Int()), signed, verb)
|
771
|
+
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
772
|
+
p.fmtInteger(f.Uint(), unsigned, verb)
|
773
|
+
case reflect.Float32:
|
774
|
+
p.fmtFloat(f.Float(), 32, verb)
|
775
|
+
case reflect.Float64:
|
776
|
+
p.fmtFloat(f.Float(), 64, verb)
|
777
|
+
case reflect.Complex64:
|
778
|
+
p.fmtComplex(f.Complex(), 64, verb)
|
779
|
+
case reflect.Complex128:
|
780
|
+
p.fmtComplex(f.Complex(), 128, verb)
|
781
|
+
case reflect.String:
|
782
|
+
p.fmtString(f.String(), verb)
|
783
|
+
case reflect.Map:
|
784
|
+
if p.fmt.sharpV {
|
785
|
+
p.WriteString(f.Type().String())
|
786
|
+
if f.IsNil() {
|
787
|
+
p.WriteString(nilParenString)
|
788
|
+
return
|
789
|
+
}
|
790
|
+
p.WriteByte('{')
|
791
|
+
} else {
|
792
|
+
p.WriteString(mapString)
|
793
|
+
}
|
794
|
+
keys := f.MapKeys()
|
795
|
+
for i, key := range keys {
|
796
|
+
if i > 0 {
|
797
|
+
if p.fmt.sharpV {
|
798
|
+
p.WriteString(commaSpaceString)
|
799
|
+
} else {
|
800
|
+
p.WriteByte(' ')
|
801
|
+
}
|
802
|
+
}
|
803
|
+
p.printValue(key, verb, depth+1)
|
804
|
+
p.WriteByte(':')
|
805
|
+
p.printValue(f.MapIndex(key), verb, depth+1)
|
806
|
+
}
|
807
|
+
if p.fmt.sharpV {
|
808
|
+
p.WriteByte('}')
|
809
|
+
} else {
|
810
|
+
p.WriteByte(']')
|
811
|
+
}
|
812
|
+
case reflect.Struct:
|
813
|
+
if p.fmt.sharpV {
|
814
|
+
p.WriteString(f.Type().String())
|
815
|
+
}
|
816
|
+
p.WriteByte('{')
|
817
|
+
for i := 0; i < f.NumField(); i++ {
|
818
|
+
if i > 0 {
|
819
|
+
if p.fmt.sharpV {
|
820
|
+
p.WriteString(commaSpaceString)
|
821
|
+
} else {
|
822
|
+
p.WriteByte(' ')
|
823
|
+
}
|
824
|
+
}
|
825
|
+
if p.fmt.plusV || p.fmt.sharpV {
|
826
|
+
if name := f.Type().Field(i).Name; name != "" {
|
827
|
+
p.WriteString(name)
|
828
|
+
p.WriteByte(':')
|
829
|
+
}
|
830
|
+
}
|
831
|
+
p.printValue(getField(f, i), verb, depth+1)
|
832
|
+
}
|
833
|
+
p.WriteByte('}')
|
834
|
+
case reflect.Interface:
|
835
|
+
value := f.Elem()
|
836
|
+
if !value.IsValid() {
|
837
|
+
if p.fmt.sharpV {
|
838
|
+
p.WriteString(f.Type().String())
|
839
|
+
p.WriteString(nilParenString)
|
840
|
+
} else {
|
841
|
+
p.WriteString(nilAngleString)
|
842
|
+
}
|
843
|
+
} else {
|
844
|
+
p.printValue(value, verb, depth+1)
|
845
|
+
}
|
846
|
+
case reflect.Array, reflect.Slice:
|
847
|
+
switch verb {
|
848
|
+
case 's', 'q', 'x', 'X':
|
849
|
+
// Handle byte and uint8 slices and arrays special for the above verbs.
|
850
|
+
t := f.Type()
|
851
|
+
if t.Elem().Kind() == reflect.Uint8 {
|
852
|
+
var bytes []byte
|
853
|
+
if f.Kind() == reflect.Slice {
|
854
|
+
bytes = f.Bytes()
|
855
|
+
} else if f.CanAddr() {
|
856
|
+
bytes = f.Slice(0, f.Len()).Bytes()
|
857
|
+
} else {
|
858
|
+
// We have an array, but we cannot Slice() a non-addressable array,
|
859
|
+
// so we build a slice by hand. This is a rare case but it would be nice
|
860
|
+
// if reflection could help a little more.
|
861
|
+
bytes = make([]byte, f.Len())
|
862
|
+
for i := range bytes {
|
863
|
+
bytes[i] = byte(f.Index(i).Uint())
|
864
|
+
}
|
865
|
+
}
|
866
|
+
p.fmtBytes(bytes, verb, t.String())
|
867
|
+
return
|
868
|
+
}
|
869
|
+
}
|
870
|
+
if p.fmt.sharpV {
|
871
|
+
p.WriteString(f.Type().String())
|
872
|
+
if f.Kind() == reflect.Slice && f.IsNil() {
|
873
|
+
p.WriteString(nilParenString)
|
874
|
+
return
|
875
|
+
}
|
876
|
+
p.WriteByte('{')
|
877
|
+
for i := 0; i < f.Len(); i++ {
|
878
|
+
if i > 0 {
|
879
|
+
p.WriteString(commaSpaceString)
|
880
|
+
}
|
881
|
+
p.printValue(f.Index(i), verb, depth+1)
|
882
|
+
}
|
883
|
+
p.WriteByte('}')
|
884
|
+
} else {
|
885
|
+
p.WriteByte('[')
|
886
|
+
for i := 0; i < f.Len(); i++ {
|
887
|
+
if i > 0 {
|
888
|
+
p.WriteByte(' ')
|
889
|
+
}
|
890
|
+
p.printValue(f.Index(i), verb, depth+1)
|
891
|
+
}
|
892
|
+
p.WriteByte(']')
|
893
|
+
}
|
894
|
+
case reflect.Ptr:
|
895
|
+
// pointer to array or slice or struct? ok at top level
|
896
|
+
// but not embedded (avoid loops)
|
897
|
+
if depth == 0 && f.Pointer() != 0 {
|
898
|
+
switch a := f.Elem(); a.Kind() {
|
899
|
+
case reflect.Array, reflect.Slice, reflect.Struct, reflect.Map:
|
900
|
+
p.WriteByte('&')
|
901
|
+
p.printValue(a, verb, depth+1)
|
902
|
+
return
|
903
|
+
}
|
904
|
+
}
|
905
|
+
fallthrough
|
906
|
+
case reflect.Chan, reflect.Func, reflect.UnsafePointer:
|
907
|
+
p.fmtPointer(f, verb)
|
908
|
+
default:
|
909
|
+
p.unknownType(f)
|
910
|
+
}
|
911
|
+
}
|
912
|
+
|
913
|
+
// intFromArg gets the argNumth element of a. On return, isInt reports whether the argument has integer type.
|
914
|
+
func (p *printer) intFromArg() (num int, isInt bool) {
|
915
|
+
if p.argNum < len(p.args) {
|
916
|
+
arg := p.args[p.argNum]
|
917
|
+
num, isInt = arg.(int) // Almost always OK.
|
918
|
+
if !isInt {
|
919
|
+
// Work harder.
|
920
|
+
switch v := reflect.ValueOf(arg); v.Kind() {
|
921
|
+
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
922
|
+
n := v.Int()
|
923
|
+
if int64(int(n)) == n {
|
924
|
+
num = int(n)
|
925
|
+
isInt = true
|
926
|
+
}
|
927
|
+
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
928
|
+
n := v.Uint()
|
929
|
+
if int64(n) >= 0 && uint64(int(n)) == n {
|
930
|
+
num = int(n)
|
931
|
+
isInt = true
|
932
|
+
}
|
933
|
+
default:
|
934
|
+
// Already 0, false.
|
935
|
+
}
|
936
|
+
}
|
937
|
+
p.argNum++
|
938
|
+
if tooLarge(num) {
|
939
|
+
num = 0
|
940
|
+
isInt = false
|
941
|
+
}
|
942
|
+
}
|
943
|
+
return
|
944
|
+
}
|
945
|
+
|
946
|
+
// parseArgNumber returns the value of the bracketed number, minus 1
|
947
|
+
// (explicit argument numbers are one-indexed but we want zero-indexed).
|
948
|
+
// The opening bracket is known to be present at format[0].
|
949
|
+
// The returned values are the index, the number of bytes to consume
|
950
|
+
// up to the closing paren, if present, and whether the number parsed
|
951
|
+
// ok. The bytes to consume will be 1 if no closing paren is present.
|
952
|
+
func parseArgNumber(format string) (index int, wid int, ok bool) {
|
953
|
+
// There must be at least 3 bytes: [n].
|
954
|
+
if len(format) < 3 {
|
955
|
+
return 0, 1, false
|
956
|
+
}
|
957
|
+
|
958
|
+
// Find closing bracket.
|
959
|
+
for i := 1; i < len(format); i++ {
|
960
|
+
if format[i] == ']' {
|
961
|
+
width, ok, newi := parsenum(format, 1, i)
|
962
|
+
if !ok || newi != i {
|
963
|
+
return 0, i + 1, false
|
964
|
+
}
|
965
|
+
return width - 1, i + 1, true // arg numbers are one-indexed and skip paren.
|
966
|
+
}
|
967
|
+
}
|
968
|
+
return 0, 1, false
|
969
|
+
}
|
970
|
+
|
971
|
+
// updateArgNumber returns the next argument to evaluate, which is either the value of the passed-in
|
972
|
+
// argNum or the value of the bracketed integer that begins format[i:]. It also returns
|
973
|
+
// the new value of i, that is, the index of the next byte of the format to process.
|
974
|
+
func (p *printer) updateArgNumber(format string, i int) (newi int, found bool) {
|
975
|
+
if len(format) <= i || format[i] != '[' {
|
976
|
+
return i, false
|
977
|
+
}
|
978
|
+
p.reordered = true
|
979
|
+
index, wid, ok := parseArgNumber(format[i:])
|
980
|
+
if ok && 0 <= index && index < len(p.args) {
|
981
|
+
p.argNum = index
|
982
|
+
return i + wid, true
|
983
|
+
}
|
984
|
+
p.goodArgNum = false
|
985
|
+
return i + wid, ok
|
986
|
+
}
|
987
|
+
|
988
|
+
func (p *printer) badArgNum(verb rune) {
|
989
|
+
p.WriteString(percentBangString)
|
990
|
+
p.WriteRune(verb)
|
991
|
+
p.WriteString(badIndexString)
|
992
|
+
}
|
993
|
+
|
994
|
+
func (p *printer) missingArg(verb rune) {
|
995
|
+
p.WriteString(percentBangString)
|
996
|
+
p.WriteRune(verb)
|
997
|
+
p.WriteString(missingString)
|
998
|
+
}
|
999
|
+
|
1000
|
+
func (p *printer) doPrintf(format string) {
|
1001
|
+
end := len(format)
|
1002
|
+
afterIndex := false // previous item in format was an index like [3].
|
1003
|
+
formatLoop:
|
1004
|
+
for i := 0; i < end; {
|
1005
|
+
p.goodArgNum = true
|
1006
|
+
lasti := i
|
1007
|
+
for i < end && format[i] != '%' {
|
1008
|
+
i++
|
1009
|
+
}
|
1010
|
+
if i > lasti {
|
1011
|
+
p.WriteString(format[lasti:i])
|
1012
|
+
}
|
1013
|
+
if i >= end {
|
1014
|
+
// done processing format string
|
1015
|
+
break
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
// Process one verb
|
1019
|
+
i++
|
1020
|
+
|
1021
|
+
// Do we have flags?
|
1022
|
+
p.fmt.clearflags()
|
1023
|
+
simpleFormat:
|
1024
|
+
for ; i < end; i++ {
|
1025
|
+
c := format[i]
|
1026
|
+
switch c {
|
1027
|
+
case '#':
|
1028
|
+
p.fmt.sharp = true
|
1029
|
+
case '0':
|
1030
|
+
p.fmt.zero = !p.fmt.minus // Only allow zero padding to the left.
|
1031
|
+
case '+':
|
1032
|
+
p.fmt.plus = true
|
1033
|
+
case '-':
|
1034
|
+
p.fmt.minus = true
|
1035
|
+
p.fmt.zero = false // Do not pad with zeros to the right.
|
1036
|
+
case ' ':
|
1037
|
+
p.fmt.space = true
|
1038
|
+
default:
|
1039
|
+
// Fast path for common case of ascii lower case simple verbs
|
1040
|
+
// without precision or width or argument indices.
|
1041
|
+
if 'a' <= c && c <= 'z' && p.argNum < len(p.args) {
|
1042
|
+
if c == 'v' {
|
1043
|
+
// Go syntax
|
1044
|
+
p.fmt.sharpV = p.fmt.sharp
|
1045
|
+
p.fmt.sharp = false
|
1046
|
+
// Struct-field syntax
|
1047
|
+
p.fmt.plusV = p.fmt.plus
|
1048
|
+
p.fmt.plus = false
|
1049
|
+
}
|
1050
|
+
p.printArg(p.Arg(p.argNum+1), rune(c))
|
1051
|
+
p.argNum++
|
1052
|
+
i++
|
1053
|
+
continue formatLoop
|
1054
|
+
}
|
1055
|
+
// Format is more complex than simple flags and a verb or is malformed.
|
1056
|
+
break simpleFormat
|
1057
|
+
}
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
// Do we have an explicit argument index?
|
1061
|
+
i, afterIndex = p.updateArgNumber(format, i)
|
1062
|
+
|
1063
|
+
// Do we have width?
|
1064
|
+
if i < end && format[i] == '*' {
|
1065
|
+
i++
|
1066
|
+
p.fmt.wid, p.fmt.widPresent = p.intFromArg()
|
1067
|
+
|
1068
|
+
if !p.fmt.widPresent {
|
1069
|
+
p.WriteString(badWidthString)
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
// We have a negative width, so take its value and ensure
|
1073
|
+
// that the minus flag is set
|
1074
|
+
if p.fmt.wid < 0 {
|
1075
|
+
p.fmt.wid = -p.fmt.wid
|
1076
|
+
p.fmt.minus = true
|
1077
|
+
p.fmt.zero = false // Do not pad with zeros to the right.
|
1078
|
+
}
|
1079
|
+
afterIndex = false
|
1080
|
+
} else {
|
1081
|
+
p.fmt.wid, p.fmt.widPresent, i = parsenum(format, i, end)
|
1082
|
+
if afterIndex && p.fmt.widPresent { // "%[3]2d"
|
1083
|
+
p.goodArgNum = false
|
1084
|
+
}
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
// Do we have precision?
|
1088
|
+
if i+1 < end && format[i] == '.' {
|
1089
|
+
i++
|
1090
|
+
if afterIndex { // "%[3].2d"
|
1091
|
+
p.goodArgNum = false
|
1092
|
+
}
|
1093
|
+
i, afterIndex = p.updateArgNumber(format, i)
|
1094
|
+
if i < end && format[i] == '*' {
|
1095
|
+
i++
|
1096
|
+
p.fmt.prec, p.fmt.precPresent = p.intFromArg()
|
1097
|
+
// Negative precision arguments don't make sense
|
1098
|
+
if p.fmt.prec < 0 {
|
1099
|
+
p.fmt.prec = 0
|
1100
|
+
p.fmt.precPresent = false
|
1101
|
+
}
|
1102
|
+
if !p.fmt.precPresent {
|
1103
|
+
p.WriteString(badPrecString)
|
1104
|
+
}
|
1105
|
+
afterIndex = false
|
1106
|
+
} else {
|
1107
|
+
p.fmt.prec, p.fmt.precPresent, i = parsenum(format, i, end)
|
1108
|
+
if !p.fmt.precPresent {
|
1109
|
+
p.fmt.prec = 0
|
1110
|
+
p.fmt.precPresent = true
|
1111
|
+
}
|
1112
|
+
}
|
1113
|
+
}
|
1114
|
+
|
1115
|
+
if !afterIndex {
|
1116
|
+
i, afterIndex = p.updateArgNumber(format, i)
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
if i >= end {
|
1120
|
+
p.WriteString(noVerbString)
|
1121
|
+
break
|
1122
|
+
}
|
1123
|
+
|
1124
|
+
verb, w := utf8.DecodeRuneInString(format[i:])
|
1125
|
+
i += w
|
1126
|
+
|
1127
|
+
switch {
|
1128
|
+
case verb == '%': // Percent does not absorb operands and ignores f.wid and f.prec.
|
1129
|
+
p.WriteByte('%')
|
1130
|
+
case !p.goodArgNum:
|
1131
|
+
p.badArgNum(verb)
|
1132
|
+
case p.argNum >= len(p.args): // No argument left over to print for the current verb.
|
1133
|
+
p.missingArg(verb)
|
1134
|
+
case verb == 'v':
|
1135
|
+
// Go syntax
|
1136
|
+
p.fmt.sharpV = p.fmt.sharp
|
1137
|
+
p.fmt.sharp = false
|
1138
|
+
// Struct-field syntax
|
1139
|
+
p.fmt.plusV = p.fmt.plus
|
1140
|
+
p.fmt.plus = false
|
1141
|
+
fallthrough
|
1142
|
+
default:
|
1143
|
+
p.printArg(p.args[p.argNum], verb)
|
1144
|
+
p.argNum++
|
1145
|
+
}
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
// Check for extra arguments, but only if there was at least one ordered
|
1149
|
+
// argument. Note that this behavior is necessarily different from fmt:
|
1150
|
+
// different variants of messages may opt to drop some or all of the
|
1151
|
+
// arguments.
|
1152
|
+
if !p.reordered && p.argNum < len(p.args) && p.argNum != 0 {
|
1153
|
+
p.fmt.clearflags()
|
1154
|
+
p.WriteString(extraString)
|
1155
|
+
for i, arg := range p.args[p.argNum:] {
|
1156
|
+
if i > 0 {
|
1157
|
+
p.WriteString(commaSpaceString)
|
1158
|
+
}
|
1159
|
+
if arg == nil {
|
1160
|
+
p.WriteString(nilAngleString)
|
1161
|
+
} else {
|
1162
|
+
p.WriteString(reflect.TypeOf(arg).String())
|
1163
|
+
p.WriteByte('=')
|
1164
|
+
p.printArg(arg, 'v')
|
1165
|
+
}
|
1166
|
+
}
|
1167
|
+
p.WriteByte(')')
|
1168
|
+
}
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
func (p *printer) doPrint(a []interface{}) {
|
1172
|
+
prevString := false
|
1173
|
+
for argNum, arg := range a {
|
1174
|
+
isString := arg != nil && reflect.TypeOf(arg).Kind() == reflect.String
|
1175
|
+
// Add a space between two non-string arguments.
|
1176
|
+
if argNum > 0 && !isString && !prevString {
|
1177
|
+
p.WriteByte(' ')
|
1178
|
+
}
|
1179
|
+
p.printArg(arg, 'v')
|
1180
|
+
prevString = isString
|
1181
|
+
}
|
1182
|
+
}
|
1183
|
+
|
1184
|
+
// doPrintln is like doPrint but always adds a space between arguments
|
1185
|
+
// and a newline after the last argument.
|
1186
|
+
func (p *printer) doPrintln(a []interface{}) {
|
1187
|
+
for argNum, arg := range a {
|
1188
|
+
if argNum > 0 {
|
1189
|
+
p.WriteByte(' ')
|
1190
|
+
}
|
1191
|
+
p.printArg(arg, 'v')
|
1192
|
+
}
|
1193
|
+
p.WriteByte('\n')
|
1194
|
+
}
|