ID: move Str() to non-pointer receiver

This commit is contained in:
Alexander Neumann 2016-08-14 18:56:13 +02:00
parent 302619a11a
commit f102406cd7
2 changed files with 1 additions and 10 deletions

View File

@ -44,11 +44,7 @@ func (id ID) String() string {
const shortStr = 4
// Str returns the shortened string version of id.
func (id *ID) Str() string {
if id == nil {
return "[nil]"
}
func (id ID) Str() string {
if id.IsNull() {
return "[null]"
}

View File

@ -8,9 +8,4 @@ func TestIDMethods(t *testing.T) {
if id.Str() != "[null]" {
t.Errorf("ID.Str() returned wrong value, want %v, got %v", "[null]", id.Str())
}
var pid *ID
if pid.Str() != "[nil]" {
t.Errorf("ID.Str() returned wrong value, want %v, got %v", "[nil]", pid.Str())
}
}