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/tools/godoc/static: test failure for go1.9 (static.go is stale) #25880

Closed
griesemer opened this issue Jun 13, 2018 · 3 comments
Closed

x/tools/godoc/static: test failure for go1.9 (static.go is stale) #25880

griesemer opened this issue Jun 13, 2018 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Soon This needs to be done soon. (regressions, serious bugs, outages)
Milestone

Comments

@griesemer
Copy link
Contributor

From the build log:

darwin-386-10_11 at 1746cff738c7c801988f18cd25ca0cb488889873 building tools at c995a088887b4ae00a4c85a984117cbc8d86ca3d

ok  	golang.org/x/tools/benchmark/parse	0.005s
ok  	golang.org/x/tools/blog	0.013s
?   	golang.org/x/tools/blog/atom	[no test files]
...
ok  	golang.org/x/tools/godoc	0.758s
?   	golang.org/x/tools/godoc/analysis	[no test files]
ok  	golang.org/x/tools/godoc/redirect	0.025s
--- FAIL: TestStaticIsUpToDate (0.08s)
	gen_test.go:25: static.go is stale
FAIL
FAIL	golang.org/x/tools/godoc/static	0.085s

This is currently preventing the x/tools builders from turning "green".

@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. Soon This needs to be done soon. (regressions, serious bugs, outages) labels Jun 13, 2018
@griesemer griesemer added this to the Go1.11 milestone Jun 13, 2018
@ianlancetaylor
Copy link
Contributor

This has changed because of a change in the status of the Unicode code point \u9fe5. In Go 1.9 strconv.IsPrint('\u9fe5') returns false. In 1.10 and 1.11 it returns true. This changes the behavior of strconv.Quote, which changes the behavior of the %q used by the Generate function being tested.

The change to strconv.Quote happened in https://golang.org/cl/63953, which updated the package to Unicode 10.0.0

I think if we want this test to be stable across Go releases we should not be using %q to print non-string data.

CC @agnivade

@agnivade
Copy link
Contributor

agnivade commented Jun 14, 2018

Thanks for the analysis @ianlancetaylor. I believe you are talking about this part of the code -

if utf8.Valid(b) {
	fmt.Fprintf(buf, "`%s`", sanitize(b))
} else {
	fmt.Fprintf(buf, "%q", b)
}

What do you suggest we do instead of %q ? Because we anyways have to quote the output.

I think if we are to simply use %s, there is some more sanitization that needs to be done. Trying to print with `%s`, it throws an illegal UTF-8 encoding error. ping @bradfitz who probably wrote/reviewed the sanitize function.

Or should we maintain per-release copies of static.go and delete it once 1.11 is released ?

@gopherbot
Copy link

Change https://golang.org/cl/118955 mentions this issue: godoc/static: mimic the pre-1.10 behavior of strconv.Quote

@golang golang locked and limited conversation to collaborators Jun 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Soon This needs to be done soon. (regressions, serious bugs, outages)
Projects
None yet
Development

No branches or pull requests

6 participants