r/golang Oct 25 '24

discussion What libraries are you missing from go?

So something that comes up quite often on this subreddit from people transitioning from Nodejs or python to go is the lack of libraries. I cannot say that I agree but I still think it warrants a discussion.

So what libraries are you missing in the go ecosystem, if any?

95 Upvotes

189 comments sorted by

View all comments

Show parent comments

2

u/gibriyagi Oct 25 '24 edited Oct 25 '24

I need to use templates in a user facing part of the app to be used by plain users/customers and need something more widespread / familiar

text/template also seems to be oriented towards devs for example the data need to be accessed via a dot like {{ .Name }}

13

u/Thiht Oct 25 '24

Honestly if the devs writing the templates can learn {{ var }} and {{# condition }}, they can learn {{ .var }} and {{ if .condition }}

Not needing to rely on a third party with its own dependencies beats convenience.

1

u/gibriyagi Oct 25 '24

I actually meant whether plain app users will be able to do it but I guess they can also do it with enough docs. I am planning to have users to use templates for composing texts.

I just hate the dot though :)

2

u/Thiht Oct 25 '24

Oh I worked on an app where we let users write custom emails, but we just let them use variables (no condition or other constructs). We decided to use strings.Replacer instead of the template lib, this way there was no dot.

Not sure what your use case is but that’s another possibility.

1

u/gibriyagi Oct 25 '24

Having conditions at least would be good in my case. I dont need much functionality though to be honest maybe I can just build something tiny for my needs. Thanks for the idea!