Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow skipping nil bytes for WithCredentialsJSON #2647

Closed
Assignees
codyoss
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
@lexcao

Description

@lexcao

Background

I added a small feature to a repositoryauthzed/spicedb#1942 that supports passingWithCredentialsJSON to Spanner options. Since this is just library code, it simply forwards the option directly.

I discovered thatWithCredentialsJSON doesn't work correctly with nil slice, as converting them to an empty slice results in invalid JSON. To address this issue, I submitted another PR:authzed/spicedb#1948.

Problem

I believe the issue lies in how theWithCredentialsJSON function handles a nil slice within the option pattern, treating it as an empty slice.

For user code, I agree with that use case; we call the option as needed.

However, for library code, it's more ergonomic to forward options directly without needing to consider how to pass them in such cases.

Solution

We can skip nil slice for the value.
This way the library code can simply forward the option directly.

Additional context

It seems there aren't enough use cases for handling slices in the option pattern.
I am looking for other libraries that handle this case, but I have only found one.

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp