Revert "ID: move Str() to non-pointer receiver"

This reverts commit f102406cd7.
This commit is contained in:
Alexander Neumann 2016-08-19 20:45:19 +02:00
parent a107e3cc84
commit bb84d351f1
2 changed files with 10 additions and 1 deletions

View file

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

View file

@ -8,4 +8,9 @@ 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())
}
}