Friday, December 14, 2012
Monday, December 10, 2012
strftime
Go's time.Time already have Format, which is very human readable. However if you try to "embed" time format in longer strings, Format might expand things that you want to stay fixed. Take for example "/report06/2006", the first "06: will be expanded to the current year.
Python's strftime is less human readable but requires explicit escaping to it's easier to write string with embedded time directives. Now you can have strftime in Go as well.
To get it, run the usual go get bitbucket.org/tebeka/strftime.
Python's strftime is less human readable but requires explicit escaping to it's easier to write string with embedded time directives. Now you can have strftime in Go as well.
To get it, run the usual go get bitbucket.org/tebeka/strftime.
Tuesday, December 4, 2012
snowball
I wanted to play a bit with cgo. As a project I tried to have Go bindings to snowball.
One of the problems was that snowball does not come as a library but an archive of sources. cgo can handle C source files, but all in the same directory. I had to "flatten" the source tree, rewriting #include directives (sed FTW!).
One the above was done, the rest was pretty much straightforward. I confess that at the beginning I wanted to write a lot of C helper functions, but managed to resist the temptation :)
You can get it with go get bitbucket.org/tebeka/snowball. Note the building takes time - that's C compilation for you :)
One of the problems was that snowball does not come as a library but an archive of sources. cgo can handle C source files, but all in the same directory. I had to "flatten" the source tree, rewriting #include directives (sed FTW!).
One the above was done, the rest was pretty much straightforward. I confess that at the beginning I wanted to write a lot of C helper functions, but managed to resist the temptation :)
You can get it with go get bitbucket.org/tebeka/snowball. Note the building takes time - that's C compilation for you :)
Subscribe to:
Posts (Atom)