Commit 14c92c5f authored by Gregory Petrosyan's avatar Gregory Petrosyan Committed by Dmitri Shuralyov
Browse files

[release-branch.go1.14] go/doc: fix detection of whole file examples

After CL 211357 (commit 499dc1c5),
hasTests and numDecl were not updated properly for function
declarations with parameters, which affected the whole file
example detection logic. This caused examples like

	package foo_test

	func Foo(x int) {
	}

	func Example() {
		fmt.Println("Hello, world!")
		// Output: Hello, world!
	}

to not be detected as whole file ones.

Fixes #38418.
For #38409.

Change-Id: I9ebd47e52d7ee9d91eb6f8e0257511de69b2a402
GitHub-Last-Rev: cc71c31124f6e3514f4e33ac7b169eca74c8bcb7
GitHub-Pull-Request: golang/go#37730
Reviewed-on: https://go-review.googlesource.com/c/go/+/222477


Reviewed-by: default avatarAgniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit c4961dc2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/232868


Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: default avatarGregory Petrosyan <gregory.petrosyan@gmail.com>
parent f4274e64
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment