Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ghostly is a simple, lightweight, and fast full-stack framework for Golang (github.com/dominic-wassef)
104 points by tomcam on Nov 12, 2022 | hide | past | favorite | 57 comments


Slightly off-topic question. What are you using to do the rendering and validation of forms in a "Django like" way in Go? I have a half-backed system build using the ideas coming from Django but I wonder if something a bit more robust exists.

My impression is that more and more people are just submitting forms a JSON through an heavy weight app to an API end-point and less people are using forms "the old way". So, if some "old people" have some pointers for another "CGI old dev", I would really enjoy them!


One nice thing about submitting forms the "old way" is that they work even when JS is disabled. Not many people care about that, however.


I use Echo with Jet and some 20-lines JS code to POST JSON to an Echo handler on form submit.


Are there any examples of things built with Ghostly?


Looks good, will have to try it. What are the competitors to this? I ask because I want to do my next side project in go.


Just start with the standard library and you will be OK, in Go there is rarely a _need_ for some kind of framework to get going as I assume it is in JS.


Check the "awesome go" repository: https://github.com/avelino/awesome-go. You could look under ORM and Web Frameworks.


Labstack Echo, buffalo, gorilla, and gin gonic.

I prefer https://gofiber.io the most.

There are many more, too.


You really don't need a framework in Go, and probably shouldn't start with one


Have you already seen Buffalo? https://gobuffalo.io/


I currently use Echo, Jet for templating and Air for automatic reloads.


I’m using Echo which work pretty good with SPA like Vue 3.

Wish I could find job opportunity to utilise these.


I work with go for years but never used a fw. At the beginning when i came from php, i looked for fw because that was how things were done. But once i let go of that idea and started making things by hand i never looked back. Go really does not need a framework. Sooner or later it starts to limit you. For example i used grpc a lot in the past but came to realize it was hindrance and now i just use proto files to define schemas and generate the structs but that's is all it does. Everything else is hand-made. I even moved away from SQL abstraction and just use sql and directly. Again, sooner or later there will be some limitation that will bother you and so it is just not worth it. And being able to tailor-made every part of the application for its desired purpose is priceless.


Same here. It doesn't work in Golang world. I stopped using ORMs (especially GORM), realized it's completely incompetence in generating SQL queries. It doesn't worth it, just another bounds.


The readme doesn't seem to mention or list what libraries this depends on, it has chi and jet at least based on the structs section.

Given this "framework" is predominantly a collection of other people's (usually apache/mit) work, where is the BOM/licence text including all of the dependencies?

And why has the author attempted to licence their likely sub 100 lines of glue code under the GPL?

I don't see the point in using something like this which is basically a prefilled go.mod with some other files with a pretty stock organization.

I've used Pagoda (https://github.com/mikestefanello/pagoda) in the past which makes a show of displaying its nature as a wrapper around a bunch of community libraries, and is documented as such. They also make effort to document the interfaces for each component so you could easily replace them with your own implementations to avoid getting stuck due to the "framework". This is my preferred approach for all of these "starters" now since using pagoda.


Seems a bit harsh.

The BOM of Golang, which you know, is easily found:

https://github.com/Dominic-Wassef/ghostly/blob/main/go.mod https://github.com/Dominic-Wassef/ghostly/blob/main/go.sum

I suspect most library authors who are happy with others using their work, are probably somewhat okay with the standard file pointing to their original work as attribution.

It's also a bit more than 100 glue code.

Last paragraph is a good though. :)


"I suspect ... are probably somewhat okay ..."

This is not an argument against what he said.


classic hacker news comment. demean the work as if it’s beneath you. i know you know enough github to see this is more than 100 lines of glue code. why even comment if only to shit on someone’s work? want to share pagoda? submit a link for it


I'll be honest, the "full documentation" just being generated API docs isn't great.

Just show me how you use it, damnit.


In Go world, most libraries and frameworks come with documentation like that. I so miss being a Python dev


In the Python world, most docs give a couple of usage examples but no type information (at best it will usually tell you that an argument is “a file-like object” with no information about what “file-like” methods are required). Moreover, Sphinx just renders everything onto one giant page so you have no idea which class a given method belongs to without doing a bunch of error-prone scrolling (sqlalchemy was the worst because every class had the same method names).

I will take Go docs all day, every day over Python docs.


Yeah, Python docs are crap, PHP docs are the gold standard IMO (although Julia's docs are pretty frosty too. (I don't know anything about Go's docs.))

(I am not joking. I am not trolling. I love Python, but the documentation is mostly like notes taken by a distracted teenager.)


I’ll take the Go doc over Python documentation any day. Python docs are really worst in class, completely unreadable and useless when you want to do anything precise.


This having the GPL license is an interesting choice. If I understand licenses correctly (I am not a lawyer), integrating this into your code, will instantly cause your website's source code to become open source.

That seems like a non-starter for almost every major usage, to me.


My understanding is that this is true only if you distribute your executables which most people don't do for server-side code.


IANAL. I think that your assessment is correct in the consequences but not in the letter: your source code does become GPL but if you don't distribute the binary and only use it on your servers nobody is entitled to ask you the source code. That would happen with the AGPL license.

Same thing if you make changes to Ghostly itself and don't distribute the binary. Those changes are GPL but you can keep them to you.

If you are working for customers and the IP of the software is yours but the servers are theirs, that is an act of distribution and the source code must be available. For sure customers can ask for it because binaries are distributed to them, maybe everyone else can ask it too. This is the same as GPL code on set top boxes or other devices.

If the contract states that the IP belongs to the customer, the source code is theirs but nobody else is entitled to ask for it because there is no distribution.


This is not the case for backend applications. The license you want to be aware of that does this to backend services is the AGPL. Which indeed for some is a non-starter.


Linux is under GPL. Running your website on Linux doesn't force you to open its sources.


Linux isn't compiled with your application inside it, that's why I had pause


The GPL is very clear when it states "For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received."

This has nothing to do with compiling things.


https://en.wikipedia.org/wiki/GPL_linking_exception

> The Free Software Foundation states that, without applying the linking exception, a program linked to GPL library code may only be distributed under a GPL-compatible license. This has not been explicitly tested in court, but linking violations have resulted in settlement.

So yes, what constitutes "copies of such a program" does include how it's been compiled/linked.


FUD. Nothing wrong with GPL. GPL might "protect" the user by granting them certain rights.


It doesn't even explain it's a web(?) framework. Just "full-stack framework".


Full-stack implies web. It's both halves of the front-end and back-end.


Full-stack implies hardware. It's everything from the hardware up to the application layer.

It's very easy to redefine arbitrary terms to suit the needs of the moment.


You are pedantically wrong, the worst kind of wrong. Sorry for the snark.


I'm not sure what the value of a "framework" is in Go.


Go isn't polymorphic enough as a language to achieve something akin to JEE, Rails, Django or Laravel, so these "go frameworks" will have hard time encapsulating the complexity of underlying libraries they might use. All the former use either an IoC container, or their own flavor of "module loading". This is absolutely not practical in Go.

Of course, dependency injection is possible, explicitly, but can hardly be generalized an efficient way, so the plumbing will always be explicit, because the underlying lib types will always leak.

So it's not so much that there is no value in frameworks in Go, it just hard to write actual web frameworks in that language that would be useful.


Go interfaces are the best form of dependency injection :)


>Go isn't polymorphic enough

Can you elaborate?


What's the best way to learn Go these days? Any recommended books?


Learning Go by Jon Bodner is a great introduction.

Learn Go with tests helped me a lot too: https://quii.gitbook.io/learn-go-with-tests/



While I don't get to use Go much these days, this is still one of the best programming books I've read.

I just wish they'd create a 2nd edition...


I used the docs, the excellent https://gobyexample.com and Google mostly.


If you know Java, C++ or C#, the official tour will get you productive pretty quickly IME.

https://go.dev/tour/welcome/1


I'll shamelessly plug my course: https://boot.dev/learn/learn-golang


Check out the recommendations in the "Thirteen Years of Go" thread.


Here's the comment where people posted their recommendations.

https://news.ycombinator.com/item?id=33560306

To summarize:

- The tour - https://go.dev/tour/welcome/1

- Effective Go - https://go.dev/doc/effective_go

- Go by Example - https://gobyexample.com/

- The Little Go Book - https://www.openmymind.net/The-Little-Go-Book/

- "The Go Programming Language" by Alan A.A. Donovan and Brian W. Kernighan

- Go 101 - https://go101.org/


Great list, thank you!


Idiomatic Go approach - https://go.dev/doc/effective_go


Are you serious, frameworks similar to Iris gone? And we now have to use this?


The project with 3 stars which was written in a month? You certainly don't have to use it.


Here we go again, yet another wannabe code it like it's Ruby or Python. Frameworks are useless in Go!


Why?


The equivalent of a framework in go is the standard library itself


it's not considered idiomatic Go to use frameworks, the stdlib provides everything.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: