mirror of
https://github.com/octoleo/restic.git
synced 2024-12-23 03:18:55 +00:00
ID: move Str() to non-pointer receiver
This commit is contained in:
parent
302619a11a
commit
f102406cd7
@ -44,11 +44,7 @@ func (id ID) String() string {
|
|||||||
const shortStr = 4
|
const shortStr = 4
|
||||||
|
|
||||||
// Str returns the shortened string version of id.
|
// 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() {
|
if id.IsNull() {
|
||||||
return "[null]"
|
return "[null]"
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,4 @@ func TestIDMethods(t *testing.T) {
|
|||||||
if id.Str() != "[null]" {
|
if id.Str() != "[null]" {
|
||||||
t.Errorf("ID.Str() returned wrong value, want %v, got %v", "[null]", id.Str())
|
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())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user