├── .gitattributes ├── .gitignore ├── dup_linux.go ├── dup.go ├── .goreleaser.yaml ├── Makefile ├── .github └── workflows │ ├── release.yaml │ └── ci.yaml ├── dup_windows.go ├── go.mod ├── LICENSE ├── README.md ├── cmd └── test │ └── test.go ├── .golangci.yml ├── panicwatch_test.go ├── panicwatch.go └── go.sum /.gitattributes: -------------------------------------------------------------------------------- 1 | *.go text eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | /dist 3 | /test 4 | /test.exe 5 | -------------------------------------------------------------------------------- /dup_linux.go: -------------------------------------------------------------------------------- 1 | // +build arm arm64 2 | 3 | package panicwatch 4 | 5 | import ( 6 | "os" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | func dup(oldfd int) (fd int, err error) { 12 | return unix.Dup(oldfd) 13 | } 14 | 15 | func redirectStderr(target *os.File) error { 16 | err := unix.Dup3(int(target.Fd()), unix.Stderr, 0) 17 | if err == nil { 18 | os.Stderr = target 19 | } 20 | 21 | return err 22 | } 23 | -------------------------------------------------------------------------------- /dup.go: -------------------------------------------------------------------------------- 1 | // +build linux,!arm,!arm64 !linux 2 | // +build !windows 3 | 4 | package panicwatch 5 | 6 | import ( 7 | "os" 8 | 9 | "golang.org/x/sys/unix" 10 | ) 11 | 12 | func dup(oldfd int) (fd int, err error) { 13 | return unix.FcntlInt(uintptr(oldfd), unix.F_DUPFD_CLOEXEC, 0) 14 | } 15 | 16 | func redirectStderr(target *os.File) error { 17 | err := unix.Dup2(int(target.Fd()), unix.Stderr) 18 | if err == nil { 19 | os.Stderr = target 20 | } 21 | 22 | return err 23 | } 24 | -------------------------------------------------------------------------------- /.goreleaser.yaml: -------------------------------------------------------------------------------- 1 | archives: 2 | - format: binary 3 | 4 | builds: 5 | - main: ./cmd/test 6 | binary: test 7 | goos: 8 | - darwin 9 | - freebsd 10 | - linux 11 | - netbsd 12 | - openbsd 13 | - windows 14 | goarch: 15 | - 386 16 | - amd64 17 | - arm 18 | - arm64 19 | 20 | checksum: 21 | disable: true 22 | 23 | changelog: 24 | 25 | release: 26 | ids: 27 | - none 28 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export BIN = ${PWD}/bin 2 | export GOBIN = $(BIN) 3 | 4 | .PHONY: check 5 | check: lint test 6 | 7 | .PHONY: lint 8 | lint: $(BIN)/golangci-lint 9 | $(BIN)/golangci-lint run 10 | 11 | .PHONY: fix 12 | fix: $(BIN)/golangci-lint 13 | $(BIN)/golangci-lint run --fix 14 | 15 | .PHONY: test 16 | test: test-unit 17 | 18 | .PHONY: test-unit 19 | test-unit: 20 | go build cmd/test/test.go 21 | go test --timeout 5m --count 1 ./... 22 | go test --timeout 5m --count 1 --race ./... 23 | go test --timeout 5m --count 10 ./... 24 | 25 | .PHONY: clean 26 | clean: 27 | rm -rf bin 28 | 29 | $(BIN)/golangci-lint: 30 | curl --retry 5 -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh 31 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | 8 | jobs: 9 | release: 10 | name: Release 11 | runs-on: ubuntu-18.04 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v2 15 | with: 16 | fetch-depth: 0 17 | - uses: actions/setup-go@v2 18 | with: 19 | go-version: '^1.17' 20 | - name: GoReleaser 21 | uses: goreleaser/goreleaser-action@v2 22 | with: 23 | args: release 24 | env: 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | -------------------------------------------------------------------------------- /dup_windows.go: -------------------------------------------------------------------------------- 1 | package panicwatch 2 | 3 | import ( 4 | "golang.org/x/sys/windows" 5 | "os" 6 | ) 7 | 8 | func dup(oldfd int) (int, error) { 9 | processHandle := windows.CurrentProcess() 10 | 11 | var fdHandle windows.Handle 12 | 13 | err := windows.DuplicateHandle( 14 | processHandle, 15 | windows.Handle(oldfd), 16 | processHandle, 17 | &fdHandle, 18 | 0, 19 | true, 20 | windows.DUPLICATE_SAME_ACCESS, 21 | ) 22 | if err != nil { 23 | return 0, err 24 | } 25 | 26 | return int(fdHandle), nil 27 | } 28 | 29 | func redirectStderr(target *os.File) error { 30 | err := windows.SetStdHandle(windows.STD_ERROR_HANDLE, windows.Handle(target.Fd())) 31 | if err == nil { 32 | os.Stderr = target 33 | } 34 | 35 | return err 36 | } 37 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/grongor/panicwatch 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/glycerine/rbuf v0.0.0-20190314090850-75b78581bebe 7 | github.com/go-errors/errors v1.4.0 8 | github.com/stretchr/testify v1.7.0 9 | golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 10 | ) 11 | 12 | require ( 13 | github.com/davecgh/go-spew v1.1.1 // indirect 14 | github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 // indirect 15 | github.com/gopherjs/gopherjs v0.0.0-20210803090616-8f023c250c89 // indirect 16 | github.com/jtolds/gls v4.20.0+incompatible // indirect 17 | github.com/kr/pretty v0.1.0 // indirect 18 | github.com/pmezard/go-difflib v1.0.0 // indirect 19 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect 20 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect 21 | ) 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jakub Chábek 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | panicwatch 2 | ========== 3 | 4 | ![CI](https://github.com/grongor/panicwatch/workflows/CI/badge.svg) 5 | [![Go Reference](https://pkg.go.dev/badge/github.com/grongor/panicwatch.svg)](https://pkg.go.dev/github.com/grongor/panicwatch) 6 | 7 | Simple utility for catching panics in your Go applications. 8 | 9 | When you start panicwatch, it creates a new process which watches your application. When the application exits, 10 | panicwatch parses the stderr output of your application and if it finds a panic, it will report it using configured 11 | callback. Panicwatch doesn't block usage of stderr of your application in any way as it uses `dup` to get a copy of it. 12 | 13 | Panicwatch isn't meant for recovery from panics, but merely for safe and reliable logging when they happen. 14 | 15 | Panicwatch won't stand in your way: it won't prevent you from any signal handling/manipulation, other file descriptor 16 | magic on your side, or anything that you can think of. It is completely transparent to your application. 17 | 18 | Try using it via [grongor/go-bootstrap](https://github.com/grongor/go-bootstrap): a library that handles all 19 | the annoying bootstrapping for you (config, signals, logging, application context, ...). 20 | 21 | ```go 22 | package main 23 | 24 | import ( 25 | "log" 26 | 27 | "github.com/getsentry/sentry-go" 28 | "github.com/grongor/panicwatch" 29 | ) 30 | 31 | func main() { 32 | if err := sentry.Init(); err != nil { 33 | log.Fatalln("sentry.Init: " + err.Error()) 34 | } 35 | 36 | app := &yourApp{} 37 | 38 | err := panicwatch.Start(panicwatch.Config{ 39 | OnPanic: func(p panicwatch.Panic) { 40 | sentry.Log("panic: "+p.Message, "stack", p.Stack) 41 | }, 42 | OnWatcherDied: func(err error) { 43 | log.Println("panicwatch watcher process died") 44 | app.ShutdownGracefully() 45 | }, 46 | }) 47 | if err != nil { 48 | log.Fatalln("failed to start panicwatch: " + err.Error()) 49 | } 50 | 51 | app.Start() 52 | } 53 | ``` 54 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | 8 | branches: 9 | - master 10 | 11 | pull_request: 12 | 13 | permissions: 14 | contents: read 15 | pull-requests: read 16 | 17 | jobs: 18 | test: 19 | name: Test 20 | runs-on: ${{ matrix.os }} 21 | strategy: 22 | matrix: 23 | os: [ macos-latest, ubuntu-latest, windows-latest ] 24 | steps: 25 | - uses: actions/checkout@v2 26 | - uses: actions/setup-go@v2 27 | with: 28 | go-version: '^1.17' 29 | - name: Run tests 30 | run: make test 31 | 32 | test-arm: 33 | name: Test ARM 34 | runs-on: ubuntu-latest 35 | strategy: 36 | matrix: 37 | arch: [ armv6, armv7, aarch64 ] 38 | steps: 39 | - uses: actions/checkout@v2 40 | - uses: actions/setup-go@v2 41 | with: 42 | go-version: '^1.17' 43 | - uses: uraimo/run-on-arch-action@v2.1.1 44 | id: runcmd 45 | with: 46 | arch: ${{ matrix.arch }} 47 | distro: bullseye 48 | install: | 49 | apt update 50 | apt install -y build-essential wget 51 | 52 | if [[ ${{ matrix.arch }} == arm* ]]; then 53 | pkg=go1.17.linux-armv6l.tar.gz 54 | else 55 | pkg=go1.17.linux-arm64.tar.gz 56 | fi 57 | 58 | wget https://golang.org/dl/$pkg 59 | tar -C /usr/local -xzf $pkg 60 | run: | 61 | export PATH=$PATH:/usr/local/go/bin 62 | go build cmd/test/test.go 63 | go test --timeout 5m --count 1 ./... 64 | 65 | lint: 66 | name: Lint 67 | runs-on: ubuntu-latest 68 | steps: 69 | - uses: actions/checkout@v2 70 | - name: golangci-lint 71 | uses: golangci/golangci-lint-action@v2 72 | with: 73 | only-new-issues: true 74 | -------------------------------------------------------------------------------- /cmd/test/test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io/ioutil" 7 | "os" 8 | "path" 9 | "runtime" 10 | "time" 11 | 12 | "github.com/grongor/panicwatch" 13 | ) 14 | 15 | func main() { 16 | args := os.Args[1:] 17 | if len(args) != 2 { 18 | stderr("missing command or results file") 19 | os.Exit(3) 20 | } 21 | 22 | panicHandler := func(p panicwatch.Panic) { 23 | result, err := json.Marshal(p) 24 | if err != nil { 25 | stderr("failed to marshal Panic: " + err.Error()) 26 | os.Exit(3) 27 | } 28 | 29 | err = ioutil.WriteFile(args[1], result, 0) 30 | if err != nil { 31 | stderr("failed to write results: " + err.Error()) 32 | os.Exit(3) 33 | } 34 | } 35 | 36 | err := panicwatch.Start(panicwatch.Config{OnPanic: panicHandler}) 37 | if err != nil { 38 | stderr("unexpected error:", err.Error()) 39 | os.Exit(3) 40 | } 41 | 42 | executeCommand(args[0]) 43 | } 44 | 45 | func executeCommand(cmd string) { 46 | switch cmd { 47 | case "no-panic": 48 | stdout("some stdout output") 49 | stderr("some stderr output") 50 | case "no-panic-error": 51 | stderr("blah blah something happened") 52 | os.Exit(1) 53 | case "panic": 54 | stdout("some output...\neverything looks good...") 55 | panic("wtf, unexpected panic!") 56 | case "panic-and-error": 57 | stdout("some output...\neverything looks good...") 58 | stderr("well something goes bad ...") 59 | panic("... and panic!") 60 | case "panic-sync-split": 61 | _, _ = fmt.Fprint(os.Stderr, "pani") 62 | _ = os.Stderr.Sync() 63 | 64 | time.Sleep(time.Millisecond * 500) 65 | stderr("c: i'm split in three lol") 66 | stderr("\ngoroutine 1 [running]:") 67 | 68 | _ = os.Stderr.Sync() 69 | 70 | time.Sleep(time.Millisecond * 500) 71 | 72 | _, filename, _, _ := runtime.Caller(0) 73 | projectDir := path.Dir(path.Dir(path.Dir(filename))) 74 | 75 | stderr("main.executeCommand(0x7fff79030f93, 0x22)") 76 | stderr(fmt.Sprintf("\t%s/cmd/test/test.go:83 +0x8d7", projectDir)) 77 | 78 | _ = os.Stderr.Sync() 79 | 80 | stderr("main.main()") 81 | 82 | stderr(fmt.Sprintf("\t%s/cmd/test/test.go:42 +0x12ab", projectDir)) 83 | os.Exit(2) 84 | case "panic-with-garbage": 85 | stderr("panic: blah blah\n") 86 | 87 | for i := 0; i < 1500; i++ { 88 | stdout("some garbage here...") 89 | stderr("some garbage here...") 90 | } 91 | 92 | panic("and BAM!") 93 | case "only-last-panic-string-is-detected": 94 | stderr("panic: this is fake\n") 95 | 96 | panic("and this is not") 97 | default: 98 | stderr("unknown command:", cmd) 99 | os.Exit(3) 100 | } 101 | } 102 | 103 | func stdout(a ...interface{}) { 104 | _, _ = fmt.Fprintln(os.Stdout, a...) 105 | } 106 | 107 | func stderr(a ...interface{}) { 108 | _, _ = fmt.Fprintln(os.Stderr, a...) 109 | } 110 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | run: 2 | modules-download-mode: readonly 3 | 4 | linters: 5 | enable: 6 | - asciicheck 7 | - bodyclose 8 | - cyclop 9 | - dupl 10 | - durationcheck 11 | - errorlint 12 | - exhaustive 13 | - exportloopref 14 | - gci 15 | - gochecknoglobals 16 | - gochecknoinits 17 | - gocognit # probably tune 18 | - goconst 19 | - gocritic # probably tune 20 | - godot 21 | - goerr113 22 | - gofumpt 23 | - gosec 24 | - ifshort 25 | - lll 26 | - makezero 27 | - misspell 28 | - nakedret 29 | - nilerr 30 | - nlreturn 31 | - noctx 32 | - nolintlint 33 | # - paralleltest # @todo check later, maybe enable 34 | - prealloc 35 | - predeclared 36 | - revive 37 | - sqlclosecheck 38 | - testpackage 39 | - thelper 40 | - unconvert 41 | - wastedassign 42 | - whitespace 43 | - wsl 44 | 45 | linters-settings: 46 | govet: 47 | check-shadowing: false 48 | enable-all: true 49 | disable: 50 | - fieldalignment 51 | 52 | revive: 53 | ignore-generated-header: true 54 | confidence: 0.8 55 | error-code: 0 56 | severity: error 57 | rules: 58 | - name: atomic 59 | - name: bare-return 60 | - name: blank-imports 61 | - name: bool-literal-in-expr 62 | - name: confusing-naming 63 | - name: confusing-results 64 | - name: constant-logical-expr 65 | - name: context-as-argument 66 | - name: context-keys-type 67 | - name: defer 68 | - name: dot-imports 69 | - name: duplicated-imports 70 | - name: early-return 71 | - name: empty-block 72 | - name: empty-lines 73 | - name: error-naming 74 | - name: error-return 75 | - name: error-strings 76 | - name: flag-parameter 77 | - name: get-return 78 | - name: identical-branches 79 | - name: if-return 80 | - name: import-shadowing 81 | - name: increment-decrement 82 | - name: indent-error-flow 83 | - name: modifies-parameter 84 | - name: modifies-value-receiver 85 | - name: nested-structs 86 | - name: range 87 | - name: range-val-address 88 | - name: range-val-in-closure 89 | - name: receiver-naming 90 | - name: redefines-builtin-id 91 | - name: string-of-int 92 | - name: struct-tag 93 | - name: superfluous-else 94 | - name: time-naming 95 | - name: unconditional-recursion 96 | - name: unexported-naming 97 | - name: unexported-return 98 | - name: unnecessary-stmt 99 | - name: unused-parameter 100 | - name: unused-receiver 101 | - name: useless-break 102 | - name: var-declaration 103 | - name: waitgroup-by-value 104 | 105 | lll: 106 | tab-width: 4 107 | 108 | wsl: 109 | allow-cuddle-declarations: true 110 | 111 | issues: 112 | max-issues-per-linter: 0 113 | max-same-issues: 0 114 | exclude-rules: 115 | # ignore unchecked errors, missing Close(), code complexity, global variables and line lengths in tests 116 | - path: _test\.go 117 | linters: [ errcheck, bodyclose, cyclop, gocognit, gochecknoglobals, lll ] 118 | # ignore control flags in tests 119 | - path: _test\.go 120 | text: "seems to be a control flag, avoid control coupling" 121 | linters: [ revive ] 122 | # ignore unchecked errors in defer statements 123 | - source: "^\t+defer " 124 | linters: [ errcheck ] 125 | # ignore default Revive linters which we don't want 126 | - text: "^(errorf|exported|package-comments|unreachable-code|var-naming): " 127 | linters: [ revive ] 128 | # ignore defer cuddle in tests 129 | - path: _test\.go 130 | text: only one cuddle assignment allowed before defer statement 131 | linters: [ wsl ] 132 | # ignore expressions after assignment in tests 133 | - path: _test\.go 134 | text: only cuddled expressions if assigning variable or using from line above 135 | linters: [ wsl ] 136 | # ignore goerr113 dynamic errors definition error...not sure how to approach this correctly now 137 | - text: do not define dynamic errors, use wrapped static errors instead 138 | linters: [ goerr113 ] 139 | -------------------------------------------------------------------------------- /panicwatch_test.go: -------------------------------------------------------------------------------- 1 | package panicwatch_test 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "errors" 7 | "fmt" 8 | "io/ioutil" 9 | "os" 10 | "os/exec" 11 | "path" 12 | "runtime" 13 | "strconv" 14 | "strings" 15 | "testing" 16 | 17 | goerrors "github.com/go-errors/errors" 18 | "github.com/grongor/panicwatch" 19 | "github.com/stretchr/testify/require" 20 | ) 21 | 22 | const panicRegexTemplate = `goroutine 1 \[running\]: 23 | main\.executeCommand\({?0x[a-z0-9]+, 0x[a-z0-9]+}?\) 24 | \t%[1]s/cmd/test/test\.go:\d+ \+0x[a-z0-9]+ 25 | main.main\(\) 26 | \t%[1]s/cmd/test/test\.go:\d+ \+0x[a-z0-9]+ 27 | ` 28 | 29 | func TestPanicwatch(t *testing.T) { 30 | builder := strings.Builder{} 31 | 32 | for i := 0; i < 1500; i++ { 33 | builder.WriteString("some garbage here...") 34 | builder.WriteString("\n") 35 | } 36 | 37 | garbageString := builder.String() 38 | 39 | panicRegex := getPanicRegex() 40 | 41 | tests := []struct { 42 | command string 43 | expectedStdout string 44 | expectedStderr string 45 | expectedPanic string 46 | expectedExitCode int 47 | }{ 48 | { 49 | command: "no-panic", 50 | expectedStdout: "some stdout output\n", 51 | expectedStderr: "some stderr output\n", 52 | }, 53 | { 54 | command: "no-panic-error", 55 | expectedExitCode: 1, 56 | expectedStderr: "blah blah something happened\n", 57 | }, 58 | { 59 | command: "panic", 60 | expectedExitCode: 2, 61 | expectedStdout: "some output...\neverything looks good...\n", 62 | expectedPanic: "wtf, unexpected panic!", 63 | }, 64 | { 65 | command: "panic-and-error", 66 | expectedExitCode: 2, 67 | expectedStdout: "some output...\neverything looks good...\n", 68 | expectedStderr: "well something goes bad ...\n", 69 | expectedPanic: "... and panic!", 70 | }, 71 | { 72 | command: "panic-sync-split", 73 | expectedExitCode: 2, 74 | expectedPanic: "i'm split in three lol", 75 | }, 76 | { 77 | command: "panic-with-garbage", 78 | expectedExitCode: 2, 79 | expectedStdout: garbageString, 80 | expectedStderr: "panic: blah blah\n\n" + garbageString, 81 | expectedPanic: "and BAM!", 82 | }, 83 | { 84 | command: "only-last-panic-string-is-detected", 85 | expectedExitCode: 2, 86 | expectedStderr: "panic: this is fake\n\n", 87 | expectedPanic: "and this is not", 88 | }, 89 | } 90 | for _, test := range tests { 91 | t.Run(test.command, func(t *testing.T) { 92 | assert := require.New(t) 93 | 94 | cmd, stdout, stderr, resultFile := helperProcess(test.command) 95 | defer os.Remove(resultFile) 96 | 97 | err := cmd.Run() 98 | 99 | if test.expectedExitCode == 0 { 100 | assert.NoError(err, "unexpected exit code, stderr: "+stderr.String()) 101 | } else { 102 | assert.Error(err) 103 | 104 | var exitErr *exec.ExitError 105 | 106 | assert.True(errors.As(err, &exitErr)) 107 | assert.Equal( 108 | test.expectedExitCode, 109 | exitErr.ExitCode(), 110 | "unexpected exit code, stderr: "+stderr.String(), 111 | ) 112 | } 113 | 114 | assert.Equal(test.expectedStdout, stdout.String()) 115 | 116 | result := readResult(resultFile) 117 | 118 | assert.Equal(test.expectedPanic, result.Message) 119 | 120 | if test.expectedPanic == "" { 121 | assert.Equal(test.expectedStderr, stderr.String()) 122 | 123 | return 124 | } 125 | 126 | assert.Regexp(panicRegex, result.Stack) 127 | 128 | if test.expectedStderr != "" { 129 | assert.True(strings.HasPrefix(stderr.String(), test.expectedStderr)) 130 | } 131 | 132 | assert.Regexp( 133 | fmt.Sprintf("panic: %s\n\n%s", test.expectedPanic, panicRegex), 134 | stderr.String(), 135 | ) 136 | 137 | var resultAsErr *goerrors.Error 138 | 139 | assert.True(errors.As(result.AsError(), &resultAsErr)) 140 | 141 | assert.Equal(test.expectedPanic, resultAsErr.Error()) 142 | 143 | builder := strings.Builder{} 144 | 145 | builder.WriteString("goroutine 1 [running]:\n") 146 | 147 | for _, frame := range resultAsErr.StackFrames() { 148 | if frame.Name == "main" { 149 | builder.WriteString(frame.Package + `.` + frame.Name + `()` + "\n") 150 | } else { 151 | builder.WriteString(frame.Package + `.` + frame.Name + `(0x0, 0x0)` + "\n") 152 | } 153 | 154 | builder.WriteString("\t" + frame.File + ":" + strconv.Itoa(frame.LineNumber) + ` +0x0` + "\n") 155 | } 156 | 157 | assert.Regexp(panicRegex, builder.String()) 158 | }) 159 | } 160 | } 161 | 162 | // Each test uses this test method to run a separate process in order to test the functionality. 163 | func helperProcess(command string) (*exec.Cmd, *bytes.Buffer, *bytes.Buffer, string) { 164 | f, err := ioutil.TempFile("", "result") 165 | if err != nil { 166 | panic(err) 167 | } 168 | 169 | err = f.Close() 170 | if err != nil { 171 | panic(err) 172 | } 173 | 174 | cmd := exec.Command("./test", command, f.Name()) //nolint:gosec // we control the inputs 175 | cmd.Stderr = new(bytes.Buffer) 176 | cmd.Stdout = new(bytes.Buffer) 177 | 178 | return cmd, cmd.Stdout.(*bytes.Buffer), cmd.Stderr.(*bytes.Buffer), f.Name() 179 | } 180 | 181 | func getPanicRegex() string { 182 | _, filename, _, _ := runtime.Caller(0) 183 | dir := path.Dir(filename) 184 | 185 | return fmt.Sprintf(panicRegexTemplate, dir) 186 | } 187 | 188 | func readResult(resultFile string) panicwatch.Panic { 189 | resultBytes, err := ioutil.ReadFile(resultFile) 190 | if err != nil { 191 | panic(err) 192 | } 193 | 194 | if len(resultBytes) == 0 { 195 | return panicwatch.Panic{} 196 | } 197 | 198 | result := panicwatch.Panic{} 199 | 200 | err = json.Unmarshal(resultBytes, &result) 201 | if err != nil { 202 | panic(err) 203 | } 204 | 205 | return result 206 | } 207 | -------------------------------------------------------------------------------- /panicwatch.go: -------------------------------------------------------------------------------- 1 | // Package panicwatch guarantees you that you will never miss a panic. Use it to reliably log any unhandled panics 2 | // that may occur in your application. This is completely transparent to your application, and it doesn't affect 3 | // it in any way. All signal handling and file descriptor manipulation (either from inside or outside) is still under 4 | // your control. 5 | package panicwatch 6 | 7 | import ( 8 | "bytes" 9 | "errors" 10 | "io" 11 | "log" 12 | "os" 13 | "os/exec" 14 | "os/signal" 15 | "regexp" 16 | 17 | "github.com/glycerine/rbuf" 18 | goerrors "github.com/go-errors/errors" 19 | ) 20 | 21 | // Panic holds information about a panic parsed from stderr of your application. 22 | type Panic struct { 23 | Message string 24 | Stack string 25 | } 26 | 27 | // AsError returns the Panic as an instance of error interface. When the panic message and stack aren't malformed, 28 | // it will return *goerrors.Error, otherwise it will fall back to a simple *errors.errorString, 29 | // containing just the message. 30 | func (p Panic) AsError() error { 31 | parsedErr, err := goerrors.ParsePanic("panic: " + p.Message + "\n" + p.Stack) 32 | if err != nil { 33 | return errors.New(p.Message) 34 | } 35 | 36 | return parsedErr 37 | } 38 | 39 | // Config holds the configuration of panicwatch. 40 | type Config struct { 41 | // BufferSize specifies the size of the read buffer between dup-ed stderr and the real one. Optional/ 42 | BufferSize int 43 | // PanicDetectorBufferSize specifies the size of the buffer used to detect panic. 44 | // Too low value will cause the detection to fail. Optional. 45 | PanicDetectorBufferSize int 46 | // OnPanic is a callback that will be called after your application dies, if a panic is detected. Required. 47 | OnPanic func(Panic) 48 | // OnWatcherErr is a callback that will be called when watcher process encounters an error. Optional. 49 | OnWatcherError func(error) 50 | // OnWatcherDied is a callback that will be called when watcher process dies. 51 | // It is recommended to set this callback to shut down your application gracefully. Optional. 52 | OnWatcherDied func(error) 53 | } 54 | 55 | const ( 56 | cookieName = "XkqVuiPZaKYxS3f2lHoYDTNfBPYNT24woDplRI4Z" 57 | cookieValue = "zQXfl15CShjg5yQzEqoGAIgFeyXhlr9JQABuYCXm" 58 | ) 59 | 60 | // Start validates panicwatch config, replaces the stderr file descriptor with a new one and starts a watcher process. 61 | // This watcher process will read the original stderr and tee it into the replaced file descriptor. When the application 62 | // exits, the watcher process will check if there was a panic in the original stderr. If yes, it will call the OnPanic 63 | // callback. If the watcher process encounters an error or dies, then appropriate callback is called if configured. 64 | func Start(config Config) error { 65 | if err := checkConfig(&config); err != nil { 66 | return err 67 | } 68 | 69 | if os.Getenv(cookieName) == cookieValue { 70 | runMonitoringProcess(config) 71 | panic("this never should've been executed") 72 | } 73 | 74 | exePath, err := os.Executable() 75 | if err != nil { 76 | return err 77 | } 78 | 79 | stderrR, stderrW, err := os.Pipe() 80 | if err != nil { 81 | return err 82 | } 83 | 84 | originalStderrFd, err := dup(int(os.Stderr.Fd())) 85 | if err != nil { 86 | return err 87 | } 88 | 89 | err = redirectStderr(stderrW) 90 | if err != nil { 91 | return err 92 | } 93 | 94 | originalStderr := os.NewFile(uintptr(originalStderrFd), os.Stderr.Name()) 95 | 96 | cmd := exec.Command(exePath, os.Args[1:]...) 97 | cmd.Env = append(os.Environ(), cookieName+"="+cookieValue) 98 | cmd.Stdin = stderrR 99 | cmd.Stdout = originalStderr 100 | 101 | err = cmd.Start() 102 | if err != nil { 103 | return err 104 | } 105 | 106 | go func() { 107 | err := cmd.Wait() 108 | _ = redirectStderr(originalStderr) 109 | 110 | if config.OnWatcherDied == nil { 111 | log.Fatalln("panicwatch: watcher process died") 112 | } 113 | 114 | config.OnWatcherDied(err) 115 | }() 116 | 117 | return nil 118 | } 119 | 120 | func checkConfig(config *Config) error { 121 | if config.OnPanic == nil { 122 | return errors.New("OnPanic callback must be set") 123 | } 124 | 125 | if config.BufferSize < 0 { 126 | return errors.New("BufferSize can't be less than zero") 127 | } 128 | 129 | if config.BufferSize == 0 { 130 | config.BufferSize = 1e5 131 | } 132 | 133 | if config.PanicDetectorBufferSize < 0 { 134 | return errors.New("PanicDetectorBufferSize can't be less than zero") 135 | } 136 | 137 | if config.PanicDetectorBufferSize == 0 { 138 | config.PanicDetectorBufferSize = 1e5 139 | } 140 | 141 | return nil 142 | } 143 | 144 | func runMonitoringProcess(config Config) { 145 | signal.Ignore() 146 | 147 | readBuffer := make([]byte, config.BufferSize) 148 | buffer := rbuf.NewFixedSizeRingBuf(config.PanicDetectorBufferSize) 149 | reader := io.TeeReader(os.Stdin, os.Stdout) 150 | 151 | for { 152 | n, err := reader.Read(readBuffer) 153 | if n > 0 { 154 | _, _ = buffer.WriteAndMaybeOverwriteOldestData(readBuffer[:n]) 155 | } 156 | 157 | if errors.Is(err, io.EOF) { 158 | bufferBytes := buffer.Bytes() 159 | 160 | index := findLastPanicStartIndex(bufferBytes) 161 | if index != -1 { 162 | matches := regexp.MustCompile(`(?sm)panic: (.*?$)?\n+(.*)\z`).FindSubmatch(bufferBytes[index:]) 163 | if matches != nil { 164 | config.OnPanic(Panic{string(matches[1]), string(matches[2])}) 165 | } 166 | } 167 | 168 | os.Exit(0) 169 | } 170 | 171 | if err != nil { 172 | if config.OnWatcherError != nil { 173 | config.OnWatcherError(err) 174 | } 175 | 176 | os.Exit(1) 177 | } 178 | } 179 | } 180 | 181 | func findLastPanicStartIndex(b []byte) int { 182 | for { 183 | index := bytes.LastIndex(b, []byte("panic: ")) 184 | if index == -1 { 185 | return -1 186 | } 187 | 188 | if index == 0 { 189 | return 0 190 | } 191 | 192 | if b[index-1] == '\n' { 193 | return index 194 | } 195 | 196 | b = b[:index] 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 3 | cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= 4 | cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= 5 | cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= 6 | cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= 7 | cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= 8 | cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= 9 | cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= 10 | cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= 11 | cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= 12 | cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= 13 | dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= 14 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 15 | github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= 16 | github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= 17 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= 18 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= 19 | github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= 20 | github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= 21 | github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= 22 | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= 23 | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= 24 | github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= 25 | github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= 26 | github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= 27 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 28 | github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= 29 | github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= 30 | github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= 31 | github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= 32 | github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= 33 | github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 34 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 35 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 36 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 37 | github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= 38 | github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= 39 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 40 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 41 | github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= 42 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 43 | github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 h1:gclg6gY70GLy3PbkQ1AERPfmLMMagS60DKF78eWwLn8= 44 | github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= 45 | github.com/glycerine/rbuf v0.0.0-20190314090850-75b78581bebe h1:S7HF/JKUdDrsd66htKdBOt/t3WvhU3l8EXe0U3WxEDA= 46 | github.com/glycerine/rbuf v0.0.0-20190314090850-75b78581bebe/go.mod h1:BOGkN1CszB3i4g9xn96RH4t5uXnxJjnC5/RWJ1Wx7GM= 47 | github.com/go-errors/errors v1.4.0 h1:2OA7MFw38+e9na72T1xgkomPb6GzZzzxvJ5U630FoRM= 48 | github.com/go-errors/errors v1.4.0/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= 49 | github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= 50 | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= 51 | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= 52 | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= 53 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= 54 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 55 | github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= 56 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 57 | github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 58 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 59 | github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 60 | github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= 61 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 62 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 63 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 64 | github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 65 | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 66 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 67 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 68 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 69 | github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= 70 | github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 71 | github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 72 | github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 73 | github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= 74 | github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= 75 | github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= 76 | github.com/gopherjs/gopherjs v0.0.0-20210803090616-8f023c250c89 h1:cuZTXJQ2J5mpT2gioa6NRVnuNsbisCGG5tRBG0tZpI4= 77 | github.com/gopherjs/gopherjs v0.0.0-20210803090616-8f023c250c89/go.mod h1:0RnbP5ioI0nqRf3R9iK3iQaUJgsn0htlZEHCMn8FSfw= 78 | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 79 | github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= 80 | github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= 81 | github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= 82 | github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= 83 | github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= 84 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 85 | github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 86 | github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= 87 | github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= 88 | github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= 89 | github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= 90 | github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= 91 | github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= 92 | github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 93 | github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 94 | github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= 95 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 96 | github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 97 | github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= 98 | github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= 99 | github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= 100 | github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= 101 | github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= 102 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 103 | github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= 104 | github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= 105 | github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= 106 | github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= 107 | github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= 108 | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= 109 | github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= 110 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 111 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 112 | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= 113 | github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= 114 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 115 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 116 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 117 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 118 | github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= 119 | github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 120 | github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 121 | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= 122 | github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= 123 | github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= 124 | github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 125 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 126 | github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= 127 | github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= 128 | github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= 129 | github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 130 | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 131 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 132 | github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 133 | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 134 | github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= 135 | github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= 136 | github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 137 | github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= 138 | github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= 139 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 140 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 141 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 142 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 143 | github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= 144 | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= 145 | github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= 146 | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= 147 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 148 | github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= 149 | github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= 150 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= 151 | github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= 152 | github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= 153 | github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= 154 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 155 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 156 | github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= 157 | github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= 158 | github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= 159 | github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= 160 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 161 | github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= 162 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 163 | github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= 164 | github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= 165 | github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= 166 | github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 167 | github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= 168 | github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= 169 | github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= 170 | github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= 171 | github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 172 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 173 | github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= 174 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 175 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 176 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 177 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 178 | github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= 179 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 180 | github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= 181 | github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= 182 | github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= 183 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 184 | go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= 185 | go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= 186 | go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= 187 | go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= 188 | go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= 189 | go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= 190 | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 191 | golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 192 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 193 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 194 | golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 195 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 196 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 197 | golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 198 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 199 | golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 200 | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= 201 | golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= 202 | golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= 203 | golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= 204 | golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= 205 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 206 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 207 | golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 208 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 209 | golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 210 | golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 211 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 212 | golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= 213 | golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= 214 | golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= 215 | golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= 216 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 217 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 218 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 219 | golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 220 | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 221 | golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 222 | golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 223 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 224 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 225 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 226 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 227 | golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 228 | golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 229 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 230 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 231 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 232 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 233 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 234 | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 235 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 236 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 237 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 238 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 239 | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 240 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 241 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 242 | golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 243 | golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 244 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 245 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 246 | golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 247 | golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 248 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 249 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 250 | golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 251 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 252 | golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 253 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 254 | golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 255 | golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 256 | golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 257 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 258 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 259 | golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 260 | golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 261 | golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 h1:uCLL3g5wH2xjxVREVuAbP9JM5PPKjRbXKRa6IBjkzmU= 262 | golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 263 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 264 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 265 | golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 266 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 267 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 268 | golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 269 | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 270 | golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 271 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 272 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 273 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 274 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 275 | golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 276 | golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 277 | golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 278 | golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 279 | golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 280 | golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 281 | golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 282 | golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 283 | golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 284 | golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 285 | golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 286 | golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 287 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 288 | golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= 289 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 290 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 291 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 292 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 293 | google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= 294 | google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= 295 | google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 296 | google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 297 | google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 298 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 299 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 300 | google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 301 | google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= 302 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 303 | google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 304 | google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 305 | google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 306 | google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 307 | google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 308 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 309 | google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= 310 | google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 311 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 312 | google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= 313 | google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= 314 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 315 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 316 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= 317 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 318 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 319 | gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= 320 | gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= 321 | gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= 322 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 323 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 324 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 325 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 326 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= 327 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 328 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 329 | honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 330 | honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 331 | honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 332 | rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= 333 | --------------------------------------------------------------------------------