all: reduce dependencides and be more idiomatic

This commit is contained in:
Aleksandr Razumov
2017-02-01 04:35:16 +03:00
parent 96c72a0bec
commit 7a54ae7a7a
397 changed files with 355 additions and 153484 deletions

View File

@@ -1,9 +1,5 @@
package stun
import (
"fmt"
)
// Error is error type for constant errors in stun package.
//
// See http://dave.cheney.net/2016/04/07/constant-errors for more info.
@@ -41,18 +37,15 @@ type DecodeErrPlace struct {
}
func (p DecodeErrPlace) String() string {
return fmt.Sprintf("%s/%s", p.Parent, p.Children)
return p.Parent + "/" + p.Children
}
func (e DecodeErr) Error() string {
return fmt.Sprintf("BadFormat for %s: %s",
e.Place,
e.Message,
)
return "BadFormat for " + e.Place.String() + ": " + e.Message
}
func newDecodeErr(parent, children, message string) DecodeErr {
return DecodeErr{
func newDecodeErr(parent, children, message string) *DecodeErr {
return &DecodeErr{
Place: DecodeErrPlace{Parent: parent, Children: children},
Message: message,
}