Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metautil/type_conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (e AttributeNotCompatibleError) Is(target error) bool {
// the val parameter, which therefore must be a pointer.
func SetValueFromAttribute(snapName string, ifaceName string, attrName string, attrVal any, val any) error {
rt := reflect.TypeOf(val)
if rt.Kind() != reflect.Ptr || val == nil {
if rt.Kind() != reflect.Pointer || val == nil {
return fmt.Errorf("internal error: cannot get %q attribute of interface %q with non-pointer value", attrName, ifaceName)
}

Expand Down
4 changes: 2 additions & 2 deletions store/details_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,9 @@ func (s *detailsV2Suite) TestInfoFromStoreSnap(c *C) {

// arg must be a pointer to a struct
func fillStruct(a any, c *C) {
if t := reflect.TypeOf(a); t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
if t := reflect.TypeOf(a); t.Kind() != reflect.Pointer || t.Elem().Kind() != reflect.Struct {
k := t.Kind()
if k == reflect.Ptr {
if k == reflect.Pointer {
k = t.Elem().Kind()
}
c.Fatalf("first argument must be expected a pointer to a struct, not %s", k)
Expand Down
2 changes: 1 addition & 1 deletion testutil/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func backupMockables(mockablesByPtr []any) (backup []*reflect.Value) {
for i, ptr := range mockablesByPtr {
mockedPtr := reflect.ValueOf(ptr)

if mockedPtr.Type().Kind() != reflect.Ptr {
if mockedPtr.Type().Kind() != reflect.Pointer {
panic("Backup: each mockable must be passed by pointer!")
}

Expand Down
Loading