Skip to content

Commit 7508fe4

Browse files
authored
many: inline constant to fix govet err (#17021)
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
1 parent 10d529a commit 7508fe4

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

metautil/type_conversions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (e AttributeNotCompatibleError) Is(target error) bool {
9797
// the val parameter, which therefore must be a pointer.
9898
func SetValueFromAttribute(snapName string, ifaceName string, attrName string, attrVal any, val any) error {
9999
rt := reflect.TypeOf(val)
100-
if rt.Kind() != reflect.Ptr || val == nil {
100+
if rt.Kind() != reflect.Pointer || val == nil {
101101
return fmt.Errorf("internal error: cannot get %q attribute of interface %q with non-pointer value", attrName, ifaceName)
102102
}
103103

store/details_v2_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,9 @@ func (s *detailsV2Suite) TestInfoFromStoreSnap(c *C) {
490490

491491
// arg must be a pointer to a struct
492492
func fillStruct(a any, c *C) {
493-
if t := reflect.TypeOf(a); t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
493+
if t := reflect.TypeOf(a); t.Kind() != reflect.Pointer || t.Elem().Kind() != reflect.Struct {
494494
k := t.Kind()
495-
if k == reflect.Ptr {
495+
if k == reflect.Pointer {
496496
k = t.Elem().Kind()
497497
}
498498
c.Fatalf("first argument must be expected a pointer to a struct, not %s", k)

testutil/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func backupMockables(mockablesByPtr []any) (backup []*reflect.Value) {
9191
for i, ptr := range mockablesByPtr {
9292
mockedPtr := reflect.ValueOf(ptr)
9393

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

0 commit comments

Comments
 (0)