@@ -71,10 +71,7 @@ func TestFromStruct(t *testing.T) {
7171
7272 for _ , tt := range tests {
7373 t .Run (tt .name , func (t * testing.T ) {
74- key , err := FromStruct (tt .input )
75- if err != nil {
76- t .Errorf ("unexpected error: %v" , err )
77- }
74+ key := FromStruct (tt .input )
7875 if tt .unique && (key == nil || * key == "" ) {
7976 t .Errorf ("expected unique key, got nil or empty string" )
8077 }
@@ -91,10 +88,7 @@ func TestFromStruct(t *testing.T) {
9188 Name string
9289 Other string
9390 }
94- key , err := FromStruct (noTagStruct {ID : "1" , Name : "2" , Other : "3" })
95- if err != nil {
96- t .Errorf ("unexpected error: %v" , err )
97- }
91+ key := FromStruct (noTagStruct {ID : "1" , Name : "2" , Other : "3" })
9892 if key != nil {
9993 t .Errorf ("expected nil for struct with no uniqueKey tags, got: %v" , * key )
10094 }
@@ -106,10 +100,7 @@ func TestFromStruct(t *testing.T) {
106100 Name string
107101 Other string
108102 }
109- key , err := FromStruct (testStructNoTags {ID : "1" , Name : "2" , Other : "3" })
110- if err != nil {
111- t .Errorf ("unexpected error: %v" , err )
112- }
103+ key := FromStruct (testStructNoTags {ID : "1" , Name : "2" , Other : "3" })
113104 if key != nil {
114105 t .Errorf ("expected nil for struct with no uniqueKey tags, got: %v" , * key )
115106 }
@@ -142,30 +133,21 @@ func TestFromStruct_Pointer(t *testing.T) {
142133 ID string `libnuke:"uniqueKey"`
143134 }
144135 val := & testStruct {ID : "abc" }
145- key , err := FromStruct (val )
146- if err != nil {
147- t .Errorf ("unexpected error: %v" , err )
148- }
136+ key := FromStruct (val )
149137 if key == nil || * key == "" {
150138 t .Error ("expected unique key for pointer struct, got nil or empty string" )
151139 }
152140}
153141
154142func TestFromStruct_NonStruct (t * testing.T ) {
155- key , err := FromStruct (123 )
156- if err != nil {
157- t .Errorf ("unexpected error: %v" , err )
158- }
143+ key := FromStruct (123 )
159144 if key != nil {
160145 t .Errorf ("expected nil for non-struct, got: %v" , * key )
161146 }
162147}
163148
164149func TestFromStruct_Nil (t * testing.T ) {
165- key , err := FromStruct (nil )
166- if err != nil {
167- t .Errorf ("unexpected error: %v" , err )
168- }
150+ key := FromStruct (nil )
169151 if key != nil {
170152 t .Errorf ("expected nil for nil, got: %v" , * key )
171153 }
0 commit comments