Skip to content
Closed
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: 2 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ linters:
msg: Use errors.Is(err, fs.ErrPermission) instead.
- pattern: 'sync\.Once\b($|[^FV])'
msg: Use sync.OnceFunc, sync.OnceValue, or sync.OnceValues instead.
- pattern: '\breflect\.Ptr\b'
msg: Use reflect.Pointer; reflect.Ptr is a legacy alias kept for backwards compat.
analyze-types: true
copyloopvar:
check-alias: true
Expand Down
2 changes: 1 addition & 1 deletion bundle/config/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestCustomMarshallerIsImplemented(t *testing.T) {
kt := field.Type.Key()
assert.Equal(t, reflect.String, kt.Kind(), "Resource %s is not a map with string keys", field.Name)
vt := field.Type.Elem()
assert.Equal(t, reflect.Ptr, vt.Kind(), "Resource %s is not a map with pointer values", field.Name)
assert.Equal(t, reflect.Pointer, vt.Kind(), "Resource %s is not a map with pointer values", field.Name)

// Marshalling a resourceStruct will panic if resourceStruct does not have a custom marshaller
// This is because resourceStruct embeds a Go SDK struct that implements
Expand Down
2 changes: 1 addition & 1 deletion bundle/config/resources_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var ResourcesTypes = func() map[string]reflect.Type {
continue
}
elemType := field.Type.Elem()
if elemType.Kind() == reflect.Ptr {
if elemType.Kind() == reflect.Pointer {
elemType = elemType.Elem()
}

Expand Down
6 changes: 3 additions & 3 deletions bundle/deploy/terraform/tfdyn/convert_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func TestSupportedTypeTasksComplete(t *testing.T) {

// Get the type of the task field (e.g., *NotebookTask)
taskFieldType := field.Type
if taskFieldType.Kind() == reflect.Ptr {
if taskFieldType.Kind() == reflect.Pointer {
taskFieldType = taskFieldType.Elem()
}

Expand Down Expand Up @@ -339,7 +339,7 @@ func TestSupportedTypeTasksComplete(t *testing.T) {
// findSourceFieldsShallow searches for Source fields in a struct type, going only one level deep.
// Returns a list of paths to Source fields (e.g., "" for direct Source, "file" for sql_task.file).
func findSourceFieldsShallow(t reflect.Type) []string {
if t.Kind() == reflect.Ptr {
if t.Kind() == reflect.Pointer {
t = t.Elem()
}

Expand All @@ -358,7 +358,7 @@ func findSourceFieldsShallow(t reflect.Type) []string {

// Only search one level deep in nested structs
fieldType := field.Type
if fieldType.Kind() == reflect.Ptr {
if fieldType.Kind() == reflect.Pointer {
fieldType = fieldType.Elem()
}

Expand Down
2 changes: 1 addition & 1 deletion bundle/direct/bundle_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ func isEmpty(rv reflect.Value) bool {
}

func isEmptyStruct(rv reflect.Value) bool {
if rv.Kind() == reflect.Ptr {
if rv.Kind() == reflect.Pointer {
if rv.IsNil() {
return false
}
Expand Down
4 changes: 2 additions & 2 deletions bundle/direct/dresources/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func normalizeNilPointer(v any) any {
return nil
}
rv := reflect.ValueOf(v)
if rv.Kind() == reflect.Ptr && rv.IsNil() {
if rv.Kind() == reflect.Pointer && rv.IsNil() {
return nil
}
return v
Expand Down Expand Up @@ -550,7 +550,7 @@ func validatePointerToStruct(t reflect.Type, context string) error {
if t == nil {
return fmt.Errorf("%s not set", context)
}
if t.Kind() != reflect.Ptr {
if t.Kind() != reflect.Pointer {
return fmt.Errorf("%s must be a pointer, got %s", context, t.Kind())
}
if t.Elem().Kind() != reflect.Struct {
Expand Down
2 changes: 1 addition & 1 deletion bundle/internal/schema/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (p *openapiParser) findRef(typ reflect.Type) (jsonschema.Schema, bool) {

// Deference current type if it's a pointer.
ctyp := field.Type
for ctyp.Kind() == reflect.Ptr {
for ctyp.Kind() == reflect.Pointer {
ctyp = ctyp.Elem()
}

Expand Down
2 changes: 1 addition & 1 deletion bundle/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func safeMutatorName(m Mutator) string {
t := reflect.TypeOf(m)

// Handle pointer types by getting the element type
if t.Kind() == reflect.Ptr {
if t.Kind() == reflect.Pointer {
t = t.Elem()
}

Expand Down
2 changes: 1 addition & 1 deletion libs/calladapt/calladapt.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (c *BoundCaller) call(args ...any) ([]reflect.Value, error) {
it := c.InTypes[i]
if a == nil {
// Allow untyped nil for pointer types, converting to typed nil
if it.Kind() == reflect.Ptr {
if it.Kind() == reflect.Pointer {
in[i+1] = reflect.Zero(it)
continue
}
Expand Down
4 changes: 2 additions & 2 deletions libs/flags/json_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (j *JsonFlag) Unmarshal(v any) diag.Diagnostics {

if !nv.IsValid() {
kind := reflect.TypeOf(v).Kind()
if kind == reflect.Ptr {
if kind == reflect.Pointer {
kind = reflect.TypeOf(v).Elem().Kind()
}

Expand Down Expand Up @@ -88,7 +88,7 @@ func (j *JsonFlag) Unmarshal(v any) diag.Diagnostics {
}

kind := reflect.ValueOf(v).Kind()
if kind == reflect.Ptr {
if kind == reflect.Pointer {
kind = reflect.ValueOf(v).Elem().Kind()
}

Expand Down
4 changes: 2 additions & 2 deletions libs/jsonschema/from_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TypePath(typ reflect.Type) string {
// JSON schema will refer to this path. See TestTypePath for examples outputs.
func typePath(typ reflect.Type) string {
// Pointers have a typ.Name() of "". Dereference them to get the underlying type.
for typ.Kind() == reflect.Ptr {
for typ.Kind() == reflect.Pointer {
typ = typ.Elem()
}

Expand Down Expand Up @@ -159,7 +159,7 @@ func typePath(typ reflect.Type) string {
// the corresponding $ref in the JSON schema.
func (c *constructor) walk(typ reflect.Type) (string, error) {
// Dereference pointers if necessary.
for typ.Kind() == reflect.Ptr {
for typ.Kind() == reflect.Pointer {
typ = typ.Elem()
}

Expand Down
2 changes: 1 addition & 1 deletion libs/structs/structaccess/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func ConvertToString(value any) (string, error) {

// Handle pointers by dereferencing them first
rv := reflect.ValueOf(value)
if rv.Kind() == reflect.Ptr {
if rv.Kind() == reflect.Pointer {
if rv.IsNil() {
return "", nil
}
Expand Down
2 changes: 1 addition & 1 deletion libs/testserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func isNil(i any) bool {
}
v := reflect.ValueOf(i)
switch v.Kind() {
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Slice:
case reflect.Chan, reflect.Func, reflect.Map, reflect.Pointer, reflect.Interface, reflect.Slice:
return v.IsNil()
default:
return false
Expand Down
Loading