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/cmd/godoc: _ reported by itself as a constant #14848

Closed
beauhoyt opened this issue Mar 17, 2016 · 4 comments
Closed

x/tools/cmd/godoc: _ reported by itself as a constant #14848

beauhoyt opened this issue Mar 17, 2016 · 4 comments

Comments

@beauhoyt
Copy link

  1. What version of Go are you using (go version)?

    go version go1.6 darwin/amd64

  2. What operating system and processor architecture are you using (go env)?

    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GOOS="darwin"
    GOPATH="/Users/beau/go"
    GORACE=""
    GOROOT="/usr/local/Cellar/go/1.6/libexec"
    GOTOOLDIR="/usr/local/Cellar/go/1.6/libexec/pkg/tool/darwin_amd64"
    GO15VENDOREXPERIMENT="1"
    CC="clang"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
    CXX="clang++"
    CGO_ENABLED="1"
    
  3. What did you do?

    Went to https://golang.org/pkg/time/#pkg-constants to try and show an associate how to use the time package and noticed that these (https://github.com/golang/go/blob/release-branch.go1.6/src/time/format.go#L73-L113) time constants were not showing correctly in the documentation.

  4. What did you expect to see?

    I expect to see this:

    const (
    _                        = iota
    stdLongMonth             = iota + stdNeedDate  // "January"
    stdMonth                                       // "Jan"
    stdNumMonth                                    // "1"
    stdZeroMonth                                   // "01"
    stdLongWeekDay                                 // "Monday"
    stdWeekDay                                     // "Mon"
    stdDay                                         // "2"
    stdUnderDay                                    // "_2"
    stdZeroDay                                     // "02"
    stdHour                  = iota + stdNeedClock // "15"
    stdHour12                                      // "3"
    stdZeroHour12                                  // "03"
    stdMinute                                      // "4"
    stdZeroMinute                                  // "04"
    stdSecond                                      // "5"
    stdZeroSecond                                  // "05"
    stdLongYear              = iota + stdNeedDate  // "2006"
    stdYear                                        // "06"
    stdPM                    = iota + stdNeedClock // "PM"
    stdpm                                          // "pm"
    stdTZ                    = iota                // "MST"
    stdISO8601TZ                                   // "Z0700"  // prints Z for UTC
    stdISO8601SecondsTZ                            // "Z070000"
    stdISO8601ShortTZ                              // "Z07"
    stdISO8601ColonTZ                              // "Z07:00" // prints Z for UTC
    stdISO8601ColonSecondsTZ                       // "Z07:00:00"
    stdNumTZ                                       // "-0700"  // always numeric
    stdNumSecondsTz                                // "-070000"
    stdNumShortTZ                                  // "-07"    // always numeric
    stdNumColonTZ                                  // "-07:00" // always numeric
    stdNumColonSecondsTZ                           // "-07:00:00"
    stdFracSecond0                                 // ".0", ".00", ... , trailing zeros included
    stdFracSecond9                                 // ".9", ".99", ..., trailing zeros omitted
    
    stdNeedDate  = 1 << 8             // need month, day, year
    stdNeedClock = 2 << 8             // need hour, minute, second
    stdArgShift  = 16                 // extra argument in high bits, above low stdArgShift
    stdMask      = 1<<stdArgShift - 1 // mask out argument
    )
    
  5. What did you see instead?

    But only see this on the website:

    const (
        _ = iota
    )
    
@ianlancetaylor
Copy link
Contributor

Those constants are not exported. godoc only documents exported symbols. But I'll leave this issue open because it's odd that godoc is reporting about _ all by itself.

@ianlancetaylor
Copy link
Contributor

cc @griesemer

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Mar 17, 2016
@ianlancetaylor ianlancetaylor changed the title x/tools/cmd/godoc: Constants dont display correctly on golang.org/pkg/time/#pkg-constants x/tools/cmd/godoc: _ reported by itself as a constant Mar 17, 2016
@ALTree
Copy link
Member

ALTree commented Jan 8, 2017

I suspect this is fixed on tip: I see no

const (
    _ = iota
)

in the page linked by the OP.

@griesemer
Copy link
Contributor

Closing as not reproducible.

@golang golang locked and limited conversation to collaborators Mar 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants