Skip to content
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

chore: use out.String() instead of string(out.Bytes()) #557

Merged
merged 1 commit into from Nov 17, 2023

Conversation

testwill
Copy link
Contributor

No description provided.

Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
@CLAassistant
Copy link

CLAassistant commented Nov 16, 2023

CLA assistant check
All committers have signed the CLA.

@AsterDY
Copy link
Collaborator

AsterDY commented Nov 16, 2023

both are copy string, no difference...

@testwill
Copy link
Contributor Author

bytes.Buffer has both a String and a Bytes method. It is almost never necessary to use string(buf.Bytes()) or []byte(buf.String()) – simply use the other method.

The only exception to this are map lookups. Due to a compiler optimization, m[string(buf.Bytes())] is more efficient than m[buf.String()].
staticcheck

@AsterDY AsterDY enabled auto-merge (squash) November 17, 2023 08:23
@AsterDY AsterDY merged commit 3d13f33 into bytedance:main Nov 17, 2023
24 checks passed
kodiakhq bot pushed a commit to cloudquery/codegen that referenced this pull request Mar 1, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/bytedance/sonic](https://togithub.com/bytedance/sonic) | indirect | minor | `v1.10.2` -> `v1.11.2` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>bytedance/sonic (github.com/bytedance/sonic)</summary>

### [`v1.11.2`](https://togithub.com/bytedance/sonic/releases/tag/v1.11.2)

[Compare Source](https://togithub.com/bytedance/sonic/compare/v1.11.1...v1.11.2)

#### Bugfix

-   \[[#&#8203;603](https://togithub.com/bytedance/sonic/issues/603)] fix:(ast) SortKeys(true) panic when not loaded-all

**Full Changelog**: bytedance/sonic@v1.11.1...v1.11.2

### [`v1.11.1`](https://togithub.com/bytedance/sonic/releases/tag/v1.11.1)

[Compare Source](https://togithub.com/bytedance/sonic/compare/v1.11.0...v1.11.1)

#### Feature

-   \[[#&#8203;594](https://togithub.com/bytedance/sonic/issues/594)] (ast) add new node method "IndexOrGetWithIdx"

#### Bugfix

-   \[[#&#8203;601](https://togithub.com/bytedance/sonic/issues/601)] (ast) `Unset()` used physical index to `removePair`
-   \[[#&#8203;599](https://togithub.com/bytedance/sonic/issues/599)] (build) support build `rt` on non-amd64 env

#### New Contributors

-   [@&#8203;Bisstocuz](https://togithub.com/Bisstocuz) made their first contribution in [bytedance/sonic#594

**Full Changelog**: bytedance/sonic@v1.11.0...v1.11.1

### [`v1.11.0`](https://togithub.com/bytedance/sonic/releases/tag/v1.11.0)

[Compare Source](https://togithub.com/bytedance/sonic/compare/v1.10.2...v1.11.0)

#### Feature

-   \[[#&#8203;590](https://togithub.com/bytedance/sonic/issues/590)] **support go1.22**
-   \[[#&#8203;558](https://togithub.com/bytedance/sonic/issues/558)] (encoder) allow the disabling of the newline in the encoder
-   \[[#&#8203;577](https://togithub.com/bytedance/sonic/issues/577)] (ast) always copy once after top `Get`

#### Bugfix

-   \[[#&#8203;540](https://togithub.com/bytedance/sonic/issues/540)] (encoder) checked if a interface is empty by its value field instead of type field
-   \[[#&#8203;544](https://togithub.com/bytedance/sonic/issues/544)] (ast) didn't pass non-exist value when call `Node.Interface()`
-   \[[#&#8203;547](https://togithub.com/bytedance/sonic/issues/547)] (decoder) didn't fully reuse buffer memory
-   \[[#&#8203;569](https://togithub.com/bytedance/sonic/issues/569)] (ast) `Set` on non-object node unexpectedly
-   \[[#&#8203;571](https://togithub.com/bytedance/sonic/issues/571)] (ast) implement soft delete for `Unset()`.
    -   **Break change** : `Unset()`'s behavior will be compatible with versions <= 1.9.x, while being incompatible with versions on 1.10.x

#### Optimization

-   \[[#&#8203;550](https://togithub.com/bytedance/sonic/issues/550)] (decoder) refactor streaming decoder to fully use buffer
-   \[[#&#8203;545](https://togithub.com/bytedance/sonic/issues/545)] eliminate race test errors
-   \[[#&#8203;552](https://togithub.com/bytedance/sonic/issues/552)] (loader) use lockfree to register new modules

#### New Contributors

-   [@&#8203;felix021](https://togithub.com/felix021) made their first contribution in [bytedance/sonic#552
-   [@&#8203;testwill](https://togithub.com/testwill) made their first contribution in [bytedance/sonic#557
-   [@&#8203;elee1766](https://togithub.com/elee1766) made their first contribution in [bytedance/sonic#558

**Full Changelog**: bytedance/sonic@v1.10.2...v1.11.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjIyMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
kodiakhq bot pushed a commit to cloudquery/filetypes that referenced this pull request Mar 1, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/bytedance/sonic](https://togithub.com/bytedance/sonic) | indirect | minor | `v1.10.2` -> `v1.11.2` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>bytedance/sonic (github.com/bytedance/sonic)</summary>

### [`v1.11.2`](https://togithub.com/bytedance/sonic/releases/tag/v1.11.2)

[Compare Source](https://togithub.com/bytedance/sonic/compare/v1.11.1...v1.11.2)

#### Bugfix

-   \[[#&#8203;603](https://togithub.com/bytedance/sonic/issues/603)] fix:(ast) SortKeys(true) panic when not loaded-all

**Full Changelog**: bytedance/sonic@v1.11.1...v1.11.2

### [`v1.11.1`](https://togithub.com/bytedance/sonic/releases/tag/v1.11.1)

[Compare Source](https://togithub.com/bytedance/sonic/compare/v1.11.0...v1.11.1)

#### Feature

-   \[[#&#8203;594](https://togithub.com/bytedance/sonic/issues/594)] (ast) add new node method "IndexOrGetWithIdx"

#### Bugfix

-   \[[#&#8203;601](https://togithub.com/bytedance/sonic/issues/601)] (ast) `Unset()` used physical index to `removePair`
-   \[[#&#8203;599](https://togithub.com/bytedance/sonic/issues/599)] (build) support build `rt` on non-amd64 env

#### New Contributors

-   [@&#8203;Bisstocuz](https://togithub.com/Bisstocuz) made their first contribution in [bytedance/sonic#594

**Full Changelog**: bytedance/sonic@v1.11.0...v1.11.1

### [`v1.11.0`](https://togithub.com/bytedance/sonic/releases/tag/v1.11.0)

[Compare Source](https://togithub.com/bytedance/sonic/compare/v1.10.2...v1.11.0)

#### Feature

-   \[[#&#8203;590](https://togithub.com/bytedance/sonic/issues/590)] **support go1.22**
-   \[[#&#8203;558](https://togithub.com/bytedance/sonic/issues/558)] (encoder) allow the disabling of the newline in the encoder
-   \[[#&#8203;577](https://togithub.com/bytedance/sonic/issues/577)] (ast) always copy once after top `Get`

#### Bugfix

-   \[[#&#8203;540](https://togithub.com/bytedance/sonic/issues/540)] (encoder) checked if a interface is empty by its value field instead of type field
-   \[[#&#8203;544](https://togithub.com/bytedance/sonic/issues/544)] (ast) didn't pass non-exist value when call `Node.Interface()`
-   \[[#&#8203;547](https://togithub.com/bytedance/sonic/issues/547)] (decoder) didn't fully reuse buffer memory
-   \[[#&#8203;569](https://togithub.com/bytedance/sonic/issues/569)] (ast) `Set` on non-object node unexpectedly
-   \[[#&#8203;571](https://togithub.com/bytedance/sonic/issues/571)] (ast) implement soft delete for `Unset()`.
    -   **Break change** : `Unset()`'s behavior will be compatible with versions <= 1.9.x, while being incompatible with versions on 1.10.x

#### Optimization

-   \[[#&#8203;550](https://togithub.com/bytedance/sonic/issues/550)] (decoder) refactor streaming decoder to fully use buffer
-   \[[#&#8203;545](https://togithub.com/bytedance/sonic/issues/545)] eliminate race test errors
-   \[[#&#8203;552](https://togithub.com/bytedance/sonic/issues/552)] (loader) use lockfree to register new modules

#### New Contributors

-   [@&#8203;felix021](https://togithub.com/felix021) made their first contribution in [bytedance/sonic#552
-   [@&#8203;testwill](https://togithub.com/testwill) made their first contribution in [bytedance/sonic#557
-   [@&#8203;elee1766](https://togithub.com/elee1766) made their first contribution in [bytedance/sonic#558

**Full Changelog**: bytedance/sonic@v1.10.2...v1.11.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjIyMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants