From 2eea0c0a703e32b904741d52c9e2c9ae836c14b0 Mon Sep 17 00:00:00 2001 From: Samuel Stauffer Date: Wed, 19 Mar 2014 14:22:55 -0700 Subject: Use error instead of *Error --- ldap.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ldap.go') diff --git a/ldap.go b/ldap.go index e62e559..bb84279 100644 --- a/ldap.go +++ b/ldap.go @@ -150,7 +150,7 @@ var LDAPResultCodeMap = map[uint8]string{ } // Adds descriptions to an LDAP Response packet for debugging -func addLDAPDescriptions(packet *ber.Packet) (err *Error) { +func addLDAPDescriptions(packet *ber.Packet) (err error) { defer func() { if r := recover(); r != nil { err = NewError(ErrorDebugging, errors.New("ldap: cannot process packet to add descriptions")) @@ -264,7 +264,7 @@ func addDefaultLDAPResponseDescriptions(packet *ber.Packet) { } } -func DebugBinaryFile(FileName string) *Error { +func DebugBinaryFile(FileName string) error { file, err := ioutil.ReadFile(FileName) if err != nil { return NewError(ErrorDebugging, err) @@ -282,11 +282,11 @@ type Error struct { ResultCode uint8 } -func (e *Error) String() string { +func (e *Error) Error() string { return fmt.Sprintf("LDAP Result Code %d %q: %s", e.ResultCode, LDAPResultCodeMap[e.ResultCode], e.Err.Error()) } -func NewError(resultCode uint8, err error) *Error { +func NewError(resultCode uint8, err error) error { return &Error{ResultCode: resultCode, Err: err} } -- cgit v1.2.3