From c45f011fb505f76b53bd82b454ecdfa41f20726c Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 11 Aug 2020 12:11:03 -0400 Subject: [PATCH 01/27] =?UTF-8?q?=F0=9F=93=9D=20Recommend=20Windows=20Term?= =?UTF-8?q?inal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 243b639..f0d73a9 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Amfora aims to be the best looking [Gemini](https://gemini.circumlunar.space/) client with the most features... all in the terminal. It does not support Gopher or other non-Web protocols - check out [Bombadillo](http://bombadillo.colorfield.space/) for that. -It also aims to be completely cross platform, with full Windows support. If you're on Windows, I would not recommend using the default terminal software. Maybe use Powershell (comes with Windows) or [Cmder](https://cmder.net/) instead. Note that some of the application colors will not display correctly on most Windows terminals, but all functionality will still work. +It also aims to be completely cross platform, with full Windows support. If you're on Windows, I would not recommend using the default terminal software. Use [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701) instead. Note that some of the application colors might not display correctly on Windows, but all functionality will still work. It fully passes Sean Conman's client torture test, including the new Unicode tests. It mostly passes the Egsam test. From e01b8668eaf480373ffdd052f87e92c177d4b676 Mon Sep 17 00:00:00 2001 From: makeworld Date: Wed, 12 Aug 2020 10:25:43 -0400 Subject: [PATCH 02/27] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20go-gemini=20v0.8.2?= =?UTF-8?q?=20for=20Go=201.15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 92ee038..45ec8fc 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/dustin/go-humanize v1.0.0 github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gdamore/tcell v1.3.1-0.20200608133353-cb1e5d6fa606 - github.com/makeworld-the-better-one/go-gemini v0.7.0 + github.com/makeworld-the-better-one/go-gemini v0.8.2 github.com/makeworld-the-better-one/go-isemoji v1.0.0 github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index be1cd19..ffb9f99 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tW github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/makeworld-the-better-one/go-gemini v0.7.0 h1:TCerE47eYHLXj6RQDjfd5HdGVbcVqpBC6OoPBlyY7q4= -github.com/makeworld-the-better-one/go-gemini v0.7.0/go.mod h1:P7/FbZ+IEIbA/d+A0Y3w2GNgD8SA2AcNv7aDGJbaWG4= +github.com/makeworld-the-better-one/go-gemini v0.8.2 h1:wRlNRO31ckXH29av1KM9wzkr9Rj3tnncsIeb9ehkSUQ= +github.com/makeworld-the-better-one/go-gemini v0.8.2/go.mod h1:P7/FbZ+IEIbA/d+A0Y3w2GNgD8SA2AcNv7aDGJbaWG4= github.com/makeworld-the-better-one/go-isemoji v1.0.0 h1:W3O4+qwtXeT8PUDzcQ1UjxiupQWgc/oJHpqwrllx3xM= github.com/makeworld-the-better-one/go-isemoji v1.0.0/go.mod h1:FBjkPl9rr0G4vlZCc+Mr+QcnOfGCTbGWYW8/1sp06I0= github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f h1:YEUlTs5gb35UlBLTgqrub9axWTYB3d7/8TxrkJDZpRI= From 621a2908cddc66368d2c4a12bf3e0c7fbcd93b0f Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 13 Aug 2020 14:28:23 -0400 Subject: [PATCH 03/27] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20go-gemini=20v0.8.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 45ec8fc..8405383 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/dustin/go-humanize v1.0.0 github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gdamore/tcell v1.3.1-0.20200608133353-cb1e5d6fa606 - github.com/makeworld-the-better-one/go-gemini v0.8.2 + github.com/makeworld-the-better-one/go-gemini v0.8.3 github.com/makeworld-the-better-one/go-isemoji v1.0.0 github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index ffb9f99..38c7015 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tW github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/makeworld-the-better-one/go-gemini v0.8.2 h1:wRlNRO31ckXH29av1KM9wzkr9Rj3tnncsIeb9ehkSUQ= -github.com/makeworld-the-better-one/go-gemini v0.8.2/go.mod h1:P7/FbZ+IEIbA/d+A0Y3w2GNgD8SA2AcNv7aDGJbaWG4= +github.com/makeworld-the-better-one/go-gemini v0.8.3 h1:ZxMLglHjua+mT6NxtboNkCLD109udgaOuvD0WxV/7bY= +github.com/makeworld-the-better-one/go-gemini v0.8.3/go.mod h1:P7/FbZ+IEIbA/d+A0Y3w2GNgD8SA2AcNv7aDGJbaWG4= github.com/makeworld-the-better-one/go-isemoji v1.0.0 h1:W3O4+qwtXeT8PUDzcQ1UjxiupQWgc/oJHpqwrllx3xM= github.com/makeworld-the-better-one/go-isemoji v1.0.0/go.mod h1:FBjkPl9rr0G4vlZCc+Mr+QcnOfGCTbGWYW8/1sp06I0= github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f h1:YEUlTs5gb35UlBLTgqrub9axWTYB3d7/8TxrkJDZpRI= From ef0675fc0bcfdfaf3ea67253ab387e158ac39d45 Mon Sep 17 00:00:00 2001 From: Chloe Kudryavtsev Date: Tue, 18 Aug 2020 17:32:53 -0400 Subject: [PATCH 04/27] =?UTF-8?q?=E2=9C=A8=20Allow=20relative=20URLs=20in?= =?UTF-8?q?=20bottom=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- display/display.go | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/display/display.go b/display/display.go index d48220a..c44be84 100644 --- a/display/display.go +++ b/display/display.go @@ -3,7 +3,6 @@ package display import ( "fmt" "net/url" - "path" "strconv" "strings" @@ -127,27 +126,19 @@ func Init() { reset() return } - if query == ".." && tabs[tab].hasContent() { - // Go up a directory - parsed, err := url.Parse(tabs[tab].page.Url) + if query[0] == '.' && tabs[tab].hasContent() { // relative url + current, err := url.Parse(tabs[tab].page.Url) if err != nil { // This shouldn't occur return } - if parsed.Path == "/" { - // Can't go up further + target, err := current.Parse(query) + if err != nil { + // invalid relative url reset() return } - - // Ex: /test/foo/ -> /test/foo//.. -> /test -> /test/ - parsed.Path = path.Clean(parsed.Path+"/..") + "/" - if parsed.Path == "//" { - // Fix double slash that occurs at domain root - parsed.Path = "/" - } - parsed.RawQuery = "" // Remove query - URL(parsed.String()) + URL(target.String()) return } From f22ee7d76ce62ad3b02df90b8415bc9c5b4fabcf Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 18 Aug 2020 19:48:10 -0400 Subject: [PATCH 05/27] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20comment=20style=20an?= =?UTF-8?q?d=20remove=20reset()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- display/display.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/display/display.go b/display/display.go index c44be84..58cada1 100644 --- a/display/display.go +++ b/display/display.go @@ -126,7 +126,8 @@ func Init() { reset() return } - if query[0] == '.' && tabs[tab].hasContent() { // relative url + if query[0] == '.' && tabs[tab].hasContent() { + // Relative url current, err := url.Parse(tabs[tab].page.Url) if err != nil { // This shouldn't occur @@ -134,8 +135,7 @@ func Init() { } target, err := current.Parse(query) if err != nil { - // invalid relative url - reset() + // Invalid relative url return } URL(target.String()) From 8f685a541b0b40ba6ff4672815bba2f479448b36 Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 18 Aug 2020 19:51:08 -0400 Subject: [PATCH 06/27] =?UTF-8?q?=F0=9F=93=9D=20Document=20merged=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4be83a0..5ef2e00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Emoji favicons can now be seen if `emoji_favicons` is enabled in the config (#62) - The `shift_numbers` key in the config was added, so that non US keyboard users can navigate tabs (#64) - F1 and F2 keys for navigating to the previous and next tabs (#64) +- Resolving any relative path (starting with a `.`) in the bottom bar is supported, not just `..` (#71) ### Changed From f3af61c9d116a22d6529f6a8d5ff6198afb41c8b Mon Sep 17 00:00:00 2001 From: makeworld Date: Fri, 21 Aug 2020 14:59:51 -0400 Subject: [PATCH 07/27] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20go-gemini=20v0.8.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ef2e00..9e1ffd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Resolving any relative path (starting with a `.`) in the bottom bar is supported, not just `..` (#71) ### Changed +- Update to [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) v0.8.4 ### Fixed - Two digit (and higher) link texts are now in line with one digit ones (#60) diff --git a/go.mod b/go.mod index 8405383..aa71896 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/dustin/go-humanize v1.0.0 github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gdamore/tcell v1.3.1-0.20200608133353-cb1e5d6fa606 - github.com/makeworld-the-better-one/go-gemini v0.8.3 + github.com/makeworld-the-better-one/go-gemini v0.8.4 github.com/makeworld-the-better-one/go-isemoji v1.0.0 github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index 38c7015..60bc188 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tW github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/makeworld-the-better-one/go-gemini v0.8.3 h1:ZxMLglHjua+mT6NxtboNkCLD109udgaOuvD0WxV/7bY= -github.com/makeworld-the-better-one/go-gemini v0.8.3/go.mod h1:P7/FbZ+IEIbA/d+A0Y3w2GNgD8SA2AcNv7aDGJbaWG4= +github.com/makeworld-the-better-one/go-gemini v0.8.4 h1:ntsQ9HnlJCmC9PDqXp/f1SCALjBMwh69BbT4BhFRFaw= +github.com/makeworld-the-better-one/go-gemini v0.8.4/go.mod h1:P7/FbZ+IEIbA/d+A0Y3w2GNgD8SA2AcNv7aDGJbaWG4= github.com/makeworld-the-better-one/go-isemoji v1.0.0 h1:W3O4+qwtXeT8PUDzcQ1UjxiupQWgc/oJHpqwrllx3xM= github.com/makeworld-the-better-one/go-isemoji v1.0.0/go.mod h1:FBjkPl9rr0G4vlZCc+Mr+QcnOfGCTbGWYW8/1sp06I0= github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f h1:YEUlTs5gb35UlBLTgqrub9axWTYB3d7/8TxrkJDZpRI= From 5d13054a1ef732c43aea0543419a52d3f406cb8a Mon Sep 17 00:00:00 2001 From: Adrian Hesketh Date: Sat, 22 Aug 2020 14:03:13 +0100 Subject: [PATCH 08/27] Provided default message in case of no error information. --- display/modals.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/display/modals.go b/display/modals.go index 3353a68..c445aeb 100644 --- a/display/modals.go +++ b/display/modals.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/dustin/go-humanize" + humanize "github.com/dustin/go-humanize" "github.com/gdamore/tcell" "github.com/makeworld-the-better-one/amfora/config" "github.com/spf13/viper" @@ -154,10 +154,13 @@ func modalInit() { // Error displays an error on the screen in a modal. func Error(title, text string) { - // Capitalize and add period if necessary - because most errors don't do that - text = strings.ToUpper(string([]rune(text)[0])) + text[1:] - if !strings.HasSuffix(text, ".") && !strings.HasSuffix(text, "!") && !strings.HasSuffix(text, "?") { - text += "." + if text == "" { + text = "No additional information." + } else { + text = strings.ToUpper(string([]rune(text)[0])) + text[1:] + if !strings.HasSuffix(text, ".") && !strings.HasSuffix(text, "!") && !strings.HasSuffix(text, "?") { + text += "." + } } // Add spaces to title for aesthetic reasons title = " " + strings.TrimSpace(title) + " " From b004759dee70661fa1a417f6098067d917da1d8b Mon Sep 17 00:00:00 2001 From: makeworld Date: Sat, 22 Aug 2020 11:19:09 -0400 Subject: [PATCH 09/27] =?UTF-8?q?=F0=9F=93=9D=20Add=20PR=20#73=20to=20chan?= =?UTF-8?q?gelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e1ffd5..d72347e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Two digit (and higher) link texts are now in line with one digit ones (#60) - Race condition when reloading pages, could have caused the cache to still be used +- Prevent panic (crash) when the server sends an error with an empty meta string (#73) ## [1.4.0] - 2020-07-28 From 376755f460959440ff8eb042868ee624f39a6f29 Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 25 Aug 2020 17:10:39 -0400 Subject: [PATCH 10/27] =?UTF-8?q?=F0=9F=91=B7=20Added=20golangci-lint=20an?= =?UTF-8?q?d=20Travis=20CI=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/golangci-lint.yml | 19 +++++++++++++++++++ .travis.yml | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .travis.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..4afd36d --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,19 @@ +name: golangci-lint +on: [push, pull_request] +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.30 + + # Optional: golangci-lint command line arguments. + args: --issues-exit-code=0 --exclude-use-default --enable-all -D asciicheck -D depguard -D dogsled -D funlen -D gci -D gochecknoglobals -D gochecknoinits -D gocognit -D gocyclo -D godot -D godox -D goheader -D gomodguard -D nlreturn -D noctx -D bodyclose -D rowserrcheck -D sqlclosecheck -D stylecheck -D testpackage -D wsl + + # Optional: show only new issues if it's a pull request. The default value is `false`. + only-new-issues: true diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b12c147 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: go + +go: + - "1.11" # Debian Stable golang version + - "1.12" + - "1.13" + - "1.14" + - "1.15" + +script: + - go test ./... + - go build + +# TODO: GitHub Releases deploy From f98e79b5040eff38245c9d173d2d6f1a41d7c43e Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 25 Aug 2020 17:16:07 -0400 Subject: [PATCH 11/27] =?UTF-8?q?=F0=9F=92=9A=20Let=20it=20fail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 4afd36d..d5eb391 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,7 +13,7 @@ jobs: version: v1.30 # Optional: golangci-lint command line arguments. - args: --issues-exit-code=0 --exclude-use-default --enable-all -D asciicheck -D depguard -D dogsled -D funlen -D gci -D gochecknoglobals -D gochecknoinits -D gocognit -D gocyclo -D godot -D godox -D goheader -D gomodguard -D nlreturn -D noctx -D bodyclose -D rowserrcheck -D sqlclosecheck -D stylecheck -D testpackage -D wsl + args: --exclude-use-default --enable-all -D asciicheck -D depguard -D dogsled -D funlen -D gci -D gochecknoglobals -D gochecknoinits -D gocognit -D gocyclo -D godot -D godox -D goheader -D gomodguard -D nlreturn -D noctx -D bodyclose -D rowserrcheck -D sqlclosecheck -D stylecheck -D testpackage -D wsl # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true From f5e45a70ed469f7d8eb13f397421734498ebd0ca Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 25 Aug 2020 17:22:49 -0400 Subject: [PATCH 12/27] =?UTF-8?q?=F0=9F=92=9A=20Remove=20older=20Go=20vers?= =?UTF-8?q?ions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 7 +++++-- README.md | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b12c147..9fd88c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: go go: - - "1.11" # Debian Stable golang version - - "1.12" + #- "1.11" # Debian Stable golang version, fails - see below + #- "1.12" # Also fails due to progressbar Millisecond requirement - "1.13" - "1.14" - "1.15" @@ -11,4 +11,7 @@ script: - go test ./... - go build +env: + GO111MODULE=on + # TODO: GitHub Releases deploy diff --git a/README.md b/README.md index f0d73a9..98eddf6 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ brew upgrade amfora ``` ### From Source -This section is for programmers who want to install from source. +This section is for programmers who want to install from source. Make sure you're using Go 1.13 at least, as earlier versions will fail to build. Install latest release: ``` From de41930d0a6a6925819b08a69d015612c6879dbc Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 25 Aug 2020 19:17:06 -0400 Subject: [PATCH 13/27] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20linting=20errors=20a?= =?UTF-8?q?nd=20switch=20to=20disable-all=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lint errors source: https://github.com/makeworld-the-better-one/amfora/actions/runs/224352889 --- .github/workflows/golangci-lint.yml | 3 +-- bookmarks/bookmarks.go | 10 +++++----- display/display.go | 2 +- display/download.go | 2 +- display/private.go | 11 +++++++---- display/tab.go | 6 +++--- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index d5eb391..00fe13f 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,7 +13,6 @@ jobs: version: v1.30 # Optional: golangci-lint command line arguments. - args: --exclude-use-default --enable-all -D asciicheck -D depguard -D dogsled -D funlen -D gci -D gochecknoglobals -D gochecknoinits -D gocognit -D gocyclo -D godot -D godox -D goheader -D gomodguard -D nlreturn -D noctx -D bodyclose -D rowserrcheck -D sqlclosecheck -D stylecheck -D testpackage -D wsl - + args: --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E gofumpt -E goimports -E golint -E gomnd -E goprintffuncname -E gosec -E interfacer -E lll -E maligned -E misspell -E nakedret -E nestif -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam -E whitespace # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true diff --git a/bookmarks/bookmarks.go b/bookmarks/bookmarks.go index bd22600..194c357 100644 --- a/bookmarks/bookmarks.go +++ b/bookmarks/bookmarks.go @@ -19,7 +19,7 @@ func bkmkKey(url string) string { func Set(url, name string) { bkmkStore.Set(bkmkKey(url), name) - bkmkStore.WriteConfig() + bkmkStore.WriteConfig() //nolint:errcheck } // Get returns the NAME of the bookmark, given the URL. @@ -33,7 +33,7 @@ func Remove(url string) { // XXX: Viper can't actually delete keys, which means the bookmarks file might get clouded // with non-entries over time. bkmkStore.Set(bkmkKey(url), "") - bkmkStore.WriteConfig() + bkmkStore.WriteConfig() //nolint:errcheck } // All returns all the bookmarks in a map of URLs to names. @@ -48,9 +48,9 @@ func All() (map[string]string, []string) { return bkmks, []string{} } - inverted := make(map[string]string) // Holds inverted map, name->URL - var names []string // Holds bookmark names, for sorting - var keys []string // Final sorted keys (URLs), for returning at the end + inverted := make(map[string]string) // Holds inverted map, name->URL + names := make([]string, 0, len(bkmksMap)) // Holds bookmark names, for sorting + keys := make([]string, 0, len(bkmksMap)) // Final sorted keys (URLs), for returning at the end for b32Url, name := range bkmksMap { if n, ok := name.(string); n == "" || !ok { diff --git a/display/display.go b/display/display.go index 58cada1..34ed79c 100644 --- a/display/display.go +++ b/display/display.go @@ -529,7 +529,7 @@ func Reload() { func URL(u string) { // Some code is copied in followLink() - if u == "about:bookmarks" { + if u == "about:bookmarks" { //nolint:goconst Bookmarks(tabs[curTab]) tabs[curTab].addToHistory("about:bookmarks") return diff --git a/display/download.go b/display/download.go index 2f2f783..6a34054 100644 --- a/display/download.go +++ b/display/download.go @@ -142,7 +142,7 @@ func downloadURL(u string, resp *gemini.Response) { progressbar.OptionShowCount(), progressbar.OptionSpinnerType(14), ) - bar.RenderBlank() + bar.RenderBlank() //nolint:errcheck savePath, err := downloadNameFromURL(u, "") if err != nil { diff --git a/display/private.go b/display/private.go index 355e56c..55b3f41 100644 --- a/display/private.go +++ b/display/private.go @@ -70,15 +70,18 @@ func reformatPage(p *structs.Page) { return } + // TODO: Setup a renderer.RenderFromMediatype func so this isn't needed + var rendered string - if p.Mediatype == structs.TextGemini { + switch p.Mediatype { + case structs.TextGemini: // Links are not recorded because they won't change rendered, _ = renderer.RenderGemini(p.Raw, textWidth(), leftMargin()) - } else if p.Mediatype == structs.TextPlain { + case structs.TextPlain: rendered = renderer.RenderPlainText(p.Raw, leftMargin()) - } else if p.Mediatype == structs.TextAnsi { + case structs.TextAnsi: rendered = renderer.RenderANSI(p.Raw, leftMargin()) - } else { + default: // Rendering this type is not implemented return } diff --git a/display/tab.go b/display/tab.go index 2848cf0..3188646 100644 --- a/display/tab.go +++ b/display/tab.go @@ -68,7 +68,7 @@ func makeNewTab() *tab { return } - if len(tabs[tab].page.Links) <= 0 { + if len(tabs[tab].page.Links) == 0 { // No links on page return } @@ -85,7 +85,7 @@ func makeNewTab() *tab { followLink(tabs[tab], tabs[tab].page.Url, tabs[tab].page.Links[linkN]) return } - if len(currentSelection) <= 0 && (key == tcell.KeyEnter || key == tcell.KeyTab) { + if len(currentSelection) == 0 && (key == tcell.KeyEnter || key == tcell.KeyTab) { // They've started link highlighting tabs[tab].page.Mode = structs.ModeLinkSelect @@ -102,7 +102,7 @@ func makeNewTab() *tab { // There's still a selection, but a different key was pressed, not Enter index, _ := strconv.Atoi(currentSelection[0]) - if key == tcell.KeyTab { + if key == tcell.KeyTab { //nolint:gocritic index = (index + 1) % numSelections } else if key == tcell.KeyBacktab { index = (index - 1 + numSelections) % numSelections From 13163352b3105fe8ad0797b504607a9735aa2e6e Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 25 Aug 2020 21:03:21 -0400 Subject: [PATCH 14/27] =?UTF-8?q?=F0=9F=9A=A8=20More=20linting=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Source: https://github.com/makeworld-the-better-one/amfora/actions/runs/224468383 --- .github/workflows/golangci-lint.yml | 2 +- cache/cache.go | 8 ++--- cache/cache_test.go | 14 ++++---- display/bookmarks.go | 10 +++--- display/display.go | 18 +++++----- display/download.go | 4 +-- display/private.go | 4 +-- display/tab.go | 8 ++--- go.mod | 4 ++- go.sum | 54 +++++++++++++++++++++++++++-- renderer/page.go | 28 ++++++++------- renderer/renderer.go | 4 +-- structs/structs.go | 8 ++--- 13 files changed, 110 insertions(+), 56 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 00fe13f..a3d5533 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,6 +13,6 @@ jobs: version: v1.30 # Optional: golangci-lint command line arguments. - args: --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E gofumpt -E goimports -E golint -E gomnd -E goprintffuncname -E gosec -E interfacer -E lll -E maligned -E misspell -E nakedret -E nestif -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam -E whitespace + args: --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E goimports -E golint -E gomnd -E goprintffuncname -E gosec -E interfacer -E lll -E maligned -E misspell -E nakedret -E nestif -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true diff --git a/cache/cache.go b/cache/cache.go index b9e6378..03a7f74 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -48,7 +48,7 @@ func removeUrl(url string) { // If your page is larger than the max cache size, the provided page // will silently not be added to the cache. func AddPage(p *structs.Page) { - if p.Url == "" || strings.HasPrefix(p.Url, "about:") { + if p.URL == "" || strings.HasPrefix(p.URL, "about:") { // Just in case, these pages shouldn't be cached return } @@ -71,10 +71,10 @@ func AddPage(p *structs.Page) { lock.Lock() defer lock.Unlock() - pages[p.Url] = p + pages[p.URL] = p // Remove the URL if it was already there, then add it to the end - removeUrl(p.Url) - urls = append(urls, p.Url) + removeUrl(p.URL) + urls = append(urls, p.URL) } // RemovePage will remove a page from the cache. diff --git a/cache/cache_test.go b/cache/cache_test.go index 98cf480..e8a59dc 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -7,9 +7,9 @@ import ( "github.com/stretchr/testify/assert" ) -var p = structs.Page{Url: "example.com"} -var p2 = structs.Page{Url: "example.org"} -var queryPage = structs.Page{Url: "gemini://example.com/test?query"} +var p = structs.Page{URL: "example.com"} +var p2 = structs.Page{URL: "example.org"} +var queryPage = structs.Page{URL: "gemini://example.com/test?query"} func reset() { ClearPages() @@ -33,13 +33,13 @@ func TestMaxSize(t *testing.T) { assert.Equal(1, NumPages(), "one page should be added") AddPage(&p2) assert.Equal(1, NumPages(), "there should still be just one page due to cache size limits") - assert.Equal(p2.Url, urls[0], "the only page url should be the second page one") + assert.Equal(p2.URL, urls[0], "the only page url should be the second page one") } func TestRemove(t *testing.T) { reset() AddPage(&p) - RemovePage(p.Url) + RemovePage(p.URL) assert.Equal(t, 0, NumPages(), "there shouldn't be any pages after the removal") } @@ -62,11 +62,11 @@ func TestGet(t *testing.T) { reset() AddPage(&p) AddPage(&p2) - page, ok := GetPage(p.Url) + page, ok := GetPage(p.URL) if !ok { t.Fatal("Get should say that the page was found") } - if page.Url != p.Url { + if page.URL != p.URL { t.Error("page urls don't match") } } diff --git a/display/bookmarks.go b/display/bookmarks.go index 4fbc07f..c62597b 100644 --- a/display/bookmarks.go +++ b/display/bookmarks.go @@ -120,7 +120,7 @@ func Bookmarks(t *tab) { Raw: rawContent, Content: content, Links: links, - Url: "about:bookmarks", + URL: "about:bookmarks", Width: termW, Mediatype: structs.TextGemini, } @@ -132,20 +132,20 @@ func Bookmarks(t *tab) { // It is the high-level way of doing it. It should be called in a goroutine. // It can also be called to edit an existing bookmark. func addBookmark() { - if !strings.HasPrefix(tabs[curTab].page.Url, "gemini://") { + if !strings.HasPrefix(tabs[curTab].page.URL, "gemini://") { // Can't make bookmarks for other kinds of URLs return } - name, exists := bookmarks.Get(tabs[curTab].page.Url) + name, exists := bookmarks.Get(tabs[curTab].page.URL) // Open a bookmark modal with the current name of the bookmark, if it exists newName, action := openBkmkModal(name, exists) switch action { case 1: // Add/change the bookmark - bookmarks.Set(tabs[curTab].page.Url, newName) + bookmarks.Set(tabs[curTab].page.URL, newName) case -1: - bookmarks.Remove(tabs[curTab].page.Url) + bookmarks.Remove(tabs[curTab].page.URL) } // Other case is action = 0, meaning "Cancel", so nothing needs to happen } diff --git a/display/display.go b/display/display.go index 34ed79c..9ba24f5 100644 --- a/display/display.go +++ b/display/display.go @@ -128,7 +128,7 @@ func Init() { } if query[0] == '.' && tabs[tab].hasContent() { // Relative url - current, err := url.Parse(tabs[tab].page.Url) + current, err := url.Parse(tabs[tab].page.URL) if err != nil { // This shouldn't occur return @@ -156,7 +156,7 @@ func Init() { oldTab := tab NewTab() // Resolve and follow link manually - prevParsed, _ := url.Parse(tabs[oldTab].page.Url) + prevParsed, _ := url.Parse(tabs[oldTab].page.URL) nextParsed, err := url.Parse(tabs[oldTab].page.Links[i-1]) if err != nil { Error("URL Error", "link URL could not be parsed") @@ -183,7 +183,7 @@ func Init() { } if i <= len(tabs[tab].page.Links) && i > 0 { // It's a valid link number - followLink(tabs[tab], tabs[tab].page.Url, tabs[tab].page.Links[i-1]) + followLink(tabs[tab], tabs[tab].page.URL, tabs[tab].page.Links[i-1]) return } // Invalid link number, don't do anything @@ -204,7 +204,7 @@ func Init() { Raw: newTabContent, Content: renderedNewTabContent, Links: newTabLinks, - Url: "about:newtab", + URL: "about:newtab", Width: -1, // Force reformatting on first display Mediatype: structs.TextGemini, } @@ -312,7 +312,7 @@ func Init() { } if i <= len(tabs[curTab].page.Links) && i > 0 { // It's a valid link number - followLink(tabs[curTab], tabs[curTab].page.Url, tabs[curTab].page.Links[i-1]) + followLink(tabs[curTab], tabs[curTab].page.URL, tabs[curTab].page.Links[i-1]) return nil } } @@ -323,7 +323,7 @@ func Init() { switch event.Key() { case tcell.KeyCtrlT: if tabs[curTab].page.Mode == structs.ModeLinkSelect { - next, err := resolveRelLink(tabs[curTab], tabs[curTab].page.Url, tabs[curTab].page.Selected) + next, err := resolveRelLink(tabs[curTab], tabs[curTab].page.URL, tabs[curTab].page.Selected) if err != nil { Error("URL Error", err.Error()) return nil @@ -512,11 +512,11 @@ func Reload() { return } - parsed, _ := url.Parse(tabs[curTab].page.Url) + parsed, _ := url.Parse(tabs[curTab].page.URL) go func(t *tab) { - cache.RemovePage(tabs[curTab].page.Url) + cache.RemovePage(tabs[curTab].page.URL) cache.RemoveFavicon(parsed.Host) - handleURL(t, t.page.Url) // goURL is not used bc history shouldn't be added to + handleURL(t, t.page.URL) // goURL is not used bc history shouldn't be added to if t == tabs[curTab] { // Display the bottomBar state that handleURL set t.applyBottomBar() diff --git a/display/download.go b/display/download.go index 6a34054..4257b21 100644 --- a/display/download.go +++ b/display/download.go @@ -200,9 +200,9 @@ func downloadPage(p *structs.Page) (string, error) { var err error if p.Mediatype == structs.TextGemini { - savePath, err = downloadNameFromURL(p.Url, ".gmi") + savePath, err = downloadNameFromURL(p.URL, ".gmi") } else { - savePath, err = downloadNameFromURL(p.Url, ".txt") + savePath, err = downloadNameFromURL(p.URL, ".txt") } if err != nil { return "", err diff --git a/display/private.go b/display/private.go index 55b3f41..1ade0af 100644 --- a/display/private.go +++ b/display/private.go @@ -120,7 +120,7 @@ func setPage(t *tab, p *structs.Page) { t.page = p go func() { - parsed, _ := url.Parse(p.Url) + parsed, _ := url.Parse(p.URL) handleFavicon(t, parsed.Host, oldFav) }() @@ -134,7 +134,7 @@ func setPage(t *tab, p *structs.Page) { // Save bottom bar for the tab - other funcs will apply/display it t.barLabel = "" - t.barText = p.Url + t.barText = p.URL } // handleHTTP is used by handleURL. diff --git a/display/tab.go b/display/tab.go index 3188646..b8982aa 100644 --- a/display/tab.go +++ b/display/tab.go @@ -62,7 +62,7 @@ func makeNewTab() *tab { if key == tcell.KeyEsc { // Stop highlighting bottomBar.SetLabel("") - bottomBar.SetText(tabs[tab].page.Url) + bottomBar.SetText(tabs[tab].page.URL) tabs[tab].clearSelected() tabs[tab].saveBottomBar() return @@ -82,7 +82,7 @@ func makeNewTab() *tab { linkN, _ := strconv.Atoi(currentSelection[0]) tabs[tab].page.Selected = tabs[tab].page.Links[linkN] tabs[tab].page.SelectedID = currentSelection[0] - followLink(tabs[tab], tabs[tab].page.Url, tabs[tab].page.Links[linkN]) + followLink(tabs[tab], tabs[tab].page.URL, tabs[tab].page.Links[linkN]) return } if len(currentSelection) == 0 && (key == tcell.KeyEnter || key == tcell.KeyTab) { @@ -153,10 +153,10 @@ func (t *tab) hasContent() bool { if t.page == nil || t.view == nil { return false } - if t.page.Url == "" { + if t.page.URL == "" { return false } - if strings.HasPrefix(t.page.Url, "about:") { + if strings.HasPrefix(t.page.URL, "about:") { return false } if t.page.Content == "" { diff --git a/go.mod b/go.mod index aa71896..b129432 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/dustin/go-humanize v1.0.0 github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gdamore/tcell v1.3.1-0.20200608133353-cb1e5d6fa606 + github.com/google/go-cmp v0.5.0 // indirect github.com/makeworld-the-better-one/go-gemini v0.8.4 github.com/makeworld-the-better-one/go-isemoji v1.0.0 github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f @@ -19,7 +20,8 @@ require ( github.com/spf13/viper v1.7.0 github.com/stretchr/testify v1.6.1 gitlab.com/tslocum/cview v1.4.8-0.20200713214710-cc7796c4ca44 - golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 // indirect + golang.org/x/sys v0.0.0-20200817155316-9781c653f443 // indirect golang.org/x/text v0.3.3 + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/ini.v1 v1.57.0 // indirect ) diff --git a/go.sum b/go.sum index 60bc188..13618da 100644 --- a/go.sum +++ b/go.sum @@ -4,11 +4,14 @@ cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSR 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 h1:AVXDdKsrtX33oR9fbCMu/+c1o8Ofjq6Ku/MInaLVg5Y= 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 h1:9x7Bx0A9R5/M9jibeJeZWqjeVEIxYW9fZYqB9a70/bY= 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 h1:VV2nUM3wwLLGh9lSABFgZMjInyUbJeaRSE64WuAIQ+4= 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 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= @@ -16,19 +19,25 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c h1:+0HFd5KSZ/mm3JmhmrDukiId5iR6w4+BdFtfSy4yWIc= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -39,6 +48,7 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= @@ -53,6 +63,7 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -63,6 +74,7 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb 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 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -70,25 +82,34 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a 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.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 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 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0 h1:BNQPM9ytxj6jbjjdRPioQ94T6YXriSopn0i8COv6SRA= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= @@ -96,14 +117,17 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -111,6 +135,7 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= 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/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -130,7 +155,9 @@ github.com/makeworld-the-better-one/go-isemoji v1.0.0 h1:W3O4+qwtXeT8PUDzcQ1Ujxi github.com/makeworld-the-better-one/go-isemoji v1.0.0/go.mod h1:FBjkPl9rr0G4vlZCc+Mr+QcnOfGCTbGWYW8/1sp06I0= github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f h1:YEUlTs5gb35UlBLTgqrub9axWTYB3d7/8TxrkJDZpRI= github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f/go.mod h1:X6sxWNi9PBgQybpR4fpXPVD5fm7svLqZTQ5DJuERIoM= +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-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -138,6 +165,7 @@ github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14 h1:9jZdLNd/P4+SfEJ0TNyxYpsK8N4GtfylBLqtbYN1sbA= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= @@ -152,7 +180,9 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA= github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -161,6 +191,7 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw= github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -177,6 +208,7 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -218,6 +250,7 @@ gitlab.com/tslocum/cview v1.4.8-0.20200713214710-cc7796c4ca44 h1:YddMqXJ6jI3SkP8 gitlab.com/tslocum/cview v1.4.8-0.20200713214710-cc7796c4ca44/go.mod h1:QctoEJaR2AqZTy0KKo12P1ZjHgQJyVkAXaeDanBBhlE= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -226,6 +259,7 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 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= @@ -240,10 +274,12 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk 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 h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= 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 h1:sfUMP1Gu8qASkorDVjnMuvgJzwFbTZSeXFiGBYAVdl4= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -258,9 +294,11 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 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 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= 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= @@ -285,14 +323,15 @@ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200610111108-226ff32320da h1:bGb80FudwxpeucJUjPYJXuJ8Hk91vNtfvrymzwiei38= golang.org/x/sys v0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 h1:sIky/MyNRSHTrdxfsiUSS4WIAMvInbeXljJz+jDjeYE= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200817155316-9781c653f443 h1:X18bCaipMcoJGm27Nv7zr4XYPKGUy92GtqboKC2Hxaw= +golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/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-20190308202827-9d24e82272b4/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-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -310,12 +349,17 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc h1:NCy3Ohtk6Iny5V/reW2Ktypo4zIpWBdRJ1uFMjBxdg8= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/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.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 h1:Q3Ui3V3/CVinFWFiW39Iw0kMuVrRzYX0wN6OPFp0lTA= 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.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -329,14 +373,19 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn 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 h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.57.0 h1:9unxIsFcTt4I55uWluz+UmL95q4kdJ0buvQ1ZIqVQww= @@ -353,5 +402,6 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C 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.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= 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= diff --git a/renderer/page.go b/renderer/page.go index 8ae5277..63922d5 100644 --- a/renderer/page.go +++ b/renderer/page.go @@ -16,6 +16,8 @@ import ( var ErrTooLarge = errors.New("page content would be too large") var ErrTimedOut = errors.New("page download timed out") +var ErrCantDisplay = errors.New("invalid content for a page") +var ErrBadEncoding = errors.New("unsupported encoding") // isUTF8 returns true for charsets that are compatible with UTF-8 and don't need to be decoded. func isUTF8(charset string) bool { @@ -56,7 +58,7 @@ func CanDisplay(res *gemini.Response) bool { // You must set the Page.Width value yourself. func MakePage(url string, res *gemini.Response, width, leftMargin int) (*structs.Page, error) { if !CanDisplay(res) { - return nil, errors.New("not valid content for a Page") + return nil, ErrCantDisplay } buf := new(bytes.Buffer) @@ -90,7 +92,7 @@ func MakePage(url string, res *gemini.Response, width, leftMargin int) (*structs encoding, err := ianaindex.MIME.Encoding(params["charset"]) if encoding == nil || err != nil { // Some encoding doesn't exist and wasn't caught in CanDisplay() - return nil, errors.New("unsupported encoding") + return nil, ErrBadEncoding } utfText, err = encoding.NewDecoder().String(buf.String()) if err != nil { @@ -102,7 +104,7 @@ func MakePage(url string, res *gemini.Response, width, leftMargin int) (*structs rendered, links := RenderGemini(utfText, width, leftMargin) return &structs.Page{ Mediatype: structs.TextGemini, - Url: url, + URL: url, Raw: utfText, Content: rendered, Links: links, @@ -112,21 +114,21 @@ func MakePage(url string, res *gemini.Response, width, leftMargin int) (*structs // ANSI return &structs.Page{ Mediatype: structs.TextAnsi, - Url: url, + URL: url, Raw: utfText, Content: RenderANSI(utfText, leftMargin), Links: []string{}, }, nil - } else { - // Treated as plaintext - return &structs.Page{ - Mediatype: structs.TextPlain, - Url: url, - Raw: utfText, - Content: RenderPlainText(utfText, leftMargin), - Links: []string{}, - }, nil } + + // Treated as plaintext + return &structs.Page{ + Mediatype: structs.TextPlain, + URL: url, + Raw: utfText, + Content: RenderPlainText(utfText, leftMargin), + Links: []string{}, + }, nil } return nil, errors.New("displayable mediatype is not handled in the code, implementation error") diff --git a/renderer/renderer.go b/renderer/renderer.go index 4046553..05a17b1 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -101,11 +101,11 @@ func convertRegularGemini(s string, numLinks, width int) (string, []string) { for i := range lines { lines[i] = strings.TrimRight(lines[i], " \r\t\n") - if strings.HasPrefix(lines[i], "#") { + if strings.HasPrefix(lines[i], "#") { //nolint:gocritic // Headings var tag string if viper.GetBool("a-general.color") { - if strings.HasPrefix(lines[i], "###") { + if strings.HasPrefix(lines[i], "###") { //nolint:gocritic tag = fmt.Sprintf("[%s::b]", config.GetColorString("hdg_3")) } else if strings.HasPrefix(lines[i], "##") { tag = fmt.Sprintf("[%s::b]", config.GetColorString("hdg_2")) diff --git a/structs/structs.go b/structs/structs.go index a98c479..4dd194c 100644 --- a/structs/structs.go +++ b/structs/structs.go @@ -18,14 +18,14 @@ const ( // Page is for storing UTF-8 text/gemini pages, as well as text/plain pages. type Page struct { - Url string + URL string Mediatype Mediatype Raw string // The raw response, as received over the network - Content string // The processed content, NOT raw. Uses cview color tags. All link/link texts must have region tags. It will also have a left margin. + Content string // The processed content, NOT raw. Uses cview color tags. It will also have a left margin. Links []string // URLs, for each region in the content. Row int // Scroll position Column int // ditto - Width int // The width of the terminal at the time when the Content was set. This is to know when reformatting should happen. + Width int // The terminal width when the Content was set, to know when reformatting should happen. Selected string // The current text or link selected SelectedID string // The cview region ID for the selected text/link Mode PageMode @@ -34,7 +34,7 @@ type Page struct { // Size returns an approx. size of a Page in bytes. func (p *Page) Size() int { - n := len(p.Raw) + len(p.Content) + len(p.Url) + len(p.Selected) + len(p.SelectedID) + n := len(p.Raw) + len(p.Content) + len(p.URL) + len(p.Selected) + len(p.SelectedID) for i := range p.Links { n += len(p.Links[i]) } From 01fa5709f51228228a11f2047a9164eb87d8dbac Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 25 Aug 2020 21:06:35 -0400 Subject: [PATCH 15/27] =?UTF-8?q?=F0=9F=92=9A=20Don't=20limit=20linter=20i?= =?UTF-8?q?ssues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a3d5533..ad37a82 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,6 +13,6 @@ jobs: version: v1.30 # Optional: golangci-lint command line arguments. - args: --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E goimports -E golint -E gomnd -E goprintffuncname -E gosec -E interfacer -E lll -E maligned -E misspell -E nakedret -E nestif -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam + args: --max-issues-per-linter 0 --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E goimports -E golint -E gomnd -E goprintffuncname -E gosec -E interfacer -E lll -E maligned -E misspell -E nakedret -E nestif -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true From e4279de4172a7e2fcb238968553284258270054e Mon Sep 17 00:00:00 2001 From: makeworld Date: Tue, 25 Aug 2020 21:18:57 -0400 Subject: [PATCH 16/27] =?UTF-8?q?=F0=9F=9A=A8=20More=20linter=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Source: https://github.com/makeworld-the-better-one/amfora/actions/runs/224580926 --- client/tofu.go | 13 +++++++------ config/config.go | 4 ++-- webbrowser/open_browser_unix.go | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/client/tofu.go b/client/tofu.go index 9fd2d1a..7af273e 100644 --- a/client/tofu.go +++ b/client/tofu.go @@ -39,19 +39,20 @@ func expiryKey(domain string, port string) string { func loadTofuEntry(domain string, port string) (string, time.Time, error) { id := tofuStore.GetString(idKey(domain, port)) // Fingerprint - if len(id) != 64 { + if len(id) != sha256.Size*2 { // Not set, or invalid - return "", time.Time{}, errors.New("not found") + return "", time.Time{}, errors.New("not found") //nolint:goerr113 } expiry := tofuStore.GetTime(expiryKey(domain, port)) if expiry.IsZero() { // Not set - return id, time.Time{}, errors.New("not found") + return id, time.Time{}, errors.New("not found") //nolint:goerr113 } return id, expiry, nil } +//nolint:errcheck // certID returns a generic string representing a cert or domain. func certID(cert *x509.Certificate) string { h := sha256.New() @@ -62,14 +63,14 @@ func certID(cert *x509.Certificate) string { // origCertID uses cert.Raw, which was used in v1.0.0 of the app. func origCertID(cert *x509.Certificate) string { h := sha256.New() - h.Write(cert.Raw) + h.Write(cert.Raw) //nolint:errcheck return fmt.Sprintf("%X", h.Sum(nil)) } func saveTofuEntry(domain, port string, cert *x509.Certificate) { tofuStore.Set(idKey(domain, port), certID(cert)) tofuStore.Set(expiryKey(domain, port), cert.NotAfter.UTC()) - tofuStore.WriteConfig() + tofuStore.WriteConfig() //nolint:errcheck // Not an issue if it's not saved, only cached data } // handleTofu is the abstracted interface for taking care of TOFU. @@ -90,7 +91,7 @@ func handleTofu(domain, port string, cert *x509.Certificate) bool { // Store expiry again in case it changed tofuStore.Set(expiryKey(domain, port), cert.NotAfter.UTC()) - tofuStore.WriteConfig() + tofuStore.WriteConfig() //nolint:errcheck return true } diff --git a/config/config.go b/config/config.go index 528b7c4..c53815c 100644 --- a/config/config.go +++ b/config/config.go @@ -114,13 +114,13 @@ func Init() error { if err != nil { return err } - os.OpenFile(tofuDBPath, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) + os.OpenFile(tofuDBPath, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) //nolint:errcheck // Bookmarks err = os.MkdirAll(bkmkDir, 0755) if err != nil { return err } - os.OpenFile(bkmkPath, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) + os.OpenFile(bkmkPath, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) //nolint:errcheck // Setup vipers diff --git a/webbrowser/open_browser_unix.go b/webbrowser/open_browser_unix.go index 298abaf..2b9493e 100644 --- a/webbrowser/open_browser_unix.go +++ b/webbrowser/open_browser_unix.go @@ -1,5 +1,5 @@ // +build linux freebsd netbsd openbsd - +//nolint:goerr113 package webbrowser import ( From 6853bb9c6d66a6a679a6fb4ba6d5b899c4a46a97 Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 11:47:57 -0400 Subject: [PATCH 17/27] =?UTF-8?q?=F0=9F=9A=A8=20More=20linting=20fixes=20a?= =?UTF-8?q?nd=20unix=20build=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/golangci-lint.yml | 2 +- .travis.yml | 5 +++++ cache/cache.go | 6 +++--- cache/cache_test.go | 1 - config/config.go | 7 ++++--- config/keybindings.go | 2 +- display/display.go | 7 ++++++- display/download.go | 11 +++++------ display/modals.go | 1 + display/newtab.go | 1 + display/private.go | 3 +-- webbrowser/open_browser_unix.go | 1 + 12 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index ad37a82..c8a8ea7 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,6 +13,6 @@ jobs: version: v1.30 # Optional: golangci-lint command line arguments. - args: --max-issues-per-linter 0 --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E goimports -E golint -E gomnd -E goprintffuncname -E gosec -E interfacer -E lll -E maligned -E misspell -E nakedret -E nestif -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam + args: --max-issues-per-linter=0 --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E goimports -E golint -E goprintffuncname -E interfacer -E lll -E maligned -E misspell -E nakedret -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true diff --git a/.travis.yml b/.travis.yml index 9fd88c1..77e51d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,9 @@ script: env: GO111MODULE=on +cache: + directories: + - $HOME/.cache/go-build + - $GOPATH/pkg/mod + # TODO: GitHub Releases deploy diff --git a/cache/cache.go b/cache/cache.go index 03a7f74..fa0bc3d 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -33,7 +33,7 @@ func removeIndex(s []string, i int) []string { return s[:len(s)-1] } -func removeUrl(url string) { +func removeURL(url string) { for i := range urls { if urls[i] == url { urls = removeIndex(urls, i) @@ -73,7 +73,7 @@ func AddPage(p *structs.Page) { defer lock.Unlock() pages[p.URL] = p // Remove the URL if it was already there, then add it to the end - removeUrl(p.URL) + removeURL(p.URL) urls = append(urls, p.URL) } @@ -83,7 +83,7 @@ func RemovePage(url string) { lock.Lock() defer lock.Unlock() delete(pages, url) - removeUrl(url) + removeURL(url) } // ClearPages removes all pages from the cache. diff --git a/cache/cache_test.go b/cache/cache_test.go index e8a59dc..7fc4d38 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -9,7 +9,6 @@ import ( var p = structs.Page{URL: "example.com"} var p2 = structs.Page{URL: "example.org"} -var queryPage = structs.Page{URL: "gemini://example.com/test?query"} func reset() { ClearPages() diff --git a/config/config.go b/config/config.go index c53815c..494bce2 100644 --- a/config/config.go +++ b/config/config.go @@ -23,20 +23,21 @@ var tofuDBDir string var tofuDBPath string // Bookmarks + var BkmkStore = viper.New() var bkmkDir string var bkmkPath string -// For other pkgs to use var DownloadsDir string +//nolint:golint,goerr113 func Init() error { home, err := homedir.Dir() if err != nil { return err } // Store AppData path - if runtime.GOOS == "windows" { + if runtime.GOOS == "windows" { //nolint:goconst appdata, ok := os.LookupEnv("APPDATA") if ok { amforaAppData = filepath.Join(appdata, "amfora") @@ -179,7 +180,7 @@ func Init() error { // Validate path dDir := viper.GetString("a-general.downloads") di, err := os.Stat(dDir) - if err == nil { + if err == nil { //nolint:gocritic if !di.IsDir() { return fmt.Errorf("downloads path specified is not a directory: %s", dDir) } diff --git a/config/keybindings.go b/config/keybindings.go index ccc7310..e3cd06e 100644 --- a/config/keybindings.go +++ b/config/keybindings.go @@ -20,5 +20,5 @@ func KeyToNum(key rune) (int, error) { return i + 1, nil } } - return -1, errors.New("provided key is invalid") + return -1, errors.New("provided key is invalid") //nolint:goerr113 } diff --git a/display/display.go b/display/display.go index 9ba24f5..74cfe35 100644 --- a/display/display.go +++ b/display/display.go @@ -114,6 +114,7 @@ func Init() { App.SetFocus(tabs[tab].view) } + //nolint:exhaustive switch key { case tcell.KeyEnter: // Figure out whether it's a URL, link number, or search @@ -169,7 +170,8 @@ func Init() { } else { // It's a full URL or search term // Detect if it's a search or URL - if strings.Contains(query, " ") || (!strings.Contains(query, "//") && !strings.Contains(query, ".") && !strings.HasPrefix(query, "about:")) { + if strings.Contains(query, " ") || + (!strings.Contains(query, "//") && !strings.Contains(query, ".") && !strings.HasPrefix(query, "about:")) { u := viper.GetString("a-general.search") + "?" + queryEscape(query) cache.RemovePage(u) // Don't use the cached version of the search URL(u) @@ -245,6 +247,7 @@ func Init() { } } + //nolint:exhaustive switch event.Key() { case tcell.KeyCtrlR: Reload() @@ -318,8 +321,10 @@ func Init() { } } } + // All the keys and operations that can work while a tab IS loading + //nolint:exhaustive switch event.Key() { case tcell.KeyCtrlT: if tabs[curTab].page.Mode == structs.ModeLinkSelect { diff --git a/display/download.go b/display/download.go index 4257b21..a150166 100644 --- a/display/download.go +++ b/display/download.go @@ -261,13 +261,12 @@ func getSafeDownloadName(name string, lastDot bool, n int) (string, error) { if lastDot { ext := filepath.Ext(name) return strings.TrimSuffix(name, ext) + "(" + strconv.Itoa(n) + ")" + ext - } else { - idx := strings.Index(name, ".") - if idx == -1 { - return name + "(" + strconv.Itoa(n) + ")" - } - return name[:idx] + "(" + strconv.Itoa(n) + ")" + name[idx:] } + idx := strings.Index(name, ".") + if idx == -1 { + return name + "(" + strconv.Itoa(n) + ")" + } + return name[:idx] + "(" + strconv.Itoa(n) + ")" + name[idx:] } d, err := os.Open(config.DownloadsDir) diff --git a/display/modals.go b/display/modals.go index c445aeb..5a472d9 100644 --- a/display/modals.go +++ b/display/modals.go @@ -268,6 +268,7 @@ func Tofu(host string, expiry time.Time) bool { } yesNoModal.GetFrame().SetTitle(" TOFU ") yesNoModal.SetText( + //nolint:lll fmt.Sprintf("%s's certificate has changed, possibly indicating an security issue. The certificate would have expired %s. Are you sure you want to continue? ", host, humanize.Time(expiry), diff --git a/display/newtab.go b/display/newtab.go index ee451bd..987f0f6 100644 --- a/display/newtab.go +++ b/display/newtab.go @@ -1,3 +1,4 @@ +//nolint package display var newTabContent = `# New Tab diff --git a/display/private.go b/display/private.go index 1ade0af..c148ef1 100644 --- a/display/private.go +++ b/display/private.go @@ -392,8 +392,7 @@ func handleURL(t *tab, u string) (string, bool) { // Make another request with the query string added // + chars are replaced because PathEscape doesn't do that parsed.RawQuery = queryEscape(userInput) - if len(parsed.String()) > 1024 { - // 1024 is the max size for URLs in the spec + if len(parsed.String()) > gemini.URLMaxLength { Error("Input Error", "URL for that input would be too long.") return ret("", false) } diff --git a/webbrowser/open_browser_unix.go b/webbrowser/open_browser_unix.go index 2b9493e..99ecbb5 100644 --- a/webbrowser/open_browser_unix.go +++ b/webbrowser/open_browser_unix.go @@ -1,4 +1,5 @@ // +build linux freebsd netbsd openbsd + //nolint:goerr113 package webbrowser From 8371960fd8d0088530075831e8941cfd1466cd30 Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 17:57:19 -0400 Subject: [PATCH 18/27] =?UTF-8?q?=F0=9F=9A=A8=20All=20lint=20issues=20shou?= =?UTF-8?q?ld=20be=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- display/private.go | 11 ++++++----- display/util.go | 2 +- go.sum | 48 ---------------------------------------------- renderer/page.go | 3 ++- 5 files changed, 12 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 98eddf6..1ebd379 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@
Image modified from: amphora by Alvaro Cabrera from the Noun Project
- +[![travis build status](https://img.shields.io/travis/com/makeworld-the-better-one/amfora)](https://https://travis-ci.com/github/makeworld-the-better-one/amfora) [![go reportcard](https://goreportcard.com/badge/github.com/makeworld-the-better-one/amfora)](https://goreportcard.com/report/github.com/makeworld-the-better-one/amfora) [![license GPLv3](https://img.shields.io/github/license/makeworld-the-better-one/amfora)](https://www.gnu.org/licenses/gpl-3.0.en.html) @@ -61,12 +61,12 @@ This section is for programmers who want to install from source. Make sure you'r Install latest release: ``` -GO111MODULE=on go get -u github.com/makeworld-the-better-one/amfora +GO111MODULE=on go get github.com/makeworld-the-better-one/amfora ``` Install latest commit: ``` -GO111MODULE=on go get -u github.com/makeworld-the-better-one/amfora@master +GO111MODULE=on go get github.com/makeworld-the-better-one/amfora@master ``` ## Usage diff --git a/display/private.go b/display/private.go index c148ef1..ab270a8 100644 --- a/display/private.go +++ b/display/private.go @@ -2,6 +2,7 @@ package display import ( "bytes" + "errors" "fmt" "io" "net/url" @@ -331,7 +332,7 @@ func handleURL(t *tab, u string) (string, bool) { return ret("", false) } - if err == client.ErrTofu { + if errors.Is(err, client.ErrTofu) { if Tofu(parsed.Host, client.GetExpiry(parsed.Hostname(), parsed.Port())) { // They want to continue anyway client.ResetTofuEntry(parsed.Hostname(), parsed.Port(), res.Cert) @@ -351,20 +352,20 @@ func handleURL(t *tab, u string) (string, bool) { return ret("", false) } - if err == renderer.ErrTooLarge { + if errors.Is(err, renderer.ErrTooLarge) { // Make new request for downloading purposes res, clientErr := client.Fetch(u) - if clientErr != nil && clientErr != client.ErrTofu { + if clientErr != nil && !errors.Is(clientErr, client.ErrTofu) { Error("URL Fetch Error", err.Error()) return ret("", false) } go dlChoice("That page is too large. What would you like to do?", u, res) return ret("", false) } - if err == renderer.ErrTimedOut { + if errors.Is(err, renderer.ErrTimedOut) { // Make new request for downloading purposes res, clientErr := client.Fetch(u) - if clientErr != nil && clientErr != client.ErrTofu { + if clientErr != nil && !errors.Is(clientErr, client.ErrTofu) { Error("URL Fetch Error", err.Error()) return ret("", false) } diff --git a/display/util.go b/display/util.go index e3e7124..4601626 100644 --- a/display/util.go +++ b/display/util.go @@ -62,7 +62,7 @@ func resolveRelLink(t *tab, prev, next string) (string, error) { prevParsed, _ := url.Parse(prev) nextParsed, err := url.Parse(next) if err != nil { - return "", errors.New("link URL could not be parsed") + return "", errors.New("link URL could not be parsed") //nolint:goerr113 } return prevParsed.ResolveReference(nextParsed).String(), nil } diff --git a/go.sum b/go.sum index 13618da..b9cb5e1 100644 --- a/go.sum +++ b/go.sum @@ -4,14 +4,11 @@ cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSR 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 h1:AVXDdKsrtX33oR9fbCMu/+c1o8Ofjq6Ku/MInaLVg5Y= 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 h1:9x7Bx0A9R5/M9jibeJeZWqjeVEIxYW9fZYqB9a70/bY= 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 h1:VV2nUM3wwLLGh9lSABFgZMjInyUbJeaRSE64WuAIQ+4= 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 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= @@ -19,25 +16,19 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c h1:+0HFd5KSZ/mm3JmhmrDukiId5iR6w4+BdFtfSy4yWIc= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -48,7 +39,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= @@ -63,7 +53,6 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -74,42 +63,33 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb 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 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.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.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 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 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/consul/api v1.1.0 h1:BNQPM9ytxj6jbjjdRPioQ94T6YXriSopn0i8COv6SRA= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= @@ -117,17 +97,14 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -135,7 +112,6 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= 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/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -155,9 +131,7 @@ github.com/makeworld-the-better-one/go-isemoji v1.0.0 h1:W3O4+qwtXeT8PUDzcQ1Ujxi github.com/makeworld-the-better-one/go-isemoji v1.0.0/go.mod h1:FBjkPl9rr0G4vlZCc+Mr+QcnOfGCTbGWYW8/1sp06I0= github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f h1:YEUlTs5gb35UlBLTgqrub9axWTYB3d7/8TxrkJDZpRI= github.com/makeworld-the-better-one/progressbar/v3 v3.3.5-0.20200710151429-125743e22b4f/go.mod h1:X6sxWNi9PBgQybpR4fpXPVD5fm7svLqZTQ5DJuERIoM= -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-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -165,7 +139,6 @@ github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14 h1:9jZdLNd/P4+SfEJ0TNyxYpsK8N4GtfylBLqtbYN1sbA= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= @@ -180,9 +153,7 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA= github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -191,7 +162,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw= github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -208,7 +178,6 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -234,7 +203,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= 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= @@ -250,7 +218,6 @@ gitlab.com/tslocum/cview v1.4.8-0.20200713214710-cc7796c4ca44 h1:YddMqXJ6jI3SkP8 gitlab.com/tslocum/cview v1.4.8-0.20200713214710-cc7796c4ca44/go.mod h1:QctoEJaR2AqZTy0KKo12P1ZjHgQJyVkAXaeDanBBhlE= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -259,7 +226,6 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 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= @@ -274,12 +240,10 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk 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 h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= 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 h1:sfUMP1Gu8qASkorDVjnMuvgJzwFbTZSeXFiGBYAVdl4= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -294,11 +258,9 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 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 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= 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= @@ -321,7 +283,6 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200610111108-226ff32320da h1:bGb80FudwxpeucJUjPYJXuJ8Hk91vNtfvrymzwiei38= golang.org/x/sys v0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200817155316-9781c653f443 h1:X18bCaipMcoJGm27Nv7zr4XYPKGUy92GtqboKC2Hxaw= golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -331,7 +292,6 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/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-20190308202827-9d24e82272b4/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-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -349,9 +309,7 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc h1:NCy3Ohtk6Iny5V/reW2Ktypo4zIpWBdRJ1uFMjBxdg8= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/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= @@ -359,7 +317,6 @@ google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEt 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 h1:Q3Ui3V3/CVinFWFiW39Iw0kMuVrRzYX0wN6OPFp0lTA= 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.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -373,16 +330,12 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn 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 h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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= @@ -402,6 +355,5 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C 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.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= 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= diff --git a/renderer/page.go b/renderer/page.go index 63922d5..8159ac9 100644 --- a/renderer/page.go +++ b/renderer/page.go @@ -18,6 +18,7 @@ var ErrTooLarge = errors.New("page content would be too large") var ErrTimedOut = errors.New("page download timed out") var ErrCantDisplay = errors.New("invalid content for a page") var ErrBadEncoding = errors.New("unsupported encoding") +var ErrBadMediatype = errors.New("displayable mediatype is not handled in the code, implementation error") // isUTF8 returns true for charsets that are compatible with UTF-8 and don't need to be decoded. func isUTF8(charset string) bool { @@ -131,5 +132,5 @@ func MakePage(url string, res *gemini.Response, width, leftMargin int) (*structs }, nil } - return nil, errors.New("displayable mediatype is not handled in the code, implementation error") + return nil, ErrBadMediatype } From 6c3583b1ac08f3993b1b9b9523afc14d1fd39b56 Mon Sep 17 00:00:00 2001 From: Sotiris Papatheodorou Date: Fri, 28 Aug 2020 01:02:19 +0300 Subject: [PATCH 19/27] =?UTF-8?q?=E2=9C=A8Add=20option=20to=20open=20unkno?= =?UTF-8?q?wn=20URLs=20(#74)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 1 + config/default.go | 14 ++++++++++++++ default-config.toml | 14 ++++++++++++++ display/private.go | 26 +++++++++++++++++++++++++- 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 494bce2..71ebc97 100644 --- a/config/config.go +++ b/config/config.go @@ -156,6 +156,7 @@ func Init() error { viper.SetDefault("a-general.page_max_time", 10) viper.SetDefault("a-general.emoji_favicons", false) viper.SetDefault("keybindings.shift_numbers", "!@#$%^&*()") + viper.SetDefault("url-handlers.other", "off") viper.SetDefault("cache.max_size", 0) viper.SetDefault("cache.max_pages", 20) diff --git a/config/default.go b/config/default.go index b191984..89f85e4 100644 --- a/config/default.go +++ b/config/default.go @@ -58,6 +58,20 @@ emoji_favicons = false shift_numbers = "!@#$%^&*()" +[url-handlers] +# Allows setting the commands to run for various URL schemes. +# E.g. to open FTP URLs with FileZilla set the following key: +# ftp = "filezilla" +# You can set any scheme to "off" to disable handling it. +# +# DO NOT use this for setting the HTTP command. +# Use the http setting in the "a-general" section above + +# This is a special key that defines the handler for all URL schemes for which +# no handler is defined. +other = "off" + + [cache] # Options for page cache - which is only for text/gemini pages # Increase the cache size to speed up browsing at the expense of memory diff --git a/default-config.toml b/default-config.toml index 3dff68d..ff204ac 100644 --- a/default-config.toml +++ b/default-config.toml @@ -55,6 +55,20 @@ emoji_favicons = false shift_numbers = "!@#$%^&*()" +[url-handlers] +# Allows setting the commands to run for various URL schemes. +# E.g. to open FTP URLs with FileZilla set the following key: +# ftp = "filezilla" +# You can set any scheme to "off" to disable handling it. +# +# DO NOT use this for setting the HTTP command. +# Use the http setting in the "a-general" section above + +# This is a special key that defines the handler for all URL schemes for which +# no handler is defined. +other = "off" + + [cache] # Options for page cache - which is only for text/gemini pages # Increase the cache size to speed up browsing at the expense of memory diff --git a/display/private.go b/display/private.go index ab270a8..c56b270 100644 --- a/display/private.go +++ b/display/private.go @@ -162,6 +162,30 @@ func handleHTTP(u string, showInfo bool) { App.Draw() } +// handleOther is used by handleURL. +// It opens links other than Gemini and HTTP and displays Error modals. +func handleOther(u string) { + // The URL should have a scheme due to a previous call to normalizeURL + parsed, _ := url.Parse(u) + // Search for a handler for the URL scheme + handler := strings.TrimSpace(viper.GetString("url-handlers." + parsed.Scheme)) + if len(handler) == 0 { + handler = strings.TrimSpace(viper.GetString("url-handlers.other")) + } + switch handler { + case "", "off": + Error("URL Error", "Opening " + parsed.Scheme + " URLs is turned off.") + default: + // The config has a custom command to execute for URLs + fields := strings.Fields(handler) + err := exec.Command(fields[0], append(fields[1:], u)...).Start() + if err != nil { + Error("URL Error", "Error executing custom command: " + err.Error()) + } + } + App.Draw() +} + // handleFavicon handles getting and displaying a favicon. // `old` is the previous favicon for the tab. func handleFavicon(t *tab, host, old string) { @@ -308,7 +332,7 @@ func handleURL(t *tab, u string) (string, bool) { return ret("", false) } if !strings.HasPrefix(u, "gemini") { - Error("Protocol Error", "Only gemini and HTTP are supported. URL was "+u) + handleOther(u) return ret("", false) } // Gemini URL From 580e87bcc982f2c907abdaae291bf5188a7c3a9f Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 18:52:38 -0400 Subject: [PATCH 20/27] =?UTF-8?q?=F0=9F=9A=A8=20Add=20.golangci.yml,=20run?= =?UTF-8?q?=20gofmt,=20add=20PR=20to=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/golangci-lint.yml | 3 --- .golangci.yml | 38 +++++++++++++++++++++++++++++ CHANGELOG.md | 1 + display/private.go | 4 +-- 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index c8a8ea7..4f64e86 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -11,8 +11,5 @@ jobs: with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.30 - - # Optional: golangci-lint command line arguments. - args: --max-issues-per-linter=0 --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E goimports -E golint -E goprintffuncname -E interfacer -E lll -E maligned -E misspell -E nakedret -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..e010a47 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,38 @@ +linters: + fast: false + disable-all: true + enable: + - deadcode + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - structcheck + - typecheck + - unused + - varcheck + - dupl + - exhaustive + - exportloopref + - goconst + - gocritic + - goerr113 + - gofmt + - goimports + - golint + - goprintffuncname + - interfacer + - lll + - maligned + - misspell + - nakedret + - nolintlint + - prealloc + - scopelint + - unconvert + - unparam + +issues: + exclude-use-default: true + max-issues-per-linter: 0 diff --git a/CHANGELOG.md b/CHANGELOG.md index d72347e..bc0dc85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The `shift_numbers` key in the config was added, so that non US keyboard users can navigate tabs (#64) - F1 and F2 keys for navigating to the previous and next tabs (#64) - Resolving any relative path (starting with a `.`) in the bottom bar is supported, not just `..` (#71) +- Set programs in config to open other schemes like `gopher://` or `magnet:` (#74) ### Changed - Update to [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) v0.8.4 diff --git a/display/private.go b/display/private.go index c56b270..828390e 100644 --- a/display/private.go +++ b/display/private.go @@ -174,13 +174,13 @@ func handleOther(u string) { } switch handler { case "", "off": - Error("URL Error", "Opening " + parsed.Scheme + " URLs is turned off.") + Error("URL Error", "Opening "+parsed.Scheme+" URLs is turned off.") default: // The config has a custom command to execute for URLs fields := strings.Fields(handler) err := exec.Command(fields[0], append(fields[1:], u)...).Start() if err != nil { - Error("URL Error", "Error executing custom command: " + err.Error()) + Error("URL Error", "Error executing custom command: "+err.Error()) } } App.Draw() From 4452fcfec639ebb8b5a2aab02d2f775997cc59f6 Mon Sep 17 00:00:00 2001 From: Sotiris Papatheodorou Date: Fri, 28 Aug 2020 01:55:42 +0300 Subject: [PATCH 21/27] =?UTF-8?q?=E2=9C=A8Add=20option=20to=20automaticall?= =?UTF-8?q?y=20follow=20redirects=20(#75)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: makeworld --- config/config.go | 1 + config/default.go | 5 +++++ default-config.toml | 5 +++++ display/display.go | 2 +- display/history.go | 2 +- display/private.go | 24 +++++++++++++++++++----- 6 files changed, 32 insertions(+), 7 deletions(-) diff --git a/config/config.go b/config/config.go index 71ebc97..784ac0c 100644 --- a/config/config.go +++ b/config/config.go @@ -145,6 +145,7 @@ func Init() error { } viper.SetDefault("a-general.home", "gemini.circumlunar.space") + viper.SetDefault("a-general.auto_redirect", false) viper.SetDefault("a-general.http", "default") viper.SetDefault("a-general.search", "gus.guru/search") viper.SetDefault("a-general.color", true) diff --git a/config/default.go b/config/default.go index 89f85e4..572716f 100644 --- a/config/default.go +++ b/config/default.go @@ -16,6 +16,11 @@ var defaultConf = []byte(`# This is the default config file. # Press Ctrl-H to access it home = "gemini://gemini.circumlunar.space" +# Follow up to 5 Gemini redirects without prompting. +# A prompt is always shown after the 5th redirect and for redirects to protocols other than Gemini. +# If set to false, a prompt will be shown before following redirects. +auto_redirect = false + # What command to run to open a HTTP URL. Set to "default" to try to guess the browser, # or set to "off" to not open HTTP URLs. # If a command is set, than the URL will be added (in quotes) to the end of the command. diff --git a/default-config.toml b/default-config.toml index ff204ac..c304bf7 100644 --- a/default-config.toml +++ b/default-config.toml @@ -13,6 +13,11 @@ # Press Ctrl-H to access it home = "gemini://gemini.circumlunar.space" +# Follow up to 5 Gemini redirects without prompting. +# A prompt is always shown after the 5th redirect and for redirects to protocols other than Gemini. +# If set to false, a prompt will be shown before following redirects. +auto_redirect = false + # What command to run to open a HTTP URL. Set to "default" to try to guess the browser, # or set to "off" to not open HTTP URLs. # If a command is set, than the URL will be added (in quotes) to the end of the command. diff --git a/display/display.go b/display/display.go index 74cfe35..353f68c 100644 --- a/display/display.go +++ b/display/display.go @@ -521,7 +521,7 @@ func Reload() { go func(t *tab) { cache.RemovePage(tabs[curTab].page.URL) cache.RemoveFavicon(parsed.Host) - handleURL(t, t.page.URL) // goURL is not used bc history shouldn't be added to + handleURL(t, t.page.URL, 0) // goURL is not used bc history shouldn't be added to if t == tabs[curTab] { // Display the bottomBar state that handleURL set t.applyBottomBar() diff --git a/display/history.go b/display/history.go index df60641..333adcc 100644 --- a/display/history.go +++ b/display/history.go @@ -2,7 +2,7 @@ package display // applyHist is a history.go internal function, to load a URL in the history. func applyHist(t *tab) { - handleURL(t, t.history.urls[t.history.pos]) // Load that position in history + handleURL(t, t.history.urls[t.history.pos], 0) // Load that position in history t.applyAll() } diff --git a/display/private.go b/display/private.go index 828390e..edc5214 100644 --- a/display/private.go +++ b/display/private.go @@ -267,7 +267,7 @@ func handleFavicon(t *tab, host, old string) { // // It should be called in a goroutine. func goURL(t *tab, u string) { - final, displayed := handleURL(t, u) + final, displayed := handleURL(t, u, 0) if displayed { t.addToHistory(final) } @@ -289,7 +289,10 @@ func goURL(t *tab, u string) { // // The bottomBar is not actually changed in this func, except during loading. // The func that calls this one should apply the bottomBar values if necessary. -func handleURL(t *tab, u string) (string, bool) { +// +// numRedirects is the number of redirects that resulted in the provided URL. +// It should typically be 0. +func handleURL(t *tab, u string, numRedirects int) (string, bool) { defer App.Draw() // Just in case // Save for resetting on error @@ -421,7 +424,7 @@ func handleURL(t *tab, u string) (string, bool) { Error("Input Error", "URL for that input would be too long.") return ret("", false) } - return ret(handleURL(t, parsed.String())) + return ret(handleURL(t, parsed.String(), 0)) } return ret("", false) case 30: @@ -431,11 +434,22 @@ func handleURL(t *tab, u string) (string, bool) { return ret("", false) } redir := parsed.ResolveReference(parsedMeta).String() - if YesNo("Follow redirect?\n" + redir) { + // Prompt before redirecting to non-Gemini protocol + redirect := false + if !strings.HasPrefix(redir, "gemini") { + if YesNo("Follow redirect to non-Gemini URL?\n" + redir) { + redirect = true + } else { + return ret("", false) + } + } + // Prompt before redirecting + autoRedirect := viper.GetBool("a-general.auto_redirect") + if redirect || (autoRedirect && numRedirects < 5) || YesNo("Follow redirect?\n"+redir) { if res.Status == gemini.StatusRedirectPermanent { go cache.AddRedir(u, redir) } - return ret(handleURL(t, redir)) + return ret(handleURL(t, redir, numRedirects+1)) } return ret("", false) case 40: From 6de2b355b5b5af87167daa6169f42742791685dc Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 19:02:12 -0400 Subject: [PATCH 22/27] =?UTF-8?q?=F0=9F=93=9D=20Add=20#75=20to=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc0dc85..db01a56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - F1 and F2 keys for navigating to the previous and next tabs (#64) - Resolving any relative path (starting with a `.`) in the bottom bar is supported, not just `..` (#71) - Set programs in config to open other schemes like `gopher://` or `magnet:` (#74) +- Auto-redirecting can be enabled - redirect within Gemini up to 5 times automatically (#75) ### Changed - Update to [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) v0.8.4 diff --git a/README.md b/README.md index 1ebd379..37d783e 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ Features in *italics* are in the master branch, but not in the latest release. - See `gemini://mozz.us/files/rfc_gemini_favicon.gmi` for details - [ ] Subscribe to RSS and Atom feeds and display them - Subscribing to page changes, similar to how Spacewalk works, will also be supported + - *In progress on `feeds` branch* - [ ] Stream support - [ ] Full client certificate UX within the client - Create transient and permanent certs within the client, per domain From dbe87a3e993b20faa76c8069c444ea30646ec64f Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 19:57:06 -0400 Subject: [PATCH 23/27] =?UTF-8?q?=F0=9F=90=9B=20Recog.=20colon-only=20sche?= =?UTF-8?q?me=20URLs=20and=20add=20normalizeURL=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + display/display.go | 4 ++++ display/util.go | 7 ------- display/util_test.go | 33 +++++++++++++++++++++++++++++++++ go.sum | 1 + 5 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 display/util_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index db01a56..8a74670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Two digit (and higher) link texts are now in line with one digit ones (#60) - Race condition when reloading pages, could have caused the cache to still be used - Prevent panic (crash) when the server sends an error with an empty meta string (#73) +- URLs with with colon-only schemes (like `mailto:`) are properly recognized ## [1.4.0] - 2020-07-28 diff --git a/display/display.go b/display/display.go index 353f68c..76c05ec 100644 --- a/display/display.go +++ b/display/display.go @@ -549,6 +549,10 @@ func URL(u string) { return } + if !strings.HasPrefix(u, "//") && !strings.HasPrefix(u, "gemini://") && !strings.Contains(u, "://") { + // Assume it's a Gemini URL + u = "gemini://" + u + } go goURL(tabs[curTab], u) } diff --git a/display/util.go b/display/util.go index 4601626..3a70451 100644 --- a/display/util.go +++ b/display/util.go @@ -83,13 +83,6 @@ func normalizeURL(u string) string { return u } - if !strings.Contains(u, "://") && !strings.HasPrefix(u, "//") { - // No scheme at all in the URL - parsed, err = url.Parse("gemini://" + u) - if err != nil { - return u - } - } if parsed.Scheme == "" { // Always add scheme parsed.Scheme = "gemini" diff --git a/display/util_test.go b/display/util_test.go new file mode 100644 index 0000000..4cc3506 --- /dev/null +++ b/display/util_test.go @@ -0,0 +1,33 @@ +package display + +import ( + "testing" +) + +var normalizeURLTests = []struct { + u string + expected string +}{ + {"gemini://example.com:1965/", "gemini://example.com/"}, + {"gemini://example.com", "gemini://example.com/"}, + {"//example.com", "gemini://example.com/"}, + {"//example.com:1965", "gemini://example.com/"}, + {"//example.com:123/", "gemini://example.com:123/"}, + {"gemini://example.com/", "gemini://example.com/"}, + {"gemini://example.com/#fragment", "gemini://example.com/"}, + {"gemini://example.com#fragment", "gemini://example.com/"}, + {"gemini://user@example.com/", "gemini://example.com/"}, + // Other schemes, URL isn't modified + {"mailto:example@example.com", "mailto:example@example.com"}, + {"magnet:?xt=urn:btih:test", "magnet:?xt=urn:btih:test"}, + {"https://example.com", "https://example.com"}, +} + +func TestNormalizeURL(t *testing.T) { + for _, tt := range normalizeURLTests { + actual := normalizeURL(tt.u) + if actual != tt.expected { + t.Errorf("normalizeURL(%s): expected %s, actual %s", tt.u, tt.expected, actual) + } + } +} diff --git a/go.sum b/go.sum index b9cb5e1..c0f0870 100644 --- a/go.sum +++ b/go.sum @@ -203,6 +203,7 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= 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= From 11c3b1fec9d40b8d87f14c89749f966a28d4f5f0 Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 20:04:02 -0400 Subject: [PATCH 24/27] =?UTF-8?q?=F0=9F=94=A5=20Use=20gemini.QueryEscape?= =?UTF-8?q?=20instead?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- display/display.go | 3 ++- display/private.go | 2 +- display/util.go | 7 ------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/display/display.go b/display/display.go index 76c05ec..2aa331c 100644 --- a/display/display.go +++ b/display/display.go @@ -11,6 +11,7 @@ import ( "github.com/makeworld-the-better-one/amfora/config" "github.com/makeworld-the-better-one/amfora/renderer" "github.com/makeworld-the-better-one/amfora/structs" + "github.com/makeworld-the-better-one/go-gemini" "github.com/spf13/viper" "gitlab.com/tslocum/cview" ) @@ -172,7 +173,7 @@ func Init() { // Detect if it's a search or URL if strings.Contains(query, " ") || (!strings.Contains(query, "//") && !strings.Contains(query, ".") && !strings.HasPrefix(query, "about:")) { - u := viper.GetString("a-general.search") + "?" + queryEscape(query) + u := viper.GetString("a-general.search") + "?" + gemini.QueryEscape(query) cache.RemovePage(u) // Don't use the cached version of the search URL(u) } else { diff --git a/display/private.go b/display/private.go index edc5214..7795c6f 100644 --- a/display/private.go +++ b/display/private.go @@ -419,7 +419,7 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) { if ok { // Make another request with the query string added // + chars are replaced because PathEscape doesn't do that - parsed.RawQuery = queryEscape(userInput) + parsed.RawQuery = gemini.QueryEscape(userInput) if len(parsed.String()) > gemini.URLMaxLength { Error("Input Error", "URL for that input would be too long.") return ret("", false) diff --git a/display/util.go b/display/util.go index 3a70451..e03fdd6 100644 --- a/display/util.go +++ b/display/util.go @@ -3,7 +3,6 @@ package display import ( "errors" "net/url" - "strings" "github.com/spf13/viper" ) @@ -45,12 +44,6 @@ func textWidth() int { return viper.GetInt("a-general.max_width") } -// queryEscape is the same as url.PathEscape, but it also replaces the +. -// This is because Gemini requires percent-escaping for queries. -func queryEscape(path string) string { - return strings.ReplaceAll(url.PathEscape(path), "+", "%2B") -} - // resolveRelLink returns an absolute link for the given absolute link and relative one. // It also returns an error if it could not resolve the links, which should be displayed // to the user. From 164ed98588ee1ad02c04b565a52852a511b336d0 Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 22:40:40 -0400 Subject: [PATCH 25/27] =?UTF-8?q?=E2=9C=A8=20Proxy=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ client/client.go | 10 +++++++++- config/default.go | 10 +++++++++- default-config.toml | 9 ++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37d783e..6aa7782 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,9 @@ Features in *italics* are in the master branch, but not in the latest release. - [x] Theming - [x] *Emoji favicons* - See `gemini://mozz.us/files/rfc_gemini_favicon.gmi` for details +- [x] *Proxying* + - All requests can optionally be sent through another server + - A gemini proxy server implementation currently does not exist, but Amfora will support it when it does! - [ ] Subscribe to RSS and Atom feeds and display them - Subscribing to page changes, similar to how Spacewalk works, will also be supported - *In progress on `feeds` branch* diff --git a/client/client.go b/client/client.go index e9a4fdf..eba7205 100644 --- a/client/client.go +++ b/client/client.go @@ -5,12 +5,20 @@ import ( "net/url" "github.com/makeworld-the-better-one/go-gemini" + "github.com/spf13/viper" ) // Fetch returns response data and an error. // The error text is human friendly and should be displayed. func Fetch(u string) (*gemini.Response, error) { - res, err := gemini.Fetch(u) + var res *gemini.Response + var err error + + if viper.GetString("a-general.proxy") == "" { + res, err = gemini.Fetch(u) + } else { + res, err = gemini.FetchWithHost(viper.GetString("a-general.proxy"), u) + } if err != nil { return nil, err } diff --git a/config/default.go b/config/default.go index 572716f..8f68590 100644 --- a/config/default.go +++ b/config/default.go @@ -55,6 +55,13 @@ page_max_time = 10 # Whether to replace tab numbers with emoji favicons, which are cached. emoji_favicons = false +# Proxy server, through which all requests would be sent. +# String should be a host: a domain/IP with an optional port. Port 1965 is assumed otherwise. +# The proxy server needs to be a Gemini server that supports proxying. +# By default it is empty, which disables the proxy. +proxy = "" + + [keybindings] # In the future there will be more settings here. @@ -154,4 +161,5 @@ max_pages = 30 # The maximum number of pages the cache will store # bkmk_modal_text # bkmk_modal_label # bkmk_modal_field_bg -# bkmk_modal_field_text`) +# bkmk_modal_field_text +`) diff --git a/default-config.toml b/default-config.toml index c304bf7..272f381 100644 --- a/default-config.toml +++ b/default-config.toml @@ -52,6 +52,13 @@ page_max_time = 10 # Whether to replace tab numbers with emoji favicons, which are cached. emoji_favicons = false +# Proxy server, through which all requests would be sent. +# String should be a host: a domain/IP with an optional port. Port 1965 is assumed otherwise. +# The proxy server needs to be a Gemini server that supports proxying. +# By default it is empty, which disables the proxy. +proxy = "" + + [keybindings] # In the future there will be more settings here. @@ -151,4 +158,4 @@ max_pages = 30 # The maximum number of pages the cache will store # bkmk_modal_text # bkmk_modal_label # bkmk_modal_field_bg -# bkmk_modal_field_text \ No newline at end of file +# bkmk_modal_field_text From e29f0895fb476150cd4fef852ee867becf892c5e Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 23:14:14 -0400 Subject: [PATCH 26/27] =?UTF-8?q?=F0=9F=92=9A=20Set=20email=20notif=20sett?= =?UTF-8?q?ings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 77e51d8..7935a21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,3 +20,8 @@ cache: - $GOPATH/pkg/mod # TODO: GitHub Releases deploy + +notifications: + email: + on_success: never + on_failure: always From 5e417b040bfdfb366fcdea0c95da496871db8833 Mon Sep 17 00:00:00 2001 From: makeworld Date: Thu, 27 Aug 2020 23:17:04 -0400 Subject: [PATCH 27/27] =?UTF-8?q?=F0=9F=93=9D=20Add=20proxy=20support=20to?= =?UTF-8?q?=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a74670..1530ff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- **Proxy support** - specify a proxy in the config for all requests to go through it (#66) - Emoji favicons can now be seen if `emoji_favicons` is enabled in the config (#62) - The `shift_numbers` key in the config was added, so that non US keyboard users can navigate tabs (#64) - F1 and F2 keys for navigating to the previous and next tabs (#64)