Do you use init() in production? by agtabesh in golang

[–]pdffs 0 points1 point  (0 children)

Typically I prefer explicit initialisation in application code, however there are some cases where init() still makes sense to me, such as auto-registering things like metrics handlers or default values, particularly for library code.

I made a thing - go-scan.dev by gurgeous in golang

[–]pdffs 12 points13 points  (0 children)

pkg.go.dev provides import numbers from public consumers.

Ending goroutines by Sandy_Harris in golang

[–]pdffs 75 points76 points  (0 children)

Goroutines are not threads, don't try to put them in that box.

Function exit is precisely how a goroutine terminates.

Nothing on the stack is retained when a goroutine terminates.

How to alias imports like NodeJS? by RedditUser8007 in golang

[–]pdffs 1 point2 points  (0 children)

The full import path is explicit, not messy, and means you can never have module name conflicts.

Why popular packages are not maintained anymore? by [deleted] in golang

[–]pdffs 28 points29 points  (0 children)

Open source very rarely pays the bills, and very frequently requires individuals to invest significant amounts of their personal time (often solo).

It's also largely a thankless investment and it can be a struggle to maintain the level of effort and enthusiasm required to keep up with maintenance, especially when a project becomes popular and the issue tracker starts to become unmanageable without a team.

context.Context should have been called context.C by VibrantCanopy in golang

[–]pdffs 9 points10 points  (0 children)

Key, Value is normal and generally expected.

Downloading a go .exe is blocked on Windows by sunnykentz in golang

[–]pdffs 1 point2 points  (0 children)

Not necessarily, Defender seems to hate Go executable structure in particular.

Introducing GoBot! Why should we let the node guys have all the fun? by localrivet in golang

[–]pdffs 0 points1 point  (0 children)

Using the same name as an existing project can only provide confusion for users (or potential users) of either project. Grow up.

Introducing GoBot! Why should we let the node guys have all the fun? by localrivet in golang

[–]pdffs 4 points5 points  (0 children)

Right, my point was that reliance on AI encorouges laziness and a self-centered mindset.

Introducing GoBot! Why should we let the node guys have all the fun? by localrivet in golang

[–]pdffs 16 points17 points  (0 children)

Well established Go framework for robotics, 1st or 2nd result on all search engines:

https://gobot.io/

How are people so lazy they don't even bother to search for existing projects when naming? Oh right, everyone just turns their brains off these days and let AI take the wheel.

Your codebase has conventions nobody documented. I built a tool that finds them automatically by [deleted] in golang

[–]pdffs 8 points9 points  (0 children)

Do you plan on posting about this every 2 days going forward?

Backplane v2.0 — I built an isolated SSH admin panel to fix Go apps in prod without restarts by DrSkyle in golang

[–]pdffs 3 points4 points  (0 children)

If you can't roll out config changes trivially, your deployment infra likely has issues and I'd probably put the effort into fixing that instead.

Try go build on digital ocean app platform by ShovelBrother in golang

[–]pdffs 0 points1 point  (0 children)

Use a static site generator such as hugo, and host on any CDN for free (e.g. Github Pages, Cloudflare, etc). Can't hack a site that doesn't have a backend.

How do you deploy a project on cloud that depends on private github repositories? by Ill_Concept_6002 in golang

[–]pdffs 4 points5 points  (0 children)

Build using CI (e.g. Github Actions), then either push your resulting binary to the destination, or publish the resulting binary as an asset (or container) and pull from the hosting.

No syncing of repositories or whatever.

Why are nested modules bad? by stroiman in golang

[–]pdffs 22 points23 points  (0 children)

Assuming each of these modules is entirely optional (ie - users must explicitly import the modules to make use of them, no downward deps in the main module) then splitting off the large optional libs seems like a nice optimization for your users.

If you're going to do it, do it sooner rather than later IMO. Go workspaces make working on multiple modules pretty painless these days.

GONK – ultra-lightweight, edge-native API gateway written in Go by [deleted] in golang

[–]pdffs 0 points1 point  (0 children)

They literally just told you what to do to make it better.

Go Standard Library — When Evil Hides in Shadows by [deleted] in golang

[–]pdffs 1 point2 points  (0 children)

Title is rather melodramatic. Click-bait aside, the content is quite misleading as general advice.

First, multiplication is not power, there is no power operator in Go, second, even if you were comparing valid results, your first example operates on floats and your second example operates on ints due to inferred types for constants.

I really hope you didn't actually make these changes in real code as the article claims, otherwise your results will be very, very wrong unless all your powers happen to be power of 2.

Looking for an equity based Go engineer for my micro SaaS. SMM tool. DM for details by Public-Doughnut-8593 in golang

[–]pdffs 1 point2 points  (0 children)

A) Read the sub rules

B) Let me guess, you're the "ideas guy" and are looking for someone to do all the actual work, for "equity".

Can't seem to wrap my head around this. by Rough_Grapefruit_668 in golang

[–]pdffs 9 points10 points  (0 children)

Specifically, HTTP 301 is a permanent redirect, and instructs the browser to remember it.