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

x/text: vet errors in example tests causing builds to fail #68967

Closed
millerresearch opened this issue Aug 20, 2024 · 2 comments
Closed

x/text: vet errors in example tests causing builds to fail #68967

millerresearch opened this issue Aug 20, 2024 · 2 comments
Milestone

Comments

@millerresearch
Copy link
Contributor

Go version

gotip on all platforms

Output of go env in your module/workspace:

"HOSTNAME=buildlet-linux-amd64-bookworm-rnf4eba85" "HOME=/root" "SHLVL=0" "DEBIAN_FRONTEND=noninteractive" "USER=root" "GO_STAGE0_NET_DELAY=15.1s" "GO_STAGE0_DL_DELAY=200ms" "WORKDIR=/workdir" "GOROOT_BOOTSTRAP=/workdir/go1.4" "GO_BUILDER_NAME=linux-amd64-bookworm" "GOROOT=/workdir/go" "GOPATH=/workdir/gopath" "GOPROXY=https://proxy.golang.org" "GO_DISABLE_OUTBOUND_NETWORK=0" "TMPDIR=/workdir/tmp" "GOCACHE=/workdir/gocache" "GOPLSCACHE=/workdir/goplscache" "PATH=/workdir/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" "PWD=/workdir/gopath/src/golang.org/x/text"

What did you do?

Builds running both on LUCI and coordinator, for example this one.

What did you see happen?

...
# golang.org/x/text/encoding_test
# [golang.org/x/text/encoding_test]
encoding/example_test.go:19:1: ExampleDecodeWindows1252 refers to unknown identifier: DecodeWindows1252
...
# golang.org/x/text/collate_test
# [golang.org/x/text/collate_test]
collate/sort_test.go:15:1: ExampleCollator_Strings refers to unknown field or method: Collator.Strings
FAIL	golang.org/x/text/collate [build failed]
?   	golang.org/x/text/collate/tools/colcmp	[no test files]
FAIL	golang.org/x/text/encoding [build failed]
...
# golang.org/x/text/feature/plural_test
# [golang.org/x/text/feature/plural_test]
feature/plural/example_test.go:13:1: ExampleSelect refers to unknown identifier: Select
FAIL	golang.org/x/text/feature/plural [build failed]

What did you expect to see?

Expected successful build.

The cause is vet errors from declaration of Example test functions which do not obey the convention described by go help testfunc:

Godoc displays the body of ExampleXxx to demonstrate the use of the function, constant, or variable Xxx.

For example in x/text/encoding/example_test.go, the funtion ExampleDecodeWindows1252 is declared, but there's no corresponding identifier DecodeWindows1252 declared in the package. A simple way to fix the error would be to rename ExampleDecodeWindows1252 to Example_decodeWindows1252.

This is similar to issue #68839

@gopherbot gopherbot added this to the Unreleased milestone Aug 20, 2024
@gabyhelp
Copy link

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/606736 mentions this issue: all: rename Example test functions to prevent vet errors

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

No branches or pull requests

3 participants