mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-09-26 20:21:26 +08:00

Also, make the libp2p constructor fully useful. There should now be no need to manually construct a swarm/host.
18 lines
248 B
Go
18 lines
248 B
Go
package libp2p
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
)
|
|
|
|
func traceError(err error, skip int) error {
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
_, file, line, ok := runtime.Caller(skip + 1)
|
|
if !ok {
|
|
return err
|
|
}
|
|
return fmt.Errorf("%s:%d: %s", file, line, err)
|
|
}
|