Skip to content

*: use new slice to array conversion syntax #110261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nvanbenschoten opened this issue Sep 8, 2023 · 0 comments · Fixed by #118800
Closed

*: use new slice to array conversion syntax #110261

nvanbenschoten opened this issue Sep 8, 2023 · 0 comments · Fixed by #118800
Labels
C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. T-dev-inf

Comments

@nvanbenschoten
Copy link
Contributor

nvanbenschoten commented Sep 8, 2023

From https://tip.golang.org/doc/go1.20:

Go 1.20 extends this to allow conversions from a slice to an array: given a slice x, [4]byte(x) can now be written instead of *(*[4]byte)(x).

Once #109773 lands, we can clean up some code that converts slices to arrays.

Jira issue: CRDB-31350

@nvanbenschoten nvanbenschoten added the C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. label Sep 8, 2023
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this issue Feb 6, 2024
Closes cockroachdb#110261.

This commit adopts the new slice to array conversion syntax introduced
in go 1.20. The new syntax is only applicable in one small part of the
codebase, so it's a small change.

From https://tip.golang.org/doc/go1.20:

> Go 1.20 extends this to allow conversions from a slice to an array:
> given a slice x, [4]byte(x) can now be written instead of
> *(*[4]byte)(x).

Release note: None
craig bot pushed a commit that referenced this issue Feb 8, 2024
118329: kvclient: misc range cache cleanups r=arulajmani a=andrewbaptist

Numerous small cleanups to the range cache. 

After these changes, The RangeCache and related classes have a much simpler interface with some nice usability benefits:

1) CacheEntry is no longer public. This is good because it is intended to be immutable and it is now easier to audit its usage.
2) Test only methods are more clearly changed to designate them that way. This will prevent new code from using them incorrectly
3) Unused methods are removed from the interface.

118800: *: use new slice to array conversion syntax r=nvanbenschoten a=nvanbenschoten

Closes #110261.

This commit adopts the new slice to array conversion syntax introduced in go 1.20. The new syntax is only applicable in one small part of the codebase, so it's a small change.

From https://tip.golang.org/doc/go1.20:

> Go 1.20 extends this to allow conversions from a slice to an array: given a slice x, [4]byte(x) can now be written instead of *(*[4]byte)(x).

Release note: None

118923: sql: reduce allocations in rowContainerIterator r=mgartner a=mgartner

In #111318 a shallow copy of rows was added to
`rowContainerIterator.Next`. This copy is only necessary for one usage
of the iterator within `plpgsqlCursorHelper`. This commit moves the copy
to the cursor helper which reduces allocations for all other usages of
the iterator.

Informs #117546

Release note: None


Co-authored-by: Andrew Baptist <[email protected]>
Co-authored-by: Nathan VanBenschoten <[email protected]>
Co-authored-by: Marcus Gartner <[email protected]>
@craig craig bot closed this as completed in 3116fdf Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. T-dev-inf
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant