diff --git a/go.mod b/go.mod index 6f23ece3..14d37869 100644 --- a/go.mod +++ b/go.mod @@ -3,37 +3,39 @@ module github.com/dnote/dnote go 1.13 require ( + github.com/PuerkitoBio/goquery v1.6.0 // indirect github.com/andybalholm/cascadia v1.2.0 // indirect github.com/aymerick/douceur v0.2.0 github.com/dnote/actions v0.2.0 github.com/dnote/color v1.7.0 - github.com/gobuffalo/packr/v2 v2.8.0 - github.com/google/go-cmp v0.5.1 + github.com/dnote/xgo v0.0.0-20200205013105-40be7d6d43ff // indirect + github.com/gobuffalo/packr/v2 v2.8.1 + github.com/google/go-cmp v0.5.4 github.com/google/go-github v17.0.0+incompatible github.com/google/go-querystring v1.0.0 // indirect - github.com/google/uuid v1.1.1 + github.com/google/uuid v1.1.3 github.com/gorilla/css v1.0.0 // indirect github.com/gorilla/mux v1.8.0 github.com/jinzhu/gorm v1.9.16 github.com/joho/godotenv v1.3.0 github.com/karrick/godirwalk v1.16.1 // indirect - github.com/lib/pq v1.8.0 - github.com/mattn/go-colorable v0.1.7 // indirect - github.com/mattn/go-sqlite3 v2.0.3+incompatible + github.com/lib/pq v1.9.0 + github.com/mattn/go-colorable v0.1.8 // indirect + github.com/mattn/go-sqlite3 v1.14.6 github.com/pkg/errors v0.9.1 github.com/radovskyb/watcher v1.0.7 github.com/robfig/cron v1.2.0 github.com/rubenv/sql-migrate v0.0.0-20200616145509-8d140a17f351 github.com/sergi/go-diff v1.1.0 - github.com/sirupsen/logrus v1.6.0 // indirect - github.com/spf13/cobra v1.0.0 - github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a - golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect + github.com/sirupsen/logrus v1.7.0 // indirect + github.com/spf13/cobra v1.1.1 + golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad + golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect - golang.org/x/sys v0.0.0-20200821140526-fda516888d29 // indirect - golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e + golang.org/x/sys v0.0.0-20201231184435-2d18734c6014 // indirect + golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf // indirect + golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df - gopkg.in/yaml.v2 v2.3.0 + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index e3341365..238bdc3a 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,24 @@ 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/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/PuerkitoBio/goquery v1.6.0 h1:j7taAbelrdcsOlGeMenZxc2AWXD5fieT1/znArdnx94= +github.com/PuerkitoBio/goquery v1.6.0/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= @@ -13,7 +27,6 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE= github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= @@ -33,6 +46,7 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -44,8 +58,10 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -66,6 +82,8 @@ github.com/dnote/actions v0.2.0 h1:P1ut2/QRKwfAzIIB374vN9A4IanU94C/payEocvngYo= github.com/dnote/actions v0.2.0/go.mod h1:bBIassLhppVQdbC3iaE92SHBpM1HOVe+xZoAlj9ROxw= github.com/dnote/color v1.7.0 h1:8/QGLQKSU8/zcWQaHbMyC1hJRkKO/Uu9M89sH76ecHE= github.com/dnote/color v1.7.0/go.mod h1:75UcP/TH7CNvjQ5pwDumkUS3vkPdGggy7/3fT8MlxHM= +github.com/dnote/xgo v0.0.0-20200205013105-40be7d6d43ff h1:DJKdzouhr6u1NzuLbmSWeei9BagH3Nm4mSOzP0RMdc0= +github.com/dnote/xgo v0.0.0-20200205013105-40be7d6d43ff/go.mod h1:ruGZjl8WThApI7BAIKV2Q/PnJoudvd6Epjc3z79jWVg= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= @@ -81,6 +99,7 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= 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-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-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -88,25 +107,21 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/envy v1.7.1 h1:OQl5ys5MBea7OGCdvPbBJWRgnhC/fGona6QKfvFeau8= github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= -github.com/gobuffalo/logger v1.0.1 h1:ZEgyRGgAm4ZAhAO45YXMs5Fp+bzGLESFewzAVBMKuTg= github.com/gobuffalo/logger v1.0.1/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= github.com/gobuffalo/logger v1.0.3 h1:YaXOTHNPCvkqqA7w05A4v0k2tCdpr+sgFlgINbQ6gqc= github.com/gobuffalo/logger v1.0.3/go.mod h1:SoeejUwldiS7ZsyCBphOGURmWdwUFXs0J7TCjEhjKxM= -github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= github.com/gobuffalo/packd v1.0.0 h1:6ERZvJHfe24rfFmA9OaoKBdC7+c9sydrytMg8SdFGBM= github.com/gobuffalo/packd v1.0.0/go.mod h1:6VTc4htmJRFB7u1m/4LeMTWjFoYrUiBkU9Fdec9hrhI= -github.com/gobuffalo/packr/v2 v2.7.1 h1:n3CIW5T17T8v4GGK5sWXLVWJhCz7b5aNLSxW6gYim4o= github.com/gobuffalo/packr/v2 v2.7.1/go.mod h1:qYEvAazPaVxy7Y7KR0W8qYEE+RymX74kETFqjFoFlOc= -github.com/gobuffalo/packr/v2 v2.8.0 h1:IULGd15bQL59ijXLxEvA5wlMxsmx/ZkQv9T282zNVIY= -github.com/gobuffalo/packr/v2 v2.8.0/go.mod h1:PDk2k3vGevNE3SwVyVRgQCCXETC9SaONCNSXT1Q8M1g= +github.com/gobuffalo/packr/v2 v2.8.1 h1:tkQpju6i3EtMXJ9uoF5GT6kB+LMTimDWD8Xvbz6zDVA= +github.com/gobuffalo/packr/v2 v2.8.1/go.mod h1:c/PLlOuTU+p3SybaJATW3H6lX/iK7xEz5OeMf+NnJpg= github.com/godror/godror v0.13.3/go.mod h1:2ouUT4kdhUBk7TAkHWD4SN0CdI0pgEQbo8FVHhbSKWg= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -119,6 +134,8 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 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.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -127,39 +144,43 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z 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.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 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 v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.3 h1:twObb+9XcuH5B9V1TBCvvvZoO6iEdILi2a76PYn5rJI= +github.com/google/uuid v1.1.3/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +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/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= -github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +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-middleware v1.0.1-0.20190118093823-f849b5445de4/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/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.3.0/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= @@ -185,8 +206,6 @@ github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmK github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jinzhu/gorm v1.9.12 h1:Drgk1clyWT9t9ERbzHza6Mj/8FY/CqMyVzOiHviMo6Q= -github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs= github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o= github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= @@ -200,50 +219,40 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +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/karrick/godirwalk v1.15.3 h1:0a2pXOgtB16CqIqXTiT7+K9L73f74n/aNQUnH6Ortew= -github.com/karrick/godirwalk v1.15.3/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= -github.com/karrick/godirwalk v1.15.6 h1:Yf2mmR8TJy+8Fa0SuQVto5SYap6IF7lNVX4Jdl8G1qA= -github.com/karrick/godirwalk v1.15.6/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= +github.com/karrick/godirwalk v1.15.8/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= 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.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/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 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/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.5.2 h1:yTSXVswvWUOQ3k1sd7vJfDrbSl8lKuscqFJRqjC0ifw= -github.com/lib/pq v1.5.2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg= -github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.9.0 h1:L8nSXQQzAYByakOFMTwpjRoHsMJklur4Gi59b6VivR8= +github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI= github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc= github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY= github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= @@ -253,7 +262,8 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-sqlite3 v1.12.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= -github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -304,7 +314,6 @@ github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9 github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -342,12 +351,9 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.4.0 h1:LUa41nrWTQNGhzdsZ5lTnkwbNjj6rXTdazA1cSdjkOY= github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w= github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rubenv/sql-migrate v0.0.0-20200429072036-ae26b214fa43 h1:0i6uTtxUGc/jpK/CngM4T2S2NFnqYUUxH+lKDgBLw8U= -github.com/rubenv/sql-migrate v0.0.0-20200429072036-ae26b214fa43/go.mod h1:DCgfY80j8GYL7MLEfvcpSFvjD0L5yZq/aZUJmhZklyg= github.com/rubenv/sql-migrate v0.0.0-20200616145509-8d140a17f351 h1:HXr/qUllAWv9riaI4zh2eXWKmCSDqVS/XH1MRHLKRwk= github.com/rubenv/sql-migrate v0.0.0-20200616145509-8d140a17f351/go.mod h1:DCgfY80j8GYL7MLEfvcpSFvjD0L5yZq/aZUJmhZklyg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -359,10 +365,9 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= 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= @@ -371,19 +376,18 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO 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 v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= 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/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -391,10 +395,10 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ 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.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -410,6 +414,8 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -425,24 +431,32 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/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-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= 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/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-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-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.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -458,27 +472,26 @@ golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73r 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-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-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 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-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-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -492,69 +505,96 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/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-20190515120540-06a5c4944438/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-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200513112337-417ce2331b5c h1:kISX68E8gSkNYAFRFiDU8rl5RIn1sJYKYb/r2vMLDrU= -golang.org/x/sys v0.0.0-20200513112337-417ce2331b5c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200821140526-fda516888d29 h1:mNuhGagCf3lDDm5C0376C/sxh6V7fy9WbdEu/YDNA04= -golang.org/x/sys v0.0.0-20200821140526-fda516888d29/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201231184435-2d18734c6014 h1:joucsQqXmyBVxViHCPFjG3hx8JzIFSaym3l3MM/Jsdg= +golang.org/x/sys v0.0.0-20201231184435-2d18734c6014/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= +golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +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/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI= -golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= -golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/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-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-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-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-20191004055002-72853e10c5a3/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-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/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-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200308013534-11ec41452d41 h1:9Di9iYgOt9ThCipBxChBVhgNipDoE5mxO84rQV7D0FE= golang.org/x/tools v0.0.0-20200308013534-11ec41452d41/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +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.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= +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/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 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-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +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-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= @@ -563,7 +603,6 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= 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/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -575,20 +614,24 @@ gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AW gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= gopkg.in/gorp.v1 v1.7.2 h1:j3DWlAyGVv8whO7AcIWznQ2Yj7yJkn34B8s63GViAAw= gopkg.in/gorp.v1 v1.7.2/go.mod h1:Wo3h+DBQZIxATwftsglhdD/62zRFPhGhTiu5jUJmCaw= +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/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= 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.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/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.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/pkg/cli/cmd/root/root.go b/pkg/cli/cmd/root/root.go index 5076e709..5e3db92f 100644 --- a/pkg/cli/cmd/root/root.go +++ b/pkg/cli/cmd/root/root.go @@ -24,7 +24,7 @@ import ( var root = &cobra.Command{ Use: "dnote", - Short: "Dnote - Instantly capture what you learn while coding", + Short: "Dnote - a simple command line notebook", SilenceErrors: true, SilenceUsage: true, } diff --git a/pkg/cli/cmd/sync/main_test.go b/pkg/cli/cmd/sync/main_test.go new file mode 100644 index 00000000..c869afb7 --- /dev/null +++ b/pkg/cli/cmd/sync/main_test.go @@ -0,0 +1,17 @@ +package sync + +import ( + "github.com/dnote/dnote/pkg/cli/context" + "path/filepath" +) + +var testDir = "../../tmp" + +var paths context.Paths = context.Paths{ + Home: testDir, + Cache: testDir, + Config: testDir, + Data: testDir, +} + +var dbPath = filepath.Join(testDir, "test.db") diff --git a/pkg/cli/cmd/sync/sync_test.go b/pkg/cli/cmd/sync/sync_test.go index e5c6457a..f107ed15 100644 --- a/pkg/cli/cmd/sync/sync_test.go +++ b/pkg/cli/cmd/sync/sync_test.go @@ -36,8 +36,6 @@ import ( "github.com/pkg/errors" ) -var dbPath = "../../tmp/.dnote.db" - func TestProcessFragments(t *testing.T) { fragments := []client.SyncFragment{ { @@ -1822,7 +1820,7 @@ func TestMergeBook(t *testing.T) { func TestSaveServerState(t *testing.T) { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) @@ -1866,7 +1864,7 @@ func TestSaveServerState(t *testing.T) { // are updated accordingly based on the server response. func TestSendBooks(t *testing.T) { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) @@ -2099,7 +2097,7 @@ func TestSendBooks_isBehind(t *testing.T) { for idx, tc := range testCases { func() { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) ctx.APIEndpoint = ts.URL defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) @@ -2147,7 +2145,7 @@ func TestSendBooks_isBehind(t *testing.T) { for idx, tc := range testCases { func() { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) ctx.APIEndpoint = ts.URL defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) @@ -2195,7 +2193,7 @@ func TestSendBooks_isBehind(t *testing.T) { for idx, tc := range testCases { func() { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) ctx.APIEndpoint = ts.URL defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) @@ -2230,7 +2228,7 @@ func TestSendBooks_isBehind(t *testing.T) { // uuid from the incoming data. func TestSendNotes(t *testing.T) { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) @@ -2383,7 +2381,7 @@ func TestSendNotes(t *testing.T) { func TestSendNotes_addedOn(t *testing.T) { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) @@ -2515,7 +2513,7 @@ func TestSendNotes_isBehind(t *testing.T) { for idx, tc := range testCases { func() { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) ctx.APIEndpoint = ts.URL @@ -2564,7 +2562,7 @@ func TestSendNotes_isBehind(t *testing.T) { for idx, tc := range testCases { func() { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) ctx.APIEndpoint = ts.URL @@ -2613,7 +2611,7 @@ func TestSendNotes_isBehind(t *testing.T) { for idx, tc := range testCases { func() { // set up - ctx := context.InitTestCtx(t, "../../tmp", nil) + ctx := context.InitTestCtx(t, paths, nil) defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) ctx.APIEndpoint = ts.URL diff --git a/pkg/cli/config/config.go b/pkg/cli/config/config.go index bb2e9424..8d0bd7dd 100644 --- a/pkg/cli/config/config.go +++ b/pkg/cli/config/config.go @@ -24,6 +24,8 @@ import ( "github.com/dnote/dnote/pkg/cli/consts" "github.com/dnote/dnote/pkg/cli/context" + "github.com/dnote/dnote/pkg/cli/log" + "github.com/dnote/dnote/pkg/cli/utils" "github.com/pkg/errors" "gopkg.in/yaml.v2" ) @@ -34,9 +36,28 @@ type Config struct { APIEndpoint string `yaml:"apiEndpoint"` } +func checkLegacyPath(ctx context.DnoteCtx) (string, bool) { + legacyPath := fmt.Sprintf("%s/%s", ctx.Paths.LegacyDnote, consts.ConfigFilename) + + ok, err := utils.FileExists(legacyPath) + if err != nil { + log.Errorf(errors.Wrapf(err, "checking legacy dnote directory at %s", legacyPath).Error()) + } + if ok { + return legacyPath, true + } + + return "", false +} + // GetPath returns the path to the dnote config file func GetPath(ctx context.DnoteCtx) string { - return fmt.Sprintf("%s/%s", ctx.DnoteDir, consts.ConfigFilename) + legacyPath, ok := checkLegacyPath(ctx) + if ok { + return legacyPath + } + + return fmt.Sprintf("%s/%s/%s", ctx.Paths.Config, consts.DnoteDirName, consts.ConfigFilename) } // Read reads the config file diff --git a/pkg/cli/consts/consts.go b/pkg/cli/consts/consts.go index 4c84d1ae..e7235934 100644 --- a/pkg/cli/consts/consts.go +++ b/pkg/cli/consts/consts.go @@ -20,8 +20,10 @@ package consts var ( + // LegacyDnoteDirName is the name of the legacy directory containing dnote files + LegacyDnoteDirName = ".dnote" // DnoteDirName is the name of the directory containing dnote files - DnoteDirName = ".dnote" + DnoteDirName = "dnote" // DnoteDBFileName is a filename for the Dnote SQLite database DnoteDBFileName = "dnote.db" // TmpContentFileBase is the base for the filename for a temporary content diff --git a/pkg/cli/context/ctx.go b/pkg/cli/context/ctx.go index 26ddc0e2..6ba8f9dd 100644 --- a/pkg/cli/context/ctx.go +++ b/pkg/cli/context/ctx.go @@ -24,10 +24,18 @@ import ( "github.com/dnote/dnote/pkg/clock" ) +// Paths contain directory definitions +type Paths struct { + Home string + Config string + Data string + Cache string + LegacyDnote string +} + // DnoteCtx is a context holding the information of the current runtime type DnoteCtx struct { - HomeDir string - DnoteDir string + Paths Paths APIEndpoint string Version string DB *database.DB diff --git a/pkg/cli/context/testutils.go b/pkg/cli/context/testutils.go index 383c5a08..4572a62c 100644 --- a/pkg/cli/context/testutils.go +++ b/pkg/cli/context/testutils.go @@ -30,16 +30,15 @@ import ( ) // InitTestCtx initializes a test context -func InitTestCtx(t *testing.T, dnoteDir string, dbOpts *database.TestDBOptions) DnoteCtx { - dbPath := fmt.Sprintf("%s/%s", dnoteDir, consts.DnoteDBFileName) +func InitTestCtx(t *testing.T, paths Paths, dbOpts *database.TestDBOptions) DnoteCtx { + dbPath := fmt.Sprintf("%s/%s/%s", paths.Data, consts.DnoteDirName, consts.DnoteDBFileName) db := database.InitTestDB(t, dbPath, dbOpts) return DnoteCtx{ - DB: db, - DnoteDir: dnoteDir, - // Use a mock clock to test times - Clock: clock.NewMock(), + DB: db, + Paths: paths, + Clock: clock.NewMock(), // Use a mock clock to test times } } @@ -47,7 +46,13 @@ func InitTestCtx(t *testing.T, dnoteDir string, dbOpts *database.TestDBOptions) func TeardownTestCtx(t *testing.T, ctx DnoteCtx) { database.TeardownTestDB(t, ctx.DB) - if err := os.RemoveAll(ctx.DnoteDir); err != nil { - t.Fatal(errors.Wrap(err, "removing test dnote directory")) + if err := os.RemoveAll(ctx.Paths.Data); err != nil { + t.Fatal(errors.Wrap(err, "removing test data directory")) + } + if err := os.RemoveAll(ctx.Paths.Config); err != nil { + t.Fatal(errors.Wrap(err, "removing test config directory")) + } + if err := os.RemoveAll(ctx.Paths.Cache); err != nil { + t.Fatal(errors.Wrap(err, "removing test cache directory")) } } diff --git a/pkg/cli/database/testutils.go b/pkg/cli/database/testutils.go index 17032696..dbcb0bc5 100644 --- a/pkg/cli/database/testutils.go +++ b/pkg/cli/database/testutils.go @@ -151,7 +151,7 @@ func TeardownTestDB(t *testing.T, db *DB) { // OpenTestDB opens the database connection to a test database // without initializing any schema func OpenTestDB(t *testing.T, dnoteDir string) *DB { - dbPath := fmt.Sprintf("%s/%s", dnoteDir, consts.DnoteDBFileName) + dbPath := fmt.Sprintf("%s/%s/%s", dnoteDir, consts.DnoteDirName, consts.DnoteDBFileName) db, err := Open(dbPath) if err != nil { t.Fatal(errors.Wrap(err, "opening database connection to the test database")) diff --git a/pkg/cli/dirs/dirs.go b/pkg/cli/dirs/dirs.go new file mode 100644 index 00000000..81f2e5f7 --- /dev/null +++ b/pkg/cli/dirs/dirs.go @@ -0,0 +1,49 @@ +// Package dirs provides base directory definitions for the system +package dirs + +import ( + "os" + "os/user" + + "github.com/pkg/errors" +) + +var ( + // Home is the home directory of the user + Home string + // ConfigHome is the full path to the directory in which user-specific + // configurations should be written. + ConfigHome string + // DataHome is the full path to the directory in which user-specific data + // files should be written. + DataHome string + // CacheHome is the full path to the directory in which user-specific + // non-essential cached data should be writte + CacheHome string +) + +func init() { + Reload() +} + +// Reload reloads the directory definitions +func Reload() { + initDirs() +} + +func getHomeDir() string { + usr, err := user.Current() + if err != nil { + panic(errors.Wrap(err, "getting home dir")) + } + + return usr.HomeDir +} + +func readPath(envName, defaultPath string) string { + if dir := os.Getenv(envName); dir != "" { + return dir + } + + return defaultPath +} diff --git a/pkg/cli/dirs/dirs_test.go b/pkg/cli/dirs/dirs_test.go new file mode 100644 index 00000000..058b7949 --- /dev/null +++ b/pkg/cli/dirs/dirs_test.go @@ -0,0 +1,25 @@ +package dirs + +import ( + "os" + "testing" + + "github.com/dnote/dnote/pkg/assert" +) + +type envTestCase struct { + envKey string + envVal string + got *string + expected string +} + +func testCustomDirs(t *testing.T, testCases []envTestCase) { + for _, tc := range testCases { + os.Setenv(tc.envKey, tc.envVal) + + Reload() + + assert.Equal(t, *tc.got, tc.expected, "result mismatch") + } +} diff --git a/pkg/cli/dirs/dirs_unix.go b/pkg/cli/dirs/dirs_unix.go new file mode 100644 index 00000000..28dfe5fb --- /dev/null +++ b/pkg/cli/dirs/dirs_unix.go @@ -0,0 +1,33 @@ +// +build linux darwin + +package dirs + +import ( + "path/filepath" +) + +// The environment variable names for the XDG base directory specification +var ( + envConfigHome = "XDG_CONFIG_HOME" + envDataHome = "XDG_DATA_HOME" + envCacheHome = "XDG_CACHE_HOME" +) + +func initDirs() { + Home = getHomeDir() + ConfigHome = readPath(envConfigHome, getConfigHome(Home)) + DataHome = readPath(envDataHome, getDataHome(Home)) + CacheHome = readPath(envCacheHome, getCacheHome(Home)) +} + +func getConfigHome(homeDir string) string { + return filepath.Join(homeDir, ".config") +} + +func getDataHome(homeDir string) string { + return filepath.Join(homeDir, ".local/share") +} + +func getCacheHome(homeDir string) string { + return filepath.Join(homeDir, ".cache") +} diff --git a/pkg/cli/dirs/dirs_unix_test.go b/pkg/cli/dirs/dirs_unix_test.go new file mode 100644 index 00000000..a0b08c0c --- /dev/null +++ b/pkg/cli/dirs/dirs_unix_test.go @@ -0,0 +1,66 @@ +// +build linux darwin + +package dirs + +import ( + "path/filepath" + "testing" + + "github.com/dnote/dnote/pkg/assert" +) + +func TestDirs(t *testing.T) { + home := Home + assert.NotEqual(t, home, "", "home is empty") + + configHome := filepath.Join(home, ".config") + dataHome := filepath.Join(home, ".local", "share") + cacheHome := filepath.Join(home, ".cache") + + testCases := []struct { + got string + expected string + }{ + { + got: ConfigHome, + expected: configHome, + }, + { + got: DataHome, + expected: dataHome, + }, + { + got: CacheHome, + expected: cacheHome, + }, + } + + for _, tc := range testCases { + assert.Equal(t, tc.got, tc.expected, "result mismatch") + } +} + +func TestCustomDirs(t *testing.T) { + testCases := []envTestCase{ + { + envKey: "XDG_CONFIG_HOME", + envVal: "~/custom/config", + got: &ConfigHome, + expected: "~/custom/config", + }, + { + envKey: "XDG_DATA_HOME", + envVal: "~/custom/data", + got: &DataHome, + expected: "~/custom/data", + }, + { + envKey: "XDG_CACHE_HOME", + envVal: "~/custom/cache", + got: &CacheHome, + expected: "~/custom/cache", + }, + } + + testCustomDirs(t, testCases) +} diff --git a/pkg/cli/dirs/dirs_windows.go b/pkg/cli/dirs/dirs_windows.go new file mode 100644 index 00000000..a3660e18 --- /dev/null +++ b/pkg/cli/dirs/dirs_windows.go @@ -0,0 +1,14 @@ +// +build windows + +package dirs + +import ( + "path/filepath" +) + +func initDirs() { + Home = getHomeDir() + ConfigHome = filepath.Join(Home, ".dnote") + DataHome = filepath.Join(Home, ".dnote") + CacheHome = filepath.Join(Home, ".dnote") +} diff --git a/pkg/cli/dirs/dirs_windows_test.go b/pkg/cli/dirs/dirs_windows_test.go new file mode 100644 index 00000000..093c1608 --- /dev/null +++ b/pkg/cli/dirs/dirs_windows_test.go @@ -0,0 +1,41 @@ +// +build windows + +package dirs + +import ( + "path/filepath" + "testing" + + "github.com/dnote/dnote/pkg/assert" +) + +func TestDirs(t *testing.T) { + home := Home + assert.NotEqual(t, home, "", "home is empty") + + configHome := filepath.Join(home, ".dnote") + dataHome := filepath.Join(home, ".dnote") + cacheHome := filepath.Join(home, ".dnote") + + testCases := []struct { + got string + expected string + }{ + { + got: ConfigHome, + expected: configHome, + }, + { + got: DataHome, + expected: dataHome, + }, + { + got: CacheHome, + expected: cacheHome, + }, + } + + for _, tc := range testCases { + assert.Equal(t, tc.got, tc.expected, "result mismatch") + } +} diff --git a/pkg/cli/infra/init.go b/pkg/cli/infra/init.go index 5feb4b7d..381483a3 100644 --- a/pkg/cli/infra/init.go +++ b/pkg/cli/infra/init.go @@ -24,7 +24,7 @@ import ( "database/sql" "fmt" "os" - "os/user" + "path/filepath" "strconv" "time" @@ -32,6 +32,7 @@ import ( "github.com/dnote/dnote/pkg/cli/consts" "github.com/dnote/dnote/pkg/cli/context" "github.com/dnote/dnote/pkg/cli/database" + "github.com/dnote/dnote/pkg/cli/dirs" "github.com/dnote/dnote/pkg/cli/log" "github.com/dnote/dnote/pkg/cli/migrate" "github.com/dnote/dnote/pkg/cli/utils" @@ -43,24 +44,50 @@ import ( // RunEFunc is a function type of dnote commands type RunEFunc func(*cobra.Command, []string) error -func newCtx(versionTag string) (context.DnoteCtx, error) { - homeDir, err := getHomeDir() - if err != nil { - return context.DnoteCtx{}, errors.Wrap(err, "Failed to get home dir") +func checkLegacyDBPath() (string, bool) { + legacyDnoteDir := getLegacyDnotePath(dirs.Home) + ok, err := utils.FileExists(legacyDnoteDir) + if ok { + return legacyDnoteDir, true } - dnoteDir := getDnoteDir(homeDir) - dnoteDBPath := fmt.Sprintf("%s/%s", dnoteDir, consts.DnoteDBFileName) - db, err := database.Open(dnoteDBPath) + if err != nil { + log.Errorf(errors.Wrapf(err, "checking legacy dnote directory at %s", legacyDnoteDir).Error()) + } + + return "", false +} + +func getDBPath(paths context.Paths) string { + legacyDnoteDir, ok := checkLegacyDBPath() + if ok { + return fmt.Sprintf("%s/%s", legacyDnoteDir, consts.DnoteDBFileName) + } + + return fmt.Sprintf("%s/%s/%s", paths.Data, consts.DnoteDirName, consts.DnoteDBFileName) +} + +func newCtx(versionTag string) (context.DnoteCtx, error) { + dnoteDir := getLegacyDnotePath(dirs.Home) + paths := context.Paths{ + Home: dirs.Home, + Config: dirs.ConfigHome, + Data: dirs.DataHome, + Cache: dirs.CacheHome, + LegacyDnote: dnoteDir, + } + + dbPath := getDBPath(paths) + + db, err := database.Open(dbPath) if err != nil { return context.DnoteCtx{}, errors.Wrap(err, "conntecting to db") } ctx := context.DnoteCtx{ - HomeDir: homeDir, - DnoteDir: dnoteDir, - Version: versionTag, - DB: db, + Paths: paths, + Version: versionTag, + DB: db, } return ctx, nil @@ -123,8 +150,7 @@ func SetupCtx(ctx context.DnoteCtx) (context.DnoteCtx, error) { } ret := context.DnoteCtx{ - HomeDir: ctx.HomeDir, - DnoteDir: ctx.DnoteDir, + Paths: ctx.Paths, Version: ctx.Version, DB: ctx.DB, SessionKey: sessionKey, @@ -137,31 +163,10 @@ func SetupCtx(ctx context.DnoteCtx) (context.DnoteCtx, error) { return ret, nil } -func getDnoteDir(homeDir string) string { - var ret string - - dnoteDirEnv := os.Getenv("DNOTE_DIR") - if dnoteDirEnv == "" { - ret = fmt.Sprintf("%s/%s", homeDir, consts.DnoteDirName) - } else { - ret = dnoteDirEnv - } - - return ret -} - -func getHomeDir() (string, error) { - homeDirEnv := os.Getenv("DNOTE_HOME_DIR") - if homeDirEnv != "" { - return homeDirEnv, nil - } - - usr, err := user.Current() - if err != nil { - return "", errors.Wrap(err, "Failed to get current user") - } - - return usr.HomeDir, nil +// getLegacyDnotePath returns a legacy dnote directory path placed under +// the user's home directory +func getLegacyDnotePath(homeDir string) string { + return fmt.Sprintf("%s/%s", homeDir, consts.LegacyDnoteDirName) } // InitDB initializes the database. @@ -304,20 +309,32 @@ func getEditorCommand() string { return ret } -// initDnoteDir initializes dnote directory if it does not exist yet -func initDnoteDir(ctx context.DnoteCtx) error { - path := ctx.DnoteDir - +func initDir(path string) error { ok, err := utils.FileExists(path) if err != nil { - return errors.Wrap(err, "checking if dnote dir exists") + return errors.Wrapf(err, "checking if dir exists at %s", path) } if ok { return nil } if err := os.MkdirAll(path, 0755); err != nil { - return errors.Wrap(err, "Failed to create dnote directory") + return errors.Wrapf(err, "creating a directory at %s", path) + } + + return nil +} + +// initDnoteDir initializes missing directories that Dnote uses +func initDnoteDir(ctx context.DnoteCtx) error { + if err := initDir(filepath.Join(ctx.Paths.Config, consts.DnoteDirName)); err != nil { + return errors.Wrap(err, "initializing config dir") + } + if err := initDir(filepath.Join(ctx.Paths.Data, consts.DnoteDirName)); err != nil { + return errors.Wrap(err, "initializing data dir") + } + if err := initDir(filepath.Join(ctx.Paths.Cache, consts.DnoteDirName)); err != nil { + return errors.Wrap(err, "initializing cache dir") } return nil diff --git a/pkg/cli/main_test.go b/pkg/cli/main_test.go index ecf819af..38b8bdcf 100644 --- a/pkg/cli/main_test.go +++ b/pkg/cli/main_test.go @@ -35,9 +35,14 @@ import ( var binaryName = "test-dnote" +var testDir = "./tmp/.dnote" + var opts = testutils.RunDnoteCmdOptions{ - HomeDir: "./tmp", - DnoteDir: "./tmp/.dnote", + Env: []string{ + fmt.Sprintf("XDG_CONFIG_HOME=%s", testDir), + fmt.Sprintf("XDG_DATA_HOME=%s", testDir), + fmt.Sprintf("XDG_CACHE_HOME=%s", testDir), + }, } func TestMain(m *testing.M) { @@ -53,12 +58,12 @@ func TestInit(t *testing.T) { // Execute // run an arbitrary command "view" due to https://github.com/spf13/cobra/issues/1056 testutils.RunDnoteCmd(t, opts, binaryName, "view") - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) - db := database.OpenTestDB(t, opts.DnoteDir) + db := database.OpenTestDB(t, testDir) // Test - ok, err := utils.FileExists(opts.DnoteDir) + ok, err := utils.FileExists(testDir) if err != nil { t.Fatal(errors.Wrap(err, "checking if dnote dir exists")) } @@ -66,7 +71,7 @@ func TestInit(t *testing.T) { t.Errorf("dnote directory was not initialized") } - ok, err = utils.FileExists(fmt.Sprintf("%s/%s", opts.DnoteDir, consts.ConfigFilename)) + ok, err = utils.FileExists(fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.ConfigFilename)) if err != nil { t.Fatal(errors.Wrap(err, "checking if dnote config exists")) } @@ -104,9 +109,9 @@ func TestAddNote(t *testing.T) { t.Run("new book", func(t *testing.T) { // Set up and execute testutils.RunDnoteCmd(t, opts, binaryName, "add", "js", "-c", "foo") - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) - db := database.OpenTestDB(t, opts.DnoteDir) + db := database.OpenTestDB(t, testDir) // Test var noteCount, bookCount int @@ -132,12 +137,12 @@ func TestAddNote(t *testing.T) { t.Run("existing book", func(t *testing.T) { // Setup - db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil) + db := database.InitTestDB(t, fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.DnoteDBFileName), nil) testutils.Setup3(t, db) // Execute testutils.RunDnoteCmd(t, opts, binaryName, "add", "js", "-c", "foo") - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) // Test @@ -173,12 +178,12 @@ func TestAddNote(t *testing.T) { func TestEditNote(t *testing.T) { t.Run("content flag", func(t *testing.T) { // Setup - db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil) + db := database.InitTestDB(t, fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.DnoteDBFileName), nil) testutils.Setup4(t, db) // Execute testutils.RunDnoteCmd(t, opts, binaryName, "edit", "2", "-c", "foo bar") - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) // Test var noteCount, bookCount int @@ -206,12 +211,12 @@ func TestEditNote(t *testing.T) { t.Run("book flag", func(t *testing.T) { // Setup - db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil) + db := database.InitTestDB(t, fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.DnoteDBFileName), nil) testutils.Setup5(t, db) // Execute testutils.RunDnoteCmd(t, opts, binaryName, "edit", "2", "-b", "linux") - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) // Test var noteCount, bookCount int @@ -240,12 +245,12 @@ func TestEditNote(t *testing.T) { t.Run("book flag and content flag", func(t *testing.T) { // Setup - db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil) + db := database.InitTestDB(t, fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.DnoteDBFileName), nil) testutils.Setup5(t, db) // Execute testutils.RunDnoteCmd(t, opts, binaryName, "edit", "2", "-b", "linux", "-c", "n2 body updated") - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) // Test var noteCount, bookCount int @@ -276,12 +281,12 @@ func TestEditNote(t *testing.T) { func TestEditBook(t *testing.T) { t.Run("name flag", func(t *testing.T) { // Setup - db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil) + db := database.InitTestDB(t, fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.DnoteDBFileName), nil) testutils.Setup1(t, db) // Execute testutils.RunDnoteCmd(t, opts, binaryName, "edit", "js", "-n", "js-edited") - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) // Test var noteCount, bookCount int @@ -335,7 +340,7 @@ func TestRemoveNote(t *testing.T) { for _, tc := range testCases { t.Run(fmt.Sprintf("--yes=%t", tc.yesFlag), func(t *testing.T) { // Setup - db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil) + db := database.InitTestDB(t, fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.DnoteDBFileName), nil) testutils.Setup2(t, db) // Execute @@ -344,7 +349,7 @@ func TestRemoveNote(t *testing.T) { } else { testutils.WaitDnoteCmd(t, opts, testutils.UserConfirm, binaryName, "remove", "1") } - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) // Test var noteCount, bookCount, jsNoteCount, linuxNoteCount int @@ -422,7 +427,7 @@ func TestRemoveBook(t *testing.T) { for _, tc := range testCases { t.Run(fmt.Sprintf("--yes=%t", tc.yesFlag), func(t *testing.T) { // Setup - db := database.InitTestDB(t, fmt.Sprintf("%s/%s", opts.DnoteDir, consts.DnoteDBFileName), nil) + db := database.InitTestDB(t, fmt.Sprintf("%s/%s/%s", testDir, consts.DnoteDirName, consts.DnoteDBFileName), nil) testutils.Setup2(t, db) // Execute @@ -432,7 +437,7 @@ func TestRemoveBook(t *testing.T) { testutils.WaitDnoteCmd(t, opts, testutils.UserConfirm, binaryName, "remove", "js") } - defer testutils.RemoveDir(t, opts.HomeDir) + defer testutils.RemoveDir(t, testDir) // Test var noteCount, bookCount, jsNoteCount, linuxNoteCount int diff --git a/pkg/cli/migrate/legacy.go b/pkg/cli/migrate/legacy.go index 3d771ac9..ef4f8045 100644 --- a/pkg/cli/migrate/legacy.go +++ b/pkg/cli/migrate/legacy.go @@ -177,8 +177,8 @@ func performMigration(ctx context.DnoteCtx, migrationID int) error { // backupDnoteDir backs up the dnote directory to a temporary backup directory func backupDnoteDir(ctx context.DnoteCtx) error { - srcPath := fmt.Sprintf("%s/.dnote", ctx.HomeDir) - tmpPath := fmt.Sprintf("%s/%s", ctx.HomeDir, backupDirName) + srcPath := fmt.Sprintf("%s/.dnote", ctx.Paths.Home) + tmpPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, backupDirName) if err := utils.CopyDir(srcPath, tmpPath); err != nil { return errors.Wrap(err, "Failed to copy the .dnote directory") @@ -198,8 +198,8 @@ func restoreBackup(ctx context.DnoteCtx) error { } }() - srcPath := fmt.Sprintf("%s/.dnote", ctx.HomeDir) - backupPath := fmt.Sprintf("%s/%s", ctx.HomeDir, backupDirName) + srcPath := fmt.Sprintf("%s/.dnote", ctx.Paths.Home) + backupPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, backupDirName) if err = os.RemoveAll(srcPath); err != nil { return errors.Wrapf(err, "Failed to clear current dnote data at %s", backupPath) @@ -213,7 +213,7 @@ func restoreBackup(ctx context.DnoteCtx) error { } func clearBackup(ctx context.DnoteCtx) error { - backupPath := fmt.Sprintf("%s/%s", ctx.HomeDir, backupDirName) + backupPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, backupDirName) if err := os.RemoveAll(backupPath); err != nil { return errors.Wrapf(err, "Failed to remove backup at %s", backupPath) @@ -224,7 +224,7 @@ func clearBackup(ctx context.DnoteCtx) error { // getSchemaPath returns the path to the file containing schema info func getSchemaPath(ctx context.DnoteCtx) string { - return fmt.Sprintf("%s/%s", ctx.DnoteDir, schemaFilename) + return fmt.Sprintf("%s/%s", ctx.Paths.LegacyDnote, schemaFilename) } func readSchema(ctx context.DnoteCtx) (schema, error) { @@ -485,7 +485,7 @@ var migrateToV8SystemKeyBookMark = "bookmark" // migrateToV1 deletes YAML archive if exists func migrateToV1(ctx context.DnoteCtx) error { - yamlPath := fmt.Sprintf("%s/%s", ctx.HomeDir, ".dnote-yaml-archived") + yamlPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, ".dnote-yaml-archived") ok, err := utils.FileExists(yamlPath) if err != nil { return errors.Wrap(err, "checking if yaml file exists") @@ -502,7 +502,7 @@ func migrateToV1(ctx context.DnoteCtx) error { } func migrateToV2(ctx context.DnoteCtx) error { - notePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir) + notePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote) b, err := ioutil.ReadFile(notePath) if err != nil { @@ -558,8 +558,8 @@ func migrateToV2(ctx context.DnoteCtx) error { // migrateToV3 generates actions for existing dnote func migrateToV3(ctx context.DnoteCtx) error { - notePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir) - actionsPath := fmt.Sprintf("%s/actions", ctx.DnoteDir) + notePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote) + actionsPath := fmt.Sprintf("%s/actions", ctx.Paths.LegacyDnote) b, err := ioutil.ReadFile(notePath) if err != nil { @@ -645,7 +645,7 @@ func getEditorCommand() string { } func migrateToV4(ctx context.DnoteCtx) error { - configPath := fmt.Sprintf("%s/dnoterc", ctx.DnoteDir) + configPath := fmt.Sprintf("%s/dnoterc", ctx.Paths.LegacyDnote) b, err := ioutil.ReadFile(configPath) if err != nil { @@ -678,7 +678,7 @@ func migrateToV4(ctx context.DnoteCtx) error { // migrateToV5 migrates actions func migrateToV5(ctx context.DnoteCtx) error { - actionsPath := fmt.Sprintf("%s/actions", ctx.DnoteDir) + actionsPath := fmt.Sprintf("%s/actions", ctx.Paths.LegacyDnote) b, err := ioutil.ReadFile(actionsPath) if err != nil { @@ -748,7 +748,7 @@ func migrateToV5(ctx context.DnoteCtx) error { // migrateToV6 adds a 'public' field to notes func migrateToV6(ctx context.DnoteCtx) error { - notePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir) + notePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote) b, err := ioutil.ReadFile(notePath) if err != nil { @@ -803,7 +803,7 @@ func migrateToV6(ctx context.DnoteCtx) error { // EditNoteDataV2. Due to a bug, edit logged actions with schema version '2' // but with a data of EditNoteDataV1. https://github.com/dnote/dnote/pkg/cli/issues/107 func migrateToV7(ctx context.DnoteCtx) error { - actionPath := fmt.Sprintf("%s/actions", ctx.DnoteDir) + actionPath := fmt.Sprintf("%s/actions", ctx.Paths.LegacyDnote) b, err := ioutil.ReadFile(actionPath) if err != nil { @@ -873,7 +873,7 @@ func migrateToV8(ctx context.DnoteCtx) error { } // 1. Migrate the the dnote file - dnoteFilePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir) + dnoteFilePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote) b, err := ioutil.ReadFile(dnoteFilePath) if err != nil { return errors.Wrap(err, "reading the notes") @@ -913,7 +913,7 @@ func migrateToV8(ctx context.DnoteCtx) error { } // 2. Migrate the actions file - actionsPath := fmt.Sprintf("%s/actions", ctx.DnoteDir) + actionsPath := fmt.Sprintf("%s/actions", ctx.Paths.LegacyDnote) b, err = ioutil.ReadFile(actionsPath) if err != nil { return errors.Wrap(err, "reading the actions") @@ -938,7 +938,7 @@ func migrateToV8(ctx context.DnoteCtx) error { } // 3. Migrate the timestamps file - timestampsPath := fmt.Sprintf("%s/timestamps", ctx.DnoteDir) + timestampsPath := fmt.Sprintf("%s/timestamps", ctx.Paths.LegacyDnote) b, err = ioutil.ReadFile(timestampsPath) if err != nil { return errors.Wrap(err, "reading the timestamps") @@ -980,7 +980,7 @@ func migrateToV8(ctx context.DnoteCtx) error { if err := os.RemoveAll(timestampsPath); err != nil { return errors.Wrap(err, "removing the timestamps file") } - schemaPath := fmt.Sprintf("%s/schema", ctx.DnoteDir) + schemaPath := fmt.Sprintf("%s/schema", ctx.Paths.LegacyDnote) if err := os.RemoveAll(schemaPath); err != nil { return errors.Wrap(err, "removing the schema file") } diff --git a/pkg/cli/migrate/legacy_test.go b/pkg/cli/migrate/legacy_test.go index 7fe81126..948dd7b4 100644 --- a/pkg/cli/migrate/legacy_test.go +++ b/pkg/cli/migrate/legacy_test.go @@ -42,13 +42,15 @@ func setupEnv(t *testing.T, homeDir string) context.DnoteCtx { } return context.DnoteCtx{ - HomeDir: homeDir, - DnoteDir: dnoteDir, + Paths: context.Paths{ + Home: homeDir, + LegacyDnote: dnoteDir, + }, } } func teardownEnv(t *testing.T, ctx context.DnoteCtx) { - if err := os.RemoveAll(ctx.DnoteDir); err != nil { + if err := os.RemoveAll(ctx.Paths.LegacyDnote); err != nil { t.Fatal(errors.Wrap(err, "tearing down the dnote dir")) } } @@ -59,7 +61,7 @@ func TestMigrateToV1(t *testing.T) { ctx := setupEnv(t, "../tmp") defer teardownEnv(t, ctx) - yamlPath, err := filepath.Abs(filepath.Join(ctx.HomeDir, ".dnote-yaml-archived")) + yamlPath, err := filepath.Abs(filepath.Join(ctx.Paths.Home, ".dnote-yaml-archived")) if err != nil { panic(errors.Wrap(err, "Failed to get absolute YAML path").Error()) } @@ -85,7 +87,7 @@ func TestMigrateToV1(t *testing.T) { ctx := setupEnv(t, "../tmp") defer teardownEnv(t, ctx) - yamlPath, err := filepath.Abs(filepath.Join(ctx.HomeDir, ".dnote-yaml-archived")) + yamlPath, err := filepath.Abs(filepath.Join(ctx.Paths.Home, ".dnote-yaml-archived")) if err != nil { panic(errors.Wrap(err, "Failed to get absolute YAML path").Error()) } @@ -356,7 +358,13 @@ func TestMigrateToV8(t *testing.T) { db := database.InitTestDB(t, "../tmp/.dnote/dnote-test.db", &opts) defer database.TeardownTestDB(t, db) - ctx := context.DnoteCtx{HomeDir: "../tmp", DnoteDir: "../tmp/.dnote", DB: db} + ctx := context.DnoteCtx{ + Paths: context.Paths{ + Home: "../tmp", + LegacyDnote: "../tmp/.dnote", + }, + DB: db, + } // set up testutils.CopyFixture(t, ctx, "./fixtures/legacy-8-actions.json", "actions") @@ -373,10 +381,10 @@ func TestMigrateToV8(t *testing.T) { // test // 1. test if files are migrated - dnoteFilePath := fmt.Sprintf("%s/dnote", ctx.DnoteDir) - dnotercPath := fmt.Sprintf("%s/dnoterc", ctx.DnoteDir) - schemaFilePath := fmt.Sprintf("%s/schema", ctx.DnoteDir) - timestampFilePath := fmt.Sprintf("%s/timestamps", ctx.DnoteDir) + dnoteFilePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote) + dnotercPath := fmt.Sprintf("%s/dnoterc", ctx.Paths.LegacyDnote) + schemaFilePath := fmt.Sprintf("%s/schema", ctx.Paths.LegacyDnote) + timestampFilePath := fmt.Sprintf("%s/timestamps", ctx.Paths.LegacyDnote) ok, err := utils.FileExists(dnoteFilePath) if err != nil { diff --git a/pkg/cli/migrate/migrate_test.go b/pkg/cli/migrate/migrate_test.go index 2a94b9d6..6a2719b0 100644 --- a/pkg/cli/migrate/migrate_test.go +++ b/pkg/cli/migrate/migrate_test.go @@ -37,6 +37,14 @@ import ( "github.com/pkg/errors" ) +var paths context.Paths = context.Paths{ + Home: "../../tmp", + Cache: "../../tmp", + Config: "../../tmp", + Data: "../../tmp", + LegacyDnote: "../../tmp", +} + func TestExecute_bump_schema(t *testing.T) { testCases := []struct { schemaKey string @@ -53,7 +61,7 @@ func TestExecute_bump_schema(t *testing.T) { func() { // set up opts := database.TestDBOptions{SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -110,7 +118,7 @@ func TestRun_nonfresh(t *testing.T) { func() { // set up opts := database.TestDBOptions{SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -190,7 +198,7 @@ func TestRun_fresh(t *testing.T) { func() { // set up opts := database.TestDBOptions{SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -264,7 +272,7 @@ func TestRun_up_to_date(t *testing.T) { func() { // set up opts := database.TestDBOptions{SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -319,7 +327,7 @@ func TestRun_up_to_date(t *testing.T) { func TestLocalMigration1(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -397,7 +405,7 @@ func TestLocalMigration1(t *testing.T) { func TestLocalMigration2(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -484,7 +492,7 @@ func TestLocalMigration2(t *testing.T) { func TestLocalMigration3(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -559,7 +567,7 @@ func TestLocalMigration3(t *testing.T) { func TestLocalMigration4(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-1-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -603,7 +611,7 @@ func TestLocalMigration4(t *testing.T) { func TestLocalMigration5(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-5-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -665,7 +673,7 @@ func TestLocalMigration5(t *testing.T) { func TestLocalMigration6(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-5-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -698,7 +706,7 @@ func TestLocalMigration6(t *testing.T) { func TestLocalMigration7_trash(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-7-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -731,7 +739,7 @@ func TestLocalMigration7_trash(t *testing.T) { func TestLocalMigration7_conflicts(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-7-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -764,7 +772,7 @@ func TestLocalMigration7_conflicts(t *testing.T) { func TestLocalMigration7_conflicts_dup(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-7-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -802,7 +810,7 @@ func TestLocalMigration7_conflicts_dup(t *testing.T) { func TestLocalMigration8(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-8-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -868,7 +876,7 @@ func TestLocalMigration8(t *testing.T) { func TestLocalMigration9(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-9-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -914,7 +922,7 @@ func TestLocalMigration9(t *testing.T) { func TestLocalMigration10(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-10-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -986,7 +994,7 @@ func TestLocalMigration10(t *testing.T) { func TestLocalMigration11(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-11-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) db := ctx.DB @@ -1066,11 +1074,11 @@ func TestLocalMigration11(t *testing.T) { func TestLocalMigration12(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/local-12-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) data := []byte("editor: vim") - path := fmt.Sprintf("%s/dnoterc", ctx.DnoteDir) + path := fmt.Sprintf("%s/dnoterc", ctx.Paths.LegacyDnote) if err := ioutil.WriteFile(path, data, 0644); err != nil { t.Fatal(errors.Wrap(err, "Failed to write schema file")) } @@ -1103,7 +1111,7 @@ func TestLocalMigration12(t *testing.T) { func TestRemoteMigration1(t *testing.T) { // set up opts := database.TestDBOptions{SchemaSQLPath: "./fixtures/remote-1-pre-schema.sql", SkipMigration: true} - ctx := context.InitTestCtx(t, "../tmp", &opts) + ctx := context.InitTestCtx(t, paths, &opts) defer context.TeardownTestCtx(t, ctx) testutils.Login(t, &ctx) diff --git a/pkg/cli/testutils/main.go b/pkg/cli/testutils/main.go index 68f66eaa..dfc62421 100644 --- a/pkg/cli/testutils/main.go +++ b/pkg/cli/testutils/main.go @@ -22,7 +22,6 @@ package testutils import ( "bytes" "encoding/json" - "fmt" "io" "io/ioutil" "os" @@ -64,7 +63,7 @@ func CopyFixture(t *testing.T, ctx context.DnoteCtx, fixturePath string, filenam t.Fatal(errors.Wrap(err, "getting the absolute path for fixture")) } - dp, err := filepath.Abs(filepath.Join(ctx.DnoteDir, filename)) + dp, err := filepath.Abs(filepath.Join(ctx.Paths.LegacyDnote, filename)) if err != nil { t.Fatal(errors.Wrap(err, "getting the absolute path dnote dir")) } @@ -77,7 +76,7 @@ func CopyFixture(t *testing.T, ctx context.DnoteCtx, fixturePath string, filenam // WriteFile writes a file with the given content and filename inside the dnote dir func WriteFile(ctx context.DnoteCtx, content []byte, filename string) { - dp, err := filepath.Abs(filepath.Join(ctx.DnoteDir, filename)) + dp, err := filepath.Abs(filepath.Join(ctx.Paths.LegacyDnote, filename)) if err != nil { panic(err) } @@ -89,7 +88,7 @@ func WriteFile(ctx context.DnoteCtx, content []byte, filename string) { // ReadFile reads the content of the file with the given name in dnote dir func ReadFile(ctx context.DnoteCtx, filename string) []byte { - path := filepath.Join(ctx.DnoteDir, filename) + path := filepath.Join(ctx.Paths.LegacyDnote, filename) b, err := ioutil.ReadFile(path) if err != nil { @@ -121,17 +120,17 @@ func NewDnoteCmd(opts RunDnoteCmdOptions, binaryName string, arg ...string) (*ex } cmd := exec.Command(binaryPath, arg...) - cmd.Env = []string{fmt.Sprintf("DNOTE_DIR=%s", opts.DnoteDir), fmt.Sprintf("DNOTE_HOME_DIR=%s", opts.HomeDir)} cmd.Stderr = &stderr cmd.Stdout = &stdout + cmd.Env = opts.Env + return cmd, &stderr, &stdout, nil } // RunDnoteCmdOptions is an option for RunDnoteCmd type RunDnoteCmdOptions struct { - DnoteDir string - HomeDir string + Env []string } // RunDnoteCmd runs a dnote command diff --git a/pkg/cli/ui/editor.go b/pkg/cli/ui/editor.go index 4b5cb0d4..9fa73072 100644 --- a/pkg/cli/ui/editor.go +++ b/pkg/cli/ui/editor.go @@ -37,7 +37,7 @@ import ( func GetTmpContentPath(ctx context.DnoteCtx) (string, error) { for i := 0; ; i++ { filename := fmt.Sprintf("%s_%d.%s", consts.TmpContentFileBase, i, consts.TmpContentFileExt) - candidate := fmt.Sprintf("%s/%s", ctx.DnoteDir, filename) + candidate := fmt.Sprintf("%s/%s", ctx.Paths.Cache, filename) ok, err := utils.FileExists(candidate) if err != nil { diff --git a/pkg/cli/ui/editor_test.go b/pkg/cli/ui/editor_test.go index d89e3d9c..03338560 100644 --- a/pkg/cli/ui/editor_test.go +++ b/pkg/cli/ui/editor_test.go @@ -30,7 +30,10 @@ import ( func TestGetTmpContentPath(t *testing.T) { t.Run("no collision", func(t *testing.T) { - ctx := context.InitTestCtx(t, "../tmp1", nil) + ctx := context.InitTestCtx(t, context.Paths{ + Data: "../tmp", + Cache: "../tmp", + }, nil) defer context.TeardownTestCtx(t, ctx) res, err := GetTmpContentPath(ctx) @@ -38,16 +41,19 @@ func TestGetTmpContentPath(t *testing.T) { t.Fatal(errors.Wrap(err, "executing")) } - expected := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_0.md") + expected := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_0.md") assert.Equal(t, res, expected, "filename did not match") }) t.Run("one existing session", func(t *testing.T) { // set up - ctx := context.InitTestCtx(t, "../tmp2", nil) + ctx := context.InitTestCtx(t, context.Paths{ + Data: "../tmp2", + Cache: "../tmp2", + }, nil) defer context.TeardownTestCtx(t, ctx) - p := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_0.md") + p := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_0.md") if _, err := os.Create(p); err != nil { t.Fatal(errors.Wrap(err, "preparing the conflicting file")) } @@ -59,20 +65,23 @@ func TestGetTmpContentPath(t *testing.T) { } // test - expected := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_1.md") + expected := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_1.md") assert.Equal(t, res, expected, "filename did not match") }) t.Run("two existing sessions", func(t *testing.T) { // set up - ctx := context.InitTestCtx(t, "../tmp3", nil) + ctx := context.InitTestCtx(t, context.Paths{ + Data: "../tmp3", + Cache: "../tmp3", + }, nil) defer context.TeardownTestCtx(t, ctx) - p1 := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_0.md") + p1 := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_0.md") if _, err := os.Create(p1); err != nil { t.Fatal(errors.Wrap(err, "preparing the conflicting file")) } - p2 := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_1.md") + p2 := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_1.md") if _, err := os.Create(p2); err != nil { t.Fatal(errors.Wrap(err, "preparing the conflicting file")) } @@ -84,7 +93,7 @@ func TestGetTmpContentPath(t *testing.T) { } // test - expected := fmt.Sprintf("%s/%s", ctx.DnoteDir, "DNOTE_TMPCONTENT_2.md") + expected := fmt.Sprintf("%s/%s", ctx.Paths.Cache, "DNOTE_TMPCONTENT_2.md") assert.Equal(t, res, expected, "filename did not match") }) }