From 2059adef99a8ca2ed4b0264cd19f84a9cb9e4420 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Fri, 11 Jan 2019 15:11:43 -0800 Subject: [PATCH] fix build --- Dockerfile | 2 +- go.mod | 3 +- go.sum | 72 +------ tools_install.go | 2 +- version/ko/main.go | 21 --- version/version.go | 455 --------------------------------------------- 6 files changed, 7 insertions(+), 548 deletions(-) delete mode 100644 version/ko/main.go delete mode 100644 version/version.go diff --git a/Dockerfile b/Dockerfile index dd0e2978..3002350a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM xena/go:1.11.2 AS build +FROM xena/go:1.11.4 AS build WORKDIR /x COPY . . ENV GOPROXY=https://cache.greedo.xeserv.us diff --git a/go.mod b/go.mod index 85d8840a..0d3f961d 100644 --- a/go.mod +++ b/go.mod @@ -48,6 +48,7 @@ require ( github.com/kohkimakimoto/gluatemplate v0.0.0-20160815033744-d9e2c9d6b00f github.com/kohkimakimoto/gluayaml v0.0.0-20160815032708-6fe413d49d73 github.com/kr/pretty v0.1.0 + github.com/kr/pty v1.1.2 // indirect github.com/layeh/gopher-luar v1.0.4 github.com/mndrix/golog v0.0.0-20170330170653-a28e2a269775 github.com/mndrix/ps v0.0.0-20170330174427-18e65badd6ab // indirect @@ -58,6 +59,7 @@ require ( github.com/peterh/liner v1.1.0 github.com/pkg/errors v0.8.1 github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481 + github.com/russross/blackfriday v1.5.1 // indirect github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect github.com/streamrail/concurrent-map v0.0.0-20160823150647-8bf1e9bacbf6 github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef @@ -67,7 +69,6 @@ require ( github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed github.com/yuin/gopher-lua v0.0.0-20181109042959-a0dfe84f6227 go4.org v0.0.0-20180809161055-417644f6feb5 - golang.org/x/build v0.0.0-20181004175654-90ec83e7f349 golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 golang.org/x/image v0.0.0-20180926015637-991ec62608f3 // indirect golang.org/x/oauth2 v0.0.0-20181003184128-c57b0facaced diff --git a/go.sum b/go.sum index 6f4c44ad..2f791ad7 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -contrib.go.opencensus.io/exporter/stackdriver v0.5.0/go.mod h1:QeFzMJDAw8TXt5+aRaSuE8l5BwaMIOIlaVkBOPRuMuw= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= github.com/Greyh4t/gluassh v0.0.0-20180109082511-239b4f6310f4 h1:f6TV2YjK++45AAjV35fvimbImX5MVaOiV2/3DhbNpgg= github.com/Greyh4t/gluassh v0.0.0-20180109082511-239b4f6310f4/go.mod h1:e2V5IvwVow5cEY2rUG+D5lNAkusxAZbs7MWLJNPKQIw= github.com/McKael/madon v2.3.0+incompatible h1:xMUA+Fy4saDV+8tN3MMnwJUoYWC//5Fy8LeOqJsRNIM= @@ -18,8 +14,6 @@ github.com/aclements/go-moremath v0.0.0-20180329182055-b1aff36309c7 h1:/NWziSfuX github.com/aclements/go-moremath v0.0.0-20180329182055-b1aff36309c7/go.mod h1:idZL3yvz4kzx1dsBOAC+oYv6L92P1oFEhUXUB1A/lwQ= github.com/ailncode/gluaxmlpath v0.0.0-20161126153117-6ce478ecb4a6 h1:FM0WudTZ+xeiXPJcs+X1Zg8JXe4vlb9P2GZYqCYjZkk= github.com/ailncode/gluaxmlpath v0.0.0-20161126153117-6ce478ecb4a6/go.mod h1:Ti1AvV2KUYtHEBX7eYbdAGEfFyKz9+lHrJPcr79Vkng= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/brandur/simplebox v0.0.0-20150921201729-84e9865bb03a h1:EMG9wk3iGM7WBAohiKenvpfyh1L5jv3snIMj3ffAMY8= github.com/brandur/simplebox v0.0.0-20150921201729-84e9865bb03a/go.mod h1:8hDWkKEpFQwZcugC69PxsoNQMh+0/A3FzLCppp/yJZM= github.com/bwmarrin/discordgo v0.18.0 h1:XopVQXCIFy7Cr2eT7NcYcm4k0l2PYX+AP5RUbIWX2/8= @@ -33,8 +27,6 @@ github.com/cjoudrey/gluaurl v0.0.0-20161028222611-31cbb9bef199 h1:cJ1E8ZwZLfercT github.com/cjoudrey/gluaurl v0.0.0-20161028222611-31cbb9bef199/go.mod h1:jC+zrjHA5CaxJzn+tojIoIOzSp/6BlkRWXnMlxNkB+g= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coreos/go-systemd v0.0.0-20180705093442-88bfeed483d3/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-failure v0.0.0-20151001134759-4963dbd58fd0 h1:SJzP6kZNFsdxFN4fRtVXu2yrf8QrKnofjQouzaCn36w= @@ -43,7 +35,6 @@ github.com/dgryski/go-onlinestats v0.0.0-20170612111826-1c7d19468768 h1:Xzl7CSuS github.com/dgryski/go-onlinestats v0.0.0-20170612111826-1c7d19468768/go.mod h1:alfmlCqcg4uw9jaoIU1nOp9RFdJLMuu8P07BCEgpgoo= github.com/disintegration/imaging v1.5.0 h1:uYqUhwNmLU4K1FN44vhqS4TZJRAA4RhBINgbQlKyGi0= github.com/disintegration/imaging v1.5.0/go.mod h1:9B/deIUIrliYkyMTuXJd6OUFLcrZ2tf+3Qlwnaf/CjU= -github.com/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eaburns/johaus v0.0.0-20180211190535-0482c3c1f4ff/go.mod h1:haq7Ati+IITjB94ZcX9Pur49JW6bQRs/yTcYaqDPxsc= github.com/eaburns/peggy v0.0.0-20180405011029-d685ddd3cbcb h1:VNtdhXiCNFtQkeRwcS8XW2+gyxollG4Kc4wnHbzGpP8= github.com/eaburns/peggy v0.0.0-20180405011029-d685ddd3cbcb/go.mod h1:5tfPwI6ukiK3W5vJzkj5MBQKHHY9Gcy2y6k1FC/23Xk= @@ -57,44 +48,32 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojt github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fogleman/gg v1.1.0 h1:wVTfU9tB/LDr2eI5HILatkzBQLD3yl0KtPFt8KlcSIY= github.com/fogleman/gg v1.1.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/primitive v0.0.0-20170926175833-69506c928bef h1:b2hzCO7V6vnDYAvucXo5smx9wut3A3Huw4VRNg1SMK8= github.com/fogleman/primitive v0.0.0-20170926175833-69506c928bef/go.mod h1:Tm6t8LbdhSCXNfpjTwoL1mdjCnyKHkMyf6PqQXo7Or8= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/garyburd/redigo v1.6.0 h1:0VruCpn7yAIIu7pWVClQC8wxCJEcG3nyzpMSHKi1PQc= github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gops v0.3.5 h1:SIWvPLiYvy5vMwjxB3rVFTE4QBhUFj2KKWr3Xm7CKhw= github.com/google/gops v0.3.5/go.mod h1:pMQgrscwEK/aUSW1IFSaBPbJX82FPHWaSoJw1axQfD0= -github.com/google/martian v2.0.0-beta.2.0.20180813215018-c223d6f7955e+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/gopherjs/gopherjs v0.0.0-20180628210949-0892b62f0d9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0= github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= github.com/hullerob/go.farbfeld v0.0.0-20160317142651-b572f0728b69 h1:oVHYt/ne+aIKsvK4QhnDeCNz9PNn1FbXLtdsX8qZG34= github.com/hullerob/go.farbfeld v0.0.0-20160317142651-b572f0728b69/go.mod h1:mQEoc766DxPTAwQ54neWTK/lFqIeSO7OU6bqZsceglw= github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 h1:xqgexXAGQgY3HAjNPSaCqn5Aahbo5TKsmhp8VRfr1iQ= github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/joeshaw/envdecode v0.0.0-20180312135643-c9e015854467 h1:REcMVvHDwEBFDEUrphtsx+/LqVKkKfcWxnAuVKFzSWk= github.com/joeshaw/envdecode v0.0.0-20180312135643-c9e015854467/go.mod h1:Q+alOFAXgW5SrcfMPt/G4B2oN+qEcQRJjkn/f4mKL04= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= @@ -103,7 +82,6 @@ github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/ github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e h1:+lIPJOWl+jSiJOc70QXJ07+2eg2Jy2EC7Mi11BWujeM= github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20170628072449-bab58d77464a h1:NLr4Iy1X81t+cfi3RXELAOZhlkduugBKsO2RwWHRm8M= @@ -122,22 +100,21 @@ github.com/kohkimakimoto/gluatemplate v0.0.0-20160815033744-d9e2c9d6b00f h1:CXJz github.com/kohkimakimoto/gluatemplate v0.0.0-20160815033744-d9e2c9d6b00f/go.mod h1:mepZlGlueX0FYzgC3KQMEuBBQuaAvdp8RUY+ZEe2fbI= github.com/kohkimakimoto/gluayaml v0.0.0-20160815032708-6fe413d49d73 h1:e2UU76WBjv6W0QUuPHe2QfSAXLR1kouek1fcSUtnSrk= github.com/kohkimakimoto/gluayaml v0.0.0-20160815032708-6fe413d49d73/go.mod h1:I+YgUp/uc0hF+H4RuQjR+uzDJNjUz7Sm21e63UCLWWQ= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.2 h1:Q7kfkJVHag8Gix8Z5+eTo09NFHV8MXL9K66sv9qDaVI= github.com/kr/pty v1.1.2/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/layeh/gopher-luar v1.0.4 h1:Vq9z0s+2zldfnhZ8gMAEveURmDe19nlLsn/zIxKbIxQ= github.com/layeh/gopher-luar v1.0.4/go.mod h1:MQNGlVP6GjSjpz9zLif7SbgOTGh6QRR+6ubmcNlW4Ug= github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/microcosm-cc/bluemonday v1.0.0/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/mndrix/golog v0.0.0-20170330170653-a28e2a269775 h1:KPqf9x/eMg3ZnHATLXcM1OgQMNVkPUv1QcGv6zTRMRg= github.com/mndrix/golog v0.0.0-20170330170653-a28e2a269775/go.mod h1:Q4YHYl483MNk6wwg3g8YsINpKe5S2UzUJCRSRlFaSU0= github.com/mndrix/ps v0.0.0-20170330174427-18e65badd6ab h1:fPrYMvMnWuED0MLhLyrny1fLaHhtiXK30pNyBGrk9Gs= github.com/mndrix/ps v0.0.0-20170330174427-18e65badd6ab/go.mod h1:dHgTaDInzkAqJv67VaX1IkK449M2UoBY68CZeI/bNCU= -github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/olekukonko/tablewriter v0.0.0-20180912035003-be2c049b30cc h1:rQ1O4ZLYR2xXHXgBCCfIIGnuZ0lidMQw2S5n1oOv+Wg= github.com/olekukonko/tablewriter v0.0.0-20180912035003-be2c049b30cc/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/otm/gluaflag v0.0.0-20160113203828-078088de6891 h1:ADqWBpIYjPWtGIQJNKQQj5HMDECvb9Y2kzYTOhfzEzI= @@ -153,43 +130,18 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= 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/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481 h1:jMxcLa+VjJKhpCwbLUXAD15wJ+hhvXMLujCl3MkXpfM= +github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481 h1:hIqz4wmkOdw3S5lg8DrW0PaRx5VIaPGmCiFymE6KsIU= github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s= github.com/russross/blackfriday v1.5.1 h1:B8ZN6pD4PVofmlDCDUdELeYrbsVIDM/bpjW3v3zgcRc= github.com/russross/blackfriday v1.5.1/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sendgrid/rest v2.4.1+incompatible h1:HDib/5xzQREPq34lN3YMhQtMkdXxS/qLp5G3k9a5++4= github.com/sendgrid/rest v2.4.1+incompatible/go.mod h1:kXX7q3jZtJXK5c5qK83bSGMdV6tsOE70KbHoqJls4lE= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20180517181903-37636e399bf5/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20180602233135-8913699a52e3/go.mod h1:19y9eBxWq15wrq3NRr6osGtk0dkbHhO6uznyrOtrBsE= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20170515013102-78fb10f4a5f8/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20180509033703-c5ffda838306/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20180509033327-dff011de8119/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20180602230221-c42b0e3b24d9/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20180602233045-253d879cae26/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM= github.com/streamrail/concurrent-map v0.0.0-20160823150647-8bf1e9bacbf6 h1:XklXvOrWxWCDX2n4vdEQWkjuIP820XD6C4kF0O0FzH4= github.com/streamrail/concurrent-map v0.0.0-20160823150647-8bf1e9bacbf6/go.mod h1:yqDD2twFAqxvvH5gtpwwgLsj5L1kbNwtoPoDOwBzXcs= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/tarm/serial v0.0.0-20180114052751-eaafced92e96/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef h1:7D6Nm4D6f0ci9yttWaKjM1TMAXrH5Su72dojqYGntFY= github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef/go.mod h1:WLFStEdnJXpjK8kd4qKLwQKX/1vrDzp5BcDyiZJBHJM= github.com/velour/chat v0.0.0-20180713122344-fd1d1606cb89/go.mod h1:ejwOYCjnDMyO5LXFXRARQJGBZ6xQJZ3rgAHE5drSuMM= @@ -203,52 +155,34 @@ github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed h1:I1vcLHWU9m30rA90rMr github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed/go.mod h1:9w6KSdZh23UWqOywWsRLUcJUrUNjRh4Ql3z9uVgnSP4= github.com/yuin/gopher-lua v0.0.0-20181109042959-a0dfe84f6227 h1:GRy+0tGtORsCA+CJUMfhLuN71eQ0LtsQRDBQKbzESdc= github.com/yuin/gopher-lua v0.0.0-20181109042959-a0dfe84f6227/go.mod h1:fFiAh+CowNFr0NK5VASokuwKwkbacRmHsVA7Yb1Tqac= -go.opencensus.io v0.14.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= -go4.org v0.0.0-20180417224846-9599cf28b011/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= go4.org v0.0.0-20180809161055-417644f6feb5 h1:+hE86LblG4AyDgwMCLTE6FOlM9+qjHSYS+rKqxUVdsM= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/build v0.0.0-20181004175654-90ec83e7f349 h1:XPddsYqUEmKO0sVe5QT00QlgT+um6zpdvTXa4TOwRug= -golang.org/x/build v0.0.0-20181004175654-90ec83e7f349/go.mod h1:eyWLc0/Jmz/CqV4n9TcikWbe+qYZi9gRRwevxMtJxLE= -golang.org/x/crypto v0.0.0-20180807104621-f027049dab0a/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 h1:Vk3wNqEZwyGyei9yq5ekj7frek2u7HUfffJ1/opblzc= golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/image v0.0.0-20180926015637-991ec62608f3 h1:5IfA9fqItkh2alJW94tvQk+6+RF9MW2q9DzwE8DBddQ= golang.org/x/image v0.0.0-20180926015637-991ec62608f3/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180808004115-f9ce57c11b24/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 h1:dgd4x4kJt7G4k4m93AYLzM8Ni6h2qLTfh9n9vXJT3/0= golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/oauth2 v0.0.0-20180724155351-3d292e4d0cdc/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-20181003184128-c57b0facaced h1:4oqSq7eft7MdPKBGQK11X9WYUxmj6ZLgGTqYIbY1kyw= golang.org/x/oauth2 v0.0.0-20181003184128-c57b0facaced/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180807162357-acbc56fc7007/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181004145325-8469e314837c h1:SJ7JoQNVl3mC7EWkkONgBWgCno8LcABIJwFMkWBC+EY= golang.org/x/sys v0.0.0-20181004145325-8469e314837c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180807205940-ca6481ae5650/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/api v0.0.0-20180808000436-6e1e03fd226b/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0 h1:S0iUepdCWODXRvtE+gcRDd15L+k+k1AiHlMiMjefH24= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180731170733-daca94659cb5/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= 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/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/tucnak/telebot.v2 v2.0.0-20181115150921-4688194c178d h1:rwP+DFa5TQOEP7iCCc2z0ql57CtuI+divggCiXbuYR0= gopkg.in/tucnak/telebot.v2 v2.0.0-20181115150921-4688194c178d/go.mod h1:EmWSFwexO5JPTHiU7gDd9HMCCiyatACwO0HhuKNsOd0= gopkg.in/xmlpath.v2 v2.0.0-20150820204837-860cbeca3ebc h1:LMEBgNcZUqXaP7evD1PZcL6EcDVa2QOFuI+cqM3+AJM= gopkg.in/xmlpath.v2 v2.0.0-20150820204837-860cbeca3ebc/go.mod h1:N8UOSI6/c2yOpa/XDz3KVUiegocTziPiqNkeNTMiG1k= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= layeh.com/gopher-json v0.0.0-20181116191917-d3d498bb4913 h1:7GSXubN0n2gOZFLkm72eB1ep93KbqEw0Heiz2h6CQGE= layeh.com/gopher-json v0.0.0-20181116191917-d3d498bb4913/go.mod h1:ivKkcY8Zxw5ba0jldhZCYYQfGdb2K6u9tbYK1AwMIBc= layeh.com/gopher-luar v1.0.4 h1:BFgt94J/CXh4HkDcE2b7A7pBaVeQKEVfHEBRKL/K/Tc= diff --git a/tools_install.go b/tools_install.go index 0af98b1f..636b5c59 100644 --- a/tools_install.go +++ b/tools_install.go @@ -16,7 +16,7 @@ func main() { env := append(os.Environ(), []string{"GO111MODULE=on"}...) - for _, tool := range []string{"github.com/russross/blackfriday-tool", "github.com/robertkrimen/godocdown/godocdown"} { + for _, tool := range []string{"github.com/robertkrimen/godocdown/godocdown"} { yeet.ShouldWork(ctx, env, yeet.WD, "go", "install", tool) } } diff --git a/version/ko/main.go b/version/ko/main.go deleted file mode 100644 index c1a30b6f..00000000 --- a/version/ko/main.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -import ( - "os" - "runtime" - - "github.com/Xe/x/version" - _ "github.com/joho/godotenv/autoload" -) - -func main() { - ver := os.Getenv("GO_VERSION") - - if ver == "" { - ver = runtime.Version() - } else { - ver = "go" + ver - } - - version.Run(ver) -} diff --git a/version/version.go b/version/version.go deleted file mode 100644 index 7ae78948..00000000 --- a/version/version.go +++ /dev/null @@ -1,455 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// The version package permits running a specific version of Go. -package version - -import ( - "archive/tar" - "archive/zip" - "compress/gzip" - "crypto/sha256" - "errors" - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "os" - "os/exec" - "os/user" - "path" - "path/filepath" - "runtime" - "strings" - "time" - - "golang.org/x/build/envutil" -) - -func init() { - http.DefaultTransport = &userAgentTransport{http.DefaultTransport} -} - -// Run runs the "go" tool of the provided Go version. -func Run(version string) { - log.SetFlags(0) - - root, err := goroot(version) - if err != nil { - log.Fatalf("%s: %v", version, err) - } - - if len(os.Args) == 2 && os.Args[1] == "download" { - if err := install(root, version); err != nil { - log.Fatalf("%s: download failed: %v", version, err) - } - os.Exit(0) - } - - if _, err := os.Stat(filepath.Join(root, unpackedOkay)); err != nil { - log.Fatalf("%s: not downloaded. Run '%s download' to install to %v", version, os.Args[0], root) - } - - gobin := filepath.Join(root, "bin", "go"+exe()) - cmd := exec.Command(gobin, os.Args[1:]...) - cmd.Stdin = os.Stdin - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - cmd.Env = envutil.Dedup(caseInsensitiveEnv, append(os.Environ(), "GOROOT="+root)) - if err := cmd.Run(); err != nil { - // TODO: return the same exit status maybe. - os.Exit(1) - } - os.Exit(0) -} - -// install installs a version of Go to the named target directory, creating the -// directory as needed. -func install(targetDir, version string) error { - if _, err := os.Stat(filepath.Join(targetDir, unpackedOkay)); err == nil { - log.Printf("%s: already downloaded in %v", version, targetDir) - return nil - } - - goURL, err := versionArchiveURL(version) - if err != nil { - return err - } - if err := os.MkdirAll(targetDir, 0755); err != nil { - return err - } - res, err := http.Head(goURL) - if err != nil { - return err - } - if res.StatusCode == http.StatusNotFound { - return fmt.Errorf("no binary release of %v for %v/%v at %v", version, getOS(), runtime.GOARCH, goURL) - } - if res.StatusCode != http.StatusOK { - return fmt.Errorf("server returned %v checking size of %v", http.StatusText(res.StatusCode), goURL) - } - base := path.Base(goURL) - archiveFile := filepath.Join(targetDir, base) - defer os.RemoveAll(archiveFile) - if fi, err := os.Stat(archiveFile); err != nil || fi.Size() != res.ContentLength { - if err != nil && !os.IsNotExist(err) { - // Something weird. Don't try to download. - return err - } - if err := copyFromURL(archiveFile, goURL); err != nil { - return fmt.Errorf("error downloading %v: %v", goURL, err) - } - fi, err = os.Stat(archiveFile) - if err != nil { - return err - } - if fi.Size() != res.ContentLength { - return fmt.Errorf("downloaded file %s size %v doesn't match server size %v", archiveFile, fi.Size(), res.ContentLength) - } - } - wantSHA, err := slurpURLToString(goURL + ".sha256") - if err != nil { - return err - } - if err := verifySHA256(archiveFile, strings.TrimSpace(wantSHA)); err != nil { - return fmt.Errorf("error verifying SHA256 of %v: %v", archiveFile, err) - } - log.Printf("Unpacking %v ...", archiveFile) - if err := unpackArchive(targetDir, archiveFile); err != nil { - return fmt.Errorf("extracting archive %v: %v", archiveFile, err) - } - if err := ioutil.WriteFile(filepath.Join(targetDir, unpackedOkay), nil, 0644); err != nil { - return err - } - log.Printf("Success. You may now run '%v'", os.Args[0]) - return nil -} - -// unpackArchive unpacks the provided archive zip or tar.gz file to targetDir, -// removing the "go/" prefix from file entries. -func unpackArchive(targetDir, archiveFile string) error { - switch { - case strings.HasSuffix(archiveFile, ".zip"): - return unpackZip(targetDir, archiveFile) - case strings.HasSuffix(archiveFile, ".tar.gz"): - return unpackTarGz(targetDir, archiveFile) - default: - return errors.New("unsupported archive file") - } -} - -// unpackTarGz is the tar.gz implementation of unpackArchive. -func unpackTarGz(targetDir, archiveFile string) error { - r, err := os.Open(archiveFile) - if err != nil { - return err - } - defer r.Close() - madeDir := map[string]bool{} - zr, err := gzip.NewReader(r) - if err != nil { - return err - } - tr := tar.NewReader(zr) - for { - f, err := tr.Next() - if err == io.EOF { - break - } - if err != nil { - return err - } - if !validRelPath(f.Name) { - return fmt.Errorf("tar file contained invalid name %q", f.Name) - } - rel := filepath.FromSlash(strings.TrimPrefix(f.Name, "go/")) - abs := filepath.Join(targetDir, rel) - - fi := f.FileInfo() - mode := fi.Mode() - switch { - case mode.IsRegular(): - // Make the directory. This is redundant because it should - // already be made by a directory entry in the tar - // beforehand. Thus, don't check for errors; the next - // write will fail with the same error. - dir := filepath.Dir(abs) - if !madeDir[dir] { - if err := os.MkdirAll(filepath.Dir(abs), 0755); err != nil { - return err - } - madeDir[dir] = true - } - wf, err := os.OpenFile(abs, os.O_RDWR|os.O_CREATE|os.O_TRUNC, mode.Perm()) - if err != nil { - return err - } - n, err := io.Copy(wf, tr) - if closeErr := wf.Close(); closeErr != nil && err == nil { - err = closeErr - } - if err != nil { - return fmt.Errorf("error writing to %s: %v", abs, err) - } - if n != f.Size { - return fmt.Errorf("only wrote %d bytes to %s; expected %d", n, abs, f.Size) - } - if !f.ModTime.IsZero() { - if err := os.Chtimes(abs, f.ModTime, f.ModTime); err != nil { - // benign error. Gerrit doesn't even set the - // modtime in these, and we don't end up relying - // on it anywhere (the gomote push command relies - // on digests only), so this is a little pointless - // for now. - log.Printf("error changing modtime: %v", err) - } - } - case mode.IsDir(): - if err := os.MkdirAll(abs, 0755); err != nil { - return err - } - madeDir[abs] = true - default: - return fmt.Errorf("tar file entry %s contained unsupported file type %v", f.Name, mode) - } - } - return nil -} - -// unpackZip is the zip implementation of unpackArchive. -func unpackZip(targetDir, archiveFile string) error { - zr, err := zip.OpenReader(archiveFile) - if err != nil { - return err - } - defer zr.Close() - - for _, f := range zr.File { - name := strings.TrimPrefix(f.Name, "go/") - - outpath := filepath.Join(targetDir, name) - if f.FileInfo().IsDir() { - if err := os.MkdirAll(outpath, 0755); err != nil { - return err - } - continue - } - - rc, err := f.Open() - if err != nil { - return err - } - - // File - if err := os.MkdirAll(filepath.Dir(outpath), 0755); err != nil { - return err - } - out, err := os.OpenFile(outpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) - if err != nil { - return err - } - _, err = io.Copy(out, rc) - rc.Close() - if err != nil { - out.Close() - return err - } - if err := out.Close(); err != nil { - return err - } - } - return nil -} - -// verifySHA256 reports whether the named file has contents with -// SHA-256 of the given wantHex value. -func verifySHA256(file, wantHex string) error { - f, err := os.Open(file) - if err != nil { - return err - } - defer f.Close() - hash := sha256.New() - if _, err := io.Copy(hash, f); err != nil { - return err - } - if fmt.Sprintf("%x", hash.Sum(nil)) != wantHex { - return fmt.Errorf("%s corrupt? does not have expected SHA-256 of %v", file, wantHex) - } - return nil -} - -// slurpURLToString downloads the given URL and returns it as a string. -func slurpURLToString(url_ string) (string, error) { - res, err := http.Get(url_) - if err != nil { - return "", err - } - defer res.Body.Close() - if res.StatusCode != http.StatusOK { - return "", fmt.Errorf("%s: %v", url_, res.Status) - } - slurp, err := ioutil.ReadAll(res.Body) - if err != nil { - return "", fmt.Errorf("reading %s: %v", url_, err) - } - return string(slurp), nil -} - -// copyFromURL downloads srcURL to dstFile. -func copyFromURL(dstFile, srcURL string) (err error) { - f, err := os.Create(dstFile) - if err != nil { - return err - } - defer func() { - if err != nil { - f.Close() - os.Remove(dstFile) - } - }() - c := &http.Client{ - Transport: &userAgentTransport{&http.Transport{ - // It's already compressed. Prefer accurate ContentLength. - // (Not that GCS would try to compress it, though) - DisableCompression: true, - DisableKeepAlives: true, - Proxy: http.ProxyFromEnvironment, - }}, - } - res, err := c.Get(srcURL) - if err != nil { - return err - } - defer res.Body.Close() - if res.StatusCode != http.StatusOK { - return errors.New(res.Status) - } - pw := &progressWriter{w: f, total: res.ContentLength} - n, err := io.Copy(pw, res.Body) - if err != nil { - return err - } - if res.ContentLength != -1 && res.ContentLength != n { - return fmt.Errorf("copied %v bytes; expected %v", n, res.ContentLength) - } - pw.update() // 100% - return f.Close() -} - -type progressWriter struct { - w io.Writer - n int64 - total int64 - last time.Time -} - -func (p *progressWriter) update() { - end := " ..." - if p.n == p.total { - end = "" - } - fmt.Fprintf(os.Stderr, "Downloaded %0.1f%% (%d / %d bytes)%s\n", - (100.0*float64(p.n))/float64(p.total), - p.n, p.total, end) -} - -func (p *progressWriter) Write(buf []byte) (n int, err error) { - n, err = p.w.Write(buf) - p.n += int64(n) - if now := time.Now(); now.Unix() != p.last.Unix() { - p.update() - p.last = now - } - return -} - -// getOS returns runtime.GOOS. It exists as a function just for lazy -// testing of the Windows zip path when running on Linux/Darwin. -func getOS() string { - return runtime.GOOS -} - -// versionArchiveURL returns the zip or tar.gz URL of the given Go version. -func versionArchiveURL(version string) (string, error) { - goos := getOS() - - // TODO: Maybe we should parse - // https://storage.googleapis.com/go-builder-data/dl-index.txt ? - // Let's just guess the URL for now and see if it's there. - // Then we don't have to maintain that txt file too. - ext := ".tar.gz" - if goos == "windows" { - ext = ".zip" - } - arch := runtime.GOARCH - if goos == "linux" && runtime.GOARCH == "arm" { - arch = "armv6l" - } - // https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz - return "https://dl.google.com/go/" + version + "." + goos + "-" + arch + ext, nil -} - -const caseInsensitiveEnv = runtime.GOOS == "windows" - -// unpackedOkay is a sentinel zero-byte file to indicate that the Go -// version was downloaded and unpacked successfully. -const unpackedOkay = ".unpacked-success" - -func exe() string { - if runtime.GOOS == "windows" { - return ".exe" - } - return "" -} - -func goroot(version string) (string, error) { - home, err := homedir() - if err != nil { - return "", fmt.Errorf("failed to get home directory: %v", err) - } - return filepath.Join(home, ".ko", "installed", version), nil -} - -func homedir() (string, error) { - switch getOS() { - case "plan9": - return "", fmt.Errorf("%q not yet supported", runtime.GOOS) - case "windows": - if dir := os.Getenv("USERPROFILE"); dir != "" { - return dir, nil - } - return "", errors.New("can't find user home directory; %USERPROFILE% is empty") - default: - if dir := os.Getenv("HOME"); dir != "" { - return dir, nil - } - if u, err := user.Current(); err == nil && u.HomeDir != "" { - return u.HomeDir, nil - } - return "", errors.New("can't find user home directory; $HOME is empty") - } -} - -func validRelPath(p string) bool { - if p == "" || strings.Contains(p, `\`) || strings.HasPrefix(p, "/") || strings.Contains(p, "../") { - return false - } - return true -} - -type userAgentTransport struct { - rt http.RoundTripper -} - -func (uat userAgentTransport) RoundTrip(r *http.Request) (*http.Response, error) { - version := runtime.Version() - if strings.Contains(version, "devel") { - // Strip the SHA hash and date. We don't want spaces or other tokens (see RFC2616 14.43) - version = "devel" - } - r.Header.Set("User-Agent", "github-com-Xe-x/"+version) - return uat.rt.RoundTrip(r) -}