Skip to content

time: Panic with time.Parse(time.StampNano, [time in time.StampMicro format]) #4502

@gopherbot

Description

@gopherbot

by okeeffeco:

What steps will reproduce the problem?

http://tip.play.golang.org/p/F7jmnR9VD6

What is the expected output?

error, as in the play sample

What do you see instead?

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
time.parseNanoseconds(0x4b2baf, 0x7, 0xa, 0x0, 0x0, ...)
    /home/jake/code/golang/src/pkg/time/format.go:937 +0x14c
time.Parse(0x4b5e19, 0x0, 0x4b2baf, 0x7, 0x46e820, ...)
    /home/jake/code/golang/src/pkg/time/format.go:858 +0x199c
main.main()
    /tmp/t.go:14 +0x51

goroutine 2 [syscall]:
created by runtime.main
    /home/jake/code/golang/src/pkg/runtime/proc.c:225
exit status 2


Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Debian Linux
Mac OSX

Which version are you using?

Tested with:

go version devel +a5efcd1675eb Thu Dec 06 09:47:12 2012 -0800
go version devel +88e4ba173900 Wed Nov 28 17:01:59 2012 +1100

Please provide any additional information below.

Realize I'm parsing one format with another, but this is part of an underlying tool
where I don't always know what format is sent in.

Works on release (1.0.3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions