this post was submitted on 23 Jul 2024
29 points (100.0% liked)

Today I Learned

0 readers
1 users here now

Today I Learned (TIL). You learn something new every day; what did you learn today?

founded 1 year ago
MODERATORS
 

I am able to use different programming languages. I know most of the well-known languages ​​without any problems: C, C++, Java, Python, JavaScript, Typescript, PHP...

However, I wanted to expand my horizon. Zig didn't do much for me neither did Rust, but now that I've written some Golang. I admit, I'm intrigued by the language.

I love the fact it's compiled to native machine language. There is still one caveat: despite Go being a GC language, you often still need to manage your memory. Sound strange right? But I needed to use io.Copy instead of io.ReadAll to avoid memory issues. But also you need to explicitly call defer res.Body.Close() to avoid Go not cleaning-up the HTTP response.. Ow well, so you learn it the hard way. Overall, I'm still very optimistic with Go. And looking forward to use it more often in some of my open-source projects.

See my first project in Go: https://gitlab.melroy.org/melroy/gitlab-artifact-deployer-go. Which I wrote in 3 days.

Did you try Go? What are your thoughts?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 month ago (6 children)

@[email protected] i recently tried Go for the first time. just trying to parse some nested json from a file was quite painful as there seems to be no easy way to parse arbitrary json. it always needed a struct, which for complex json is quite awful to write out.

safe to say, since i have absolutely no need to the language, i won't be using it

[–] [email protected] 2 points 1 month ago (1 children)
[–] [email protected] 1 points 1 month ago

Thanks for mentioning this. So it is possible without defining the whole struct. Great!

load more comments (4 replies)