golang impression

I’ve been very excited to use Go at work and somehow very refreshing, been meaning to learn it for some time but it’s easier for me to learn if I actually see it in action.

So far it’s been very nice, though of course, some stuff is not so easy. Here’s one trivial matter.

I had to test a package that makes sure it truncates to a certain Unicode character limit. This is when I appreciated Python for having duck typing. I can just build a long character like this:

long_unicode_char = "ひ" * 100

For some reason, my brain is fixated on how easy it is to do in a dynamic language that it blocks from trying to search for a way in Go. But then of course, after some complaining and brain rewire you can then move forward.

So here’s how you should it.

s := strings.Repeat("ひ", 100)

Small things matters.

Contributing

Dislike