From 1e3e9fdab19c86b2b575f3bdb8831eaa3468381f Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Tue, 20 Aug 2024 14:40:47 +0100 Subject: [PATCH] all: rename Example test functions to prevent vet errors Building x/text was being prevented by vet errors caused by Example test functions of the form ExampleXxx where Xxx was not an identifier declared in the package. This is corrected by renaming: ExampleCollator_Strings to ExampleCollator_strings in text/collate ExampleDecodeWindows1252 to Example_decodeWindows1252 in text/encoding ExampleSelect to ExampleSelectf in text/feature/plural Fixes golang/go#68967 Change-Id: Id584a518af766676ab44fc49c12160e36f66542a Reviewed-on: https://go-review.googlesource.com/c/text/+/606736 LUCI-TryBot-Result: Go LUCI Reviewed-by: Tim King Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor --- collate/sort_test.go | 2 +- encoding/example_test.go | 2 +- feature/plural/example_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/collate/sort_test.go b/collate/sort_test.go index d9e7f31cc..4bbb227fc 100644 --- a/collate/sort_test.go +++ b/collate/sort_test.go @@ -12,7 +12,7 @@ import ( "golang.org/x/text/language" ) -func ExampleCollator_Strings() { +func ExampleCollator_strings() { c := collate.New(language.Und) strings := []string{ "ad", diff --git a/encoding/example_test.go b/encoding/example_test.go index 4f923530f..2ec15801f 100644 --- a/encoding/example_test.go +++ b/encoding/example_test.go @@ -16,7 +16,7 @@ import ( "golang.org/x/text/transform" ) -func ExampleDecodeWindows1252() { +func Example_decodeWindows1252() { sr := strings.NewReader("Gar\xe7on !") tr := charmap.Windows1252.NewDecoder().Reader(sr) io.Copy(os.Stdout, tr) diff --git a/feature/plural/example_test.go b/feature/plural/example_test.go index c75408c0e..ea9dcc489 100644 --- a/feature/plural/example_test.go +++ b/feature/plural/example_test.go @@ -10,7 +10,7 @@ import ( "golang.org/x/text/message" ) -func ExampleSelect() { +func ExampleSelectf() { // Manually set some translations. This is typically done programmatically. message.Set(language.English, "%d files remaining", plural.Selectf(1, "%d",