Does Go really not needed in frameworks? And if yes, what frameworks should I use?

Hello! Recently I read somewhere that Go does not need frameworks at all, so what is the reason to learn them, but to faster your work? And what frameworks are usually used in real projects in tech companies? I’m so confused right now…

As always, this depends. There is no typical “real project”, only projects with similar or different requirements. Some of these requirements may make it feasible to use a framework, others may not.

Start with the Go standard library.

1 Like

Excellent advice from lutzhorn. Go with the standard library.

There are lots of reasons to do that:

  1. You’ll learn the standard library, which is extremely good (in both quality and performance).
  2. Frameworks usually expand upon the concepts from the standard library, so even if you decide to use frameworks (later), it is better if you know the standard library already.
  3. The standard library always works with the version of Go you are using, since it is built into the Go release.
  4. If you use external libraries, you introduce additional dependencies:
    a) Can make writing your code trickier, since Go does not allow cyclical package dependencies.
    b) Can make compiling your code trickier (this is why Go modules were introduced).
    c) Quality of external libraries varies (some are really good, others, not so much).
    d) It’s not always obvious which versions of external libraries are compatible with which versions of Go.

More notes about learning Go:

Good luck.

Jeff Kayser

Do not resume only at standard library even it’s a good one. Complex applications needs many more things like routes, middlewares for authentication or sessions. You can’t achieve all those very easy without a decent framework or a toolkit. Personally I use Gorilla toolkit but are many good options like Echo, Gin and so on.

1 Like

I only use Go to program my own personal projects and have never worked with a team for Go development, so take this advice with a grain of salt, but I would suggest to use the standard library by default until you have a reason not to.

When you have a concrete scenario, e.g.:

I have problem A. I’m trying to use package X from the standard library but that has been difficult because of B and/or it causes issue(s) with C

I would recommend posting on this same community (or another like it) to ask “What should I try now?” People here will provide helpful answers like “I had that issue too and package Y fixes it,” or better yet, “Package Z in the standard library was built specifically to solve that!”

By trying to stick to the standard library, you make it easier for developers using your package to understand it so they’re both comfortable enough to use it in their own projects and/or more likely to contribute to your project because it’s based on the standard library.

However, when you really do need more than the standard library has to offer because your problem domain is outside of what the standard library solves, then it makes sense to find another library. Albert Einstein is attributed the following quote: “Everything should be made as simple as possible, but no simpler.”

1 Like

@rot13 I’m not sure I understand; is your point that knowing the language is only part of the job, and that you need to know libraries to be a more productive developer in a language? If so, I agree that you need to know libraries, but my point is that the standard library is powerful in Go. If you’re starting a new project and need to host a web site from it, I would still say start with the standard library until you have a reason to switch.

If you know ahead of time that you’re going to need something feature-rich, then using a library makes sense, but at the same time, if you don’t know exactly why you need a library, then how do you know you’re picking the right one? When someone asks “what web framework should I use for my new project?” It’s hard to provide a useful answer without knowing exactly what they’re doing. People answer based on their own experiences they’ve accumulated from projects that they’ve worked on, but it’s hard to know if that particular library will help the asker.

I still think the right way to do it is to use the standard library until you determine that it won’t work for you. Then when you ask the community what they suggest, you can provide background to the issue you’re having so they can provide relevant suggestions.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.