From 09114fa5b34cddf46dd53ff8641fa95aad31c6c8 Mon Sep 17 00:00:00 2001 From: alexey semenyuk Date: Tue, 28 Nov 2023 17:16:41 +0000 Subject: [PATCH] Fix header for string-byte-slice (#202) Clarify that the intent for string-to-byte conversions is to avoid repeated conversions. --------- Co-authored-by: alex-semenyuk Co-authored-by: Matt Way --- src/SUMMARY.md | 2 +- src/string-byte-slice.md | 2 +- style.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index f3b1027e..6ea20440 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -31,7 +31,7 @@ - [No goroutines in `init()`](goroutine-init.md) - [Performance](performance.md) - [Prefer strconv over fmt](strconv.md) - - [Avoid string-to-byte conversion](string-byte-slice.md) + - [Avoid repeated string-to-byte conversions](string-byte-slice.md) - [Prefer Specifying Container Capacity](container-capacity.md) - Style - [Avoid overly long lines](line-length.md) diff --git a/src/string-byte-slice.md b/src/string-byte-slice.md index cebfee11..078e7149 100644 --- a/src/string-byte-slice.md +++ b/src/string-byte-slice.md @@ -1,4 +1,4 @@ -# Avoid string-to-byte conversion +# Avoid repeated string-to-byte conversions Do not create byte slices from a fixed string repeatedly. Instead, perform the conversion once and capture the result. diff --git a/style.md b/style.md index 42ce98ba..ab553dff 100644 --- a/style.md +++ b/style.md @@ -38,7 +38,7 @@ - [No goroutines in `init()`](#no-goroutines-in-init) - [Performance](#performance) - [Prefer strconv over fmt](#prefer-strconv-over-fmt) - - [Avoid string-to-byte conversion](#avoid-string-to-byte-conversion) + - [Avoid repeated string-to-byte conversions](#avoid-repeated-string-to-byte-conversions) - [Prefer Specifying Container Capacity](#prefer-specifying-container-capacity) - [Style](#style) - [Avoid overly long lines](#avoid-overly-long-lines) @@ -2192,7 +2192,7 @@ BenchmarkStrconv-4 64.2 ns/op 1 allocs/op -### Avoid string-to-byte conversion +### Avoid repeated string-to-byte conversions Do not create byte slices from a fixed string repeatedly. Instead, perform the conversion once and capture the result.