First of all, thank you to all the amazing things you do for the self-hoster, FOSS comunity ! We won’t be able to have those shiny things without you ! I’m not a dev and have just played arround with python (and I know how most of you feel about it 🤫) so I have very limited knowledge regarding programming languages.

I know whats a low level language (C, C#, rust?), general scripting tools and even heard about assembly. And it always baffles me how all those coding lines rule and make our microchips communicate and understand each other, but that’s another story ! This is about golang !


As a self-hoster enthousiast, when I’m looking at a github repository, I always check the programing language used, even though I have no idea if those integrate well with each other or if it’s the best programming language for that kind of application.

And everytime I see golang, It makes me smile and have a feeling it’s going to be a good application. I know it also depends on the programmer skills and creativity, but all my self-hosted Go apps works like a charm.

Traefik is the best example, I never had any issue or strange behavior, except for wrong configuration files on my side,

Or navidrome a music server compatible with subsonic, also written in go, is working great and fast AF !

Or Vikunja, the todo app… and many more !

I’m probably biased because I have no idea of how the programing realm works, but I have the feeling that Golang is a certificate for good working and fast applications. Just to bad it’s backed/supported by google (uuhhg)

Feel free to debate and give me your personal opinion of the Go language, if my feelings are right or Am I just beeing silly :).

Thanks for reading through 👋

  • anti-idpol action
    link
    fedilink
    1
    edit-2
    10 months ago

    In short when a program runs, it allocates memory for the data it is using. Then the garbage collector which you can think of a ‘program’ (though not in a strict sense, just a part of the runtime), takes care of freeing the memory which is no longer needed. In languages with manual memory management, like C or C++ it is up to the programmer to properly (de)allocate memory, which might result in issues like dangling pointers (references to already freed memory, which might cause unpredictable behavior and compromise your whole system’s security) or memory leaks (gradually increasing memory usage over time in absence of user action that would prompt that, like e.g. opening more and more browser tabs, which is also partly why in the past you’ve often had to restart your PC every once in a while to free some trashed memory. In Go most of the stuff is done by GC and only code that uses the unsafe package or relies on external resources, like reading a file or database connection needs to have programmatic termination of access to these (usually by calling something like defer db.Close() ).

    Also Go is a nice balance between low and high level, one of such examples is the use of pointers. They might be complicated for most beginner coders, but in reality there is seldom any use of uintptr, double pointers and even slice (list) pointers, but it has a tremendous performance amount since when you do some operation, especially loops where without a pointer you would copy the data you’re iterating through by value instead of just it’s memory address.

    Which is especially important with large sets of data, where 160 bytes might seem miniscule with one call, but if you loop over 1 million records, that’s 160 MB (for example in some database used by municipal authorities of a large city). That’s one of the reasons some databases like CockroachDB were written in Go.

    • @[email protected]OP
      link
      fedilink
      110 months ago

      Thanks for the ELI16 !!!

      Also Go is a nice balance between low and high level, one of such examples is the use of pointers.

      Yeah, I read/heard about pointers being on of the most hated/complicated stuff in C for beginners, but that’s also C’s advantage over other languages, isn’t it? You have more control on how memory is used ? Or is that considered “bad practice”, prone to error, to today’s standards? (I hope it make sense and that you understand what I’m trying to express :/). And that’s the reason way something like Go and Rust? are becoming more prevalent.

      Like e.g. opening more and more browser tabs, which is also partly why in the past you’ve often had to restart your PC every once in a while to free some trashed memory.

      Yeah I remember that time, looking for THE best browser that wasn’t eating to much memory (settle with Firefox). I thought killing the process in windows was enough?

      CockroachDB

      xD

      • anti-idpol action
        link
        fedilink
        210 months ago

        Rust’s memory safety is much different (ownership, lifetimes, immutability). Also Rust has null safety while Go doesn’t. Go has some uninitialized variable use protection, but you can still screw up if you do stuff like accessing a struct field that hasn’t been assigned a value. In C there’s much higher chance of segfaults, use-after-free precisely due to manual memory management (malloc and free, which do not exist in Go). For example earlier versions of Java and most interpreted languages of the past whilst offering memory safety, consumed a lot of system resources, making them unsuitable for performance critical things like games, drivers etc.

        Then innovations in memory management and the resulting safety improvements and easier development these new languages offer allowed using them for writing performance critical code. Hope that answers your question.

        • @[email protected]OP
          link
          fedilink
          110 months ago

          Yes :) Thank your very much for sharing your knowledge !! It’s just difficult to understand everything with all the new related vocabulary I never heard of. But I think I get the general gist !

          Just one last question, it’s something that’s on my mind for a while ! I know it’s a hot potato in the programming world and has been asked several times over here in the community, but I’m really interested on your opinion on that topic:

          C, C++ (C#? I dunno the difference between the 3, so pardon me for my ignorance) are they slowly dying out and being replaced by something like Rust (or other low level language?)? Because C and derivatives are prevalent everywhere and probably everything , and If I get it right, it’s the language, that programs other languages. So shifting to something new takes time, resources and probably is “risky”?

          I’m asking that question because, recently read about Linux slowly merging some rust coding in the Linux kernel.