aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-07-11 19:43:33 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-07-11 19:43:33 +0800
commitbd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba (patch)
tree757422f3f76a3a0917859ace69767451d28b475f /vendor/github.com
parent09587706253a26dc58a81912419ed48672c6ec68 (diff)
downloaddexon-bd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba.tar.gz
dexon-bd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba.tar.zst
dexon-bd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba.zip
vendor: update go-stack to fix a sigpanic panic (#14790)
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/go-stack/stack/LICENSE.md28
-rw-r--r--vendor/github.com/go-stack/stack/stack.go31
2 files changed, 20 insertions, 39 deletions
diff --git a/vendor/github.com/go-stack/stack/LICENSE.md b/vendor/github.com/go-stack/stack/LICENSE.md
index c8ca66c5e..2abf98ea8 100644
--- a/vendor/github.com/go-stack/stack/LICENSE.md
+++ b/vendor/github.com/go-stack/stack/LICENSE.md
@@ -1,13 +1,21 @@
-Copyright 2014 Chris Hines
+The MIT License (MIT)
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Copyright (c) 2014 Chris Hines
- http://www.apache.org/licenses/LICENSE-2.0
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/go-stack/stack/stack.go b/vendor/github.com/go-stack/stack/stack.go
index a614eeebf..8033c4013 100644
--- a/vendor/github.com/go-stack/stack/stack.go
+++ b/vendor/github.com/go-stack/stack/stack.go
@@ -39,7 +39,7 @@ func Caller(skip int) Call {
}
c.pc = pcs[1]
- if runtime.FuncForPC(pcs[0]) != sigpanic {
+ if runtime.FuncForPC(pcs[0]).Name() != "runtime.sigpanic" {
c.pc--
}
c.fn = runtime.FuncForPC(c.pc)
@@ -205,33 +205,6 @@ func (cs CallStack) Format(s fmt.State, verb rune) {
s.Write(closeBracketBytes)
}
-// findSigpanic intentionally executes faulting code to generate a stack trace
-// containing an entry for runtime.sigpanic.
-func findSigpanic() *runtime.Func {
- var fn *runtime.Func
- var p *int
- func() int {
- defer func() {
- if p := recover(); p != nil {
- var pcs [512]uintptr
- n := runtime.Callers(2, pcs[:])
- for _, pc := range pcs[:n] {
- f := runtime.FuncForPC(pc)
- if f.Name() == "runtime.sigpanic" {
- fn = f
- break
- }
- }
- }
- }()
- // intentional nil pointer dereference to trigger sigpanic
- return *p
- }()
- return fn
-}
-
-var sigpanic = findSigpanic()
-
// Trace returns a CallStack for the current goroutine with element 0
// identifying the calling function.
func Trace() CallStack {
@@ -241,7 +214,7 @@ func Trace() CallStack {
for i, pc := range pcs[:n] {
pcFix := pc
- if i > 0 && cs[i-1].fn != sigpanic {
+ if i > 0 && cs[i-1].fn.Name() != "runtime.sigpanic" {
pcFix--
}
cs[i] = Call{