Initialize module and dependencies
This commit is contained in:
23
vendor/golang.org/x/vuln/internal/derrors/derrors.go
generated
vendored
Normal file
23
vendor/golang.org/x/vuln/internal/derrors/derrors.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package derrors defines internal error values to categorize the different
|
||||
// types error semantics supported by x/vuln.
|
||||
package derrors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Wrap adds context to the error and allows
|
||||
// unwrapping the result to recover the original error.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// defer derrors.Wrap(&err, "copy(%s, %s)", dst, src)
|
||||
func Wrap(errp *error, format string, args ...interface{}) {
|
||||
if *errp != nil {
|
||||
*errp = fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), *errp)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user