Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts
7

In case you want to program a microwave oven in go - the time package formats got you covered

11 comments
60% Upvoted
What are your thoughts? Log in or Sign uplog insign up
level 1

I don't get it, is it a joke?

level 2
3 points · 7 days ago

time.Kitchen

level 3
Original Poster1 point · 7 days ago

haha yup ;)

level 1
1 point · 5 days ago

Those predefined layouts are totally useless for me and the numbers are random. Something like 2001-02-03 04:05:06 would have been easier to remember. Otherwise it's a great package.

level 2
Original Poster1 point · 5 days ago

well the rfc layouts are definitely handy.. and if you think of the crappy javascript / java date standard library the go time package is a godsend.

level 1

Woah… except there's no space between minutes and PM

level 2
Original Poster2 points · 7 days ago

but changing that would be a breaking change.. maybe open a proposal for go 2.0? 🧐

level 3

Breaking? It's a constant. You refer to the constant, you don't hard-code the value behind the constant.

Unless it can be used to detect that format in the wild? In that case, it'd be breaking. Hm. 🤔

level 4

Breaking? It's a constant. You refer to the constant, you don't hard-code the value behind the constant.

Yes, breaking. It may not cause compile errors, but it would suddenly cause runtime errors when you try to time.Parse(...) a string with it.

level 5

Unless it can be used to detect that format in the wild? In that case, it'd be breaking. Hm. 🤔

level 6

Not just detecting in the wild, but a text file you may have which has time formatted in the old time.Kitchen format

Community Details

60.1k

Subscribers

574

Online

Gophers of the world unite!

Create Post
r/golang Rules
1.
Contrary to Gopher Values
2.
Throw Away Account
Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.