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

flag: zero value for time.Duration not recognized #15904

Closed
xi2 opened this issue May 31, 2016 · 2 comments
Closed

flag: zero value for time.Duration not recognized #15904

xi2 opened this issue May 31, 2016 · 2 comments

Comments

@xi2
Copy link

xi2 commented May 31, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version devel +4223294 Tue May 31 13:02:09 2016 +0000 linux/amd64

  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/user"
    GORACE=""
    GOROOT="/usr/lib/go"
    GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build043601680=/tmp/go-build -gno-record-gcc-switches"
    CXX="g++"
    CGO_ENABLED="1"

  3. What did you do?
    Ran the following with argument -h:

    package main
    
    import "flag"
    
    func main() {
        _ = flag.Duration("duration", 0, "set a duration")
        flag.Parse()
    }
  4. What did you expect to see?
    On Go 1.6 I see:

    Usage of test:
    -duration duration
          set a duration
    exit status 2
    
  5. What did you see instead?

    Usage of test:
    -duration duration
          set a duration (default 0s)
    exit status 2
    

Does isZeroValue in flag/flags.go now need a case "0s":?

@mark-rushakoff
Copy link
Contributor

@gopherbot
Copy link

CL https://golang.org/cl/23581 mentions this issue.

@golang golang locked and limited conversation to collaborators May 31, 2017
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

3 participants