ldd: separate Parse from Exec and trim space
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
26
ldd/error.go
26
ldd/error.go
@@ -1,11 +1,27 @@
|
||||
package ldd
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type EntryUnexpectedSegmentsError struct {
|
||||
Entry string
|
||||
var (
|
||||
ErrUnexpectedSeparator = errors.New("unexpected separator")
|
||||
ErrPathNotAbsolute = errors.New("path not absolute")
|
||||
ErrBadLocationFormat = errors.New("bad location format")
|
||||
ErrUnexpectedNewline = errors.New("unexpected newline")
|
||||
)
|
||||
|
||||
type EntryUnexpectedSegmentsError string
|
||||
|
||||
func (e EntryUnexpectedSegmentsError) Is(err error) bool {
|
||||
var eq EntryUnexpectedSegmentsError
|
||||
if !errors.As(err, &eq) {
|
||||
return false
|
||||
}
|
||||
return e == eq
|
||||
}
|
||||
|
||||
func (e *EntryUnexpectedSegmentsError) Error() string {
|
||||
return fmt.Sprintf("unexpected segments in entry %q", e.Entry)
|
||||
func (e EntryUnexpectedSegmentsError) Error() string {
|
||||
return fmt.Sprintf("unexpected segments in entry %q", string(e))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user