go-gorm / go-gorm/cli

style: shorten verbose local variable `interfaceValues` across `field` package

Open
#48 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
108
Forks
15
PR merge metrics
No merged PRs in 30d

Description

## Summary

Several methods in the `field` package use a local variable named `interfaceValues` to convert typed slices to `[]any`. This name is verbose for a ~5-line scope. Go convention is to use shorter names for shorter scopes.

## Locations

| File | Line | Method |
|---|---|---|
| `field/bytes.go` | 66–70 | `In`, `NotIn` |
| `field/number.go` | 116–120, 124–129 | `In`, `NotIn` |
| `field/string.go` | 136–140, 144–149 | `In`, `NotIn` |
| `field/time.go` | 116–120, 124–129 | `In`, `NotIn` |

## Current

```go
interfaceValues := make([]any, len(values))
for i, v := range values {
interfaceValues[i] = v
}
```

## Proposed

```go
vals := make([]any, len(values))
for i, v := range values {
vals[i] = v
}
```

## References

- [Go Code Review Comments — Variable Names](https://github.com/golang/go/wiki/CodeReviewComments#variable-names)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.