-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/godoc/dochtml: remove deprecated symbols from index
If a symbol is deprecated, don't display it in the outline. This CL only handles the non-mobile outline. For golang/go#40850 Change-Id: Ic758ffa5d811b2a2287c550dddadc38d0a322937 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/312691 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
- Loading branch information
Showing
6 changed files
with
188 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2021 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// Package deprecated has some deprecated symbols. | ||
package deprecated | ||
|
||
const GoodC = 1 | ||
|
||
// BadC is bad. | ||
// Deprecated: use GoodC. | ||
const BadC = 2 | ||
|
||
var GoodV = 1 | ||
|
||
var BadV = 2 // Deprecated: use GoodV. | ||
|
||
func GoodF() {} | ||
|
||
/* | ||
BadF is bad. | ||
Deprecated: use GoodF. | ||
*/ | ||
func BadF() {} | ||
|
||
type GoodT int | ||
|
||
// BadT is bad. | ||
// Deprecated: use GoodT. | ||
// Don't use this. | ||
type BadT int | ||
|
||
func NewGoodTGood() GoodT {} | ||
|
||
// NewGoodTBad is bad. | ||
// Deprecated: use NewGoodTGood. | ||
func NewGoodTBad() GoodT {} | ||
|
||
func (GoodT) GoodM() {} | ||
|
||
// BadM is bad. | ||
// Deprecated: use GoodM. | ||
func (GoodT) BadM() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2021 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package doc | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestIsDeprecated(t *testing.T) { | ||
for _, test := range []struct { | ||
text string | ||
want bool | ||
}{ | ||
{"A comment", false}, | ||
{"Deprecated: foo", true}, | ||
{" A comment\n Deprecated: foo", true}, | ||
{"This is\n Deprecated.", false}, | ||
{"line 1\nDeprecated:\nline 2\n", true}, | ||
} { | ||
got := isDeprecated(test.text) | ||
if got != test.want { | ||
t.Errorf("%q: got %t, want %t", test.text, got, test.want) | ||
} | ||
} | ||
} |