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?

  • laund@hachyderm.io
    link
    fedilink
    arrow-up
    2
    ·
    4 months ago

    @[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

    • melroy@kbin.melroy.orgOPM
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      I understand your situation, apparently there are workarounds for with as listed in this comment thread. Statically typed languages catch errors at compile time, ensuring robust code and safer refactoring, while also allowing for better performance optimizations. Their explicit type annotations enhance code clarity and maintainability, making it easier to understand and manage large codebases. This leads to more reliable and efficient backend systems.

      • laund@hachyderm.io
        link
        fedilink
        arrow-up
        1
        ·
        4 months ago

        @[email protected] i mean, you can have a statically typed language and safely handle arbitrayry json. you just need Tagged Union types in the language, which make it easy to type hierarchical structures where each level is one of a set of types

      • melroy@kbin.melroy.orgOPM
        link
        fedilink
        arrow-up
        1
        ·
        4 months ago

        No… In production you don’t want dynamically typed languages. Frankly, even TypeScript is still not good enough (since it still compiles to JS and the value can become any kind of type during runtime), it can cause catastrophic failures and errors in production. When you write a back-end server, I learned my lesson the hard way, I believe you want a statically typed language for better safety, security and mainly predictability at runtime.

        Python is fine for some simple scripts here and there, but please do not use it for critical production software. Please …