Offline today (memorial day) but just noticed this one: I think ast is already imported ...
12 years, 1 month ago
(2013-05-27 21:21:47 UTC)
#2
Offline today (memorial day) but just noticed this one: I think ast is
already imported and there is an IsExported function and method. Please use
those instead. Thanks.
-gri
On May 27, 2013 12:10 PM, <jonathan@titanous.com> wrote:
> Reviewers: golang-dev1,
>
> Message:
> Hello golang-dev@googlegroups.com,
>
> I'd like you to review this change to
> https://code.google.com/p/go/
>
>
> Description:
> cmd/godoc: don't link unexported identifiers
>
> Please review this at
https://codereview.appspot.**com/9722045/<https://codereview.appspot.com/9722...
>
> Affected files:
> M src/cmd/godoc/linkify.go
>
>
> Index: src/cmd/godoc/linkify.go
> ==============================**==============================**=======
> --- a/src/cmd/godoc/linkify.go
> +++ b/src/cmd/godoc/linkify.go
> @@ -16,6 +16,8 @@
> "go/token"
> "io"
> "strconv"
> + "unicode"
> + "unicode/utf8"
> )
>
> // LinkifyText HTML-escapes source text and writes it to w.
> @@ -56,7 +58,7 @@
> if info.mode == identVal {
> fmt.Fprintf(w, `<span id="%s">`,
> info.name)
> prev = "span"
> - } else {
> + } else if isExported(info.name) {
> fmt.Fprintf(w, `<a href="#%s">`,
> info.name)
> prev = "a"
> }
> @@ -187,6 +189,12 @@
> return m
> }
>
> +// isExported returns true if the name is exported
> +func isExported(name string) bool {
> + r, _ := utf8.DecodeRuneInString(name)
> + return unicode.IsUpper(r)
> +}
> +
> // The predeclared map represents the set of all predeclared identifiers.
> // TODO(gri) This information is also encoded in similar maps in go/doc,
> // but not exported. Consider exporting an accessor and using
>
>
> --
>
> ---You received this message because you are subscribed to the Google
> Groups "golang-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
golang-dev+unsubscribe@**googlegroups.com<golang-dev%2Bunsubscribe@googlegrou...
> .
> For more options, visit
https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/o...
> .
>
>
>
On 2013/05/27 21:21:47, gri1 wrote: > Offline today (memorial day) but just noticed this one: ...
12 years, 1 month ago
(2013-05-28 01:28:50 UTC)
#3
On 2013/05/27 21:21:47, gri1 wrote:
> Offline today (memorial day) but just noticed this one: I think ast is
> already imported and there is an IsExported function and method. Please use
> those instead. Thanks.
> -gri
Done.
Issue 9722045: code review 9722045: cmd/godoc: don't link unexported identifiers
(Closed)
Created 12 years, 1 month ago by titanous
Modified 12 years ago
Reviewers:
Base URL:
Comments: 0