pkg/guid: Prefer passing GUID by value

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
This commit is contained in:
Kevin Parsons
2019-05-08 15:52:52 -07:00
parent 2be8053e58
commit 7185c03f75
2 changed files with 21 additions and 21 deletions
+6 -6
View File
@@ -15,7 +15,7 @@ func Test_New(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if *g == *g2 {
if g == g2 {
t.Fatalf("GUIDs are equal: %s, %s", g, g2)
}
}
@@ -49,7 +49,7 @@ func Test_MarshalJSON(t *testing.T) {
func Test_MarshalJSON_Nested(t *testing.T) {
type test struct {
G *GUID
G GUID
}
g, err := NewV4()
if err != nil {
@@ -79,14 +79,14 @@ func Test_UnmarshalJSON(t *testing.T) {
if err := json.Unmarshal(j, &g2); err != nil {
t.Fatal(err)
}
if *g != g2 {
t.Fatalf("GUIDs not equal: %s, %s", g, &g2)
if g != g2 {
t.Fatalf("GUIDs not equal: %s, %s", g, g2)
}
}
func Test_UnmarshalJSON_Nested(t *testing.T) {
type test struct {
G *GUID
G GUID
}
g, err := NewV4()
if err != nil {
@@ -101,7 +101,7 @@ func Test_UnmarshalJSON_Nested(t *testing.T) {
if err := json.Unmarshal(j, &t2); err != nil {
t.Fatal(err)
}
if *t1.G != *t2.G {
if t1.G != t2.G {
t.Fatalf("GUIDs not equal: %v, %v", t1.G, t2.G)
}
}