I had a shower thought about using NATS to offer an AWS IoT alternative that would implement the same device shadow topics to make migration easier, but also offer a way to make provisioning new devices much less complicated than to get further into bed with AWS products.<br><br><a href="/tags/nats/" rel="tag">#NATS</a> <a href="/tags/iot/" rel="tag">#IoT</a> <a href="/tags/golang/" rel="tag">#GoLang</a><br>
golang
<p>Did any <a href="/tags/go/" rel="tag">#Go</a> developers need code to get a zero value of a struct but without knowing the layout of the struct itself? </p><p>The only thing I could come up with was: </p><p>func zero[T any](v T) T {<br> z := &v<br> zz := reflect.ValueOf(z).Elem()<br> zz.Set(reflect.Zero(reflect.TypeOf(v)))<br> return *z<br>}</p><p>And see here an example of usage: <a href="https://go.dev/play/p/Aqzc_nRzOcP" rel="nofollow"><span class="invisible">https://</span>go.dev/play/p/Aqzc_nRzOcP</a></p><p>I needed it in order to get zero copies of random structs so I could test that some marshal/unmarshal functionality is a bijection.</p><p>Is this a decent way to do it? Are there alternatives?</p><p><a href="/tags/golang/" rel="tag">#golang</a> <a href="/tags/dev/" rel="tag">#dev</a></p>
Edited 158d ago
<p>One issue I'm noticing when learning Go is that the idiomatic nature of the language is making the learning process more difficult for me than C++ or C#. </p><p>With C++/C# you can focus on how to write code and then how to design code, but there is a very tight coupling of these concepts in Go that is taxing my brain and pretty much forcing me down the tutorial route, which I tend to struggle with compared to the language reference route.</p><p><a href="/tags/golang/" rel="tag">#Golang</a> <a href="/tags/go/" rel="tag">#Go</a> <a href="/tags/programming/" rel="tag">#Programming</a> <a href="/tags/softwaredevelopment/" rel="tag">#SoftwareDevelopment</a></p>
Edited 156d ago
<p>Sigh. I can fully understand why <a href="/tags/golang/" rel="tag">#golang</a> have given up trying to improve the language’s cluttered error handling syntax, but it’s still disappointing. <a href="https://go.dev/blog/error-syntax" rel="nofollow"><span class="invisible">https://</span>go.dev/blog/error-syntax</a></p>
If game devs can say "just use Unreal/Unity" to build games then I am always going to unapologetically say "just use Go and PostgreSQL" to build your backend.<br><br>I will die on this hill.<br><br><a href="/tags/gamedev/" rel="tag">#GameDev</a> <a href="/tags/unity/" rel="tag">#Unity</a> <a href="/tags/unityengine/" rel="tag">#UnityEngine</a> <a href="/tags/unreal/" rel="tag">#Unreal</a> <a href="/tags/unrealengine/" rel="tag">#UnrealEngine</a> <a href="/tags/ue/" rel="tag">#UE</a> <a href="/tags/golang/" rel="tag">#GoLang</a> <a href="/tags/postgresql/" rel="tag">#PostgreSQL</a><br>
Dropped some knowledge bomb on some new-ish Go folks with the interface implementation compile-time check hack.<br><br><p>var _ TheInterface = (*TheImplementation)(nil)<br></p>Minds were blown.<br><br><a href="/tags/golang/" rel="tag">#GoLang</a><br><br>
Edited 146d ago
<p>How the @#$% does <a href="/tags/hugo/" rel="tag">#Hugo</a> (static website generator) work with Github? Hundreds of pages reference <a href="/tags/github/" rel="tag">#github</a> but I still can't find how that works. Almost every Hugo help site says "add this reference to [a? your?] github repo..." but don't explain what the heck is happening or why I need that... why do I need a github repo to have a website somewhere else? </p><p>Clearly I don't need it; I have a hugo site up and running, and at no point was github involved.... except nothing would work until I initalized (?) my hugo directory (or the executable? IDK) on my webhost's server using a git command. For some reason.</p><p>I seriously don't understand why (or, more importantly, how) Hugo needs github. Right now dozens or hundreds of help sites seem like they're telling me that I need to have a shrine to my cat in my neighbor's house or else my blender won't work. </p><p>Lots of references to using github submodules and plenty of people saying "No! You fool! Don't do that!" and other people saying "Ackshully you should make your website a github module." Then other sites (including Hugo's official site) saying I should make my website into a <a href="/tags/go/" rel="tag">#go</a> module somehow for some reason... and I can't do that unless I have a github repo somewhere? Which is also maybe a Go module? Yet more sites saying I don't need to do that if I use some fancy scripts to fool something (my Hugo installation? My github repo? IDK) into thinking my Hugo site is or has a github repo...</p><p>If anyone would like to explain this to me like I'm literally 12 years old I'm very open to this. Every help site I've seen for weeks just assumes I understand some basic things that I don't remotely understand, like what the connection is between Hugo and github, how important it is, how it works, etc.</p><p>Understanding that I already have a functioning Hugo site, but apparently still need a github repo (maybe?) to do anything more interesting with it.</p><p>I know I'm using Mastodon as tech support a lot lately, but honestly y'all are more helpful than most search engines for some things.</p><p><a href="/tags/golang/" rel="tag">#golang</a> <a href="/tags/webdev/" rel="tag">#webdev</a> <a href="/tags/confused/" rel="tag">#confused</a> <a href="/tags/help/" rel="tag">#help</a> <a href="/tags/eli5/" rel="tag">#eli5</a></p>
🦣 Stegodon <a href="https://github.com/deemkeen/stegodon/releases/tag/v1.7.2" rel="nofollow">v1.7.2</a> brings vibrant 24-bit TrueColor support and smoother timeline performance! No more redundant reloads when switching views, plus better content sanitization and a handy spinner. <a href="/tags/stegodon/" rel="tag">#stegodon</a> <a href="/tags/fediverse/" rel="tag">#fediverse</a> <a href="/tags/golang/" rel="tag">#golang</a> <a href="/tags/tui/" rel="tag">#tui</a>
🦣 Stegodon <a href="https://github.com/deemkeen/stegodon/releases/tag/v1.8.0" rel="nofollow">v1.8.0</a> is here! This release upgrades to Charm v2 and fixes annoying text glitches for a smoother SSH experience. Ready to toot from your terminal? <a href="/tags/stegodon/" rel="tag">#stegodon</a> <a href="/tags/fediverse/" rel="tag">#fediverse</a> <a href="/tags/tui/" rel="tag">#tui</a> <a href="/tags/golang/" rel="tag">#golang</a>
🦣 Stegodon <a href="https://github.com/deemkeen/stegodon/releases/tag/v1.8.1" rel="nofollow">v1.8.1</a> is here! Fixed terminal flickering on Linux and added composite indexes for faster timeline queries. Your SSH-first fediverse experience just got smoother! <a href="/tags/stegodon/" rel="tag">#stegodon</a> <a href="/tags/fediverse/" rel="tag">#fediverse</a> <a href="/tags/activitypub/" rel="tag">#activitypub</a> <a href="/tags/tui/" rel="tag">#tui</a> <a href="/tags/golang/" rel="tag">#golang</a>
🦣 Stegodon <a href="https://github.com/deemkeen/stegodon/releases/tag/v1.8.2" rel="nofollow">v1.8.2</a> brings configurable SSH idle timeouts and migrates to wish v2 for a smoother terminal experience! More control and cleaner code. <a href="/tags/stegodon/" rel="tag">#stegodon</a> <a href="/tags/fediverse/" rel="tag">#fediverse</a> <a href="/tags/golang/" rel="tag">#golang</a> <a href="/tags/ssh/" rel="tag">#ssh</a>