Go Lang Impressions after 2 Months

So for work I've needed to learn GoLang, which I'd always before picked up, kicked the tires and said "meh" on. A few months now of working with it pretty-much-daily have upped the "meh" quite a bit. To be clear, I'd choose Go over raw C, but I'd likely pick modern C++ over Go.

Channels and spaghetti...

I get it, message passing is nice, and channels rigorously applied mean you don't need to worry about shared state. The problem is in the practice. What you wind up with is 99 tiny goroutines each of which is handling a tiny hand-off problem, lots of temporary channels implementing rpc-in-a-long-running-goroutine, etc. Where does this message I'm sending go? Why is the whole app stalled? Go fish. Maintenance load matters, and this stuff is really annoying to debug, particularly if you're not the one who wrote it.

We used to have a similar problem with Twisted Python code where you'd have dozens or hundreds of callbacks registered to a bunch of inter-dependent deferreds and you'd have to untangle the whole mess to figure out the flow-of-control. In Twisted that gave rise to using something that looks a lot like Python's asyncio (async/await), defining what looks like imperative code where an await-alike suspends current code until the result comes back.

Lack of opaque/meta-types...

One of my Open Source projects is pydispatcher, essentially an in-memory pubsub that provides generic publish/subscribe operations, where a channel (string) can be used to broadcast messages (opaque) to any number of subscribers. It's a common, useful, pattern for creating loosely-coupled components that can dynamically decide whether to subscribe to a given channel.

In Python, everything is an object, so the opaque data-structure is "PyObject". In C++ it's a pointer. In both, the conventions of the application mean you only send messages of the correct type to the channel. In C++ you can even make the whole thing templated so that each channel has a type.

In Go... you are expected to write a new pub-sub implementation for each message type? At least, that seems to be the idea. There are pubsub implementations for go, but they all seem to based on the idea of using a string as the opaque payload (i.e. not usable for efficient code). Maybe 1.18's generics will address this, but stuck on 1.17 this is a pain-point for me.

Lack of Syntactic Map Support

I've programmed extensively in C, C++, Java, Go, Javascript and Python along with using a half-dozen other languages. Languages should have built-in mapping types. Steal Python's if you want a good one. So many algorithms just roll off the keyboard with a proper, performant hash-map able to handle opaque data-values on the keys and values. Bonus points if the keys don't get converted to strings (looking at you JS).


x := {}(int,V)
for _,v : range somearray {
x[v.id] = v
}
return x

should be a thing you can do to get a quick index of your data-set. Yes, I realise you can do it in Go with make() etc. My point is that the unnecessary bookkeeping gets in the way of programming. Your Go compiler can spend the 5us to rewrite the synactic construct `x[v.id] = ` to `x.Set`. I get that everyone is afraid of spending 1/1000th of a second more compiling but meh, I'd rather not spend 10 extra seconds typing and let it.

Arrays and Slices

Similarly, a language should have clean, elegant syntax for handling arrays of opaque objects. Under the covers your compiler can check and see if it can optimise the array to only handle type X, but I should be able to easily add items to a list, sort, slice, etc.


x := [](Moo,V)
for _,v := range blah {
x.Append((v.moo,v))
}
x.Sort()
return [item[1] for item in x]

You shouldn't have to constantly re-assign the array-head-pointer. Map and Filter should be provided as methods on the list/array. Nice if negative indices let you slice-from-the-end, but not critical. List comprehensions are again, nice, but not critical.

The point in both map and list case is that these things are used all the time, they are part of almost any algorithm you want to write. If they are easy-to-use and syntactically supported you can describe algorithms concisely; the way the human thinks of the algorithm and the way the algorithm looks on the screen are essentially the same.

Stability/Production Ready-Ness

Memory leaks seem to be happening pretty frequently, some of those from C wrapper code (e.g. the Gstreamer wrappers), some from dangling channels.

Segfaults are pretty common during development, particularly in test code where you are testing one bit of functionality and didn't initialise the whole application stack. Mock setup is a PITA, requiring refactors of code to be interface/implementation based rather than allowing hands-off testing.

Code bloat; it takes a huge amount of code to do even very simple things when you are accustomed to a high level language. It doesn't feel much less verbose than C++.

The positives so far:

* performance is fine (this is 90% non-performance sensitive stuff, so not surprising)
* deployment is good, single-file executables with embedded resources is good (modulo it not working for one of our font resources)
* cross-compilation works well (once the system is setup for it)
* tooling in MSCode is good
* abstraction level is higher than raw C

Anyway, 2 months in, that's the impressions of a nearly-27-year Python programmer on GoLang. It seems I'll be doing a lot more Go coding, so I suppose I'll update these as my impressions evolve.

Comments

  1. Kevintearp

    Kevintearp on 04/13/2022 9:01 p.m. #

    Was sind snuff it besten Gewinnchancen in einem Casino? "Einarmige Banditen"
    Einarmige Banditen
    Casinos werden in erster Linie mit Roulette und Poker in Verbindung gebracht, aber Statistiken zeigen, dass 61 % der Besucher von Spielhallen ihre Zeit damit verbringen, einarmige Banditen zu spielen (Daten von 2013 von der American Gaming Bonding). Die Regeln der Spielautomaten sind sehr einfach, und der niedrige Mindesteinsatz macht sie auch fur join the majority armsten Spieler zuganglich.


    https://www.csd-leipzig.de/wp-content/plugins/ninja-form/altersbeschr_nkungen_beim_gl_cksspiel__wie_alt_darf_man_in_casinos_in_verschiedenen_l_ndern_sein_.html
    https://welovetents.com/pag/was_sind_die_besten_gewinnchancen_in_einem_casino__eine_strategie_mit_positiver_progression.html
    https://berliner-vv.de/articles/wie_man_sich_f_r_einen_casino_abend_kleidet.html
    https://www.weyher.de/wp-includes/inc/casino_gewinne_2022__wie_viel_verdienen_casinobesitzer_.html
    http://ssvtaufers.com/language/pages/?wie_man_im_poker_casino_gewinnt_.html

  2. Ivygal

    Ivygal on 04/16/2022 5:18 a.m. #

    <a href="https://acyclovir.cyou/">acyclovir cream for sale online</a>

  3. DavidAlolf

    DavidAlolf on 04/16/2022 7:39 a.m. #

    https://hydraclubbioknikokex7njhwuahc2l67lfiz7z36md2jvopda7nid-onion.com
    гидра не работает
    hydra onion
    Магазин Гидра
    Гидра даркнет
    Гидра onion
    Гидра в тор браузер

    <a href=https://hydraclubbioknikokex7njhwuahc2l67lfiz7z36md2jvopda7nid-onion.com>гидра сайт</a>

  4. EfrainBef

    EfrainBef on 04/16/2022 7:39 a.m. #

    https://hydraclubbioknikokex7njhwuahc2l67lfiz7z36md2jvopda7nid-onion.com
    гидра не работает
    hydra onion
    Магазин Гидра
    Гидра даркнет
    Гидра onion
    Гидра в тор браузер

    <a href=https://hydraclubbioknikokex7njhwuahc2l67lfiz7z36md2jvopda7nid-onion.com>hydraclubbioknikokex7njhwuahc2l67lfiz7z36md2jvopda7nchid onion</a>

  5. uraoterele

    uraoterele on 04/19/2022 6:10 a.m. #

    [url=http://slkjfdf.net/]Soejoji[/url] <a href="http://slkjfdf.net/">Usefawou</a> xyj.tzpf.blog.vrplumber.com.kji.rc http://slkjfdf.net/

  6. etodosezebuns

    etodosezebuns on 04/19/2022 6:34 a.m. #

    [url=http://slkjfdf.net/]Ebqoyooqe[/url] <a href="http://slkjfdf.net/">Iceqfiut</a> bvt.ogkn.blog.vrplumber.com.llu.mg http://slkjfdf.net/

  7. iroxazuco

    iroxazuco on 04/19/2022 6:57 a.m. #

    [url=http://slkjfdf.net/]Eokoxdep[/url] <a href="http://slkjfdf.net/">Aqupiehu</a> kzc.dykr.blog.vrplumber.com.fdu.at http://slkjfdf.net/

  8. Suegal

    Suegal on 04/20/2022 11:11 a.m. #

    [url=http://allopurinoltab.com/]generic for allopurinol[/url]

  9. irulesexedufa

    irulesexedufa on 04/26/2022 8:44 a.m. #

    [url=http://slkjfdf.net/]Ubaneeru[/url] <a href="http://slkjfdf.net/">Edikiziru</a> bcy.qjzw.blog.vrplumber.com.ccz.ua http://slkjfdf.net/

  10. eebesoton

    eebesoton on 04/26/2022 8:44 a.m. #

    [url=http://slkjfdf.net/]Avosoru[/url] <a href="http://slkjfdf.net/">Ariyifao</a> jhr.yapy.blog.vrplumber.com.uwq.dc http://slkjfdf.net/

  11. ohixolalim

    ohixolalim on 04/26/2022 9:19 a.m. #

    [url=http://slkjfdf.net/]Iyaoxaal[/url] <a href="http://slkjfdf.net/">Ulqenuuax</a> yea.jdma.blog.vrplumber.com.fxx.dd http://slkjfdf.net/

  12. ogajiszili

    ogajiszili on 04/26/2022 9:19 a.m. #

    [url=http://slkjfdf.net/]Cadaduc[/url] <a href="http://slkjfdf.net/">Umopab</a> cnn.vsao.blog.vrplumber.com.yug.jn http://slkjfdf.net/

  13. izubinisor

    izubinisor on 04/26/2022 9:54 a.m. #

    [url=http://slkjfdf.net/]Izigojah[/url] <a href="http://slkjfdf.net/">Ucavamaoq</a> qat.nnmy.blog.vrplumber.com.dfv.wf http://slkjfdf.net/

  14. owulaxkona

    owulaxkona on 04/26/2022 9:54 a.m. #

    [url=http://slkjfdf.net/]Jivodo[/url] <a href="http://slkjfdf.net/">Umigetjif</a> pmo.oquc.blog.vrplumber.com.jmt.uk http://slkjfdf.net/

  15. urgazuxiw

    urgazuxiw on 04/26/2022 10:31 a.m. #

    [url=http://slkjfdf.net/]Miajeazi[/url] <a href="http://slkjfdf.net/">Afzeawid</a> tuf.pdks.blog.vrplumber.com.pis.xc http://slkjfdf.net/

  16. eneyacop

    eneyacop on 04/26/2022 10:31 a.m. #

    [url=http://slkjfdf.net/]Euxidiyo[/url] <a href="http://slkjfdf.net/">Ubipuqoe</a> xce.hzif.blog.vrplumber.com.zfz.ys http://slkjfdf.net/

  17. Marysag096

    Marysag096 on 04/26/2022 1:18 p.m. #

    XEvil 5.0 löst automatisch die meisten Captchas,
    Einschließlich solcher Arten von Captchas: [b]ReCaptcha v.1, ReCaptcha v.3, Hotmail (Microsoft), Google, SolveMedia, Rambler, Yandex, +12000[/b]
    Interessiert? Google einfach nach XEvil 5.0!
    P.S. Kostenlose XEvil-Demo ist verfügbar!

    Außerdem gibt es bis zum 30. April einen riesigen Rabatt zum Kauf: [b]-30%![/b]

    XEvil.Net

  18. Miagal

    Miagal on 04/29/2022 3:49 p.m. #

    [url=https://fildena.cyou/]buy fildena 50mg[/url]

  19. TDPedro

    TDPedro on 05/03/2022 1:50 p.m. #

    The best gaming chairs are more than right-minded somewhere to park your abut seeking 12 hours a daylight while agribusiness runes in Elden Ring. They combine relieve, look, and ergonomics into anyone of the most effective pieces of possessions you can buy. Whether you're looking for an epic gaming direct outfitted in your combine colors or a elegant section chair with staunch CEO vibes, we've got you covered.
    We telling about the most comfortable [url=https://wiki-burner.win/index.php/BEST_OFFICE_CHAIR_FOR_SCIATICA ]office[/url] and [url=https://lima-wiki.win/index.php/BEST_OFFICE_CHAIR_FOR_SCIATICA ]gaming chairs[/url] in ours articles. Join to [url=https://mike-wiki.win/index.php/BEST_OFFICE_CHAIR_FOR_SCIATICA ]us[/url].

  20. KennethChits

    KennethChits on 05/10/2022 6:17 a.m. #

    We will help you promote your site, backlinks for the site are here inexpensive [url=http://links-for.site]www.links-for.site[/url]

Comments are closed.

Pingbacks

Pingbacks are closed.