Support for obtaining a stack trace without requiring github.com/pkg/errors
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia individuando l’uso attuale di github.com/pkg/errors e l’accesso agli stack trace del package. Confronta il comportamento esistente con l’interfaccia proposta StackTrace() []uintptr e con l’interfaccia alternativa Callers() []uintptr. Il lavoro è completato quando gli errori provenienti da package diversi possono esporre o preservare gli stack trace senza richiedere github.com/pkg/errors e le aspettative di compatibilità sono state risolte.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I made a spiritual successor of github.com/pkg/errors some time ago and in it I want to know if an error already contains a stack trace. The goal is that if a large codebase uses different packages for errors, they should work together and not hide existing recorded information, like a stack trace.
One of the issues with github.com/pkg/errors is that its stackTracer interface uses a custom type only exported by github.com/pkg/errors. And it seems this package relays heavily on that and reuses it and even re-exports it.
I would suggest that instead, the following interface is implemented:
type stackTracer interface {
StackTrace() []uintptr
}
Then, it is easy to obtain a stack trace, use it, format it, and one does not have to depend on a library which created the error.
If you do want to keep using github.com/pkg/errors and re-exporting it and keeping its interface (to prevent a breaking change), I have seen also the following interface being used in this package:
type goErrorsStackTracer interface {
Callers() []uintptr
}
But given that github.com/pkg/errors is deprecated, then it is probably reasonable to drop its direct use (this package seems to use it for stack formatting as well) and just change the function to StackTrace() []uintptr.
(As I mentioned in #70, you can also use my package as drop-in maintained replacement for github.com/pkg/errors which provides same stack frame formatting features, but does not lock you in into custom types just to access a stack trace.)
- Lingua principale
- Go
- Stelle
- 2.5k
- Fork
- 75
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cockroachdb/errors
-
Errors returned from Join are incompatible with errors returned the standard lib's errors.Join Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
cockroachdb/errors#162 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
cockroachdb/errors#156 · 20 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
cockroachdb/errors#155 · 1 commento · 1 reazione ·
-
move subpackages to internal Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cockroachdb/errors#146 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cockroachdb/errors#145 · 1 commento · 1 reazione ·
Tutte le issue di cockroachdb/errors
Issue simili
-
area/dev-productivity area/disaster-recovery area/ipcei kind/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
kind/bug status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
🤔 refinement needed
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
equinor/radix-operator#1979 ·