*: update dependencies (#3552)

This commit is contained in:
Derek Parker 2023-11-04 11:07:55 -05:00 committed by GitHub
parent e06a1163d0
commit 4d1c1f3a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
286 changed files with 34775 additions and 18872 deletions

36
go.mod

@ -5,32 +5,30 @@ go 1.17
require ( require (
github.com/cilium/ebpf v0.11.0 github.com/cilium/ebpf v0.11.0
github.com/cosiner/argv v0.1.0 github.com/cosiner/argv v0.1.0
github.com/creack/pty v1.1.9 github.com/creack/pty v1.1.20
github.com/derekparker/trie v0.0.0-20221213183930-4c74548207f4 github.com/derekparker/trie v0.0.0-20230829180723-39f4de51ef7d
github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d
github.com/google/go-dap v0.9.1 github.com/google/go-dap v0.11.0
github.com/hashicorp/golang-lru v0.5.4 github.com/hashicorp/golang-lru v1.0.2
github.com/mattn/go-colorable v0.0.9 github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty v0.0.3 github.com/mattn/go-isatty v0.0.20
github.com/sirupsen/logrus v1.6.0 github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.1.3 github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
go.starlark.net v0.0.0-20220816155156-cfacd8902214 go.starlark.net v0.0.0-20231101134539-556fd59b42f6
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4 golang.org/x/arch v0.5.0
golang.org/x/sys v0.12.0 golang.org/x/sys v0.13.0
golang.org/x/tools v0.13.0 golang.org/x/tools v0.14.0
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
) )
require ( require (
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/rivo/uniseg v0.2.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/stretchr/testify v1.7.0 // indirect
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect
golang.org/x/mod v0.12.0 // indirect golang.org/x/mod v0.13.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
) )

330
go.sum

@ -1,77 +1,33 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cilium/ebpf v0.11.0 h1:V8gS/bTCCjX9uUnkUFUpPsksM8n1lXBAvHcpiFk1X2Y= github.com/cilium/ebpf v0.11.0 h1:V8gS/bTCCjX9uUnkUFUpPsksM8n1lXBAvHcpiFk1X2Y=
github.com/cilium/ebpf v0.11.0/go.mod h1:WE7CZAnqOL2RouJ4f1uyNhqr2P4CCvXFIqdRDUgWsVs= github.com/cilium/ebpf v0.11.0/go.mod h1:WE7CZAnqOL2RouJ4f1uyNhqr2P4CCvXFIqdRDUgWsVs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosiner/argv v0.1.0 h1:BVDiEL32lwHukgJKP87btEPenzrrHUjajs/8yzaqcXg= github.com/cosiner/argv v0.1.0 h1:BVDiEL32lwHukgJKP87btEPenzrrHUjajs/8yzaqcXg=
github.com/cosiner/argv v0.1.0/go.mod h1:EusR6TucWKX+zFgtdUsKT2Cvg45K5rtpCcWz4hK06d8= github.com/cosiner/argv v0.1.0/go.mod h1:EusR6TucWKX+zFgtdUsKT2Cvg45K5rtpCcWz4hK06d8=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.20 h1:VIPb/a2s17qNeQgDnkfZC35RScx+blkKF8GV68n80J4=
github.com/creack/pty v1.1.20/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/derekparker/trie v0.0.0-20221213183930-4c74548207f4 h1:atN94qKNhLpy+9BwbE5nxvFj4rScJi6W3x/NfFmMDg4= github.com/derekparker/trie v0.0.0-20230829180723-39f4de51ef7d h1:hUWoLdw5kvo2xCsqlsIBMvWUc1QCSsCYD2J2+Fg6YoU=
github.com/derekparker/trie v0.0.0-20221213183930-4c74548207f4/go.mod h1:C7Es+DLenIpPc9J6IYw4jrK0h7S9bKj4DNl8+KxGEXU= github.com/derekparker/trie v0.0.0-20230829180723-39f4de51ef7d/go.mod h1:C7Es+DLenIpPc9J6IYw4jrK0h7S9bKj4DNl8+KxGEXU=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA= github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=
github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d h1:pxjSLshkZJGLVm0wv20f/H0oTWiq/egkoJQ2ja6LEvo= github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d h1:pxjSLshkZJGLVm0wv20f/H0oTWiq/egkoJQ2ja6LEvo=
github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d/go.mod h1:biJCRbqp51wS+I92HMqn5H8/A0PAhxn2vyOT+JqhiGI= github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d/go.mod h1:biJCRbqp51wS+I92HMqn5H8/A0PAhxn2vyOT+JqhiGI=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
@ -79,8 +35,6 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@ -90,292 +44,138 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-dap v0.9.1 h1:d8dETjgHMR9/xs+Xza+NrZmB7jxIS5OtM2uRsyJVA/c= github.com/google/go-dap v0.11.0 h1:SpAZJL41rOOvd85PuLCCLE1dteTQOyKNnn0H3DBHywo=
github.com/google/go-dap v0.9.1/go.mod h1:HAeyoSd2WIfTfg+0GRXcFrb+RnojAtGNh+k+XTIxJDE= github.com/google/go-dap v0.11.0/go.mod h1:HAeyoSd2WIfTfg+0GRXcFrb+RnojAtGNh+k+XTIxJDE=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.starlark.net v0.0.0-20231101134539-556fd59b42f6 h1:+eC0F/k4aBLC4szgOcjd7bDTEnpxADJyWJE0yowgM3E=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.starlark.net v0.0.0-20231101134539-556fd59b42f6/go.mod h1:LcLNIzVOMp4oV+uusnpk+VU+SzXaJakUuBjoCSWH5dM=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y=
go.starlark.net v0.0.0-20220816155156-cfacd8902214 h1:MqijAN3S61c7KWasOk+zIqIjHQPN6WUra/X3+YAkQxQ= golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
go.starlark.net v0.0.0-20220816155156-cfacd8902214/go.mod h1:VZcBMdr3cT3PnBoWunTabuSEXwVAH+ZJ5zxfs3AdASk=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4 h1:QlVATYS7JBoZMVaf+cNjb90WD/beKVHnIxFKT4QaHVI=
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI=
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
@ -385,25 +185,15 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

@ -54,7 +54,7 @@ func ppc64leAsmDecode(asmInst *AsmInstruction, mem []byte, regs *op.DwarfRegiste
case ppc64asm.BL, ppc64asm.BLA, ppc64asm.BCL, ppc64asm.BCLA, ppc64asm.BCLRL, ppc64asm.BCCTRL, ppc64asm.BCTARL: case ppc64asm.BL, ppc64asm.BLA, ppc64asm.BCL, ppc64asm.BCLA, ppc64asm.BCLRL, ppc64asm.BCCTRL, ppc64asm.BCTARL:
// Pages 38-40 Book I v3.0 // Pages 38-40 Book I v3.0
asmInst.Kind = CallInstruction asmInst.Kind = CallInstruction
case ppc64asm.RFEBB, ppc64asm.RFID, ppc64asm.HRFID, ppc64asm.RFI, ppc64asm.RFCI, ppc64asm.RFDI, ppc64asm.RFMCI, ppc64asm.RFGI, ppc64asm.BCLR: case ppc64asm.RFEBB, ppc64asm.RFID, ppc64asm.HRFID, ppc64asm.BCLR:
asmInst.Kind = RetInstruction asmInst.Kind = RetInstruction
case ppc64asm.B, ppc64asm.BA, ppc64asm.BC, ppc64asm.BCA, ppc64asm.BCCTR, ppc64asm.BCTAR: case ppc64asm.B, ppc64asm.BA, ppc64asm.BC, ppc64asm.BCA, ppc64asm.BCCTR, ppc64asm.BCTAR:
// Pages 38-40 Book I v3.0 // Pages 38-40 Book I v3.0

@ -15,7 +15,7 @@ type roffRenderer struct {
extensions blackfriday.Extensions extensions blackfriday.Extensions
listCounters []int listCounters []int
firstHeader bool firstHeader bool
defineTerm bool firstDD bool
listDepth int listDepth int
} }
@ -42,7 +42,8 @@ const (
quoteCloseTag = "\n.RE\n" quoteCloseTag = "\n.RE\n"
listTag = "\n.RS\n" listTag = "\n.RS\n"
listCloseTag = "\n.RE\n" listCloseTag = "\n.RE\n"
arglistTag = "\n.TP\n" dtTag = "\n.TP\n"
dd2Tag = "\n"
tableStart = "\n.TS\nallbox;\n" tableStart = "\n.TS\nallbox;\n"
tableEnd = ".TE\n" tableEnd = ".TE\n"
tableCellStart = "T{\n" tableCellStart = "T{\n"
@ -90,7 +91,7 @@ func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering
switch node.Type { switch node.Type {
case blackfriday.Text: case blackfriday.Text:
r.handleText(w, node, entering) escapeSpecialChars(w, node.Literal)
case blackfriday.Softbreak: case blackfriday.Softbreak:
out(w, crTag) out(w, crTag)
case blackfriday.Hardbreak: case blackfriday.Hardbreak:
@ -150,40 +151,21 @@ func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering
out(w, codeCloseTag) out(w, codeCloseTag)
case blackfriday.Table: case blackfriday.Table:
r.handleTable(w, node, entering) r.handleTable(w, node, entering)
case blackfriday.TableCell:
r.handleTableCell(w, node, entering)
case blackfriday.TableHead: case blackfriday.TableHead:
case blackfriday.TableBody: case blackfriday.TableBody:
case blackfriday.TableRow: case blackfriday.TableRow:
// no action as cell entries do all the nroff formatting // no action as cell entries do all the nroff formatting
return blackfriday.GoToNext return blackfriday.GoToNext
case blackfriday.TableCell:
r.handleTableCell(w, node, entering)
case blackfriday.HTMLSpan:
// ignore other HTML tags
default: default:
fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String()) fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String())
} }
return walkAction return walkAction
} }
func (r *roffRenderer) handleText(w io.Writer, node *blackfriday.Node, entering bool) {
var (
start, end string
)
// handle special roff table cell text encapsulation
if node.Parent.Type == blackfriday.TableCell {
if len(node.Literal) > 30 {
start = tableCellStart
end = tableCellEnd
} else {
// end rows that aren't terminated by "tableCellEnd" with a cr if end of row
if node.Parent.Next == nil && !node.Parent.IsHeader {
end = crTag
}
}
}
out(w, start)
escapeSpecialChars(w, node.Literal)
out(w, end)
}
func (r *roffRenderer) handleHeading(w io.Writer, node *blackfriday.Node, entering bool) { func (r *roffRenderer) handleHeading(w io.Writer, node *blackfriday.Node, entering bool) {
if entering { if entering {
switch node.Level { switch node.Level {
@ -230,15 +212,20 @@ func (r *roffRenderer) handleItem(w io.Writer, node *blackfriday.Node, entering
if node.ListFlags&blackfriday.ListTypeOrdered != 0 { if node.ListFlags&blackfriday.ListTypeOrdered != 0 {
out(w, fmt.Sprintf(".IP \"%3d.\" 5\n", r.listCounters[len(r.listCounters)-1])) out(w, fmt.Sprintf(".IP \"%3d.\" 5\n", r.listCounters[len(r.listCounters)-1]))
r.listCounters[len(r.listCounters)-1]++ r.listCounters[len(r.listCounters)-1]++
} else if node.ListFlags&blackfriday.ListTypeTerm != 0 {
// DT (definition term): line just before DD (see below).
out(w, dtTag)
r.firstDD = true
} else if node.ListFlags&blackfriday.ListTypeDefinition != 0 { } else if node.ListFlags&blackfriday.ListTypeDefinition != 0 {
// state machine for handling terms and following definitions // DD (definition description): line that starts with ": ".
// since blackfriday does not distinguish them properly, nor //
// does it seperate them into separate lists as it should // We have to distinguish between the first DD and the
if !r.defineTerm { // subsequent ones, as there should be no vertical
out(w, arglistTag) // whitespace between the DT and the first DD.
r.defineTerm = true if r.firstDD {
r.firstDD = false
} else { } else {
r.defineTerm = false out(w, dd2Tag)
} }
} else { } else {
out(w, ".IP \\(bu 2\n") out(w, ".IP \\(bu 2\n")
@ -251,7 +238,7 @@ func (r *roffRenderer) handleItem(w io.Writer, node *blackfriday.Node, entering
func (r *roffRenderer) handleTable(w io.Writer, node *blackfriday.Node, entering bool) { func (r *roffRenderer) handleTable(w io.Writer, node *blackfriday.Node, entering bool) {
if entering { if entering {
out(w, tableStart) out(w, tableStart)
//call walker to count cells (and rows?) so format section can be produced // call walker to count cells (and rows?) so format section can be produced
columns := countColumns(node) columns := countColumns(node)
out(w, strings.Repeat("l ", columns)+"\n") out(w, strings.Repeat("l ", columns)+"\n")
out(w, strings.Repeat("l ", columns)+".\n") out(w, strings.Repeat("l ", columns)+".\n")
@ -261,28 +248,41 @@ func (r *roffRenderer) handleTable(w io.Writer, node *blackfriday.Node, entering
} }
func (r *roffRenderer) handleTableCell(w io.Writer, node *blackfriday.Node, entering bool) { func (r *roffRenderer) handleTableCell(w io.Writer, node *blackfriday.Node, entering bool) {
var (
start, end string
)
if node.IsHeader {
start = codespanTag
end = codespanCloseTag
}
if entering { if entering {
var start string
if node.Prev != nil && node.Prev.Type == blackfriday.TableCell { if node.Prev != nil && node.Prev.Type == blackfriday.TableCell {
out(w, "\t"+start) start = "\t"
} else {
out(w, start)
} }
if node.IsHeader {
start += codespanTag
} else if nodeLiteralSize(node) > 30 {
start += tableCellStart
}
out(w, start)
} else { } else {
// need to carriage return if we are at the end of the header row var end string
if node.IsHeader && node.Next == nil { if node.IsHeader {
end = end + crTag end = codespanCloseTag
} else if nodeLiteralSize(node) > 30 {
end = tableCellEnd
}
if node.Next == nil && end != tableCellEnd {
// Last cell: need to carriage return if we are at the end of the
// header row and content isn't wrapped in a "tablecell"
end += crTag
} }
out(w, end) out(w, end)
} }
} }
func nodeLiteralSize(node *blackfriday.Node) int {
total := 0
for n := node.FirstChild; n != nil; n = n.FirstChild {
total += len(n.Literal)
}
return total
}
// because roff format requires knowing the column count before outputting any table // because roff format requires knowing the column count before outputting any table
// data we need to walk a table tree and count the columns // data we need to walk a table tree and count the columns
func countColumns(node *blackfriday.Node) int { func countColumns(node *blackfriday.Node) int {
@ -309,15 +309,6 @@ func out(w io.Writer, output string) {
io.WriteString(w, output) // nolint: errcheck io.WriteString(w, output) // nolint: errcheck
} }
func needsBackslash(c byte) bool {
for _, r := range []byte("-_&\\~") {
if c == r {
return true
}
}
return false
}
func escapeSpecialChars(w io.Writer, text []byte) { func escapeSpecialChars(w io.Writer, text []byte) {
for i := 0; i < len(text); i++ { for i := 0; i < len(text); i++ {
// escape initial apostrophe or period // escape initial apostrophe or period
@ -328,7 +319,7 @@ func escapeSpecialChars(w io.Writer, text []byte) {
// directly copy normal characters // directly copy normal characters
org := i org := i
for i < len(text) && !needsBackslash(text[i]) { for i < len(text) && text[i] != '\\' {
i++ i++
} }
if i > org { if i > org {

17
vendor/github.com/creack/pty/Dockerfile.golang generated vendored Normal file

@ -0,0 +1,17 @@
ARG GOVERSION=1.14
FROM golang:${GOVERSION}
# Set base env.
ARG GOOS=linux
ARG GOARCH=amd64
ENV GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=0 GOFLAGS='-v -ldflags=-s -ldflags=-w'
# Pre compile the stdlib for 386/arm (32bits).
RUN go build -a std
# Add the code to the image.
WORKDIR pty
ADD . .
# Build the lib.
RUN go build

@ -1,3 +1,4 @@
# NOTE: Using 1.13 as a base to build the RISCV compiler, the resulting version is based on go1.6.
FROM golang:1.13 FROM golang:1.13
# Clone and complie a riscv compatible version of the go compiler. # Clone and complie a riscv compatible version of the go compiler.
@ -8,7 +9,15 @@ ENV PATH=/riscv-go/misc/riscv:/riscv-go/bin:$PATH
RUN cd /riscv-go/src && GOROOT_BOOTSTRAP=$(go env GOROOT) ./make.bash RUN cd /riscv-go/src && GOROOT_BOOTSTRAP=$(go env GOROOT) ./make.bash
ENV GOROOT=/riscv-go ENV GOROOT=/riscv-go
# Make sure we compile. # Set the base env.
ENV GOOS=linux GOARCH=riscv CGO_ENABLED=0 GOFLAGS='-v -ldflags=-s -ldflags=-w'
# Pre compile the stdlib.
RUN go build -a std
# Add the code to the image.
WORKDIR pty WORKDIR pty
ADD . . ADD . .
RUN GOOS=linux GOARCH=riscv go build
# Build the lib.
RUN go build

@ -4,9 +4,13 @@ Pty is a Go package for using unix pseudo-terminals.
## Install ## Install
go get github.com/creack/pty ```sh
go get github.com/creack/pty
```
## Example ## Examples
Note that those examples are for demonstration purpose only, to showcase how to use the library. They are not meant to be used in any kind of production environment.
### Command ### Command
@ -14,10 +18,11 @@ Pty is a Go package for using unix pseudo-terminals.
package main package main
import ( import (
"github.com/creack/pty"
"io" "io"
"os" "os"
"os/exec" "os/exec"
"github.com/creack/pty"
) )
func main() { func main() {
@ -51,7 +56,7 @@ import (
"syscall" "syscall"
"github.com/creack/pty" "github.com/creack/pty"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/term"
) )
func test() error { func test() error {
@ -77,15 +82,17 @@ func test() error {
} }
}() }()
ch <- syscall.SIGWINCH // Initial resize. ch <- syscall.SIGWINCH // Initial resize.
defer func() { signal.Stop(ch); close(ch) }() // Cleanup signals when done.
// Set stdin in raw mode. // Set stdin in raw mode.
oldState, err := terminal.MakeRaw(int(os.Stdin.Fd())) oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
if err != nil { if err != nil {
panic(err) panic(err)
} }
defer func() { _ = terminal.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort. defer func() { _ = term.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort.
// Copy stdin to the pty and the pty to stdout. // Copy stdin to the pty and the pty to stdout.
// NOTE: The goroutine will keep reading until the next keystroke before returning.
go func() { _, _ = io.Copy(ptmx, os.Stdin) }() go func() { _, _ = io.Copy(ptmx, os.Stdin) }()
_, _ = io.Copy(os.Stdout, ptmx) _, _ = io.Copy(os.Stdout, ptmx)

18
vendor/github.com/creack/pty/asm_solaris_amd64.s generated vendored Normal file

@ -0,0 +1,18 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build gc
//+build gc
#include "textflag.h"
//
// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
//
TEXT ·sysvicall6(SB),NOSPLIT,$0-88
JMP syscall·sysvicall6(SB)
TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
JMP syscall·rawSysvicall6(SB)

@ -10,7 +10,7 @@ import (
// available on the current platform. // available on the current platform.
var ErrUnsupported = errors.New("unsupported") var ErrUnsupported = errors.New("unsupported")
// Opens a pty and its corresponding tty. // Open a pty and its corresponding tty.
func Open() (pty, tty *os.File, err error) { func Open() (pty, tty *os.File, err error) {
return open() return open()
} }

@ -1,13 +1,23 @@
// +build !windows,!solaris //go:build !windows && go1.12
// +build !windows,go1.12
package pty package pty
import "syscall" import "os"
func ioctl(fd, cmd, ptr uintptr) error { func ioctl(f *os.File, cmd, ptr uintptr) error {
_, _, e := syscall.Syscall(syscall.SYS_IOCTL, fd, cmd, ptr) sc, e := f.SyscallConn()
if e != 0 { if e != nil {
return ioctl_inner(f.Fd(), cmd, ptr) // fall back to blocking io (old behavior)
}
ch := make(chan error, 1)
defer close(ch)
e = sc.Control(func(fd uintptr) { ch <- ioctl_inner(fd, cmd, ptr) })
if e != nil {
return e return e
} }
return nil e = <-ch
return e
} }

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd // +build darwin dragonfly freebsd netbsd openbsd
package pty package pty

19
vendor/github.com/creack/pty/ioctl_inner.go generated vendored Normal file

@ -0,0 +1,19 @@
//go:build !windows && !solaris && !aix
// +build !windows,!solaris,!aix
package pty
import "syscall"
const (
TIOCGWINSZ = syscall.TIOCGWINSZ
TIOCSWINSZ = syscall.TIOCSWINSZ
)
func ioctl_inner(fd, cmd, ptr uintptr) error {
_, _, e := syscall.Syscall(syscall.SYS_IOCTL, fd, cmd, ptr)
if e != 0 {
return e
}
return nil
}

10
vendor/github.com/creack/pty/ioctl_legacy.go generated vendored Normal file

@ -0,0 +1,10 @@
//go:build !windows && !go1.12
// +build !windows,!go1.12
package pty
import "os"
func ioctl(f *os.File, cmd, ptr uintptr) error {
return ioctl_inner(f.Fd(), cmd, ptr) // fall back to blocking io (old behavior)
}

@ -1,30 +1,48 @@
//go:build solaris
// +build solaris
package pty package pty
import ( import (
"golang.org/x/sys/unix" "syscall"
"unsafe" "unsafe"
) )
//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
//go:linkname procioctl libc_ioctl
var procioctl uintptr
const ( const (
// see /usr/include/sys/stropts.h // see /usr/include/sys/stropts.h
I_PUSH = uintptr((int32('S')<<8 | 002)) I_PUSH = uintptr((int32('S')<<8 | 002))
I_STR = uintptr((int32('S')<<8 | 010)) I_STR = uintptr((int32('S')<<8 | 010))
I_FIND = uintptr((int32('S')<<8 | 013)) I_FIND = uintptr((int32('S')<<8 | 013))
// see /usr/include/sys/ptms.h // see /usr/include/sys/ptms.h
ISPTM = (int32('P') << 8) | 1 ISPTM = (int32('P') << 8) | 1
UNLKPT = (int32('P') << 8) | 2 UNLKPT = (int32('P') << 8) | 2
PTSSTTY = (int32('P') << 8) | 3 PTSSTTY = (int32('P') << 8) | 3
ZONEPT = (int32('P') << 8) | 4 ZONEPT = (int32('P') << 8) | 4
OWNERPT = (int32('P') << 8) | 5 OWNERPT = (int32('P') << 8) | 5
// see /usr/include/sys/termios.h
TIOCSWINSZ = (uint32('T') << 8) | 103
TIOCGWINSZ = (uint32('T') << 8) | 104
) )
type strioctl struct { type strioctl struct {
ic_cmd int32 icCmd int32
ic_timout int32 icTimeout int32
ic_len int32 icLen int32
ic_dp unsafe.Pointer icDP unsafe.Pointer
} }
func ioctl(fd, cmd, ptr uintptr) error { // Defined in asm_solaris_amd64.s.
return unix.IoctlSetInt(int(fd), uint(cmd), int(ptr)) func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
func ioctl_inner(fd, cmd, ptr uintptr) error {
if _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, fd, cmd, ptr, 0, 0, 0); errno != 0 {
return errno
}
return nil
} }

13
vendor/github.com/creack/pty/ioctl_unsupported.go generated vendored Normal file

@ -0,0 +1,13 @@
//go:build aix
// +build aix
package pty
const (
TIOCGWINSZ = 0
TIOCSWINSZ = 0
)
func ioctl_inner(fd, cmd, ptr uintptr) error {
return ErrUnsupported
}

@ -13,7 +13,7 @@ GODEFS="go tool cgo -godefs"
$GODEFS types.go |gofmt > ztypes_$GOARCH.go $GODEFS types.go |gofmt > ztypes_$GOARCH.go
case $GOOS in case $GOOS in
freebsd|dragonfly|openbsd) freebsd|dragonfly|netbsd|openbsd)
$GODEFS types_$GOOS.go |gofmt > ztypes_$GOOSARCH.go $GODEFS types_$GOOS.go |gofmt > ztypes_$GOOSARCH.go
;; ;;
esac esac

@ -1,3 +1,6 @@
//go:build darwin
// +build darwin
package pty package pty
import ( import (
@ -33,7 +36,7 @@ func open() (pty, tty *os.File, err error) {
return nil, nil, err return nil, nil, err
} }
t, err := os.OpenFile(sname, os.O_RDWR, 0) t, err := os.OpenFile(sname, os.O_RDWR|syscall.O_NOCTTY, 0)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
@ -43,7 +46,7 @@ func open() (pty, tty *os.File, err error) {
func ptsname(f *os.File) (string, error) { func ptsname(f *os.File) (string, error) {
n := make([]byte, _IOC_PARM_LEN(syscall.TIOCPTYGNAME)) n := make([]byte, _IOC_PARM_LEN(syscall.TIOCPTYGNAME))
err := ioctl(f.Fd(), syscall.TIOCPTYGNAME, uintptr(unsafe.Pointer(&n[0]))) err := ioctl(f, syscall.TIOCPTYGNAME, uintptr(unsafe.Pointer(&n[0])))
if err != nil { if err != nil {
return "", err return "", err
} }
@ -57,9 +60,9 @@ func ptsname(f *os.File) (string, error) {
} }
func grantpt(f *os.File) error { func grantpt(f *os.File) error {
return ioctl(f.Fd(), syscall.TIOCPTYGRANT, 0) return ioctl(f, syscall.TIOCPTYGRANT, 0)
} }
func unlockpt(f *os.File) error { func unlockpt(f *os.File) error {
return ioctl(f.Fd(), syscall.TIOCPTYUNLK, 0) return ioctl(f, syscall.TIOCPTYUNLK, 0)
} }

@ -1,3 +1,6 @@
//go:build dragonfly
// +build dragonfly
package pty package pty
import ( import (
@ -42,17 +45,17 @@ func open() (pty, tty *os.File, err error) {
} }
func grantpt(f *os.File) error { func grantpt(f *os.File) error {
_, err := isptmaster(f.Fd()) _, err := isptmaster(f)
return err return err
} }
func unlockpt(f *os.File) error { func unlockpt(f *os.File) error {
_, err := isptmaster(f.Fd()) _, err := isptmaster(f)
return err return err
} }
func isptmaster(fd uintptr) (bool, error) { func isptmaster(f *os.File) (bool, error) {
err := ioctl(fd, syscall.TIOCISPTMASTER, 0) err := ioctl(f, syscall.TIOCISPTMASTER, 0)
return err == nil, err return err == nil, err
} }
@ -65,7 +68,7 @@ func ptsname(f *os.File) (string, error) {
name := make([]byte, _C_SPECNAMELEN) name := make([]byte, _C_SPECNAMELEN)
fa := fiodgnameArg{Name: (*byte)(unsafe.Pointer(&name[0])), Len: _C_SPECNAMELEN, Pad_cgo_0: [4]byte{0, 0, 0, 0}} fa := fiodgnameArg{Name: (*byte)(unsafe.Pointer(&name[0])), Len: _C_SPECNAMELEN, Pad_cgo_0: [4]byte{0, 0, 0, 0}}
err := ioctl(f.Fd(), ioctl_FIODNAME, uintptr(unsafe.Pointer(&fa))) err := ioctl(f, ioctl_FIODNAME, uintptr(unsafe.Pointer(&fa)))
if err != nil { if err != nil {
return "", err return "", err
} }

@ -1,3 +1,6 @@
//go:build freebsd
// +build freebsd
package pty package pty
import ( import (
@ -41,8 +44,8 @@ func open() (pty, tty *os.File, err error) {
return p, t, nil return p, t, nil
} }
func isptmaster(fd uintptr) (bool, error) { func isptmaster(f *os.File) (bool, error) {
err := ioctl(fd, syscall.TIOCPTMASTER, 0) err := ioctl(f, syscall.TIOCPTMASTER, 0)
return err == nil, err return err == nil, err
} }
@ -52,7 +55,7 @@ var (
) )
func ptsname(f *os.File) (string, error) { func ptsname(f *os.File) (string, error) {
master, err := isptmaster(f.Fd()) master, err := isptmaster(f)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -65,7 +68,7 @@ func ptsname(f *os.File) (string, error) {
buf = make([]byte, n) buf = make([]byte, n)
arg = fiodgnameArg{Len: n, Buf: (*byte)(unsafe.Pointer(&buf[0]))} arg = fiodgnameArg{Len: n, Buf: (*byte)(unsafe.Pointer(&buf[0]))}
) )
if err := ioctl(f.Fd(), ioctlFIODGNAME, uintptr(unsafe.Pointer(&arg))); err != nil { if err := ioctl(f, ioctlFIODGNAME, uintptr(unsafe.Pointer(&arg))); err != nil {
return "", err return "", err
} }

@ -1,3 +1,6 @@
//go:build linux
// +build linux
package pty package pty
import ( import (
@ -28,7 +31,7 @@ func open() (pty, tty *os.File, err error) {
return nil, nil, err return nil, nil, err
} }
t, err := os.OpenFile(sname, os.O_RDWR|syscall.O_NOCTTY, 0) t, err := os.OpenFile(sname, os.O_RDWR|syscall.O_NOCTTY, 0) //nolint:gosec // Expected Open from a variable.
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
@ -37,7 +40,7 @@ func open() (pty, tty *os.File, err error) {
func ptsname(f *os.File) (string, error) { func ptsname(f *os.File) (string, error) {
var n _C_uint var n _C_uint
err := ioctl(f.Fd(), syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n))) err := ioctl(f, syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n))) //nolint:gosec // Expected unsafe pointer for Syscall call.
if err != nil { if err != nil {
return "", err return "", err
} }
@ -47,5 +50,5 @@ func ptsname(f *os.File) (string, error) {
func unlockpt(f *os.File) error { func unlockpt(f *os.File) error {
var u _C_int var u _C_int
// use TIOCSPTLCK with a pointer to zero to clear the lock // use TIOCSPTLCK with a pointer to zero to clear the lock
return ioctl(f.Fd(), syscall.TIOCSPTLCK, uintptr(unsafe.Pointer(&u))) return ioctl(f, syscall.TIOCSPTLCK, uintptr(unsafe.Pointer(&u))) //nolint:gosec // Expected unsafe pointer for Syscall call.
} }

69
vendor/github.com/creack/pty/pty_netbsd.go generated vendored Normal file

@ -0,0 +1,69 @@
//go:build netbsd
// +build netbsd
package pty
import (
"errors"
"os"
"syscall"
"unsafe"
)
func open() (pty, tty *os.File, err error) {
p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
if err != nil {
return nil, nil, err
}
// In case of error after this point, make sure we close the ptmx fd.
defer func() {
if err != nil {
_ = p.Close() // Best effort.
}
}()
sname, err := ptsname(p)
if err != nil {
return nil, nil, err
}
if err := grantpt(p); err != nil {
return nil, nil, err
}
// In NetBSD unlockpt() does nothing, so it isn't called here.
t, err := os.OpenFile(sname, os.O_RDWR|syscall.O_NOCTTY, 0)
if err != nil {
return nil, nil, err
}
return p, t, nil
}
func ptsname(f *os.File) (string, error) {
/*
* from ptsname(3): The ptsname() function is equivalent to:
* struct ptmget pm;
* ioctl(fd, TIOCPTSNAME, &pm) == -1 ? NULL : pm.sn;
*/
var ptm ptmget
if err := ioctl(f, uintptr(ioctl_TIOCPTSNAME), uintptr(unsafe.Pointer(&ptm))); err != nil {
return "", err
}
name := make([]byte, len(ptm.Sn))
for i, c := range ptm.Sn {
name[i] = byte(c)
if c == 0 {
return string(name[:i]), nil
}
}
return "", errors.New("TIOCPTSNAME string not NUL-terminated")
}
func grantpt(f *os.File) error {
/*
* from grantpt(3): Calling grantpt() is equivalent to:
* ioctl(fd, TIOCGRANTPT, 0);
*/
return ioctl(f, uintptr(ioctl_TIOCGRANTPT), 0)
}

@ -1,3 +1,6 @@
//go:build openbsd
// +build openbsd
package pty package pty
import ( import (
@ -6,6 +9,17 @@ import (
"unsafe" "unsafe"
) )
func cInt8ToString(in []int8) string {
var s []byte
for _, v := range in {
if v == 0 {
break
}
s = append(s, byte(v))
}
return string(s)
}
func open() (pty, tty *os.File, err error) { func open() (pty, tty *os.File, err error) {
/* /*
* from ptm(4): * from ptm(4):
@ -22,12 +36,12 @@ func open() (pty, tty *os.File, err error) {
defer p.Close() defer p.Close()
var ptm ptmget var ptm ptmget
if err := ioctl(p.Fd(), uintptr(ioctl_PTMGET), uintptr(unsafe.Pointer(&ptm))); err != nil { if err := ioctl(p, uintptr(ioctl_PTMGET), uintptr(unsafe.Pointer(&ptm))); err != nil {
return nil, nil, err return nil, nil, err
} }
pty = os.NewFile(uintptr(ptm.Cfd), "/dev/ptm") pty = os.NewFile(uintptr(ptm.Cfd), cInt8ToString(ptm.Cn[:]))
tty = os.NewFile(uintptr(ptm.Sfd), "/dev/ptm") tty = os.NewFile(uintptr(ptm.Sfd), cInt8ToString(ptm.Sn[:]))
return pty, tty, nil return pty, tty, nil
} }

@ -1,3 +1,6 @@
//go:build solaris
// +build solaris
package pty package pty
/* based on: /* based on:
@ -6,122 +9,153 @@ http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/pt.c
import ( import (
"errors" "errors"
"golang.org/x/sys/unix"
"os" "os"
"strconv" "strconv"
"syscall" "syscall"
"unsafe" "unsafe"
) )
const NODEV = ^uint64(0)
func open() (pty, tty *os.File, err error) { func open() (pty, tty *os.File, err error) {
masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|unix.O_NOCTTY, 0) ptmxfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_NOCTTY, 0)
//masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC|unix.O_NOCTTY, 0)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
p := os.NewFile(uintptr(masterfd), "/dev/ptmx") p := os.NewFile(uintptr(ptmxfd), "/dev/ptmx")
// In case of error after this point, make sure we close the ptmx fd.
defer func() {
if err != nil {
_ = p.Close() // Best effort.
}
}()
sname, err := ptsname(p) sname, err := ptsname(p)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
err = grantpt(p) if err := grantpt(p); err != nil {
if err != nil {
return nil, nil, err return nil, nil, err
} }
err = unlockpt(p) if err := unlockpt(p); err != nil {
if err != nil {
return nil, nil, err return nil, nil, err
} }
slavefd, err := syscall.Open(sname, os.O_RDWR|unix.O_NOCTTY, 0) ptsfd, err := syscall.Open(sname, os.O_RDWR|syscall.O_NOCTTY, 0)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
t := os.NewFile(uintptr(slavefd), sname) t := os.NewFile(uintptr(ptsfd), sname)
// In case of error after this point, make sure we close the pts fd.
defer func() {
if err != nil {
_ = t.Close() // Best effort.
}
}()
// pushing terminal driver STREAMS modules as per pts(7) // pushing terminal driver STREAMS modules as per pts(7)
for _, mod := range([]string{"ptem", "ldterm", "ttcompat"}) { for _, mod := range []string{"ptem", "ldterm", "ttcompat"} {
err = streams_push(t, mod) if err := streamsPush(t, mod); err != nil {
if err != nil {
return nil, nil, err return nil, nil, err
} }
} }
return p, t, nil return p, t, nil
} }
func minor(x uint64) uint64 {
return x & 0377
}
func ptsdev(fd uintptr) uint64 {
istr := strioctl{ISPTM, 0, 0, nil}
err := ioctl(fd, I_STR, uintptr(unsafe.Pointer(&istr)))
if err != nil {
return NODEV
}
var status unix.Stat_t
err = unix.Fstat(int(fd), &status)
if err != nil {
return NODEV
}
return uint64(minor(status.Rdev))
}
func ptsname(f *os.File) (string, error) { func ptsname(f *os.File) (string, error) {
dev := ptsdev(f.Fd()) dev, err := ptsdev(f)
if dev == NODEV { if err != nil {
return "", errors.New("not a master pty") return "", err
} }
fn := "/dev/pts/" + strconv.FormatInt(int64(dev), 10) fn := "/dev/pts/" + strconv.FormatInt(int64(dev), 10)
// access(2) creates the slave device (if the pty exists)
// F_OK == 0 (unistd.h) if err := syscall.Access(fn, 0); err != nil {
err := unix.Access(fn, 0)
if err != nil {
return "", err return "", err
} }
return fn, nil return fn, nil
} }
type pt_own struct { func unlockpt(f *os.File) error {
pto_ruid int32 istr := strioctl{
pto_rgid int32 icCmd: UNLKPT,
icTimeout: 0,
icLen: 0,
icDP: nil,
}
return ioctl(f, I_STR, uintptr(unsafe.Pointer(&istr)))
}
func minor(x uint64) uint64 { return x & 0377 }
func ptsdev(f *os.File) (uint64, error) {
istr := strioctl{
icCmd: ISPTM,
icTimeout: 0,
icLen: 0,
icDP: nil,
}
if err := ioctl(f, I_STR, uintptr(unsafe.Pointer(&istr))); err != nil {
return 0, err
}
var errors = make(chan error, 1)
var results = make(chan uint64, 1)
defer close(errors)
defer close(results)
var err error
var sc syscall.RawConn
sc, err = f.SyscallConn()
if err != nil {
return 0, err
}
err = sc.Control(func(fd uintptr) {
var status syscall.Stat_t
if err := syscall.Fstat(int(fd), &status); err != nil {
results <- 0
errors <- err
}
results <- uint64(minor(status.Rdev))
errors <- nil
})
if err != nil {
return 0, err
}
return <-results, <-errors
}
type ptOwn struct {
rUID int32
rGID int32
} }
func grantpt(f *os.File) error { func grantpt(f *os.File) error {
if ptsdev(f.Fd()) == NODEV { if _, err := ptsdev(f); err != nil {
return errors.New("not a master pty") return err
} }
var pto pt_own pto := ptOwn{
pto.pto_ruid = int32(os.Getuid()) rUID: int32(os.Getuid()),
// XXX should first attempt to get gid of DEFAULT_TTY_GROUP="tty" // XXX should first attempt to get gid of DEFAULT_TTY_GROUP="tty"
pto.pto_rgid = int32(os.Getgid()) rGID: int32(os.Getgid()),
var istr strioctl }
istr.ic_cmd = OWNERPT istr := strioctl{
istr.ic_timout = 0 icCmd: OWNERPT,
istr.ic_len = int32(unsafe.Sizeof(istr)) icTimeout: 0,
istr.ic_dp = unsafe.Pointer(&pto) icLen: int32(unsafe.Sizeof(strioctl{})),
err := ioctl(f.Fd(), I_STR, uintptr(unsafe.Pointer(&istr))) icDP: unsafe.Pointer(&pto),
if err != nil { }
if err := ioctl(f, I_STR, uintptr(unsafe.Pointer(&istr))); err != nil {
return errors.New("access denied") return errors.New("access denied")
} }
return nil return nil
} }
func unlockpt(f *os.File) error { // streamsPush pushes STREAMS modules if not already done so.
istr := strioctl{UNLKPT, 0, 0, nil} func streamsPush(f *os.File, mod string) error {
return ioctl(f.Fd(), I_STR, uintptr(unsafe.Pointer(&istr)))
}
// push STREAMS modules if not already done so
func streams_push(f *os.File, mod string) error {
var err error
buf := []byte(mod) buf := []byte(mod)
// XXX I_FIND is not returning an error when the module // XXX I_FIND is not returning an error when the module
// is already pushed even though truss reports a return // is already pushed even though truss reports a return
// value of 1. A bug in the Go Solaris syscall interface? // value of 1. A bug in the Go Solaris syscall interface?
@ -129,11 +163,9 @@ func streams_push(f *os.File, mod string) error {
// https://www.illumos.org/issues/9042 // https://www.illumos.org/issues/9042
// but since we are not using libc or XPG4.2, we should not be // but since we are not using libc or XPG4.2, we should not be
// double-pushing modules // double-pushing modules
err = ioctl(f.Fd(), I_FIND, uintptr(unsafe.Pointer(&buf[0]))) if err := ioctl(f, I_FIND, uintptr(unsafe.Pointer(&buf[0]))); err != nil {
if err != nil {
return nil return nil
} }
err = ioctl(f.Fd(), I_PUSH, uintptr(unsafe.Pointer(&buf[0]))) return ioctl(f, I_PUSH, uintptr(unsafe.Pointer(&buf[0])))
return err
} }

@ -1,4 +1,5 @@
// +build !linux,!darwin,!freebsd,!dragonfly,!openbsd,!solaris //go:build !linux && !darwin && !freebsd && !dragonfly && !netbsd && !openbsd && !solaris
// +build !linux,!darwin,!freebsd,!dragonfly,!netbsd,!openbsd,!solaris
package pty package pty

40
vendor/github.com/creack/pty/run.go generated vendored

@ -1,5 +1,3 @@
// +build !windows
package pty package pty
import ( import (
@ -11,25 +9,31 @@ import (
// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, // Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
// and c.Stderr, calls c.Start, and returns the File of the tty's // and c.Stderr, calls c.Start, and returns the File of the tty's
// corresponding pty. // corresponding pty.
func Start(c *exec.Cmd) (pty *os.File, err error) { //
return StartWithSize(c, nil) // Starts the process in a new session and sets the controlling terminal.
func Start(cmd *exec.Cmd) (*os.File, error) {
return StartWithSize(cmd, nil)
} }
// StartWithSize assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, // StartWithAttrs assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
// and c.Stderr, calls c.Start, and returns the File of the tty's // and c.Stderr, calls c.Start, and returns the File of the tty's
// corresponding pty. // corresponding pty.
// //
// This will resize the pty to the specified size before starting the command // This will resize the pty to the specified size before starting the command if a size is provided.
func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) { // The `attrs` parameter overrides the one set in c.SysProcAttr.
//
// This should generally not be needed. Used in some edge cases where it is needed to create a pty
// without a controlling terminal.
func StartWithAttrs(c *exec.Cmd, sz *Winsize, attrs *syscall.SysProcAttr) (*os.File, error) {
pty, tty, err := Open() pty, tty, err := Open()
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer tty.Close() defer func() { _ = tty.Close() }() // Best effort.
if sz != nil { if sz != nil {
err = Setsize(pty, sz) if err := Setsize(pty, sz); err != nil {
if err != nil { _ = pty.Close() // Best effort.
pty.Close()
return nil, err return nil, err
} }
} }
@ -42,15 +46,11 @@ func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) {
if c.Stdin == nil { if c.Stdin == nil {
c.Stdin = tty c.Stdin = tty
} }
if c.SysProcAttr == nil {
c.SysProcAttr = &syscall.SysProcAttr{} c.SysProcAttr = attrs
}
c.SysProcAttr.Setctty = true if err := c.Start(); err != nil {
c.SysProcAttr.Setsid = true _ = pty.Close() // Best effort.
c.SysProcAttr.Ctty = int(tty.Fd())
err = c.Start()
if err != nil {
pty.Close()
return nil, err return nil, err
} }
return pty, err return pty, err

25
vendor/github.com/creack/pty/start.go generated vendored Normal file

@ -0,0 +1,25 @@
//go:build !windows
// +build !windows
package pty
import (
"os"
"os/exec"
"syscall"
)
// StartWithSize assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
// and c.Stderr, calls c.Start, and returns the File of the tty's
// corresponding pty.
//
// This will resize the pty to the specified size before starting the command.
// Starts the process in a new session and sets the controlling terminal.
func StartWithSize(cmd *exec.Cmd, ws *Winsize) (*os.File, error) {
if cmd.SysProcAttr == nil {
cmd.SysProcAttr = &syscall.SysProcAttr{}
}
cmd.SysProcAttr.Setsid = true
cmd.SysProcAttr.Setctty = true
return StartWithAttrs(cmd, ws, cmd.SysProcAttr)
}

19
vendor/github.com/creack/pty/start_windows.go generated vendored Normal file

@ -0,0 +1,19 @@
//go:build windows
// +build windows
package pty
import (
"os"
"os/exec"
)
// StartWithSize assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
// and c.Stderr, calls c.Start, and returns the File of the tty's
// corresponding pty.
//
// This will resize the pty to the specified size before starting the command.
// Starts the process in a new session and sets the controlling terminal.
func StartWithSize(cmd *exec.Cmd, ws *Winsize) (*os.File, error) {
return nil, ErrUnsupported
}

@ -4,32 +4,32 @@
# Does not actually test the logic, just the compilation so we make sure we don't break code depending on the lib. # Does not actually test the logic, just the compilation so we make sure we don't break code depending on the lib.
echo2() { echo2() {
echo $@ >&2 echo $@ >&2
} }
trap end 0 trap end 0
end() { end() {
[ "$?" = 0 ] && echo2 "Pass." || (echo2 "Fail."; exit 1) [ "$?" = 0 ] && echo2 "Pass." || (echo2 "Fail."; exit 1)
} }
cross() { cross() {
os=$1 os=$1
shift shift
echo2 "Build for $os." echo2 "Build for $os."
for arch in $@; do for arch in $@; do
echo2 " - $os/$arch" echo2 " - $os/$arch"
GOOS=$os GOARCH=$arch go build GOOS=$os GOARCH=$arch go build
done done
echo2 echo2
} }
set -e set -e
cross linux amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le cross linux amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le riscv64
cross darwin amd64 386 arm arm64 cross darwin amd64 arm64
cross freebsd amd64 386 arm cross freebsd amd64 386 arm arm64 riscv64
cross netbsd amd64 386 arm cross netbsd amd64 386 arm arm64
cross openbsd amd64 386 cross openbsd amd64 386 arm arm64
cross dragonfly amd64 cross dragonfly amd64
cross solaris amd64 cross solaris amd64
@ -41,10 +41,24 @@ cross windows amd64 386 arm
# Some os/arch require a different compiler. Run in docker. # Some os/arch require a different compiler. Run in docker.
if ! hash docker; then if ! hash docker; then
# If docker is not present, stop here. # If docker is not present, stop here.
return return
fi fi
echo2 "Build for linux." echo2 "Build for linux."
echo2 " - linux/riscv" echo2 " - linux/riscv"
docker build -t test -f Dockerfile.riscv . docker build -t creack-pty-test -f Dockerfile.riscv .
# Golang dropped support for darwin 32bits since go1.15. Make sure the lib still compile with go1.14 on those archs.
echo2 "Build for darwin (32bits)."
echo2 " - darwin/386"
docker build -t creack-pty-test -f Dockerfile.golang --build-arg=GOVERSION=1.14 --build-arg=GOOS=darwin --build-arg=GOARCH=386 .
echo2 " - darwin/arm"
docker build -t creack-pty-test -f Dockerfile.golang --build-arg=GOVERSION=1.14 --build-arg=GOOS=darwin --build-arg=GOARCH=arm .
# Run a single test for an old go version. Would be best with go1.0, but not available on Dockerhub.
# Using 1.6 as it is the base version for the RISCV compiler.
# Would also be better to run all the tests, not just one, need to refactor this file to allow for specifc archs per version.
echo2 "Build for linux - go1.6."
echo2 " - linux/amd64"
docker build -t creack-pty-test -f Dockerfile.golang --build-arg=GOVERSION=1.6 --build-arg=GOOS=linux --build-arg=GOARCH=amd64 .

64
vendor/github.com/creack/pty/util.go generated vendored

@ -1,64 +0,0 @@
// +build !windows,!solaris
package pty
import (
"os"
"syscall"
"unsafe"
)
// InheritSize applies the terminal size of pty to tty. This should be run
// in a signal handler for syscall.SIGWINCH to automatically resize the tty when
// the pty receives a window size change notification.
func InheritSize(pty, tty *os.File) error {
size, err := GetsizeFull(pty)
if err != nil {
return err
}
err = Setsize(tty, size)
if err != nil {
return err
}
return nil
}
// Setsize resizes t to s.
func Setsize(t *os.File, ws *Winsize) error {
return windowRectCall(ws, t.Fd(), syscall.TIOCSWINSZ)
}
// GetsizeFull returns the full terminal size description.
func GetsizeFull(t *os.File) (size *Winsize, err error) {
var ws Winsize
err = windowRectCall(&ws, t.Fd(), syscall.TIOCGWINSZ)
return &ws, err
}
// Getsize returns the number of rows (lines) and cols (positions
// in each line) in terminal t.
func Getsize(t *os.File) (rows, cols int, err error) {
ws, err := GetsizeFull(t)
return int(ws.Rows), int(ws.Cols), err
}
// Winsize describes the terminal size.
type Winsize struct {
Rows uint16 // ws_row: Number of rows (in cells)
Cols uint16 // ws_col: Number of columns (in cells)
X uint16 // ws_xpixel: Width in pixels
Y uint16 // ws_ypixel: Height in pixels
}
func windowRectCall(ws *Winsize, fd, a2 uintptr) error {
_, _, errno := syscall.Syscall(
syscall.SYS_IOCTL,
fd,
a2,
uintptr(unsafe.Pointer(ws)),
)
if errno != 0 {
return syscall.Errno(errno)
}
return nil
}

@ -1,51 +0,0 @@
//
package pty
import (
"os"
"golang.org/x/sys/unix"
)
const (
TIOCGWINSZ = 21608 // 'T' << 8 | 104
TIOCSWINSZ = 21607 // 'T' << 8 | 103
)
// Winsize describes the terminal size.
type Winsize struct {
Rows uint16 // ws_row: Number of rows (in cells)
Cols uint16 // ws_col: Number of columns (in cells)
X uint16 // ws_xpixel: Width in pixels
Y uint16 // ws_ypixel: Height in pixels
}
// GetsizeFull returns the full terminal size description.
func GetsizeFull(t *os.File) (size *Winsize, err error) {
var wsz *unix.Winsize
wsz, err = unix.IoctlGetWinsize(int(t.Fd()), TIOCGWINSZ)
if err != nil {
return nil, err
} else {
return &Winsize{wsz.Row, wsz.Col, wsz.Xpixel, wsz.Ypixel}, nil
}
}
// Get Windows Size
func Getsize(t *os.File) (rows, cols int, err error) {
var wsz *unix.Winsize
wsz, err = unix.IoctlGetWinsize(int(t.Fd()), TIOCGWINSZ)
if err != nil {
return 80, 25, err
} else {
return int(wsz.Row), int(wsz.Col), nil
}
}
// Setsize resizes t to s.
func Setsize(t *os.File, ws *Winsize) error {
wsz := unix.Winsize{ws.Rows, ws.Cols, ws.X, ws.Y}
return unix.IoctlSetWinsize(int(t.Fd()), TIOCSWINSZ, &wsz)
}

27
vendor/github.com/creack/pty/winsize.go generated vendored Normal file

@ -0,0 +1,27 @@
package pty
import "os"
// InheritSize applies the terminal size of pty to tty. This should be run
// in a signal handler for syscall.SIGWINCH to automatically resize the tty when
// the pty receives a window size change notification.
func InheritSize(pty, tty *os.File) error {
size, err := GetsizeFull(pty)
if err != nil {
return err
}
if err := Setsize(tty, size); err != nil {
return err
}
return nil
}
// Getsize returns the number of rows (lines) and cols (positions
// in each line) in terminal t.
func Getsize(t *os.File) (rows, cols int, err error) {
ws, err := GetsizeFull(t)
if err != nil {
return 0, 0, err
}
return int(ws.Rows), int(ws.Cols), nil
}

35
vendor/github.com/creack/pty/winsize_unix.go generated vendored Normal file

@ -0,0 +1,35 @@
//go:build !windows
// +build !windows
package pty
import (
"os"
"syscall"
"unsafe"
)
// Winsize describes the terminal size.
type Winsize struct {
Rows uint16 // ws_row: Number of rows (in cells)
Cols uint16 // ws_col: Number of columns (in cells)
X uint16 // ws_xpixel: Width in pixels
Y uint16 // ws_ypixel: Height in pixels
}
// Setsize resizes t to s.
func Setsize(t *os.File, ws *Winsize) error {
//nolint:gosec // Expected unsafe pointer for Syscall call.
return ioctl(t, syscall.TIOCSWINSZ, uintptr(unsafe.Pointer(ws)))
}
// GetsizeFull returns the full terminal size description.
func GetsizeFull(t *os.File) (size *Winsize, err error) {
var ws Winsize
//nolint:gosec // Expected unsafe pointer for Syscall call.
if err := ioctl(t, syscall.TIOCGWINSZ, uintptr(unsafe.Pointer(&ws))); err != nil {
return nil, err
}
return &ws, nil
}

23
vendor/github.com/creack/pty/winsize_unsupported.go generated vendored Normal file

@ -0,0 +1,23 @@
//go:build windows
// +build windows
package pty
import (
"os"
)
// Winsize is a dummy struct to enable compilation on unsupported platforms.
type Winsize struct {
Rows, Cols, X, Y uint16
}
// Setsize resizes t to s.
func Setsize(*os.File, *Winsize) error {
return ErrUnsupported
}
// GetsizeFull returns the full terminal size description.
func GetsizeFull(*os.File) (*Winsize, error) {
return nil, ErrUnsupported
}

@ -1,3 +1,6 @@
//go:build 386
// +build 386
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go // cgo -godefs types.go

@ -1,3 +1,6 @@
//go:build amd64
// +build amd64
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go // cgo -godefs types.go

@ -1,3 +1,6 @@
//go:build arm
// +build arm
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go // cgo -godefs types.go

@ -1,8 +1,9 @@
//go:build arm64
// +build arm64
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go // cgo -godefs types.go
// +build arm64
package pty package pty
type ( type (

@ -1,3 +1,6 @@
//go:build amd64 && dragonfly
// +build amd64,dragonfly
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_dragonfly.go // cgo -godefs types_dragonfly.go

@ -1,3 +1,6 @@
//go:build 386 && freebsd
// +build 386,freebsd
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go // cgo -godefs types_freebsd.go

@ -1,3 +1,6 @@
//go:build amd64 && freebsd
// +build amd64,freebsd
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go // cgo -godefs types_freebsd.go

@ -1,3 +1,6 @@
//go:build arm && freebsd
// +build arm,freebsd
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go // cgo -godefs types_freebsd.go

16
vendor/github.com/creack/pty/ztypes_freebsd_arm64.go generated vendored Normal file

@ -0,0 +1,16 @@
//go:build arm64 && freebsd
// +build arm64,freebsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types_freebsd.go
package pty
const (
_C_SPECNAMELEN = 0xff
)
type fiodgnameArg struct {
Len int32
Buf *byte
}

14
vendor/github.com/creack/pty/ztypes_freebsd_ppc64.go generated vendored Normal file

@ -0,0 +1,14 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go
package pty
const (
_C_SPECNAMELEN = 0x3f
)
type fiodgnameArg struct {
Len int32
Pad_cgo_0 [4]byte
Buf *byte
}

13
vendor/github.com/creack/pty/ztypes_freebsd_riscv64.go generated vendored Normal file

@ -0,0 +1,13 @@
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types_freebsd.go
package pty
const (
_C_SPECNAMELEN = 0x3f
)
type fiodgnameArg struct {
Len int32
Buf *byte
}

12
vendor/github.com/creack/pty/ztypes_loong64.go generated vendored Normal file

@ -0,0 +1,12 @@
//go:build loong64
// +build loong64
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go
package pty
type (
_C_int int32
_C_uint uint32
)

@ -1,9 +1,10 @@
//go:build (mips || mipsle || mips64 || mips64le) && linux
// +build mips mipsle mips64 mips64le
// +build linux
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go // cgo -godefs types.go
// +build linux
// +build mips mipsle mips64 mips64le
package pty package pty
type ( type (

@ -0,0 +1,17 @@
//go:build (386 || amd64 || arm || arm64) && netbsd
// +build 386 amd64 arm arm64
// +build netbsd
package pty
type ptmget struct {
Cfd int32
Sfd int32
Cn [1024]int8
Sn [1024]int8
}
var (
ioctl_TIOCPTSNAME = 0x48087448
ioctl_TIOCGRANTPT = 0x20007447
)

@ -1,5 +1,6 @@
// Created by cgo -godefs - DO NOT EDIT //go:build (386 || amd64 || arm || arm64 || mips64) && openbsd
// cgo -godefs types_openbsd.go // +build 386 amd64 arm arm64 mips64
// +build openbsd
package pty package pty

@ -1,13 +0,0 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_openbsd.go
package pty
type ptmget struct {
Cfd int32
Sfd int32
Cn [16]int8
Sn [16]int8
}
var ioctl_PTMGET = 0x40287401

9
vendor/github.com/creack/pty/ztypes_ppc.go generated vendored Normal file

@ -0,0 +1,9 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go
package pty
type (
_C_int int32
_C_uint uint32
)

@ -1,3 +1,4 @@
//go:build ppc64
// +build ppc64 // +build ppc64
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT

@ -1,3 +1,4 @@
//go:build ppc64le
// +build ppc64le // +build ppc64le
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT

@ -1,8 +1,9 @@
//go:build riscv || riscv64
// +build riscv riscv64
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types.go // cgo -godefs types.go
// +build riscv riscv64
package pty package pty
type ( type (

@ -1,3 +1,4 @@
//go:build s390x
// +build s390x // +build s390x
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT

12
vendor/github.com/creack/pty/ztypes_sparcx.go generated vendored Normal file

@ -0,0 +1,12 @@
//go:build sparc || sparc64
// +build sparc sparc64
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types.go
package pty
type (
_C_int int32
_C_uint uint32
)

@ -107,11 +107,22 @@ func (t *Trie) Remove(key string) {
rs = []rune(key) rs = []rune(key)
node = findNode(t.Root(), []rune(key)) node = findNode(t.Root(), []rune(key))
) )
if node == nil {
return
}
t.mu.Lock() t.mu.Lock()
t.size-- t.size--
for n := node.Parent(); n != nil; n = n.Parent() { for n := node.Parent(); n != nil; n = n.Parent() {
i++ i++
if n == t.root {
t.root = &Node{children: make(map[rune]*Node)}
break
}
if len(n.Children()) > 1 { if len(n.Children()) > 1 {
r := rs[len(rs)-i] r := rs[len(rs)-i]
n.RemoveChild(r) n.RemoveChild(r)

@ -28,84 +28,161 @@ type DecodeProtocolMessageFieldError struct {
SubType string SubType string
FieldName string FieldName string
FieldValue string FieldValue string
Message json.RawMessage
} }
func (e *DecodeProtocolMessageFieldError) Error() string { func (e *DecodeProtocolMessageFieldError) Error() string {
return fmt.Sprintf("%s %s '%s' is not supported (seq: %d)", e.SubType, e.FieldName, e.FieldValue, e.Seq) return fmt.Sprintf("%s %s '%s' is not supported (seq: %d)", e.SubType, e.FieldName, e.FieldValue, e.Seq)
} }
// DecodeProtocolMessage parses the JSON-encoded data and returns the result of // defaultCodec is used to decode vanilla DAP messages.
var defaultCodec = NewCodec()
// Codec is responsible for turning byte blobs into DAP messages.
type Codec struct {
eventCtor map[string]messageCtor
requestCtor map[string]messageCtor
responseCtor map[string]messageCtor
}
// NewCodec constructs a new codec that extends the vanilla DAP protocol.
// Unless you need to register custom DAP messages, use
// DecodeProtocolMessage instead.
func NewCodec() *Codec {
ret := &Codec{
eventCtor: make(map[string]messageCtor),
requestCtor: make(map[string]messageCtor),
responseCtor: make(map[string]messageCtor),
}
for k, v := range eventCtor {
ret.eventCtor[k] = v
}
for k, v := range requestCtor {
ret.requestCtor[k] = v
}
for k, v := range responseCtor {
ret.responseCtor[k] = v
}
return ret
}
// RegisterRequest registers a new custom DAP command, so that it can be
// unmarshalled by DecodeMessage. Returns an error when the command already
// exists.
//
// The ctor functions need to return a new instance of the underlying DAP
// message type. A typical usage looks like this:
//
// reqCtor := func() Message { return &LaunchRequest{} }
// respCtor := func() Message { return &LaunchResponse{} }
// codec.RegisterRequest("launch", reqCtor, respCtor)
func (c *Codec) RegisterRequest(command string, requestCtor, responseCtor func() Message) error {
_, hasReqCtor := c.requestCtor[command]
_, hasRespCtor := c.responseCtor[command]
if hasReqCtor || hasRespCtor {
return fmt.Errorf("command %q is already registered", command)
}
c.requestCtor[command] = requestCtor
c.responseCtor[command] = responseCtor
return nil
}
// RegisterEvent registers a new custom DAP event, so that it can be
// unmarshalled by DecodeMessage. Returns an error when the event already
// exists.
//
// The ctor function needs to return a new instance of the underlying DAP
// message type. A typical usage looks like this:
//
// ctor := func() Message { return &StoppedEvent{} }
// codec.RegisterEvent("stopped", ctor)
func (c *Codec) RegisterEvent(event string, ctor func() Message) error {
if _, hasEventCtor := c.eventCtor[event]; hasEventCtor {
return fmt.Errorf("event %q is already registered", event)
}
c.eventCtor[event] = ctor
return nil
}
// DecodeMessage parses the JSON-encoded data and returns the result of
// the appropriate type within the ProtocolMessage hierarchy. If message type, // the appropriate type within the ProtocolMessage hierarchy. If message type,
// command, etc cannot be cast, returns DecodeProtocolMessageFieldError. // command, etc cannot be cast, returns DecodeProtocolMessageFieldError.
// See also godoc for json.Unmarshal, which is used for underlying decoding. // See also godoc for json.Unmarshal, which is used for underlying decoding.
func DecodeProtocolMessage(data []byte) (Message, error) { func (c *Codec) DecodeMessage(data []byte) (Message, error) {
var protomsg ProtocolMessage // This struct is the union of the ResponseMessage, RequestMessage, and
if err := json.Unmarshal(data, &protomsg); err != nil { // EventMessage types. It is an optimization that saves an additional
// json.Unmarshal call.
var m struct {
ProtocolMessage
Command string `json:"command"`
Event string `json:"event"`
Success bool `json:"success"`
}
if err := json.Unmarshal(data, &m); err != nil {
return nil, err return nil, err
} }
switch protomsg.Type { switch m.Type {
case "request": case "request":
return decodeRequest(data) return c.decodeRequest(m.Command, m.Seq, data)
case "response": case "response":
return decodeResponse(data) return c.decodeResponse(m.Command, m.Seq, m.Success, data)
case "event": case "event":
return decodeEvent(data) return c.decodeEvent(m.Event, m.Seq, data)
default: default:
return nil, &DecodeProtocolMessageFieldError{protomsg.GetSeq(), "ProtocolMessage", "type", protomsg.Type} return nil, &DecodeProtocolMessageFieldError{m.Seq, "ProtocolMessage", "type", m.Type, json.RawMessage(data)}
} }
} }
type messageCtor func() Message
// decodeRequest determines what request type in the ProtocolMessage hierarchy // decodeRequest determines what request type in the ProtocolMessage hierarchy
// data corresponds to and uses json.Unmarshal to populate the corresponding // data corresponds to and uses json.Unmarshal to populate the corresponding
// struct to be returned. // struct to be returned.
func decodeRequest(data []byte) (Message, error) { func (c *Codec) decodeRequest(command string, seq int, data []byte) (Message, error) {
var r Request ctor, ok := c.requestCtor[command]
if err := json.Unmarshal(data, &r); err != nil { if !ok {
return nil, err return nil, &DecodeProtocolMessageFieldError{seq, "Request", "command", command, json.RawMessage(data)}
} }
if ctor, ok := requestCtor[r.Command]; ok { requestPtr := ctor()
requestPtr := ctor() err := json.Unmarshal(data, requestPtr)
err := json.Unmarshal(data, requestPtr) return requestPtr, err
return requestPtr, err
}
return nil, &DecodeProtocolMessageFieldError{r.GetSeq(), "Request", "command", r.Command}
} }
// decodeResponse determines what response type in the ProtocolMessage hierarchy // decodeResponse determines what response type in the ProtocolMessage hierarchy
// data corresponds to and uses json.Unmarshal to populate the corresponding // data corresponds to and uses json.Unmarshal to populate the corresponding
// struct to be returned. // struct to be returned.
func decodeResponse(data []byte) (Message, error) { func (c *Codec) decodeResponse(command string, seq int, success bool, data []byte) (Message, error) {
var r Response if !success {
if err := json.Unmarshal(data, &r); err != nil {
return nil, err
}
if !r.Success {
var er ErrorResponse var er ErrorResponse
err := json.Unmarshal(data, &er) err := json.Unmarshal(data, &er)
return &er, err return &er, err
} }
if ctor, ok := responseCtor[r.Command]; ok { ctor, ok := c.responseCtor[command]
responsePtr := ctor() if !ok {
err := json.Unmarshal(data, responsePtr) return nil, &DecodeProtocolMessageFieldError{seq, "Response", "command", command, json.RawMessage(data)}
return responsePtr, err
} }
return nil, &DecodeProtocolMessageFieldError{r.GetSeq(), "Response", "command", r.Command} responsePtr := ctor()
err := json.Unmarshal(data, responsePtr)
return responsePtr, err
} }
// decodeEvent determines what event type in the ProtocolMessage hierarchy // decodeEvent determines what event type in the ProtocolMessage hierarchy
// data corresponds to and uses json.Unmarshal to populate the corresponding // data corresponds to and uses json.Unmarshal to populate the corresponding
// struct to be returned. // struct to be returned.
func decodeEvent(data []byte) (Message, error) { func (c *Codec) decodeEvent(event string, seq int, data []byte) (Message, error) {
var e Event ctor, ok := c.eventCtor[event]
if err := json.Unmarshal(data, &e); err != nil { if !ok {
return nil, err return nil, &DecodeProtocolMessageFieldError{seq, "Event", "event", event, json.RawMessage(data)}
} }
if ctor, ok := eventCtor[e.Event]; ok { eventPtr := ctor()
eventPtr := ctor() err := json.Unmarshal(data, eventPtr)
err := json.Unmarshal(data, eventPtr) return eventPtr, err
return eventPtr, err
}
return nil, &DecodeProtocolMessageFieldError{e.GetSeq(), "Event", "event", e.Event}
} }
// DecodeProtocolMessage parses the JSON-encoded ProtocolMessage and returns
// the message embedded in it. If message type, command, etc cannot be cast,
// returns DecodeProtocolMessageFieldError. See also godoc for json.Unmarshal,
// which is used for underlying decoding.
func DecodeProtocolMessage(data []byte) (Message, error) {
return defaultCodec.DecodeMessage(data)
}
type messageCtor func() Message

@ -76,6 +76,8 @@ type Request struct {
Command string `json:"command"` Command string `json:"command"`
} }
func (r *Request) GetRequest() *Request { return r }
// Event: A debug adapter initiated event. // Event: A debug adapter initiated event.
type Event struct { type Event struct {
ProtocolMessage ProtocolMessage
@ -83,6 +85,8 @@ type Event struct {
Event string `json:"event"` Event string `json:"event"`
} }
func (e *Event) GetEvent() *Event { return e }
// Response: Response for a request. // Response: Response for a request.
type Response struct { type Response struct {
ProtocolMessage ProtocolMessage
@ -93,6 +97,8 @@ type Response struct {
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
} }
func (r *Response) GetResponse() *Response { return r }
// ErrorResponse: On error (whenever `success` is false), the body can provide more details. // ErrorResponse: On error (whenever `success` is false), the body can provide more details.
type ErrorResponse struct { type ErrorResponse struct {
Response Response
@ -104,8 +110,6 @@ type ErrorResponseBody struct {
Error *ErrorMessage `json:"error,omitempty"` Error *ErrorMessage `json:"error,omitempty"`
} }
func (r *ErrorResponse) GetResponse() *Response { return &r.Response }
// CancelRequest: The `cancel` request is used by the client in two situations: // CancelRequest: The `cancel` request is used by the client in two situations:
// - to indicate that it is no longer interested in the result produced by a specific request issued earlier // - to indicate that it is no longer interested in the result produced by a specific request issued earlier
// - to cancel a progress sequence. Clients should only call this request if the corresponding capability `supportsCancelRequest` is true. // - to cancel a progress sequence. Clients should only call this request if the corresponding capability `supportsCancelRequest` is true.
@ -122,8 +126,6 @@ type CancelRequest struct {
Arguments *CancelArguments `json:"arguments,omitempty"` Arguments *CancelArguments `json:"arguments,omitempty"`
} }
func (r *CancelRequest) GetRequest() *Request { return &r.Request }
// CancelArguments: Arguments for `cancel` request. // CancelArguments: Arguments for `cancel` request.
type CancelArguments struct { type CancelArguments struct {
RequestId int `json:"requestId,omitempty"` RequestId int `json:"requestId,omitempty"`
@ -135,8 +137,6 @@ type CancelResponse struct {
Response Response
} }
func (r *CancelResponse) GetResponse() *Response { return &r.Response }
// InitializedEvent: This event indicates that the debug adapter is ready to accept configuration requests (e.g. `setBreakpoints`, `setExceptionBreakpoints`). // InitializedEvent: This event indicates that the debug adapter is ready to accept configuration requests (e.g. `setBreakpoints`, `setExceptionBreakpoints`).
// A debug adapter is expected to send this event when it is ready to accept configuration requests (but not before the `initialize` request has finished). // A debug adapter is expected to send this event when it is ready to accept configuration requests (but not before the `initialize` request has finished).
// The sequence of events/requests is as follows: // The sequence of events/requests is as follows:
@ -150,8 +150,6 @@ type InitializedEvent struct {
Event Event
} }
func (e *InitializedEvent) GetEvent() *Event { return &e.Event }
// StoppedEvent: The event indicates that the execution of the debuggee has stopped due to some condition. // StoppedEvent: The event indicates that the execution of the debuggee has stopped due to some condition.
// This can be caused by a breakpoint previously set, a stepping request has completed, by executing a debugger statement etc. // This can be caused by a breakpoint previously set, a stepping request has completed, by executing a debugger statement etc.
type StoppedEvent struct { type StoppedEvent struct {
@ -170,8 +168,6 @@ type StoppedEventBody struct {
HitBreakpointIds []int `json:"hitBreakpointIds,omitempty"` HitBreakpointIds []int `json:"hitBreakpointIds,omitempty"`
} }
func (e *StoppedEvent) GetEvent() *Event { return &e.Event }
// ContinuedEvent: The event indicates that the execution of the debuggee has continued. // ContinuedEvent: The event indicates that the execution of the debuggee has continued.
// Please note: a debug adapter is not expected to send this event in response to a request that implies that execution continues, e.g. `launch` or `continue`. // Please note: a debug adapter is not expected to send this event in response to a request that implies that execution continues, e.g. `launch` or `continue`.
// It is only necessary to send a `continued` event if there was no previous request that implied this. // It is only necessary to send a `continued` event if there was no previous request that implied this.
@ -186,8 +182,6 @@ type ContinuedEventBody struct {
AllThreadsContinued bool `json:"allThreadsContinued,omitempty"` AllThreadsContinued bool `json:"allThreadsContinued,omitempty"`
} }
func (e *ContinuedEvent) GetEvent() *Event { return &e.Event }
// ExitedEvent: The event indicates that the debuggee has exited and returns its exit code. // ExitedEvent: The event indicates that the debuggee has exited and returns its exit code.
type ExitedEvent struct { type ExitedEvent struct {
Event Event
@ -199,8 +193,6 @@ type ExitedEventBody struct {
ExitCode int `json:"exitCode"` ExitCode int `json:"exitCode"`
} }
func (e *ExitedEvent) GetEvent() *Event { return &e.Event }
// TerminatedEvent: The event indicates that debugging of the debuggee has terminated. This does **not** mean that the debuggee itself has exited. // TerminatedEvent: The event indicates that debugging of the debuggee has terminated. This does **not** mean that the debuggee itself has exited.
type TerminatedEvent struct { type TerminatedEvent struct {
Event Event
@ -212,8 +204,6 @@ type TerminatedEventBody struct {
Restart interface{} `json:"restart,omitempty"` Restart interface{} `json:"restart,omitempty"`
} }
func (e *TerminatedEvent) GetEvent() *Event { return &e.Event }
// ThreadEvent: The event indicates that a thread has started or exited. // ThreadEvent: The event indicates that a thread has started or exited.
type ThreadEvent struct { type ThreadEvent struct {
Event Event
@ -226,8 +216,6 @@ type ThreadEventBody struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
} }
func (e *ThreadEvent) GetEvent() *Event { return &e.Event }
// OutputEvent: The event indicates that the target has produced some output. // OutputEvent: The event indicates that the target has produced some output.
type OutputEvent struct { type OutputEvent struct {
Event Event
@ -246,8 +234,6 @@ type OutputEventBody struct {
Data interface{} `json:"data,omitempty"` Data interface{} `json:"data,omitempty"`
} }
func (e *OutputEvent) GetEvent() *Event { return &e.Event }
// BreakpointEvent: The event indicates that some information about a breakpoint has changed. // BreakpointEvent: The event indicates that some information about a breakpoint has changed.
type BreakpointEvent struct { type BreakpointEvent struct {
Event Event
@ -260,8 +246,6 @@ type BreakpointEventBody struct {
Breakpoint Breakpoint `json:"breakpoint"` Breakpoint Breakpoint `json:"breakpoint"`
} }
func (e *BreakpointEvent) GetEvent() *Event { return &e.Event }
// ModuleEvent: The event indicates that some information about a module has changed. // ModuleEvent: The event indicates that some information about a module has changed.
type ModuleEvent struct { type ModuleEvent struct {
Event Event
@ -274,8 +258,6 @@ type ModuleEventBody struct {
Module Module `json:"module"` Module Module `json:"module"`
} }
func (e *ModuleEvent) GetEvent() *Event { return &e.Event }
// LoadedSourceEvent: The event indicates that some source has been added, changed, or removed from the set of all loaded sources. // LoadedSourceEvent: The event indicates that some source has been added, changed, or removed from the set of all loaded sources.
type LoadedSourceEvent struct { type LoadedSourceEvent struct {
Event Event
@ -288,8 +270,6 @@ type LoadedSourceEventBody struct {
Source Source `json:"source"` Source Source `json:"source"`
} }
func (e *LoadedSourceEvent) GetEvent() *Event { return &e.Event }
// ProcessEvent: The event indicates that the debugger has begun debugging a new process. Either one that it has launched, or one that it has attached to. // ProcessEvent: The event indicates that the debugger has begun debugging a new process. Either one that it has launched, or one that it has attached to.
type ProcessEvent struct { type ProcessEvent struct {
Event Event
@ -305,8 +285,6 @@ type ProcessEventBody struct {
PointerSize int `json:"pointerSize,omitempty"` PointerSize int `json:"pointerSize,omitempty"`
} }
func (e *ProcessEvent) GetEvent() *Event { return &e.Event }
// CapabilitiesEvent: The event indicates that one or more capabilities have changed. // CapabilitiesEvent: The event indicates that one or more capabilities have changed.
// Since the capabilities are dependent on the client and its UI, it might not be possible to change that at random times (or too late). // Since the capabilities are dependent on the client and its UI, it might not be possible to change that at random times (or too late).
// Consequently this event has a hint characteristic: a client can only be expected to make a 'best effort' in honoring individual capabilities but there are no guarantees. // Consequently this event has a hint characteristic: a client can only be expected to make a 'best effort' in honoring individual capabilities but there are no guarantees.
@ -321,8 +299,6 @@ type CapabilitiesEventBody struct {
Capabilities Capabilities `json:"capabilities"` Capabilities Capabilities `json:"capabilities"`
} }
func (e *CapabilitiesEvent) GetEvent() *Event { return &e.Event }
// ProgressStartEvent: The event signals that a long running operation is about to start and provides additional information for the client to set up a corresponding progress and cancellation UI. // ProgressStartEvent: The event signals that a long running operation is about to start and provides additional information for the client to set up a corresponding progress and cancellation UI.
// The client is free to delay the showing of the UI in order to reduce flicker. // The client is free to delay the showing of the UI in order to reduce flicker.
// This event should only be sent if the corresponding capability `supportsProgressReporting` is true. // This event should only be sent if the corresponding capability `supportsProgressReporting` is true.
@ -341,8 +317,6 @@ type ProgressStartEventBody struct {
Percentage int `json:"percentage,omitempty"` Percentage int `json:"percentage,omitempty"`
} }
func (e *ProgressStartEvent) GetEvent() *Event { return &e.Event }
// ProgressUpdateEvent: The event signals that the progress reporting needs to be updated with a new message and/or percentage. // ProgressUpdateEvent: The event signals that the progress reporting needs to be updated with a new message and/or percentage.
// The client does not have to update the UI immediately, but the clients needs to keep track of the message and/or percentage values. // The client does not have to update the UI immediately, but the clients needs to keep track of the message and/or percentage values.
// This event should only be sent if the corresponding capability `supportsProgressReporting` is true. // This event should only be sent if the corresponding capability `supportsProgressReporting` is true.
@ -358,8 +332,6 @@ type ProgressUpdateEventBody struct {
Percentage int `json:"percentage,omitempty"` Percentage int `json:"percentage,omitempty"`
} }
func (e *ProgressUpdateEvent) GetEvent() *Event { return &e.Event }
// ProgressEndEvent: The event signals the end of the progress reporting with a final message. // ProgressEndEvent: The event signals the end of the progress reporting with a final message.
// This event should only be sent if the corresponding capability `supportsProgressReporting` is true. // This event should only be sent if the corresponding capability `supportsProgressReporting` is true.
type ProgressEndEvent struct { type ProgressEndEvent struct {
@ -373,8 +345,6 @@ type ProgressEndEventBody struct {
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
} }
func (e *ProgressEndEvent) GetEvent() *Event { return &e.Event }
// InvalidatedEvent: This event signals that some state in the debug adapter has changed and requires that the client needs to re-render the data snapshot previously requested. // InvalidatedEvent: This event signals that some state in the debug adapter has changed and requires that the client needs to re-render the data snapshot previously requested.
// Debug adapters do not have to emit this event for runtime changes like stopped or thread events because in that case the client refetches the new state anyway. But the event can be used for example to refresh the UI after rendering formatting has changed in the debug adapter. // Debug adapters do not have to emit this event for runtime changes like stopped or thread events because in that case the client refetches the new state anyway. But the event can be used for example to refresh the UI after rendering formatting has changed in the debug adapter.
// This event should only be sent if the corresponding capability `supportsInvalidatedEvent` is true. // This event should only be sent if the corresponding capability `supportsInvalidatedEvent` is true.
@ -390,8 +360,6 @@ type InvalidatedEventBody struct {
StackFrameId int `json:"stackFrameId,omitempty"` StackFrameId int `json:"stackFrameId,omitempty"`
} }
func (e *InvalidatedEvent) GetEvent() *Event { return &e.Event }
// MemoryEvent: This event indicates that some memory range has been updated. It should only be sent if the corresponding capability `supportsMemoryEvent` is true. // MemoryEvent: This event indicates that some memory range has been updated. It should only be sent if the corresponding capability `supportsMemoryEvent` is true.
// Clients typically react to the event by re-issuing a `readMemory` request if they show the memory identified by the `memoryReference` and if the updated memory range overlaps the displayed range. Clients should not make assumptions how individual memory references relate to each other, so they should not assume that they are part of a single continuous address range and might overlap. // Clients typically react to the event by re-issuing a `readMemory` request if they show the memory identified by the `memoryReference` and if the updated memory range overlaps the displayed range. Clients should not make assumptions how individual memory references relate to each other, so they should not assume that they are part of a single continuous address range and might overlap.
// Debug adapters can use this event to indicate that the contents of a memory range has changed due to some other request like `setVariable` or `setExpression`. Debug adapters are not expected to emit this event for each and every memory change of a running program, because that information is typically not available from debuggers and it would flood clients with too many events. // Debug adapters can use this event to indicate that the contents of a memory range has changed due to some other request like `setVariable` or `setExpression`. Debug adapters are not expected to emit this event for each and every memory change of a running program, because that information is typically not available from debuggers and it would flood clients with too many events.
@ -407,8 +375,6 @@ type MemoryEventBody struct {
Count int `json:"count"` Count int `json:"count"`
} }
func (e *MemoryEvent) GetEvent() *Event { return &e.Event }
// RunInTerminalRequest: This request is sent from the debug adapter to the client to run a command in a terminal. // RunInTerminalRequest: This request is sent from the debug adapter to the client to run a command in a terminal.
// This is typically used to launch the debuggee in a terminal provided by the client. // This is typically used to launch the debuggee in a terminal provided by the client.
// This request should only be called if the corresponding client capability `supportsRunInTerminalRequest` is true. // This request should only be called if the corresponding client capability `supportsRunInTerminalRequest` is true.
@ -420,8 +386,6 @@ type RunInTerminalRequest struct {
Arguments RunInTerminalRequestArguments `json:"arguments"` Arguments RunInTerminalRequestArguments `json:"arguments"`
} }
func (r *RunInTerminalRequest) GetRequest() *Request { return &r.Request }
// RunInTerminalRequestArguments: Arguments for `runInTerminal` request. // RunInTerminalRequestArguments: Arguments for `runInTerminal` request.
type RunInTerminalRequestArguments struct { type RunInTerminalRequestArguments struct {
Kind string `json:"kind,omitempty"` Kind string `json:"kind,omitempty"`
@ -444,8 +408,6 @@ type RunInTerminalResponseBody struct {
ShellProcessId int `json:"shellProcessId,omitempty"` ShellProcessId int `json:"shellProcessId,omitempty"`
} }
func (r *RunInTerminalResponse) GetResponse() *Response { return &r.Response }
// StartDebuggingRequest: This request is sent from the debug adapter to the client to start a new debug session of the same type as the caller. // StartDebuggingRequest: This request is sent from the debug adapter to the client to start a new debug session of the same type as the caller.
// This request should only be sent if the corresponding client capability `supportsStartDebuggingRequest` is true. // This request should only be sent if the corresponding client capability `supportsStartDebuggingRequest` is true.
// A client implementation of `startDebugging` should start a new debug session (of the same type as the caller) in the same way that the caller's session was started. If the client supports hierarchical debug sessions, the newly created session can be treated as a child of the caller session. // A client implementation of `startDebugging` should start a new debug session (of the same type as the caller) in the same way that the caller's session was started. If the client supports hierarchical debug sessions, the newly created session can be treated as a child of the caller session.
@ -455,8 +417,6 @@ type StartDebuggingRequest struct {
Arguments StartDebuggingRequestArguments `json:"arguments"` Arguments StartDebuggingRequestArguments `json:"arguments"`
} }
func (r *StartDebuggingRequest) GetRequest() *Request { return &r.Request }
// StartDebuggingRequestArguments: Arguments for `startDebugging` request. // StartDebuggingRequestArguments: Arguments for `startDebugging` request.
type StartDebuggingRequestArguments struct { type StartDebuggingRequestArguments struct {
Configuration map[string]interface{} `json:"configuration"` Configuration map[string]interface{} `json:"configuration"`
@ -468,8 +428,6 @@ type StartDebuggingResponse struct {
Response Response
} }
func (r *StartDebuggingResponse) GetResponse() *Response { return &r.Response }
// InitializeRequest: The `initialize` request is sent as the first request from the client to the debug adapter in order to configure it with client capabilities and to retrieve capabilities from the debug adapter. // InitializeRequest: The `initialize` request is sent as the first request from the client to the debug adapter in order to configure it with client capabilities and to retrieve capabilities from the debug adapter.
// Until the debug adapter has responded with an `initialize` response, the client must not send any additional requests or events to the debug adapter. // Until the debug adapter has responded with an `initialize` response, the client must not send any additional requests or events to the debug adapter.
// In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an `initialize` response. // In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an `initialize` response.
@ -480,8 +438,6 @@ type InitializeRequest struct {
Arguments InitializeRequestArguments `json:"arguments"` Arguments InitializeRequestArguments `json:"arguments"`
} }
func (r *InitializeRequest) GetRequest() *Request { return &r.Request }
// InitializeRequestArguments: Arguments for `initialize` request. // InitializeRequestArguments: Arguments for `initialize` request.
type InitializeRequestArguments struct { type InitializeRequestArguments struct {
ClientID string `json:"clientID,omitempty"` ClientID string `json:"clientID,omitempty"`
@ -509,8 +465,6 @@ type InitializeResponse struct {
Body Capabilities `json:"body,omitempty"` Body Capabilities `json:"body,omitempty"`
} }
func (r *InitializeResponse) GetResponse() *Response { return &r.Response }
// ConfigurationDoneRequest: This request indicates that the client has finished initialization of the debug adapter. // ConfigurationDoneRequest: This request indicates that the client has finished initialization of the debug adapter.
// So it is the last request in the sequence of configuration requests (which was started by the `initialized` event). // So it is the last request in the sequence of configuration requests (which was started by the `initialized` event).
// Clients should only call this request if the corresponding capability `supportsConfigurationDoneRequest` is true. // Clients should only call this request if the corresponding capability `supportsConfigurationDoneRequest` is true.
@ -520,8 +474,6 @@ type ConfigurationDoneRequest struct {
Arguments *ConfigurationDoneArguments `json:"arguments,omitempty"` Arguments *ConfigurationDoneArguments `json:"arguments,omitempty"`
} }
func (r *ConfigurationDoneRequest) GetRequest() *Request { return &r.Request }
// ConfigurationDoneArguments: Arguments for `configurationDone` request. // ConfigurationDoneArguments: Arguments for `configurationDone` request.
type ConfigurationDoneArguments struct { type ConfigurationDoneArguments struct {
} }
@ -531,8 +483,6 @@ type ConfigurationDoneResponse struct {
Response Response
} }
func (r *ConfigurationDoneResponse) GetResponse() *Response { return &r.Response }
// LaunchRequest: This launch request is sent from the client to the debug adapter to start the debuggee with or without debugging (if `noDebug` is true). // LaunchRequest: This launch request is sent from the client to the debug adapter to start the debuggee with or without debugging (if `noDebug` is true).
// Since launching is debugger/runtime specific, the arguments for this request are not part of this specification. // Since launching is debugger/runtime specific, the arguments for this request are not part of this specification.
type LaunchRequest struct { type LaunchRequest struct {
@ -541,7 +491,6 @@ type LaunchRequest struct {
Arguments json.RawMessage `json:"arguments"` Arguments json.RawMessage `json:"arguments"`
} }
func (r *LaunchRequest) GetRequest() *Request { return &r.Request }
func (r *LaunchRequest) GetArguments() json.RawMessage { return r.Arguments } func (r *LaunchRequest) GetArguments() json.RawMessage { return r.Arguments }
// LaunchResponse: Response to `launch` request. This is just an acknowledgement, so no body field is required. // LaunchResponse: Response to `launch` request. This is just an acknowledgement, so no body field is required.
@ -549,8 +498,6 @@ type LaunchResponse struct {
Response Response
} }
func (r *LaunchResponse) GetResponse() *Response { return &r.Response }
// AttachRequest: The `attach` request is sent from the client to the debug adapter to attach to a debuggee that is already running. // AttachRequest: The `attach` request is sent from the client to the debug adapter to attach to a debuggee that is already running.
// Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification. // Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification.
type AttachRequest struct { type AttachRequest struct {
@ -559,7 +506,6 @@ type AttachRequest struct {
Arguments json.RawMessage `json:"arguments"` Arguments json.RawMessage `json:"arguments"`
} }
func (r *AttachRequest) GetRequest() *Request { return &r.Request }
func (r *AttachRequest) GetArguments() json.RawMessage { return r.Arguments } func (r *AttachRequest) GetArguments() json.RawMessage { return r.Arguments }
// AttachResponse: Response to `attach` request. This is just an acknowledgement, so no body field is required. // AttachResponse: Response to `attach` request. This is just an acknowledgement, so no body field is required.
@ -567,8 +513,6 @@ type AttachResponse struct {
Response Response
} }
func (r *AttachResponse) GetResponse() *Response { return &r.Response }
// RestartRequest: Restarts a debug session. Clients should only call this request if the corresponding capability `supportsRestartRequest` is true. // RestartRequest: Restarts a debug session. Clients should only call this request if the corresponding capability `supportsRestartRequest` is true.
// If the capability is missing or has the value false, a typical client emulates `restart` by terminating the debug adapter first and then launching it anew. // If the capability is missing or has the value false, a typical client emulates `restart` by terminating the debug adapter first and then launching it anew.
type RestartRequest struct { type RestartRequest struct {
@ -577,8 +521,6 @@ type RestartRequest struct {
Arguments *RestartArguments `json:"arguments,omitempty"` Arguments *RestartArguments `json:"arguments,omitempty"`
} }
func (r *RestartRequest) GetRequest() *Request { return &r.Request }
// RestartArguments: Arguments for `restart` request. // RestartArguments: Arguments for `restart` request.
type RestartArguments struct { type RestartArguments struct {
Arguments interface{} `json:"arguments,omitempty"` Arguments interface{} `json:"arguments,omitempty"`
@ -589,8 +531,6 @@ type RestartResponse struct {
Response Response
} }
func (r *RestartResponse) GetResponse() *Response { return &r.Response }
// DisconnectRequest: The `disconnect` request asks the debug adapter to disconnect from the debuggee (thus ending the debug session) and then to shut down itself (the debug adapter). // DisconnectRequest: The `disconnect` request asks the debug adapter to disconnect from the debuggee (thus ending the debug session) and then to shut down itself (the debug adapter).
// In addition, the debug adapter must terminate the debuggee if it was started with the `launch` request. If an `attach` request was used to connect to the debuggee, then the debug adapter must not terminate the debuggee. // In addition, the debug adapter must terminate the debuggee if it was started with the `launch` request. If an `attach` request was used to connect to the debuggee, then the debug adapter must not terminate the debuggee.
// This implicit behavior of when to terminate the debuggee can be overridden with the `terminateDebuggee` argument (which is only supported by a debug adapter if the corresponding capability `supportTerminateDebuggee` is true). // This implicit behavior of when to terminate the debuggee can be overridden with the `terminateDebuggee` argument (which is only supported by a debug adapter if the corresponding capability `supportTerminateDebuggee` is true).
@ -600,8 +540,6 @@ type DisconnectRequest struct {
Arguments *DisconnectArguments `json:"arguments,omitempty"` Arguments *DisconnectArguments `json:"arguments,omitempty"`
} }
func (r *DisconnectRequest) GetRequest() *Request { return &r.Request }
// DisconnectArguments: Arguments for `disconnect` request. // DisconnectArguments: Arguments for `disconnect` request.
type DisconnectArguments struct { type DisconnectArguments struct {
Restart bool `json:"restart,omitempty"` Restart bool `json:"restart,omitempty"`
@ -614,8 +552,6 @@ type DisconnectResponse struct {
Response Response
} }
func (r *DisconnectResponse) GetResponse() *Response { return &r.Response }
// TerminateRequest: The `terminate` request is sent from the client to the debug adapter in order to shut down the debuggee gracefully. Clients should only call this request if the capability `supportsTerminateRequest` is true. // TerminateRequest: The `terminate` request is sent from the client to the debug adapter in order to shut down the debuggee gracefully. Clients should only call this request if the capability `supportsTerminateRequest` is true.
// Typically a debug adapter implements `terminate` by sending a software signal which the debuggee intercepts in order to clean things up properly before terminating itself. // Typically a debug adapter implements `terminate` by sending a software signal which the debuggee intercepts in order to clean things up properly before terminating itself.
// Please note that this request does not directly affect the state of the debug session: if the debuggee decides to veto the graceful shutdown for any reason by not terminating itself, then the debug session just continues. // Please note that this request does not directly affect the state of the debug session: if the debuggee decides to veto the graceful shutdown for any reason by not terminating itself, then the debug session just continues.
@ -626,8 +562,6 @@ type TerminateRequest struct {
Arguments *TerminateArguments `json:"arguments,omitempty"` Arguments *TerminateArguments `json:"arguments,omitempty"`
} }
func (r *TerminateRequest) GetRequest() *Request { return &r.Request }
// TerminateArguments: Arguments for `terminate` request. // TerminateArguments: Arguments for `terminate` request.
type TerminateArguments struct { type TerminateArguments struct {
Restart bool `json:"restart,omitempty"` Restart bool `json:"restart,omitempty"`
@ -638,8 +572,6 @@ type TerminateResponse struct {
Response Response
} }
func (r *TerminateResponse) GetResponse() *Response { return &r.Response }
// BreakpointLocationsRequest: The `breakpointLocations` request returns all possible locations for source breakpoints in a given range. // BreakpointLocationsRequest: The `breakpointLocations` request returns all possible locations for source breakpoints in a given range.
// Clients should only call this request if the corresponding capability `supportsBreakpointLocationsRequest` is true. // Clients should only call this request if the corresponding capability `supportsBreakpointLocationsRequest` is true.
type BreakpointLocationsRequest struct { type BreakpointLocationsRequest struct {
@ -648,8 +580,6 @@ type BreakpointLocationsRequest struct {
Arguments *BreakpointLocationsArguments `json:"arguments,omitempty"` Arguments *BreakpointLocationsArguments `json:"arguments,omitempty"`
} }
func (r *BreakpointLocationsRequest) GetRequest() *Request { return &r.Request }
// BreakpointLocationsArguments: Arguments for `breakpointLocations` request. // BreakpointLocationsArguments: Arguments for `breakpointLocations` request.
type BreakpointLocationsArguments struct { type BreakpointLocationsArguments struct {
Source Source `json:"source"` Source Source `json:"source"`
@ -671,8 +601,6 @@ type BreakpointLocationsResponseBody struct {
Breakpoints []BreakpointLocation `json:"breakpoints"` Breakpoints []BreakpointLocation `json:"breakpoints"`
} }
func (r *BreakpointLocationsResponse) GetResponse() *Response { return &r.Response }
// SetBreakpointsRequest: Sets multiple breakpoints for a single source and clears all previous breakpoints in that source. // SetBreakpointsRequest: Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
// To clear all breakpoint for a source, specify an empty array. // To clear all breakpoint for a source, specify an empty array.
// When a breakpoint is hit, a `stopped` event (with reason `breakpoint`) is generated. // When a breakpoint is hit, a `stopped` event (with reason `breakpoint`) is generated.
@ -682,8 +610,6 @@ type SetBreakpointsRequest struct {
Arguments SetBreakpointsArguments `json:"arguments"` Arguments SetBreakpointsArguments `json:"arguments"`
} }
func (r *SetBreakpointsRequest) GetRequest() *Request { return &r.Request }
// SetBreakpointsArguments: Arguments for `setBreakpoints` request. // SetBreakpointsArguments: Arguments for `setBreakpoints` request.
type SetBreakpointsArguments struct { type SetBreakpointsArguments struct {
Source Source `json:"source"` Source Source `json:"source"`
@ -707,8 +633,6 @@ type SetBreakpointsResponseBody struct {
Breakpoints []Breakpoint `json:"breakpoints"` Breakpoints []Breakpoint `json:"breakpoints"`
} }
func (r *SetBreakpointsResponse) GetResponse() *Response { return &r.Response }
// SetFunctionBreakpointsRequest: Replaces all existing function breakpoints with new function breakpoints. // SetFunctionBreakpointsRequest: Replaces all existing function breakpoints with new function breakpoints.
// To clear all function breakpoints, specify an empty array. // To clear all function breakpoints, specify an empty array.
// When a function breakpoint is hit, a `stopped` event (with reason `function breakpoint`) is generated. // When a function breakpoint is hit, a `stopped` event (with reason `function breakpoint`) is generated.
@ -719,8 +643,6 @@ type SetFunctionBreakpointsRequest struct {
Arguments SetFunctionBreakpointsArguments `json:"arguments"` Arguments SetFunctionBreakpointsArguments `json:"arguments"`
} }
func (r *SetFunctionBreakpointsRequest) GetRequest() *Request { return &r.Request }
// SetFunctionBreakpointsArguments: Arguments for `setFunctionBreakpoints` request. // SetFunctionBreakpointsArguments: Arguments for `setFunctionBreakpoints` request.
type SetFunctionBreakpointsArguments struct { type SetFunctionBreakpointsArguments struct {
Breakpoints []FunctionBreakpoint `json:"breakpoints"` Breakpoints []FunctionBreakpoint `json:"breakpoints"`
@ -738,8 +660,6 @@ type SetFunctionBreakpointsResponseBody struct {
Breakpoints []Breakpoint `json:"breakpoints"` Breakpoints []Breakpoint `json:"breakpoints"`
} }
func (r *SetFunctionBreakpointsResponse) GetResponse() *Response { return &r.Response }
// SetExceptionBreakpointsRequest: The request configures the debugger's response to thrown exceptions. // SetExceptionBreakpointsRequest: The request configures the debugger's response to thrown exceptions.
// If an exception is configured to break, a `stopped` event is fired (with reason `exception`). // If an exception is configured to break, a `stopped` event is fired (with reason `exception`).
// Clients should only call this request if the corresponding capability `exceptionBreakpointFilters` returns one or more filters. // Clients should only call this request if the corresponding capability `exceptionBreakpointFilters` returns one or more filters.
@ -749,8 +669,6 @@ type SetExceptionBreakpointsRequest struct {
Arguments SetExceptionBreakpointsArguments `json:"arguments"` Arguments SetExceptionBreakpointsArguments `json:"arguments"`
} }
func (r *SetExceptionBreakpointsRequest) GetRequest() *Request { return &r.Request }
// SetExceptionBreakpointsArguments: Arguments for `setExceptionBreakpoints` request. // SetExceptionBreakpointsArguments: Arguments for `setExceptionBreakpoints` request.
type SetExceptionBreakpointsArguments struct { type SetExceptionBreakpointsArguments struct {
Filters []string `json:"filters"` Filters []string `json:"filters"`
@ -772,8 +690,6 @@ type SetExceptionBreakpointsResponseBody struct {
Breakpoints []Breakpoint `json:"breakpoints,omitempty"` Breakpoints []Breakpoint `json:"breakpoints,omitempty"`
} }
func (r *SetExceptionBreakpointsResponse) GetResponse() *Response { return &r.Response }
// DataBreakpointInfoRequest: Obtains information on a possible data breakpoint that could be set on an expression or variable. // DataBreakpointInfoRequest: Obtains information on a possible data breakpoint that could be set on an expression or variable.
// Clients should only call this request if the corresponding capability `supportsDataBreakpoints` is true. // Clients should only call this request if the corresponding capability `supportsDataBreakpoints` is true.
type DataBreakpointInfoRequest struct { type DataBreakpointInfoRequest struct {
@ -782,8 +698,6 @@ type DataBreakpointInfoRequest struct {
Arguments DataBreakpointInfoArguments `json:"arguments"` Arguments DataBreakpointInfoArguments `json:"arguments"`
} }
func (r *DataBreakpointInfoRequest) GetRequest() *Request { return &r.Request }
// DataBreakpointInfoArguments: Arguments for `dataBreakpointInfo` request. // DataBreakpointInfoArguments: Arguments for `dataBreakpointInfo` request.
type DataBreakpointInfoArguments struct { type DataBreakpointInfoArguments struct {
VariablesReference int `json:"variablesReference,omitempty"` VariablesReference int `json:"variablesReference,omitempty"`
@ -805,8 +719,6 @@ type DataBreakpointInfoResponseBody struct {
CanPersist bool `json:"canPersist,omitempty"` CanPersist bool `json:"canPersist,omitempty"`
} }
func (r *DataBreakpointInfoResponse) GetResponse() *Response { return &r.Response }
// SetDataBreakpointsRequest: Replaces all existing data breakpoints with new data breakpoints. // SetDataBreakpointsRequest: Replaces all existing data breakpoints with new data breakpoints.
// To clear all data breakpoints, specify an empty array. // To clear all data breakpoints, specify an empty array.
// When a data breakpoint is hit, a `stopped` event (with reason `data breakpoint`) is generated. // When a data breakpoint is hit, a `stopped` event (with reason `data breakpoint`) is generated.
@ -817,8 +729,6 @@ type SetDataBreakpointsRequest struct {
Arguments SetDataBreakpointsArguments `json:"arguments"` Arguments SetDataBreakpointsArguments `json:"arguments"`
} }
func (r *SetDataBreakpointsRequest) GetRequest() *Request { return &r.Request }
// SetDataBreakpointsArguments: Arguments for `setDataBreakpoints` request. // SetDataBreakpointsArguments: Arguments for `setDataBreakpoints` request.
type SetDataBreakpointsArguments struct { type SetDataBreakpointsArguments struct {
Breakpoints []DataBreakpoint `json:"breakpoints"` Breakpoints []DataBreakpoint `json:"breakpoints"`
@ -836,8 +746,6 @@ type SetDataBreakpointsResponseBody struct {
Breakpoints []Breakpoint `json:"breakpoints"` Breakpoints []Breakpoint `json:"breakpoints"`
} }
func (r *SetDataBreakpointsResponse) GetResponse() *Response { return &r.Response }
// SetInstructionBreakpointsRequest: Replaces all existing instruction breakpoints. Typically, instruction breakpoints would be set from a disassembly window. // SetInstructionBreakpointsRequest: Replaces all existing instruction breakpoints. Typically, instruction breakpoints would be set from a disassembly window.
// To clear all instruction breakpoints, specify an empty array. // To clear all instruction breakpoints, specify an empty array.
// When an instruction breakpoint is hit, a `stopped` event (with reason `instruction breakpoint`) is generated. // When an instruction breakpoint is hit, a `stopped` event (with reason `instruction breakpoint`) is generated.
@ -848,8 +756,6 @@ type SetInstructionBreakpointsRequest struct {
Arguments SetInstructionBreakpointsArguments `json:"arguments"` Arguments SetInstructionBreakpointsArguments `json:"arguments"`
} }
func (r *SetInstructionBreakpointsRequest) GetRequest() *Request { return &r.Request }
// SetInstructionBreakpointsArguments: Arguments for `setInstructionBreakpoints` request // SetInstructionBreakpointsArguments: Arguments for `setInstructionBreakpoints` request
type SetInstructionBreakpointsArguments struct { type SetInstructionBreakpointsArguments struct {
Breakpoints []InstructionBreakpoint `json:"breakpoints"` Breakpoints []InstructionBreakpoint `json:"breakpoints"`
@ -866,8 +772,6 @@ type SetInstructionBreakpointsResponseBody struct {
Breakpoints []Breakpoint `json:"breakpoints"` Breakpoints []Breakpoint `json:"breakpoints"`
} }
func (r *SetInstructionBreakpointsResponse) GetResponse() *Response { return &r.Response }
// ContinueRequest: The request resumes execution of all threads. If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true resumes only the specified thread. If not all threads were resumed, the `allThreadsContinued` attribute of the response should be set to false. // ContinueRequest: The request resumes execution of all threads. If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true resumes only the specified thread. If not all threads were resumed, the `allThreadsContinued` attribute of the response should be set to false.
type ContinueRequest struct { type ContinueRequest struct {
Request Request
@ -875,8 +779,6 @@ type ContinueRequest struct {
Arguments ContinueArguments `json:"arguments"` Arguments ContinueArguments `json:"arguments"`
} }
func (r *ContinueRequest) GetRequest() *Request { return &r.Request }
// ContinueArguments: Arguments for `continue` request. // ContinueArguments: Arguments for `continue` request.
type ContinueArguments struct { type ContinueArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -894,8 +796,6 @@ type ContinueResponseBody struct {
AllThreadsContinued bool `json:"allThreadsContinued"` AllThreadsContinued bool `json:"allThreadsContinued"`
} }
func (r *ContinueResponse) GetResponse() *Response { return &r.Response }
// NextRequest: The request executes one step (in the given granularity) for the specified thread and allows all other threads to run freely by resuming them. // NextRequest: The request executes one step (in the given granularity) for the specified thread and allows all other threads to run freely by resuming them.
// If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming. // If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming.
// The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed. // The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed.
@ -905,8 +805,6 @@ type NextRequest struct {
Arguments NextArguments `json:"arguments"` Arguments NextArguments `json:"arguments"`
} }
func (r *NextRequest) GetRequest() *Request { return &r.Request }
// NextArguments: Arguments for `next` request. // NextArguments: Arguments for `next` request.
type NextArguments struct { type NextArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -919,8 +817,6 @@ type NextResponse struct {
Response Response
} }
func (r *NextResponse) GetResponse() *Response { return &r.Response }
// StepInRequest: The request resumes the given thread to step into a function/method and allows all other threads to run freely by resuming them. // StepInRequest: The request resumes the given thread to step into a function/method and allows all other threads to run freely by resuming them.
// If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming. // If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming.
// If the request cannot step into a target, `stepIn` behaves like the `next` request. // If the request cannot step into a target, `stepIn` behaves like the `next` request.
@ -934,8 +830,6 @@ type StepInRequest struct {
Arguments StepInArguments `json:"arguments"` Arguments StepInArguments `json:"arguments"`
} }
func (r *StepInRequest) GetRequest() *Request { return &r.Request }
// StepInArguments: Arguments for `stepIn` request. // StepInArguments: Arguments for `stepIn` request.
type StepInArguments struct { type StepInArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -949,8 +843,6 @@ type StepInResponse struct {
Response Response
} }
func (r *StepInResponse) GetResponse() *Response { return &r.Response }
// StepOutRequest: The request resumes the given thread to step out (return) from a function/method and allows all other threads to run freely by resuming them. // StepOutRequest: The request resumes the given thread to step out (return) from a function/method and allows all other threads to run freely by resuming them.
// If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming. // If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming.
// The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed. // The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed.
@ -960,8 +852,6 @@ type StepOutRequest struct {
Arguments StepOutArguments `json:"arguments"` Arguments StepOutArguments `json:"arguments"`
} }
func (r *StepOutRequest) GetRequest() *Request { return &r.Request }
// StepOutArguments: Arguments for `stepOut` request. // StepOutArguments: Arguments for `stepOut` request.
type StepOutArguments struct { type StepOutArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -974,8 +864,6 @@ type StepOutResponse struct {
Response Response
} }
func (r *StepOutResponse) GetResponse() *Response { return &r.Response }
// StepBackRequest: The request executes one backward step (in the given granularity) for the specified thread and allows all other threads to run backward freely by resuming them. // StepBackRequest: The request executes one backward step (in the given granularity) for the specified thread and allows all other threads to run backward freely by resuming them.
// If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming. // If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming.
// The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed. // The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed.
@ -986,8 +874,6 @@ type StepBackRequest struct {
Arguments StepBackArguments `json:"arguments"` Arguments StepBackArguments `json:"arguments"`
} }
func (r *StepBackRequest) GetRequest() *Request { return &r.Request }
// StepBackArguments: Arguments for `stepBack` request. // StepBackArguments: Arguments for `stepBack` request.
type StepBackArguments struct { type StepBackArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -1000,8 +886,6 @@ type StepBackResponse struct {
Response Response
} }
func (r *StepBackResponse) GetResponse() *Response { return &r.Response }
// ReverseContinueRequest: The request resumes backward execution of all threads. If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true resumes only the specified thread. If not all threads were resumed, the `allThreadsContinued` attribute of the response should be set to false. // ReverseContinueRequest: The request resumes backward execution of all threads. If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true resumes only the specified thread. If not all threads were resumed, the `allThreadsContinued` attribute of the response should be set to false.
// Clients should only call this request if the corresponding capability `supportsStepBack` is true. // Clients should only call this request if the corresponding capability `supportsStepBack` is true.
type ReverseContinueRequest struct { type ReverseContinueRequest struct {
@ -1010,8 +894,6 @@ type ReverseContinueRequest struct {
Arguments ReverseContinueArguments `json:"arguments"` Arguments ReverseContinueArguments `json:"arguments"`
} }
func (r *ReverseContinueRequest) GetRequest() *Request { return &r.Request }
// ReverseContinueArguments: Arguments for `reverseContinue` request. // ReverseContinueArguments: Arguments for `reverseContinue` request.
type ReverseContinueArguments struct { type ReverseContinueArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -1023,8 +905,6 @@ type ReverseContinueResponse struct {
Response Response
} }
func (r *ReverseContinueResponse) GetResponse() *Response { return &r.Response }
// RestartFrameRequest: The request restarts execution of the specified stack frame. // RestartFrameRequest: The request restarts execution of the specified stack frame.
// The debug adapter first sends the response and then a `stopped` event (with reason `restart`) after the restart has completed. // The debug adapter first sends the response and then a `stopped` event (with reason `restart`) after the restart has completed.
// Clients should only call this request if the corresponding capability `supportsRestartFrame` is true. // Clients should only call this request if the corresponding capability `supportsRestartFrame` is true.
@ -1034,8 +914,6 @@ type RestartFrameRequest struct {
Arguments RestartFrameArguments `json:"arguments"` Arguments RestartFrameArguments `json:"arguments"`
} }
func (r *RestartFrameRequest) GetRequest() *Request { return &r.Request }
// RestartFrameArguments: Arguments for `restartFrame` request. // RestartFrameArguments: Arguments for `restartFrame` request.
type RestartFrameArguments struct { type RestartFrameArguments struct {
FrameId int `json:"frameId"` FrameId int `json:"frameId"`
@ -1046,8 +924,6 @@ type RestartFrameResponse struct {
Response Response
} }
func (r *RestartFrameResponse) GetResponse() *Response { return &r.Response }
// GotoRequest: The request sets the location where the debuggee will continue to run. // GotoRequest: The request sets the location where the debuggee will continue to run.
// This makes it possible to skip the execution of code or to execute code again. // This makes it possible to skip the execution of code or to execute code again.
// The code between the current location and the goto target is not executed but skipped. // The code between the current location and the goto target is not executed but skipped.
@ -1059,8 +935,6 @@ type GotoRequest struct {
Arguments GotoArguments `json:"arguments"` Arguments GotoArguments `json:"arguments"`
} }
func (r *GotoRequest) GetRequest() *Request { return &r.Request }
// GotoArguments: Arguments for `goto` request. // GotoArguments: Arguments for `goto` request.
type GotoArguments struct { type GotoArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -1072,8 +946,6 @@ type GotoResponse struct {
Response Response
} }
func (r *GotoResponse) GetResponse() *Response { return &r.Response }
// PauseRequest: The request suspends the debuggee. // PauseRequest: The request suspends the debuggee.
// The debug adapter first sends the response and then a `stopped` event (with reason `pause`) after the thread has been paused successfully. // The debug adapter first sends the response and then a `stopped` event (with reason `pause`) after the thread has been paused successfully.
type PauseRequest struct { type PauseRequest struct {
@ -1082,8 +954,6 @@ type PauseRequest struct {
Arguments PauseArguments `json:"arguments"` Arguments PauseArguments `json:"arguments"`
} }
func (r *PauseRequest) GetRequest() *Request { return &r.Request }
// PauseArguments: Arguments for `pause` request. // PauseArguments: Arguments for `pause` request.
type PauseArguments struct { type PauseArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -1094,8 +964,6 @@ type PauseResponse struct {
Response Response
} }
func (r *PauseResponse) GetResponse() *Response { return &r.Response }
// StackTraceRequest: The request returns a stacktrace from the current execution state of a given thread. // StackTraceRequest: The request returns a stacktrace from the current execution state of a given thread.
// A client can request all stack frames by omitting the startFrame and levels arguments. For performance-conscious clients and if the corresponding capability `supportsDelayedStackTraceLoading` is true, stack frames can be retrieved in a piecemeal way with the `startFrame` and `levels` arguments. The response of the `stackTrace` request may contain a `totalFrames` property that hints at the total number of frames in the stack. If a client needs this total number upfront, it can issue a request for a single (first) frame and depending on the value of `totalFrames` decide how to proceed. In any case a client should be prepared to receive fewer frames than requested, which is an indication that the end of the stack has been reached. // A client can request all stack frames by omitting the startFrame and levels arguments. For performance-conscious clients and if the corresponding capability `supportsDelayedStackTraceLoading` is true, stack frames can be retrieved in a piecemeal way with the `startFrame` and `levels` arguments. The response of the `stackTrace` request may contain a `totalFrames` property that hints at the total number of frames in the stack. If a client needs this total number upfront, it can issue a request for a single (first) frame and depending on the value of `totalFrames` decide how to proceed. In any case a client should be prepared to receive fewer frames than requested, which is an indication that the end of the stack has been reached.
type StackTraceRequest struct { type StackTraceRequest struct {
@ -1104,8 +972,6 @@ type StackTraceRequest struct {
Arguments StackTraceArguments `json:"arguments"` Arguments StackTraceArguments `json:"arguments"`
} }
func (r *StackTraceRequest) GetRequest() *Request { return &r.Request }
// StackTraceArguments: Arguments for `stackTrace` request. // StackTraceArguments: Arguments for `stackTrace` request.
type StackTraceArguments struct { type StackTraceArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -1126,8 +992,6 @@ type StackTraceResponseBody struct {
TotalFrames int `json:"totalFrames,omitempty"` TotalFrames int `json:"totalFrames,omitempty"`
} }
func (r *StackTraceResponse) GetResponse() *Response { return &r.Response }
// ScopesRequest: The request returns the variable scopes for a given stack frame ID. // ScopesRequest: The request returns the variable scopes for a given stack frame ID.
type ScopesRequest struct { type ScopesRequest struct {
Request Request
@ -1135,8 +999,6 @@ type ScopesRequest struct {
Arguments ScopesArguments `json:"arguments"` Arguments ScopesArguments `json:"arguments"`
} }
func (r *ScopesRequest) GetRequest() *Request { return &r.Request }
// ScopesArguments: Arguments for `scopes` request. // ScopesArguments: Arguments for `scopes` request.
type ScopesArguments struct { type ScopesArguments struct {
FrameId int `json:"frameId"` FrameId int `json:"frameId"`
@ -1153,8 +1015,6 @@ type ScopesResponseBody struct {
Scopes []Scope `json:"scopes"` Scopes []Scope `json:"scopes"`
} }
func (r *ScopesResponse) GetResponse() *Response { return &r.Response }
// VariablesRequest: Retrieves all child variables for the given variable reference. // VariablesRequest: Retrieves all child variables for the given variable reference.
// A filter can be used to limit the fetched children to either named or indexed children. // A filter can be used to limit the fetched children to either named or indexed children.
type VariablesRequest struct { type VariablesRequest struct {
@ -1163,8 +1023,6 @@ type VariablesRequest struct {
Arguments VariablesArguments `json:"arguments"` Arguments VariablesArguments `json:"arguments"`
} }
func (r *VariablesRequest) GetRequest() *Request { return &r.Request }
// VariablesArguments: Arguments for `variables` request. // VariablesArguments: Arguments for `variables` request.
type VariablesArguments struct { type VariablesArguments struct {
VariablesReference int `json:"variablesReference"` VariablesReference int `json:"variablesReference"`
@ -1185,8 +1043,6 @@ type VariablesResponseBody struct {
Variables []Variable `json:"variables"` Variables []Variable `json:"variables"`
} }
func (r *VariablesResponse) GetResponse() *Response { return &r.Response }
// SetVariableRequest: Set the variable with the given name in the variable container to a new value. Clients should only call this request if the corresponding capability `supportsSetVariable` is true. // SetVariableRequest: Set the variable with the given name in the variable container to a new value. Clients should only call this request if the corresponding capability `supportsSetVariable` is true.
// If a debug adapter implements both `setVariable` and `setExpression`, a client will only use `setExpression` if the variable has an `evaluateName` property. // If a debug adapter implements both `setVariable` and `setExpression`, a client will only use `setExpression` if the variable has an `evaluateName` property.
type SetVariableRequest struct { type SetVariableRequest struct {
@ -1195,8 +1051,6 @@ type SetVariableRequest struct {
Arguments SetVariableArguments `json:"arguments"` Arguments SetVariableArguments `json:"arguments"`
} }
func (r *SetVariableRequest) GetRequest() *Request { return &r.Request }
// SetVariableArguments: Arguments for `setVariable` request. // SetVariableArguments: Arguments for `setVariable` request.
type SetVariableArguments struct { type SetVariableArguments struct {
VariablesReference int `json:"variablesReference"` VariablesReference int `json:"variablesReference"`
@ -1220,8 +1074,6 @@ type SetVariableResponseBody struct {
IndexedVariables int `json:"indexedVariables,omitempty"` IndexedVariables int `json:"indexedVariables,omitempty"`
} }
func (r *SetVariableResponse) GetResponse() *Response { return &r.Response }
// SourceRequest: The request retrieves the source code for a given source reference. // SourceRequest: The request retrieves the source code for a given source reference.
type SourceRequest struct { type SourceRequest struct {
Request Request
@ -1229,8 +1081,6 @@ type SourceRequest struct {
Arguments SourceArguments `json:"arguments"` Arguments SourceArguments `json:"arguments"`
} }
func (r *SourceRequest) GetRequest() *Request { return &r.Request }
// SourceArguments: Arguments for `source` request. // SourceArguments: Arguments for `source` request.
type SourceArguments struct { type SourceArguments struct {
Source *Source `json:"source,omitempty"` Source *Source `json:"source,omitempty"`
@ -1249,15 +1099,11 @@ type SourceResponseBody struct {
MimeType string `json:"mimeType,omitempty"` MimeType string `json:"mimeType,omitempty"`
} }
func (r *SourceResponse) GetResponse() *Response { return &r.Response }
// ThreadsRequest: The request retrieves a list of all threads. // ThreadsRequest: The request retrieves a list of all threads.
type ThreadsRequest struct { type ThreadsRequest struct {
Request Request
} }
func (r *ThreadsRequest) GetRequest() *Request { return &r.Request }
// ThreadsResponse: Response to `threads` request. // ThreadsResponse: Response to `threads` request.
type ThreadsResponse struct { type ThreadsResponse struct {
Response Response
@ -1269,8 +1115,6 @@ type ThreadsResponseBody struct {
Threads []Thread `json:"threads"` Threads []Thread `json:"threads"`
} }
func (r *ThreadsResponse) GetResponse() *Response { return &r.Response }
// TerminateThreadsRequest: The request terminates the threads with the given ids. // TerminateThreadsRequest: The request terminates the threads with the given ids.
// Clients should only call this request if the corresponding capability `supportsTerminateThreadsRequest` is true. // Clients should only call this request if the corresponding capability `supportsTerminateThreadsRequest` is true.
type TerminateThreadsRequest struct { type TerminateThreadsRequest struct {
@ -1279,8 +1123,6 @@ type TerminateThreadsRequest struct {
Arguments TerminateThreadsArguments `json:"arguments"` Arguments TerminateThreadsArguments `json:"arguments"`
} }
func (r *TerminateThreadsRequest) GetRequest() *Request { return &r.Request }
// TerminateThreadsArguments: Arguments for `terminateThreads` request. // TerminateThreadsArguments: Arguments for `terminateThreads` request.
type TerminateThreadsArguments struct { type TerminateThreadsArguments struct {
ThreadIds []int `json:"threadIds,omitempty"` ThreadIds []int `json:"threadIds,omitempty"`
@ -1291,8 +1133,6 @@ type TerminateThreadsResponse struct {
Response Response
} }
func (r *TerminateThreadsResponse) GetResponse() *Response { return &r.Response }
// ModulesRequest: Modules can be retrieved from the debug adapter with this request which can either return all modules or a range of modules to support paging. // ModulesRequest: Modules can be retrieved from the debug adapter with this request which can either return all modules or a range of modules to support paging.
// Clients should only call this request if the corresponding capability `supportsModulesRequest` is true. // Clients should only call this request if the corresponding capability `supportsModulesRequest` is true.
type ModulesRequest struct { type ModulesRequest struct {
@ -1301,8 +1141,6 @@ type ModulesRequest struct {
Arguments ModulesArguments `json:"arguments"` Arguments ModulesArguments `json:"arguments"`
} }
func (r *ModulesRequest) GetRequest() *Request { return &r.Request }
// ModulesArguments: Arguments for `modules` request. // ModulesArguments: Arguments for `modules` request.
type ModulesArguments struct { type ModulesArguments struct {
StartModule int `json:"startModule,omitempty"` StartModule int `json:"startModule,omitempty"`
@ -1321,8 +1159,6 @@ type ModulesResponseBody struct {
TotalModules int `json:"totalModules,omitempty"` TotalModules int `json:"totalModules,omitempty"`
} }
func (r *ModulesResponse) GetResponse() *Response { return &r.Response }
// LoadedSourcesRequest: Retrieves the set of all sources currently loaded by the debugged process. // LoadedSourcesRequest: Retrieves the set of all sources currently loaded by the debugged process.
// Clients should only call this request if the corresponding capability `supportsLoadedSourcesRequest` is true. // Clients should only call this request if the corresponding capability `supportsLoadedSourcesRequest` is true.
type LoadedSourcesRequest struct { type LoadedSourcesRequest struct {
@ -1331,8 +1167,6 @@ type LoadedSourcesRequest struct {
Arguments *LoadedSourcesArguments `json:"arguments,omitempty"` Arguments *LoadedSourcesArguments `json:"arguments,omitempty"`
} }
func (r *LoadedSourcesRequest) GetRequest() *Request { return &r.Request }
// LoadedSourcesArguments: Arguments for `loadedSources` request. // LoadedSourcesArguments: Arguments for `loadedSources` request.
type LoadedSourcesArguments struct { type LoadedSourcesArguments struct {
} }
@ -1348,8 +1182,6 @@ type LoadedSourcesResponseBody struct {
Sources []Source `json:"sources"` Sources []Source `json:"sources"`
} }
func (r *LoadedSourcesResponse) GetResponse() *Response { return &r.Response }
// EvaluateRequest: Evaluates the given expression in the context of the topmost stack frame. // EvaluateRequest: Evaluates the given expression in the context of the topmost stack frame.
// The expression has access to any variables and arguments that are in scope. // The expression has access to any variables and arguments that are in scope.
type EvaluateRequest struct { type EvaluateRequest struct {
@ -1358,8 +1190,6 @@ type EvaluateRequest struct {
Arguments EvaluateArguments `json:"arguments"` Arguments EvaluateArguments `json:"arguments"`
} }
func (r *EvaluateRequest) GetRequest() *Request { return &r.Request }
// EvaluateArguments: Arguments for `evaluate` request. // EvaluateArguments: Arguments for `evaluate` request.
type EvaluateArguments struct { type EvaluateArguments struct {
Expression string `json:"expression"` Expression string `json:"expression"`
@ -1385,8 +1215,6 @@ type EvaluateResponseBody struct {
MemoryReference string `json:"memoryReference,omitempty"` MemoryReference string `json:"memoryReference,omitempty"`
} }
func (r *EvaluateResponse) GetResponse() *Response { return &r.Response }
// SetExpressionRequest: Evaluates the given `value` expression and assigns it to the `expression` which must be a modifiable l-value. // SetExpressionRequest: Evaluates the given `value` expression and assigns it to the `expression` which must be a modifiable l-value.
// The expressions have access to any variables and arguments that are in scope of the specified frame. // The expressions have access to any variables and arguments that are in scope of the specified frame.
// Clients should only call this request if the corresponding capability `supportsSetExpression` is true. // Clients should only call this request if the corresponding capability `supportsSetExpression` is true.
@ -1397,8 +1225,6 @@ type SetExpressionRequest struct {
Arguments SetExpressionArguments `json:"arguments"` Arguments SetExpressionArguments `json:"arguments"`
} }
func (r *SetExpressionRequest) GetRequest() *Request { return &r.Request }
// SetExpressionArguments: Arguments for `setExpression` request. // SetExpressionArguments: Arguments for `setExpression` request.
type SetExpressionArguments struct { type SetExpressionArguments struct {
Expression string `json:"expression"` Expression string `json:"expression"`
@ -1423,8 +1249,6 @@ type SetExpressionResponseBody struct {
IndexedVariables int `json:"indexedVariables,omitempty"` IndexedVariables int `json:"indexedVariables,omitempty"`
} }
func (r *SetExpressionResponse) GetResponse() *Response { return &r.Response }
// StepInTargetsRequest: This request retrieves the possible step-in targets for the specified stack frame. // StepInTargetsRequest: This request retrieves the possible step-in targets for the specified stack frame.
// These targets can be used in the `stepIn` request. // These targets can be used in the `stepIn` request.
// Clients should only call this request if the corresponding capability `supportsStepInTargetsRequest` is true. // Clients should only call this request if the corresponding capability `supportsStepInTargetsRequest` is true.
@ -1434,8 +1258,6 @@ type StepInTargetsRequest struct {
Arguments StepInTargetsArguments `json:"arguments"` Arguments StepInTargetsArguments `json:"arguments"`
} }
func (r *StepInTargetsRequest) GetRequest() *Request { return &r.Request }
// StepInTargetsArguments: Arguments for `stepInTargets` request. // StepInTargetsArguments: Arguments for `stepInTargets` request.
type StepInTargetsArguments struct { type StepInTargetsArguments struct {
FrameId int `json:"frameId"` FrameId int `json:"frameId"`
@ -1452,8 +1274,6 @@ type StepInTargetsResponseBody struct {
Targets []StepInTarget `json:"targets"` Targets []StepInTarget `json:"targets"`
} }
func (r *StepInTargetsResponse) GetResponse() *Response { return &r.Response }
// GotoTargetsRequest: This request retrieves the possible goto targets for the specified source location. // GotoTargetsRequest: This request retrieves the possible goto targets for the specified source location.
// These targets can be used in the `goto` request. // These targets can be used in the `goto` request.
// Clients should only call this request if the corresponding capability `supportsGotoTargetsRequest` is true. // Clients should only call this request if the corresponding capability `supportsGotoTargetsRequest` is true.
@ -1463,8 +1283,6 @@ type GotoTargetsRequest struct {
Arguments GotoTargetsArguments `json:"arguments"` Arguments GotoTargetsArguments `json:"arguments"`
} }
func (r *GotoTargetsRequest) GetRequest() *Request { return &r.Request }
// GotoTargetsArguments: Arguments for `gotoTargets` request. // GotoTargetsArguments: Arguments for `gotoTargets` request.
type GotoTargetsArguments struct { type GotoTargetsArguments struct {
Source Source `json:"source"` Source Source `json:"source"`
@ -1483,8 +1301,6 @@ type GotoTargetsResponseBody struct {
Targets []GotoTarget `json:"targets"` Targets []GotoTarget `json:"targets"`
} }
func (r *GotoTargetsResponse) GetResponse() *Response { return &r.Response }
// CompletionsRequest: Returns a list of possible completions for a given caret position and text. // CompletionsRequest: Returns a list of possible completions for a given caret position and text.
// Clients should only call this request if the corresponding capability `supportsCompletionsRequest` is true. // Clients should only call this request if the corresponding capability `supportsCompletionsRequest` is true.
type CompletionsRequest struct { type CompletionsRequest struct {
@ -1493,8 +1309,6 @@ type CompletionsRequest struct {
Arguments CompletionsArguments `json:"arguments"` Arguments CompletionsArguments `json:"arguments"`
} }
func (r *CompletionsRequest) GetRequest() *Request { return &r.Request }
// CompletionsArguments: Arguments for `completions` request. // CompletionsArguments: Arguments for `completions` request.
type CompletionsArguments struct { type CompletionsArguments struct {
FrameId int `json:"frameId,omitempty"` FrameId int `json:"frameId,omitempty"`
@ -1514,8 +1328,6 @@ type CompletionsResponseBody struct {
Targets []CompletionItem `json:"targets"` Targets []CompletionItem `json:"targets"`
} }
func (r *CompletionsResponse) GetResponse() *Response { return &r.Response }
// ExceptionInfoRequest: Retrieves the details of the exception that caused this event to be raised. // ExceptionInfoRequest: Retrieves the details of the exception that caused this event to be raised.
// Clients should only call this request if the corresponding capability `supportsExceptionInfoRequest` is true. // Clients should only call this request if the corresponding capability `supportsExceptionInfoRequest` is true.
type ExceptionInfoRequest struct { type ExceptionInfoRequest struct {
@ -1524,8 +1336,6 @@ type ExceptionInfoRequest struct {
Arguments ExceptionInfoArguments `json:"arguments"` Arguments ExceptionInfoArguments `json:"arguments"`
} }
func (r *ExceptionInfoRequest) GetRequest() *Request { return &r.Request }
// ExceptionInfoArguments: Arguments for `exceptionInfo` request. // ExceptionInfoArguments: Arguments for `exceptionInfo` request.
type ExceptionInfoArguments struct { type ExceptionInfoArguments struct {
ThreadId int `json:"threadId"` ThreadId int `json:"threadId"`
@ -1545,8 +1355,6 @@ type ExceptionInfoResponseBody struct {
Details *ExceptionDetails `json:"details,omitempty"` Details *ExceptionDetails `json:"details,omitempty"`
} }
func (r *ExceptionInfoResponse) GetResponse() *Response { return &r.Response }
// ReadMemoryRequest: Reads bytes from memory at the provided location. // ReadMemoryRequest: Reads bytes from memory at the provided location.
// Clients should only call this request if the corresponding capability `supportsReadMemoryRequest` is true. // Clients should only call this request if the corresponding capability `supportsReadMemoryRequest` is true.
type ReadMemoryRequest struct { type ReadMemoryRequest struct {
@ -1555,8 +1363,6 @@ type ReadMemoryRequest struct {
Arguments ReadMemoryArguments `json:"arguments"` Arguments ReadMemoryArguments `json:"arguments"`
} }
func (r *ReadMemoryRequest) GetRequest() *Request { return &r.Request }
// ReadMemoryArguments: Arguments for `readMemory` request. // ReadMemoryArguments: Arguments for `readMemory` request.
type ReadMemoryArguments struct { type ReadMemoryArguments struct {
MemoryReference string `json:"memoryReference"` MemoryReference string `json:"memoryReference"`
@ -1577,8 +1383,6 @@ type ReadMemoryResponseBody struct {
Data string `json:"data,omitempty"` Data string `json:"data,omitempty"`
} }
func (r *ReadMemoryResponse) GetResponse() *Response { return &r.Response }
// WriteMemoryRequest: Writes bytes to memory at the provided location. // WriteMemoryRequest: Writes bytes to memory at the provided location.
// Clients should only call this request if the corresponding capability `supportsWriteMemoryRequest` is true. // Clients should only call this request if the corresponding capability `supportsWriteMemoryRequest` is true.
type WriteMemoryRequest struct { type WriteMemoryRequest struct {
@ -1587,8 +1391,6 @@ type WriteMemoryRequest struct {
Arguments WriteMemoryArguments `json:"arguments"` Arguments WriteMemoryArguments `json:"arguments"`
} }
func (r *WriteMemoryRequest) GetRequest() *Request { return &r.Request }
// WriteMemoryArguments: Arguments for `writeMemory` request. // WriteMemoryArguments: Arguments for `writeMemory` request.
type WriteMemoryArguments struct { type WriteMemoryArguments struct {
MemoryReference string `json:"memoryReference"` MemoryReference string `json:"memoryReference"`
@ -1609,8 +1411,6 @@ type WriteMemoryResponseBody struct {
BytesWritten int `json:"bytesWritten,omitempty"` BytesWritten int `json:"bytesWritten,omitempty"`
} }
func (r *WriteMemoryResponse) GetResponse() *Response { return &r.Response }
// DisassembleRequest: Disassembles code stored at the provided location. // DisassembleRequest: Disassembles code stored at the provided location.
// Clients should only call this request if the corresponding capability `supportsDisassembleRequest` is true. // Clients should only call this request if the corresponding capability `supportsDisassembleRequest` is true.
type DisassembleRequest struct { type DisassembleRequest struct {
@ -1619,8 +1419,6 @@ type DisassembleRequest struct {
Arguments DisassembleArguments `json:"arguments"` Arguments DisassembleArguments `json:"arguments"`
} }
func (r *DisassembleRequest) GetRequest() *Request { return &r.Request }
// DisassembleArguments: Arguments for `disassemble` request. // DisassembleArguments: Arguments for `disassemble` request.
type DisassembleArguments struct { type DisassembleArguments struct {
MemoryReference string `json:"memoryReference"` MemoryReference string `json:"memoryReference"`
@ -1641,8 +1439,6 @@ type DisassembleResponseBody struct {
Instructions []DisassembledInstruction `json:"instructions"` Instructions []DisassembledInstruction `json:"instructions"`
} }
func (r *DisassembleResponse) GetResponse() *Response { return &r.Response }
// Capabilities: Information about the capabilities of a debug adapter. // Capabilities: Information about the capabilities of a debug adapter.
type Capabilities struct { type Capabilities struct {
SupportsConfigurationDoneRequest bool `json:"supportsConfigurationDoneRequest,omitempty"` SupportsConfigurationDoneRequest bool `json:"supportsConfigurationDoneRequest,omitempty"`

@ -1,3 +1,5 @@
Copyright (c) 2014 HashiCorp, Inc.
Mozilla Public License, version 2.0 Mozilla Public License, version 2.0
1. Definitions 1. Definitions

@ -25,7 +25,7 @@ type entry struct {
// NewLRU constructs an LRU of the given size // NewLRU constructs an LRU of the given size
func NewLRU(size int, onEvict EvictCallback) (*LRU, error) { func NewLRU(size int, onEvict EvictCallback) (*LRU, error) {
if size <= 0 { if size <= 0 {
return nil, errors.New("Must provide a positive size") return nil, errors.New("must provide a positive size")
} }
c := &LRU{ c := &LRU{
size: size, size: size,
@ -109,7 +109,7 @@ func (c *LRU) Remove(key interface{}) (present bool) {
} }
// RemoveOldest removes the oldest item from the cache. // RemoveOldest removes the oldest item from the cache.
func (c *LRU) RemoveOldest() (key interface{}, value interface{}, ok bool) { func (c *LRU) RemoveOldest() (key, value interface{}, ok bool) {
ent := c.evictList.Back() ent := c.evictList.Back()
if ent != nil { if ent != nil {
c.removeElement(ent) c.removeElement(ent)
@ -120,7 +120,7 @@ func (c *LRU) RemoveOldest() (key interface{}, value interface{}, ok bool) {
} }
// GetOldest returns the oldest entry // GetOldest returns the oldest entry
func (c *LRU) GetOldest() (key interface{}, value interface{}, ok bool) { func (c *LRU) GetOldest() (key, value interface{}, ok bool) {
ent := c.evictList.Back() ent := c.evictList.Back()
if ent != nil { if ent != nil {
kv := ent.Value.(*entry) kv := ent.Value.(*entry)

@ -1,3 +1,4 @@
// Package simplelru provides simple LRU implementation based on build-in container/list.
package simplelru package simplelru
// LRUCache is the interface for simple LRU cache. // LRUCache is the interface for simple LRU cache.
@ -34,6 +35,6 @@ type LRUCache interface {
// Clears all cache entries. // Clears all cache entries.
Purge() Purge()
// Resizes cache, returning number evicted // Resizes cache, returning number evicted
Resize(int) int Resize(int) int
} }

@ -1,13 +1,201 @@
Copyright 2014 Alan Shreve Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Licensed under the Apache License, Version 2.0 (the "License"); TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 1. Definitions.
Unless required by applicable law or agreed to in writing, software "License" shall mean the terms and conditions for use, reproduction,
distributed under the License is distributed on an "AS IS" BASIS, and distribution as defined by Sections 1 through 9 of this document.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and "Licensor" shall mean the copyright owner or entity authorized by
limitations under the License. the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2022 Alan Shreve (@inconshreveable)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows // +build !windows
package mousetrap package mousetrap

@ -1,79 +1,30 @@
// +build windows
// +build !go1.4
package mousetrap package mousetrap
import ( import (
"fmt"
"os"
"syscall" "syscall"
"unsafe" "unsafe"
) )
const ( func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) {
// defined by the Win32 API snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0)
th32cs_snapprocess uintptr = 0x2
)
var (
kernel = syscall.MustLoadDLL("kernel32.dll")
CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot")
Process32First = kernel.MustFindProc("Process32FirstW")
Process32Next = kernel.MustFindProc("Process32NextW")
)
// ProcessEntry32 structure defined by the Win32 API
type processEntry32 struct {
dwSize uint32
cntUsage uint32
th32ProcessID uint32
th32DefaultHeapID int
th32ModuleID uint32
cntThreads uint32
th32ParentProcessID uint32
pcPriClassBase int32
dwFlags uint32
szExeFile [syscall.MAX_PATH]uint16
}
func getProcessEntry(pid int) (pe *processEntry32, err error) {
snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0))
if snapshot == uintptr(syscall.InvalidHandle) {
err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1)
return
}
defer syscall.CloseHandle(syscall.Handle(snapshot))
var processEntry processEntry32
processEntry.dwSize = uint32(unsafe.Sizeof(processEntry))
ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
if ok == 0 {
err = fmt.Errorf("Process32First: %v", e1)
return
}
for {
if processEntry.th32ProcessID == uint32(pid) {
pe = &processEntry
return
}
ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
if ok == 0 {
err = fmt.Errorf("Process32Next: %v", e1)
return
}
}
}
func getppid() (pid int, err error) {
pe, err := getProcessEntry(os.Getpid())
if err != nil { if err != nil {
return return nil, err
}
defer syscall.CloseHandle(snapshot)
var procEntry syscall.ProcessEntry32
procEntry.Size = uint32(unsafe.Sizeof(procEntry))
if err = syscall.Process32First(snapshot, &procEntry); err != nil {
return nil, err
}
for {
if procEntry.ProcessID == uint32(pid) {
return &procEntry, nil
}
err = syscall.Process32Next(snapshot, &procEntry)
if err != nil {
return nil, err
}
} }
pid = int(pe.th32ParentProcessID)
return
} }
// StartedByExplorer returns true if the program was invoked by the user double-clicking // StartedByExplorer returns true if the program was invoked by the user double-clicking
@ -83,16 +34,9 @@ func getppid() (pid int, err error) {
// It does not guarantee that the program was run from a terminal. It only can tell you // It does not guarantee that the program was run from a terminal. It only can tell you
// whether it was launched from explorer.exe // whether it was launched from explorer.exe
func StartedByExplorer() bool { func StartedByExplorer() bool {
ppid, err := getppid() pe, err := getProcessEntry(syscall.Getppid())
if err != nil { if err != nil {
return false return false
} }
return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:])
pe, err := getProcessEntry(ppid)
if err != nil {
return false
}
name := syscall.UTF16ToString(pe.szExeFile[:])
return name == "explorer.exe"
} }

@ -1,46 +0,0 @@
// +build windows
// +build go1.4
package mousetrap
import (
"os"
"syscall"
"unsafe"
)
func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) {
snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0)
if err != nil {
return nil, err
}
defer syscall.CloseHandle(snapshot)
var procEntry syscall.ProcessEntry32
procEntry.Size = uint32(unsafe.Sizeof(procEntry))
if err = syscall.Process32First(snapshot, &procEntry); err != nil {
return nil, err
}
for {
if procEntry.ProcessID == uint32(pid) {
return &procEntry, nil
}
err = syscall.Process32Next(snapshot, &procEntry)
if err != nil {
return nil, err
}
}
}
// StartedByExplorer returns true if the program was invoked by the user double-clicking
// on the executable from explorer.exe
//
// It is conservative and returns false if any of the internal calls fail.
// It does not guarantee that the program was run from a terminal. It only can tell you
// whether it was launched from explorer.exe
func StartedByExplorer() bool {
pe, err := getProcessEntry(os.Getppid())
if err != nil {
return false
}
return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:])
}

@ -1,9 +0,0 @@
(The MIT License)
Copyright (c) 2017 marvin + konsorten GmbH (open-source@konsorten.de)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,42 +0,0 @@
# Windows Terminal Sequences
This library allow for enabling Windows terminal color support for Go.
See [Console Virtual Terminal Sequences](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) for details.
## Usage
```go
import (
"syscall"
sequences "github.com/konsorten/go-windows-terminal-sequences"
)
func main() {
sequences.EnableVirtualTerminalProcessing(syscall.Stdout, true)
}
```
## Authors
The tool is sponsored by the [marvin + konsorten GmbH](http://www.konsorten.de).
We thank all the authors who provided code to this library:
* Felix Kollmann
* Nicolas Perraut
* @dirty49374
## License
(The MIT License)
Copyright (c) 2018 marvin + konsorten GmbH (open-source@konsorten.de)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,35 +0,0 @@
// +build windows
package sequences
import (
"syscall"
)
var (
kernel32Dll *syscall.LazyDLL = syscall.NewLazyDLL("Kernel32.dll")
setConsoleMode *syscall.LazyProc = kernel32Dll.NewProc("SetConsoleMode")
)
func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error {
const ENABLE_VIRTUAL_TERMINAL_PROCESSING uint32 = 0x4
var mode uint32
err := syscall.GetConsoleMode(syscall.Stdout, &mode)
if err != nil {
return err
}
if enable {
mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING
} else {
mode &^= ENABLE_VIRTUAL_TERMINAL_PROCESSING
}
ret, _, err := setConsoleMode.Call(uintptr(stream), uintptr(mode))
if ret == 0 {
return err
}
return nil
}

@ -1,11 +0,0 @@
// +build linux darwin
package sequences
import (
"fmt"
)
func EnableVirtualTerminalProcessing(stream uintptr, enable bool) error {
return fmt.Errorf("windows only package")
}

@ -1,9 +0,0 @@
language: go
go:
- tip
before_install:
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
script:
- $HOME/gopath/bin/goveralls -repotoken xnXqRGwgW3SXIguzxf90ZSK1GPYZPaGrw

@ -1,8 +1,8 @@
# go-colorable # go-colorable
[![Godoc Reference](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable) [![Build Status](https://github.com/mattn/go-colorable/workflows/test/badge.svg)](https://github.com/mattn/go-colorable/actions?query=workflow%3Atest)
[![Build Status](https://travis-ci.org/mattn/go-colorable.svg?branch=master)](https://travis-ci.org/mattn/go-colorable) [![Codecov](https://codecov.io/gh/mattn/go-colorable/branch/master/graph/badge.svg)](https://codecov.io/gh/mattn/go-colorable)
[![Coverage Status](https://coveralls.io/repos/github/mattn/go-colorable/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-colorable?branch=master) [![GoDoc](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable)
[![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable) [![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable)
Colorable writer for windows. Colorable writer for windows.

@ -1,3 +1,4 @@
//go:build appengine
// +build appengine // +build appengine
package colorable package colorable
@ -9,7 +10,7 @@ import (
_ "github.com/mattn/go-isatty" _ "github.com/mattn/go-isatty"
) )
// NewColorable return new instance of Writer which handle escape sequence. // NewColorable returns new instance of Writer which handles escape sequence.
func NewColorable(file *os.File) io.Writer { func NewColorable(file *os.File) io.Writer {
if file == nil { if file == nil {
panic("nil passed instead of *os.File to NewColorable()") panic("nil passed instead of *os.File to NewColorable()")
@ -18,12 +19,20 @@ func NewColorable(file *os.File) io.Writer {
return file return file
} }
// NewColorableStdout return new instance of Writer which handle escape sequence for stdout. // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout.
func NewColorableStdout() io.Writer { func NewColorableStdout() io.Writer {
return os.Stdout return os.Stdout
} }
// NewColorableStderr return new instance of Writer which handle escape sequence for stderr. // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr.
func NewColorableStderr() io.Writer { func NewColorableStderr() io.Writer {
return os.Stderr return os.Stderr
} }
// EnableColorsStdout enable colors if possible.
func EnableColorsStdout(enabled *bool) func() {
if enabled != nil {
*enabled = true
}
return func() {}
}

@ -1,5 +1,5 @@
// +build !windows //go:build !windows && !appengine
// +build !appengine // +build !windows,!appengine
package colorable package colorable
@ -10,7 +10,7 @@ import (
_ "github.com/mattn/go-isatty" _ "github.com/mattn/go-isatty"
) )
// NewColorable return new instance of Writer which handle escape sequence. // NewColorable returns new instance of Writer which handles escape sequence.
func NewColorable(file *os.File) io.Writer { func NewColorable(file *os.File) io.Writer {
if file == nil { if file == nil {
panic("nil passed instead of *os.File to NewColorable()") panic("nil passed instead of *os.File to NewColorable()")
@ -19,12 +19,20 @@ func NewColorable(file *os.File) io.Writer {
return file return file
} }
// NewColorableStdout return new instance of Writer which handle escape sequence for stdout. // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout.
func NewColorableStdout() io.Writer { func NewColorableStdout() io.Writer {
return os.Stdout return os.Stdout
} }
// NewColorableStderr return new instance of Writer which handle escape sequence for stderr. // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr.
func NewColorableStderr() io.Writer { func NewColorableStderr() io.Writer {
return os.Stderr return os.Stderr
} }
// EnableColorsStdout enable colors if possible.
func EnableColorsStdout(enabled *bool) func() {
if enabled != nil {
*enabled = true
}
return func() {}
}

@ -1,5 +1,5 @@
// +build windows //go:build windows && !appengine
// +build !appengine // +build windows,!appengine
package colorable package colorable
@ -10,6 +10,7 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"sync"
"syscall" "syscall"
"unsafe" "unsafe"
@ -27,6 +28,18 @@ const (
backgroundRed = 0x40 backgroundRed = 0x40
backgroundIntensity = 0x80 backgroundIntensity = 0x80
backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity) backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
commonLvbUnderscore = 0x8000
cENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4
)
const (
genericRead = 0x80000000
genericWrite = 0x40000000
)
const (
consoleTextmodeBuffer = 0x1
) )
type wchar uint16 type wchar uint16
@ -69,23 +82,33 @@ var (
procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo") procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo")
procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo") procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo")
procSetConsoleTitle = kernel32.NewProc("SetConsoleTitleW") procSetConsoleTitle = kernel32.NewProc("SetConsoleTitleW")
procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
procSetConsoleMode = kernel32.NewProc("SetConsoleMode")
procCreateConsoleScreenBuffer = kernel32.NewProc("CreateConsoleScreenBuffer")
) )
// Writer provide colorable Writer to the console // Writer provides colorable Writer to the console
type Writer struct { type Writer struct {
out io.Writer out io.Writer
handle syscall.Handle handle syscall.Handle
oldattr word althandle syscall.Handle
oldpos coord oldattr word
oldpos coord
rest bytes.Buffer
mutex sync.Mutex
} }
// NewColorable return new instance of Writer which handle escape sequence from File. // NewColorable returns new instance of Writer which handles escape sequence from File.
func NewColorable(file *os.File) io.Writer { func NewColorable(file *os.File) io.Writer {
if file == nil { if file == nil {
panic("nil passed instead of *os.File to NewColorable()") panic("nil passed instead of *os.File to NewColorable()")
} }
if isatty.IsTerminal(file.Fd()) { if isatty.IsTerminal(file.Fd()) {
var mode uint32
if r, _, _ := procGetConsoleMode.Call(file.Fd(), uintptr(unsafe.Pointer(&mode))); r != 0 && mode&cENABLE_VIRTUAL_TERMINAL_PROCESSING != 0 {
return file
}
var csbi consoleScreenBufferInfo var csbi consoleScreenBufferInfo
handle := syscall.Handle(file.Fd()) handle := syscall.Handle(file.Fd())
procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
@ -94,12 +117,12 @@ func NewColorable(file *os.File) io.Writer {
return file return file
} }
// NewColorableStdout return new instance of Writer which handle escape sequence for stdout. // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout.
func NewColorableStdout() io.Writer { func NewColorableStdout() io.Writer {
return NewColorable(os.Stdout) return NewColorable(os.Stdout)
} }
// NewColorableStderr return new instance of Writer which handle escape sequence for stderr. // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr.
func NewColorableStderr() io.Writer { func NewColorableStderr() io.Writer {
return NewColorable(os.Stderr) return NewColorable(os.Stderr)
} }
@ -402,114 +425,171 @@ func doTitleSequence(er *bytes.Reader) error {
return nil return nil
} }
// Write write data on console // returns Atoi(s) unless s == "" in which case it returns def
func atoiWithDefault(s string, def int) (int, error) {
if s == "" {
return def, nil
}
return strconv.Atoi(s)
}
// Write writes data on console
func (w *Writer) Write(data []byte) (n int, err error) { func (w *Writer) Write(data []byte) (n int, err error) {
w.mutex.Lock()
defer w.mutex.Unlock()
var csbi consoleScreenBufferInfo var csbi consoleScreenBufferInfo
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
er := bytes.NewReader(data) handle := w.handle
var bw [1]byte
var er *bytes.Reader
if w.rest.Len() > 0 {
var rest bytes.Buffer
w.rest.WriteTo(&rest)
w.rest.Reset()
rest.Write(data)
er = bytes.NewReader(rest.Bytes())
} else {
er = bytes.NewReader(data)
}
var plaintext bytes.Buffer
loop: loop:
for { for {
c1, err := er.ReadByte() c1, err := er.ReadByte()
if err != nil { if err != nil {
plaintext.WriteTo(w.out)
break loop break loop
} }
if c1 != 0x1b { if c1 != 0x1b {
bw[0] = c1 plaintext.WriteByte(c1)
w.out.Write(bw[:])
continue continue
} }
_, err = plaintext.WriteTo(w.out)
if err != nil {
break loop
}
c2, err := er.ReadByte() c2, err := er.ReadByte()
if err != nil { if err != nil {
break loop break loop
} }
if c2 == ']' { switch c2 {
if err := doTitleSequence(er); err != nil { case '>':
continue
case ']':
w.rest.WriteByte(c1)
w.rest.WriteByte(c2)
er.WriteTo(&w.rest)
if bytes.IndexByte(w.rest.Bytes(), 0x07) == -1 {
break loop break loop
} }
continue er = bytes.NewReader(w.rest.Bytes()[2:])
} err := doTitleSequence(er)
if c2 != 0x5b {
continue
}
var buf bytes.Buffer
var m byte
for {
c, err := er.ReadByte()
if err != nil { if err != nil {
break loop break loop
} }
w.rest.Reset()
continue
// https://github.com/mattn/go-colorable/issues/27
case '7':
procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
w.oldpos = csbi.cursorPosition
continue
case '8':
procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&w.oldpos)))
continue
case 0x5b:
// execute part after switch
default:
continue
}
w.rest.WriteByte(c1)
w.rest.WriteByte(c2)
er.WriteTo(&w.rest)
var buf bytes.Buffer
var m byte
for i, c := range w.rest.Bytes()[2:] {
if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
m = c m = c
er = bytes.NewReader(w.rest.Bytes()[2+i+1:])
w.rest.Reset()
break break
} }
buf.Write([]byte(string(c))) buf.Write([]byte(string(c)))
} }
if m == 0 {
break loop
}
switch m { switch m {
case 'A': case 'A':
n, err = strconv.Atoi(buf.String()) n, err = atoiWithDefault(buf.String(), 1)
if err != nil { if err != nil {
continue continue
} }
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.y -= short(n) csbi.cursorPosition.y -= short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'B': case 'B':
n, err = strconv.Atoi(buf.String()) n, err = atoiWithDefault(buf.String(), 1)
if err != nil { if err != nil {
continue continue
} }
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.y += short(n) csbi.cursorPosition.y += short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'C': case 'C':
n, err = strconv.Atoi(buf.String()) n, err = atoiWithDefault(buf.String(), 1)
if err != nil { if err != nil {
continue continue
} }
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x += short(n) csbi.cursorPosition.x += short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'D': case 'D':
n, err = strconv.Atoi(buf.String()) n, err = atoiWithDefault(buf.String(), 1)
if err != nil { if err != nil {
continue continue
} }
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x -= short(n) csbi.cursorPosition.x -= short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) if csbi.cursorPosition.x < 0 {
csbi.cursorPosition.x = 0
}
procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'E': case 'E':
n, err = strconv.Atoi(buf.String()) n, err = strconv.Atoi(buf.String())
if err != nil { if err != nil {
continue continue
} }
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x = 0 csbi.cursorPosition.x = 0
csbi.cursorPosition.y += short(n) csbi.cursorPosition.y += short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'F': case 'F':
n, err = strconv.Atoi(buf.String()) n, err = strconv.Atoi(buf.String())
if err != nil { if err != nil {
continue continue
} }
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x = 0 csbi.cursorPosition.x = 0
csbi.cursorPosition.y -= short(n) csbi.cursorPosition.y -= short(n)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'G': case 'G':
n, err = strconv.Atoi(buf.String()) n, err = strconv.Atoi(buf.String())
if err != nil { if err != nil {
continue continue
} }
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) if n < 1 {
n = 1
}
procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
csbi.cursorPosition.x = short(n - 1) csbi.cursorPosition.x = short(n - 1)
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'H', 'f': case 'H', 'f':
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
if buf.Len() > 0 { if buf.Len() > 0 {
token := strings.Split(buf.String(), ";") token := strings.Split(buf.String(), ";")
switch len(token) { switch len(token) {
@ -534,7 +614,7 @@ loop:
} else { } else {
csbi.cursorPosition.y = 0 csbi.cursorPosition.y = 0
} }
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
case 'J': case 'J':
n := 0 n := 0
if buf.Len() > 0 { if buf.Len() > 0 {
@ -545,20 +625,20 @@ loop:
} }
var count, written dword var count, written dword
var cursor coord var cursor coord
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
switch n { switch n {
case 0: case 0:
cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y}
count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x) count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.size.y-csbi.cursorPosition.y)*dword(csbi.size.x)
case 1: case 1:
cursor = coord{x: csbi.window.left, y: csbi.window.top} cursor = coord{x: csbi.window.left, y: csbi.window.top}
count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.window.top-csbi.cursorPosition.y)*csbi.size.x) count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.window.top-csbi.cursorPosition.y)*dword(csbi.size.x)
case 2: case 2:
cursor = coord{x: csbi.window.left, y: csbi.window.top} cursor = coord{x: csbi.window.left, y: csbi.window.top}
count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x) count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.size.y-csbi.cursorPosition.y)*dword(csbi.size.x)
} }
procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
case 'K': case 'K':
n := 0 n := 0
if buf.Len() > 0 { if buf.Len() > 0 {
@ -567,28 +647,42 @@ loop:
continue continue
} }
} }
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
var cursor coord var cursor coord
var count, written dword var count, written dword
switch n { switch n {
case 0: case 0:
cursor = coord{x: csbi.cursorPosition.x + 1, y: csbi.cursorPosition.y} cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y}
count = dword(csbi.size.x - csbi.cursorPosition.x - 1) count = dword(csbi.size.x - csbi.cursorPosition.x)
case 1: case 1:
cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y} cursor = coord{x: csbi.window.left, y: csbi.cursorPosition.y}
count = dword(csbi.size.x - csbi.cursorPosition.x) count = dword(csbi.size.x - csbi.cursorPosition.x)
case 2: case 2:
cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y} cursor = coord{x: csbi.window.left, y: csbi.cursorPosition.y}
count = dword(csbi.size.x) count = dword(csbi.size.x)
} }
procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
case 'X':
n := 0
if buf.Len() > 0 {
n, err = strconv.Atoi(buf.String())
if err != nil {
continue
}
}
procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
var cursor coord
var written dword
cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y}
procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
case 'm': case 'm':
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
attr := csbi.attributes attr := csbi.attributes
cs := buf.String() cs := buf.String()
if cs == "" { if cs == "" {
procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(w.oldattr)) procSetConsoleTextAttribute.Call(uintptr(handle), uintptr(w.oldattr))
continue continue
} }
token := strings.Split(cs, ";") token := strings.Split(cs, ";")
@ -598,14 +692,19 @@ loop:
switch { switch {
case n == 0 || n == 100: case n == 0 || n == 100:
attr = w.oldattr attr = w.oldattr
case 1 <= n && n <= 5: case n == 4:
attr |= commonLvbUnderscore
case (1 <= n && n <= 3) || n == 5:
attr |= foregroundIntensity attr |= foregroundIntensity
case n == 7: case n == 7 || n == 27:
attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) attr =
case n == 22 || n == 25: (attr &^ (foregroundMask | backgroundMask)) |
attr |= foregroundIntensity ((attr & foregroundMask) << 4) |
case n == 27: ((attr & backgroundMask) >> 4)
attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) case n == 22:
attr &^= foregroundIntensity
case n == 24:
attr &^= commonLvbUnderscore
case 30 <= n && n <= 37: case 30 <= n && n <= 37:
attr &= backgroundMask attr &= backgroundMask
if (n-30)&1 != 0 { if (n-30)&1 != 0 {
@ -624,9 +723,24 @@ loop:
n256setup() n256setup()
} }
attr &= backgroundMask attr &= backgroundMask
attr |= n256foreAttr[n256] attr |= n256foreAttr[n256%len(n256foreAttr)]
i += 2 i += 2
} }
} else if len(token) == 5 && token[i+1] == "2" {
var r, g, b int
r, _ = strconv.Atoi(token[i+2])
g, _ = strconv.Atoi(token[i+3])
b, _ = strconv.Atoi(token[i+4])
i += 4
if r > 127 {
attr |= foregroundRed
}
if g > 127 {
attr |= foregroundGreen
}
if b > 127 {
attr |= foregroundBlue
}
} else { } else {
attr = attr & (w.oldattr & backgroundMask) attr = attr & (w.oldattr & backgroundMask)
} }
@ -651,9 +765,24 @@ loop:
n256setup() n256setup()
} }
attr &= foregroundMask attr &= foregroundMask
attr |= n256backAttr[n256] attr |= n256backAttr[n256%len(n256backAttr)]
i += 2 i += 2
} }
} else if len(token) == 5 && token[i+1] == "2" {
var r, g, b int
r, _ = strconv.Atoi(token[i+2])
g, _ = strconv.Atoi(token[i+3])
b, _ = strconv.Atoi(token[i+4])
i += 4
if r > 127 {
attr |= backgroundRed
}
if g > 127 {
attr |= backgroundGreen
}
if b > 127 {
attr |= backgroundBlue
}
} else { } else {
attr = attr & (w.oldattr & foregroundMask) attr = attr & (w.oldattr & foregroundMask)
} }
@ -685,38 +814,52 @@ loop:
attr |= backgroundBlue attr |= backgroundBlue
} }
} }
procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr)) procSetConsoleTextAttribute.Call(uintptr(handle), uintptr(attr))
} }
} }
case 'h': case 'h':
var ci consoleCursorInfo var ci consoleCursorInfo
cs := buf.String() cs := buf.String()
if cs == "5>" { if cs == "5>" {
procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci)))
ci.visible = 0 ci.visible = 0
procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci)))
} else if cs == "?25" { } else if cs == "?25" {
procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci)))
ci.visible = 1 ci.visible = 1
procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci)))
} else if cs == "?1049" {
if w.althandle == 0 {
h, _, _ := procCreateConsoleScreenBuffer.Call(uintptr(genericRead|genericWrite), 0, 0, uintptr(consoleTextmodeBuffer), 0, 0)
w.althandle = syscall.Handle(h)
if w.althandle != 0 {
handle = w.althandle
}
}
} }
case 'l': case 'l':
var ci consoleCursorInfo var ci consoleCursorInfo
cs := buf.String() cs := buf.String()
if cs == "5>" { if cs == "5>" {
procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci)))
ci.visible = 1 ci.visible = 1
procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci)))
} else if cs == "?25" { } else if cs == "?25" {
procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci)))
ci.visible = 0 ci.visible = 0
procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci)))
} else if cs == "?1049" {
if w.althandle != 0 {
syscall.CloseHandle(w.althandle)
w.althandle = 0
handle = w.handle
}
} }
case 's': case 's':
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
w.oldpos = csbi.cursorPosition w.oldpos = csbi.cursorPosition
case 'u': case 'u':
procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&w.oldpos))) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&w.oldpos)))
} }
} }
@ -882,3 +1025,23 @@ func n256setup() {
n256backAttr[i] = c.backgroundAttr() n256backAttr[i] = c.backgroundAttr()
} }
} }
// EnableColorsStdout enable colors if possible.
func EnableColorsStdout(enabled *bool) func() {
var mode uint32
h := os.Stdout.Fd()
if r, _, _ := procGetConsoleMode.Call(h, uintptr(unsafe.Pointer(&mode))); r != 0 {
if r, _, _ = procSetConsoleMode.Call(h, uintptr(mode|cENABLE_VIRTUAL_TERMINAL_PROCESSING)); r != 0 {
if enabled != nil {
*enabled = true
}
return func() {
procSetConsoleMode.Call(h, uintptr(mode))
}
}
}
if enabled != nil {
*enabled = true
}
return func() {}
}

12
vendor/github.com/mattn/go-colorable/go.test.sh generated vendored Normal file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e
echo "" > coverage.txt
for d in $(go list ./... | grep -v vendor); do
go test -race -coverprofile=profile.out -covermode=atomic "$d"
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done

@ -5,31 +5,35 @@ import (
"io" "io"
) )
// NonColorable hold writer but remove escape sequence. // NonColorable holds writer but removes escape sequence.
type NonColorable struct { type NonColorable struct {
out io.Writer out io.Writer
} }
// NewNonColorable return new instance of Writer which remove escape sequence from Writer. // NewNonColorable returns new instance of Writer which removes escape sequence from Writer.
func NewNonColorable(w io.Writer) io.Writer { func NewNonColorable(w io.Writer) io.Writer {
return &NonColorable{out: w} return &NonColorable{out: w}
} }
// Write write data on console // Write writes data on console
func (w *NonColorable) Write(data []byte) (n int, err error) { func (w *NonColorable) Write(data []byte) (n int, err error) {
er := bytes.NewReader(data) er := bytes.NewReader(data)
var bw [1]byte var plaintext bytes.Buffer
loop: loop:
for { for {
c1, err := er.ReadByte() c1, err := er.ReadByte()
if err != nil { if err != nil {
plaintext.WriteTo(w.out)
break loop break loop
} }
if c1 != 0x1b { if c1 != 0x1b {
bw[0] = c1 plaintext.WriteByte(c1)
w.out.Write(bw[:])
continue continue
} }
_, err = plaintext.WriteTo(w.out)
if err != nil {
break loop
}
c2, err := er.ReadByte() c2, err := er.ReadByte()
if err != nil { if err != nil {
break loop break loop
@ -38,7 +42,6 @@ loop:
continue continue
} }
var buf bytes.Buffer
for { for {
c, err := er.ReadByte() c, err := er.ReadByte()
if err != nil { if err != nil {
@ -47,7 +50,6 @@ loop:
if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
break break
} }
buf.Write([]byte(string(c)))
} }
} }

@ -1,9 +0,0 @@
language: go
go:
- tip
before_install:
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
script:
- $HOME/gopath/bin/goveralls -repotoken 3gHdORO5k5ziZcWMBxnd9LrMZaJs8m9x5

@ -1,7 +1,7 @@
# go-isatty # go-isatty
[![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty) [![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty)
[![Build Status](https://travis-ci.org/mattn/go-isatty.svg?branch=master)](https://travis-ci.org/mattn/go-isatty) [![Codecov](https://codecov.io/gh/mattn/go-isatty/branch/master/graph/badge.svg)](https://codecov.io/gh/mattn/go-isatty)
[![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master) [![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master)
[![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty) [![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty)

12
vendor/github.com/mattn/go-isatty/go.test.sh generated vendored Normal file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e
echo "" > coverage.txt
for d in $(go list ./... | grep -v vendor); do
go test -race -coverprofile=profile.out -covermode=atomic "$d"
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done

@ -1,15 +0,0 @@
// +build appengine
package isatty
// IsTerminal returns true if the file descriptor is terminal which
// is always false on on appengine classic which is a sandboxed PaaS.
func IsTerminal(fd uintptr) bool {
return false
}
// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool {
return false
}

@ -1,18 +1,20 @@
// +build darwin freebsd openbsd netbsd dragonfly //go:build (darwin || freebsd || openbsd || netbsd || dragonfly || hurd) && !appengine && !tinygo
// +build darwin freebsd openbsd netbsd dragonfly hurd
// +build !appengine // +build !appengine
// +build !tinygo
package isatty package isatty
import ( import "golang.org/x/sys/unix"
"syscall"
"unsafe"
)
const ioctlReadTermios = syscall.TIOCGETA
// IsTerminal return true if the file descriptor is terminal. // IsTerminal return true if the file descriptor is terminal.
func IsTerminal(fd uintptr) bool { func IsTerminal(fd uintptr) bool {
var termios syscall.Termios _, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA)
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) return err == nil
return err == 0 }
// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool {
return false
} }

@ -1,18 +0,0 @@
// +build linux
// +build !appengine,!ppc64,!ppc64le
package isatty
import (
"syscall"
"unsafe"
)
const ioctlReadTermios = syscall.TCGETS
// IsTerminal return true if the file descriptor is terminal.
func IsTerminal(fd uintptr) bool {
var termios syscall.Termios
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
return err == 0
}

@ -1,19 +0,0 @@
// +build linux
// +build ppc64 ppc64le
package isatty
import (
"unsafe"
syscall "golang.org/x/sys/unix"
)
const ioctlReadTermios = syscall.TCGETS
// IsTerminal return true if the file descriptor is terminal.
func IsTerminal(fd uintptr) bool {
var termios syscall.Termios
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
return err == 0
}

@ -1,8 +1,15 @@
//go:build (appengine || js || nacl || tinygo || wasm) && !windows
// +build appengine js nacl tinygo wasm
// +build !windows // +build !windows
// +build !appengine
package isatty package isatty
// IsTerminal returns true if the file descriptor is terminal which
// is always false on js and appengine classic which is a sandboxed PaaS.
func IsTerminal(fd uintptr) bool {
return false
}
// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment. // terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool { func IsCygwinTerminal(fd uintptr) bool {

23
vendor/github.com/mattn/go-isatty/isatty_plan9.go generated vendored Normal file

@ -0,0 +1,23 @@
//go:build plan9
// +build plan9
package isatty
import (
"syscall"
)
// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(fd uintptr) bool {
path, err := syscall.Fd2path(int(fd))
if err != nil {
return false
}
return path == "/dev/cons" || path == "/mnt/term/dev/cons"
}
// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool {
return false
}

@ -1,5 +1,5 @@
// +build solaris //go:build solaris && !appengine
// +build !appengine // +build solaris,!appengine
package isatty package isatty
@ -8,9 +8,14 @@ import (
) )
// IsTerminal returns true if the given file descriptor is a terminal. // IsTerminal returns true if the given file descriptor is a terminal.
// see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c // see: https://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/isatty.c
func IsTerminal(fd uintptr) bool { func IsTerminal(fd uintptr) bool {
var termio unix.Termio _, err := unix.IoctlGetTermio(int(fd), unix.TCGETA)
err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
return err == nil return err == nil
} }
// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool {
return false
}

20
vendor/github.com/mattn/go-isatty/isatty_tcgets.go generated vendored Normal file

@ -0,0 +1,20 @@
//go:build (linux || aix || zos) && !appengine && !tinygo
// +build linux aix zos
// +build !appengine
// +build !tinygo
package isatty
import "golang.org/x/sys/unix"
// IsTerminal return true if the file descriptor is terminal.
func IsTerminal(fd uintptr) bool {
_, err := unix.IoctlGetTermios(int(fd), unix.TCGETS)
return err == nil
}
// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool {
return false
}

@ -1,9 +1,10 @@
// +build windows //go:build windows && !appengine
// +build !appengine // +build windows,!appengine
package isatty package isatty
import ( import (
"errors"
"strings" "strings"
"syscall" "syscall"
"unicode/utf16" "unicode/utf16"
@ -11,15 +12,18 @@ import (
) )
const ( const (
fileNameInfo uintptr = 2 objectNameInfo uintptr = 1
fileTypePipe = 3 fileNameInfo = 2
fileTypePipe = 3
) )
var ( var (
kernel32 = syscall.NewLazyDLL("kernel32.dll") kernel32 = syscall.NewLazyDLL("kernel32.dll")
ntdll = syscall.NewLazyDLL("ntdll.dll")
procGetConsoleMode = kernel32.NewProc("GetConsoleMode") procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx") procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx")
procGetFileType = kernel32.NewProc("GetFileType") procGetFileType = kernel32.NewProc("GetFileType")
procNtQueryObject = ntdll.NewProc("NtQueryObject")
) )
func init() { func init() {
@ -45,7 +49,10 @@ func isCygwinPipeName(name string) bool {
return false return false
} }
if token[0] != `\msys` && token[0] != `\cygwin` { if token[0] != `\msys` &&
token[0] != `\cygwin` &&
token[0] != `\Device\NamedPipe\msys` &&
token[0] != `\Device\NamedPipe\cygwin` {
return false return false
} }
@ -68,11 +75,35 @@ func isCygwinPipeName(name string) bool {
return true return true
} }
// getFileNameByHandle use the undocomented ntdll NtQueryObject to get file full name from file handler
// since GetFileInformationByHandleEx is not available under windows Vista and still some old fashion
// guys are using Windows XP, this is a workaround for those guys, it will also work on system from
// Windows vista to 10
// see https://stackoverflow.com/a/18792477 for details
func getFileNameByHandle(fd uintptr) (string, error) {
if procNtQueryObject == nil {
return "", errors.New("ntdll.dll: NtQueryObject not supported")
}
var buf [4 + syscall.MAX_PATH]uint16
var result int
r, _, e := syscall.Syscall6(procNtQueryObject.Addr(), 5,
fd, objectNameInfo, uintptr(unsafe.Pointer(&buf)), uintptr(2*len(buf)), uintptr(unsafe.Pointer(&result)), 0)
if r != 0 {
return "", e
}
return string(utf16.Decode(buf[4 : 4+buf[0]/2])), nil
}
// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
// terminal. // terminal.
func IsCygwinTerminal(fd uintptr) bool { func IsCygwinTerminal(fd uintptr) bool {
if procGetFileInformationByHandleEx == nil { if procGetFileInformationByHandleEx == nil {
return false name, err := getFileNameByHandle(fd)
if err != nil {
return false
}
return isCygwinPipeName(name)
} }
// Cygwin/msys's pty is a pipe. // Cygwin/msys's pty is a pipe.

@ -1,4 +1,6 @@
Blackfriday [![Build Status](https://travis-ci.org/russross/blackfriday.svg?branch=master)](https://travis-ci.org/russross/blackfriday) Blackfriday
[![Build Status][BuildV2SVG]][BuildV2URL]
[![PkgGoDev][PkgGoDevV2SVG]][PkgGoDevV2URL]
=========== ===========
Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It
@ -16,19 +18,21 @@ It started as a translation from C of [Sundown][3].
Installation Installation
------------ ------------
Blackfriday is compatible with any modern Go release. With Go 1.7 and git Blackfriday is compatible with modern Go releases in module mode.
installed: With Go installed:
go get gopkg.in/russross/blackfriday.v2 go get github.com/russross/blackfriday/v2
will download, compile, and install the package into your `$GOPATH` will resolve and add the package to the current development module,
directory hierarchy. Alternatively, you can achieve the same if you then build and install it. Alternatively, you can achieve the same
import it into a project: if you import it in a package:
import "gopkg.in/russross/blackfriday.v2" import "github.com/russross/blackfriday/v2"
and `go get` without parameters. and `go get` without parameters.
Legacy GOPATH mode is unsupported.
Versions Versions
-------- --------
@ -36,13 +40,9 @@ Versions
Currently maintained and recommended version of Blackfriday is `v2`. It's being Currently maintained and recommended version of Blackfriday is `v2`. It's being
developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the
documentation is available at documentation is available at
https://godoc.org/gopkg.in/russross/blackfriday.v2. https://pkg.go.dev/github.com/russross/blackfriday/v2.
It is `go get`-able via via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`, It is `go get`-able in module mode at `github.com/russross/blackfriday/v2`.
but we highly recommend using package management tool like [dep][7] or
[Glide][8] and make use of semantic versioning. With package management you
should import `github.com/russross/blackfriday` and specify that you're using
version 2.0.0.
Version 2 offers a number of improvements over v1: Version 2 offers a number of improvements over v1:
@ -62,6 +62,11 @@ Potential drawbacks:
v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for
tracking. tracking.
If you are still interested in the legacy `v1`, you can import it from
`github.com/russross/blackfriday`. Documentation for the legacy v1 can be found
here: https://pkg.go.dev/github.com/russross/blackfriday.
Usage Usage
----- -----
@ -91,7 +96,7 @@ Here's an example of simple usage of Blackfriday together with Bluemonday:
```go ```go
import ( import (
"github.com/microcosm-cc/bluemonday" "github.com/microcosm-cc/bluemonday"
"github.com/russross/blackfriday" "github.com/russross/blackfriday/v2"
) )
// ... // ...
@ -104,6 +109,8 @@ html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
If you want to customize the set of options, use `blackfriday.WithExtensions`, If you want to customize the set of options, use `blackfriday.WithExtensions`,
`blackfriday.WithRenderer` and `blackfriday.WithRefOverride`. `blackfriday.WithRenderer` and `blackfriday.WithRefOverride`.
### `blackfriday-tool`
You can also check out `blackfriday-tool` for a more complete example You can also check out `blackfriday-tool` for a more complete example
of how to use it. Download and install it using: of how to use it. Download and install it using:
@ -114,7 +121,7 @@ markdown file using a standalone program. You can also browse the
source directly on github if you are just looking for some example source directly on github if you are just looking for some example
code: code:
* <http://github.com/russross/blackfriday-tool> * <https://github.com/russross/blackfriday-tool>
Note that if you have not already done so, installing Note that if you have not already done so, installing
`blackfriday-tool` will be sufficient to download and install `blackfriday-tool` will be sufficient to download and install
@ -123,6 +130,22 @@ installed in `$GOPATH/bin`. This is a statically-linked binary that
can be copied to wherever you need it without worrying about can be copied to wherever you need it without worrying about
dependencies and library versions. dependencies and library versions.
### Sanitized anchor names
Blackfriday includes an algorithm for creating sanitized anchor names
corresponding to a given input text. This algorithm is used to create
anchors for headings when `AutoHeadingIDs` extension is enabled. The
algorithm has a specification, so that other packages can create
compatible anchor names and links to those anchors.
The specification is located at https://pkg.go.dev/github.com/russross/blackfriday/v2#hdr-Sanitized_Anchor_Names.
[`SanitizedAnchorName`](https://pkg.go.dev/github.com/russross/blackfriday/v2#SanitizedAnchorName) exposes this functionality, and can be used to
create compatible links to the anchor names generated by blackfriday.
This algorithm is also implemented in a small standalone package at
[`github.com/shurcooL/sanitized_anchor_name`](https://pkg.go.dev/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients
that want a small package and don't need full functionality of blackfriday.
Features Features
-------- --------
@ -199,6 +222,15 @@ implements the following extensions:
You can use 3 or more backticks to mark the beginning of the You can use 3 or more backticks to mark the beginning of the
block, and the same number to mark the end of the block. block, and the same number to mark the end of the block.
To preserve classes of fenced code blocks while using the bluemonday
HTML sanitizer, use the following policy:
```go
p := bluemonday.UGCPolicy()
p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code")
html := p.SanitizeBytes(unsafe)
```
* **Definition lists**. A simple definition list is made of a single-line * **Definition lists**. A simple definition list is made of a single-line
term followed by a colon and the definition for that term. term followed by a colon and the definition for that term.
@ -250,7 +282,7 @@ Other renderers
Blackfriday is structured to allow alternative rendering engines. Here Blackfriday is structured to allow alternative rendering engines. Here
are a few of note: are a few of note:
* [github_flavored_markdown](https://godoc.org/github.com/shurcooL/github_flavored_markdown): * [github_flavored_markdown](https://pkg.go.dev/github.com/shurcooL/github_flavored_markdown):
provides a GitHub Flavored Markdown renderer with fenced code block provides a GitHub Flavored Markdown renderer with fenced code block
highlighting, clickable heading anchor links. highlighting, clickable heading anchor links.
@ -261,20 +293,28 @@ are a few of note:
* [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt, * [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt,
but for markdown. but for markdown.
* [LaTeX output](https://github.com/Ambrevar/Blackfriday-LaTeX): * [LaTeX output](https://gitlab.com/ambrevar/blackfriday-latex):
renders output as LaTeX. renders output as LaTeX.
* [bfchroma](https://github.com/Depado/bfchroma/): provides convenience
integration with the [Chroma](https://github.com/alecthomas/chroma) code
highlighting library. bfchroma is only compatible with v2 of Blackfriday and
provides a drop-in renderer ready to use with Blackfriday, as well as
options and means for further customization.
* [Blackfriday-Confluence](https://github.com/kentaro-m/blackfriday-confluence): provides a [Confluence Wiki Markup](https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html) renderer. * [Blackfriday-Confluence](https://github.com/kentaro-m/blackfriday-confluence): provides a [Confluence Wiki Markup](https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html) renderer.
* [Blackfriday-Slack](https://github.com/karriereat/blackfriday-slack): converts markdown to slack message style
Todo
TODO
---- ----
* More unit testing * More unit testing
* Improve unicode support. It does not understand all unicode * Improve Unicode support. It does not understand all Unicode
rules (about what constitutes a letter, a punctuation symbol, rules (about what constitutes a letter, a punctuation symbol,
etc.), so it may fail to detect word boundaries correctly in etc.), so it may fail to detect word boundaries correctly in
some instances. It is safe on all utf-8 input. some instances. It is safe on all UTF-8 input.
License License
@ -286,6 +326,10 @@ License
[1]: https://daringfireball.net/projects/markdown/ "Markdown" [1]: https://daringfireball.net/projects/markdown/ "Markdown"
[2]: https://golang.org/ "Go Language" [2]: https://golang.org/ "Go Language"
[3]: https://github.com/vmg/sundown "Sundown" [3]: https://github.com/vmg/sundown "Sundown"
[4]: https://godoc.org/gopkg.in/russross/blackfriday.v2#Parse "Parse func" [4]: https://pkg.go.dev/github.com/russross/blackfriday/v2#Parse "Parse func"
[5]: https://github.com/microcosm-cc/bluemonday "Bluemonday" [5]: https://github.com/microcosm-cc/bluemonday "Bluemonday"
[6]: https://labix.org/gopkg.in "gopkg.in"
[BuildV2SVG]: https://travis-ci.org/russross/blackfriday.svg?branch=v2
[BuildV2URL]: https://travis-ci.org/russross/blackfriday
[PkgGoDevV2SVG]: https://pkg.go.dev/badge/github.com/russross/blackfriday/v2
[PkgGoDevV2URL]: https://pkg.go.dev/github.com/russross/blackfriday/v2

@ -18,8 +18,7 @@ import (
"html" "html"
"regexp" "regexp"
"strings" "strings"
"unicode"
"github.com/shurcooL/sanitized_anchor_name"
) )
const ( const (
@ -259,7 +258,7 @@ func (p *Markdown) prefixHeading(data []byte) int {
} }
if end > i { if end > i {
if id == "" && p.extensions&AutoHeadingIDs != 0 { if id == "" && p.extensions&AutoHeadingIDs != 0 {
id = sanitized_anchor_name.Create(string(data[i:end])) id = SanitizedAnchorName(string(data[i:end]))
} }
block := p.addBlock(Heading, data[i:end]) block := p.addBlock(Heading, data[i:end])
block.HeadingID = id block.HeadingID = id
@ -673,6 +672,7 @@ func (p *Markdown) fencedCodeBlock(data []byte, doRender bool) int {
if beg == 0 || beg >= len(data) { if beg == 0 || beg >= len(data) {
return 0 return 0
} }
fenceLength := beg - 1
var work bytes.Buffer var work bytes.Buffer
work.Write([]byte(info)) work.Write([]byte(info))
@ -706,6 +706,7 @@ func (p *Markdown) fencedCodeBlock(data []byte, doRender bool) int {
if doRender { if doRender {
block := p.addBlock(CodeBlock, work.Bytes()) // TODO: get rid of temp buffer block := p.addBlock(CodeBlock, work.Bytes()) // TODO: get rid of temp buffer
block.IsFenced = true block.IsFenced = true
block.FenceLength = fenceLength
finalizeCodeBlock(block) finalizeCodeBlock(block)
} }
@ -1503,7 +1504,7 @@ func (p *Markdown) paragraph(data []byte) int {
id := "" id := ""
if p.extensions&AutoHeadingIDs != 0 { if p.extensions&AutoHeadingIDs != 0 {
id = sanitized_anchor_name.Create(string(data[prev:eol])) id = SanitizedAnchorName(string(data[prev:eol]))
} }
block := p.addBlock(Heading, data[prev:eol]) block := p.addBlock(Heading, data[prev:eol])
@ -1588,3 +1589,24 @@ func skipUntilChar(text []byte, start int, char byte) int {
} }
return i return i
} }
// SanitizedAnchorName returns a sanitized anchor name for the given text.
//
// It implements the algorithm specified in the package comment.
func SanitizedAnchorName(text string) string {
var anchorName []rune
futureDash := false
for _, r := range text {
switch {
case unicode.IsLetter(r) || unicode.IsNumber(r):
if futureDash && len(anchorName) > 0 {
anchorName = append(anchorName, '-')
}
futureDash = false
anchorName = append(anchorName, unicode.ToLower(r))
default:
futureDash = true
}
}
return string(anchorName)
}

@ -15,4 +15,32 @@
// //
// If you're interested in calling Blackfriday from command line, see // If you're interested in calling Blackfriday from command line, see
// https://github.com/russross/blackfriday-tool. // https://github.com/russross/blackfriday-tool.
//
// Sanitized Anchor Names
//
// Blackfriday includes an algorithm for creating sanitized anchor names
// corresponding to a given input text. This algorithm is used to create
// anchors for headings when AutoHeadingIDs extension is enabled. The
// algorithm is specified below, so that other packages can create
// compatible anchor names and links to those anchors.
//
// The algorithm iterates over the input text, interpreted as UTF-8,
// one Unicode code point (rune) at a time. All runes that are letters (category L)
// or numbers (category N) are considered valid characters. They are mapped to
// lower case, and included in the output. All other runes are considered
// invalid characters. Invalid characters that precede the first valid character,
// as well as invalid character that follow the last valid character
// are dropped completely. All other sequences of invalid characters
// between two valid characters are replaced with a single dash character '-'.
//
// SanitizedAnchorName exposes this functionality, and can be used to
// create compatible links to the anchor names generated by blackfriday.
// This algorithm is also implemented in a small standalone package at
// github.com/shurcooL/sanitized_anchor_name. It can be useful for clients
// that want a small package and don't need full functionality of blackfriday.
package blackfriday package blackfriday
// NOTE: Keep Sanitized Anchor Name algorithm in sync with package
// github.com/shurcooL/sanitized_anchor_name.
// Otherwise, users of sanitized_anchor_name will get anchor names
// that are incompatible with those generated by blackfriday.

2236
vendor/github.com/russross/blackfriday/v2/entities.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

@ -13,13 +13,27 @@ var htmlEscaper = [256][]byte{
} }
func escapeHTML(w io.Writer, s []byte) { func escapeHTML(w io.Writer, s []byte) {
escapeEntities(w, s, false)
}
func escapeAllHTML(w io.Writer, s []byte) {
escapeEntities(w, s, true)
}
func escapeEntities(w io.Writer, s []byte, escapeValidEntities bool) {
var start, end int var start, end int
for end < len(s) { for end < len(s) {
escSeq := htmlEscaper[s[end]] escSeq := htmlEscaper[s[end]]
if escSeq != nil { if escSeq != nil {
w.Write(s[start:end]) isEntity, entityEnd := nodeIsEntity(s, end)
w.Write(escSeq) if isEntity && !escapeValidEntities {
start = end + 1 w.Write(s[start : entityEnd+1])
start = entityEnd + 1
} else {
w.Write(s[start:end])
w.Write(escSeq)
start = end + 1
}
} }
end++ end++
} }
@ -28,6 +42,28 @@ func escapeHTML(w io.Writer, s []byte) {
} }
} }
func nodeIsEntity(s []byte, end int) (isEntity bool, endEntityPos int) {
isEntity = false
endEntityPos = end + 1
if s[end] == '&' {
for endEntityPos < len(s) {
if s[endEntityPos] == ';' {
if entities[string(s[end:endEntityPos+1])] {
isEntity = true
break
}
}
if !isalnum(s[endEntityPos]) && s[endEntityPos] != '&' && s[endEntityPos] != '#' {
break
}
endEntityPos++
}
}
return isEntity, endEntityPos
}
func escLink(w io.Writer, text []byte) { func escLink(w io.Writer, text []byte) {
unesc := html.UnescapeString(string(text)) unesc := html.UnescapeString(string(text))
escapeHTML(w, []byte(unesc)) escapeHTML(w, []byte(unesc))

@ -132,7 +132,10 @@ func NewHTMLRenderer(params HTMLRendererParameters) *HTMLRenderer {
} }
if params.FootnoteReturnLinkContents == "" { if params.FootnoteReturnLinkContents == "" {
params.FootnoteReturnLinkContents = `<sup>[return]</sup>` // U+FE0E is VARIATION SELECTOR-15.
// It suppresses automatic emoji presentation of the preceding
// U+21A9 LEFTWARDS ARROW WITH HOOK on iOS and iPadOS.
params.FootnoteReturnLinkContents = "<span aria-label='Return'>↩\ufe0e</span>"
} }
return &HTMLRenderer{ return &HTMLRenderer{
@ -616,7 +619,7 @@ func (r *HTMLRenderer) RenderNode(w io.Writer, node *Node, entering bool) WalkSt
} }
case Code: case Code:
r.out(w, codeTag) r.out(w, codeTag)
escapeHTML(w, node.Literal) escapeAllHTML(w, node.Literal)
r.out(w, codeCloseTag) r.out(w, codeCloseTag)
case Document: case Document:
break break
@ -762,7 +765,7 @@ func (r *HTMLRenderer) RenderNode(w io.Writer, node *Node, entering bool) WalkSt
r.cr(w) r.cr(w)
r.out(w, preTag) r.out(w, preTag)
r.tag(w, codeTag[:len(codeTag)-1], attrs) r.tag(w, codeTag[:len(codeTag)-1], attrs)
escapeHTML(w, node.Literal) escapeAllHTML(w, node.Literal)
r.out(w, codeCloseTag) r.out(w, codeCloseTag)
r.out(w, preCloseTag) r.out(w, preCloseTag)
if node.Parent.Type != Item { if node.Parent.Type != Item {

@ -278,7 +278,7 @@ func link(p *Markdown, data []byte, offset int) (int, *Node) {
case data[i] == '\n': case data[i] == '\n':
textHasNl = true textHasNl = true
case data[i-1] == '\\': case isBackslashEscaped(data, i):
continue continue
case data[i] == '[': case data[i] == '[':

@ -199,7 +199,8 @@ func (n *Node) InsertBefore(sibling *Node) {
} }
} }
func (n *Node) isContainer() bool { // IsContainer returns true if 'n' can contain children.
func (n *Node) IsContainer() bool {
switch n.Type { switch n.Type {
case Document: case Document:
fallthrough fallthrough
@ -238,6 +239,11 @@ func (n *Node) isContainer() bool {
} }
} }
// IsLeaf returns true if 'n' is a leaf node.
func (n *Node) IsLeaf() bool {
return !n.IsContainer()
}
func (n *Node) canContain(t NodeType) bool { func (n *Node) canContain(t NodeType) bool {
if n.Type == List { if n.Type == List {
return t == Item return t == Item
@ -309,11 +315,11 @@ func newNodeWalker(root *Node) *nodeWalker {
} }
func (nw *nodeWalker) next() { func (nw *nodeWalker) next() {
if (!nw.current.isContainer() || !nw.entering) && nw.current == nw.root { if (!nw.current.IsContainer() || !nw.entering) && nw.current == nw.root {
nw.current = nil nw.current = nil
return return
} }
if nw.entering && nw.current.isContainer() { if nw.entering && nw.current.IsContainer() {
if nw.current.FirstChild != nil { if nw.current.FirstChild != nil {
nw.current = nw.current.FirstChild nw.current = nw.current.FirstChild
nw.entering = true nw.entering = true

@ -1,16 +0,0 @@
sudo: false
language: go
go:
- 1.x
- master
matrix:
allow_failures:
- go: master
fast_finish: true
install:
- # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
script:
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d -s .)
- go tool vet .
- go test -v -race ./...

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2015 Dmitri Shuralyov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,36 +0,0 @@
sanitized_anchor_name
=====================
[![Build Status](https://travis-ci.org/shurcooL/sanitized_anchor_name.svg?branch=master)](https://travis-ci.org/shurcooL/sanitized_anchor_name) [![GoDoc](https://godoc.org/github.com/shurcooL/sanitized_anchor_name?status.svg)](https://godoc.org/github.com/shurcooL/sanitized_anchor_name)
Package sanitized_anchor_name provides a func to create sanitized anchor names.
Its logic can be reused by multiple packages to create interoperable anchor names
and links to those anchors.
At this time, it does not try to ensure that generated anchor names
are unique, that responsibility falls on the caller.
Installation
------------
```bash
go get -u github.com/shurcooL/sanitized_anchor_name
```
Example
-------
```Go
anchorName := sanitized_anchor_name.Create("This is a header")
fmt.Println(anchorName)
// Output:
// this-is-a-header
```
License
-------
- [MIT License](LICENSE)

@ -1,29 +0,0 @@
// Package sanitized_anchor_name provides a func to create sanitized anchor names.
//
// Its logic can be reused by multiple packages to create interoperable anchor names
// and links to those anchors.
//
// At this time, it does not try to ensure that generated anchor names
// are unique, that responsibility falls on the caller.
package sanitized_anchor_name // import "github.com/shurcooL/sanitized_anchor_name"
import "unicode"
// Create returns a sanitized anchor name for the given text.
func Create(text string) string {
var anchorName []rune
var futureDash = false
for _, r := range text {
switch {
case unicode.IsLetter(r) || unicode.IsNumber(r):
if futureDash && len(anchorName) > 0 {
anchorName = append(anchorName, '-')
}
futureDash = false
anchorName = append(anchorName, unicode.ToLower(r))
default:
futureDash = true
}
}
return string(anchorName)
}

Some files were not shown because too many files have changed in this diff Show More