News for hackers. Stuff that matters.
Re:Web Development in Go by meow_mix on Monday April 10, 2017 @02:13PM (#14081104)
How good are the ORMs options in Go? One of the reasons Rails is my go-to for web development is how easy Active Record it makes configuration and changing databases.
Re:Web Development in Go by znq on Monday April 10, 2017 @02:23PM (#14081187)
We've started building Bugfender using GORM and it was good for the initial job, but we now decided to remove it completely and continue on a lower level.

We've summarized our whole experience with Go here: https://bugfender.com/one-year-using-go and we're just wrapping up another blog post with the Go pros and cons (from our point of view), which should be out soon as well.

The biggest problem with go is, that it is still a very fast and changing ecosystem. Which is great for a new language, but didn't serve us too well for building something stable.

Re:Web Development in Go by sagichmal on Monday April 10, 2017 @04:54PM (#14082458)
In which universe is Go a part of a fast-changing ecosystem? It certainly isn't this one! The Go language abides a strict compatibility guarantee. Libraries, perhaps due to the poor dependency management situation, tend more than other language ecosystems to avoid breaking changes, or at least hide them behind different import paths. Go has arguably the least dynamic, most boring ecosystem among popular languages today!
Re:Web Development in Go by inimino on Monday April 10, 2017 @10:04PM (#14084300)
Compared to Java or PHP? Or did you mean "trendy" rather than popular?
Re:Web Development in Go by sagichmal on Tuesday April 11, 2017 @12:08AM (#14084777)
Yes, controlled for age, I think Go is even more static and boring than Java or PHP.
Re:Web Development in Go by inimino on Tuesday April 11, 2017 @02:06AM (#14085243)
I don't know much about the Go ecosystem but this makes me want to try it. You can't really control for age though... how does it compare to Rust in terms of stability (a language of similar age and scope)?
Re:Web Development in Go by sagichmal on Tuesday April 11, 2017 @06:54AM (#14086506)
Vastly vastly more stable. Incomparable; night and day.
Re:Web Development in Go by kevinburke on Monday April 10, 2017 @02:16PM (#14081122)
I'm not a big fan of Active Record (https://kev.inburke.com/kevin/faster-correct-database-querie...) and tend to just write queries by hand. The benefit of this is you can Prepare them, which alerts you to syntax errors earlier and means the database doesn't have to parse the query each time you execute it.

You also don't need to return every column if you know you only need an email address.

I know people that have had success with gorm or sqlx.

Re:Web Development in Go by bsaul on Monday April 10, 2017 @02:24PM (#14081192)
Imho, not good. They feel like a hack.

It's the main reason i wouldn't use go for building a webapp that needs to discuss with a moderately large sql backend.

Re:Web Development in Go by nzoschke on Monday April 10, 2017 @02:23PM (#14081180)
This weekend I played with the Buffalo framework [1] which includes "pop" [2] which an ORM of sorts.

I really enjoyed working with both. It's nowhere near as magical as Rails, but it totally reduced the amount of code/boilerplate I needed to set up databases, migrations and to get Go "model" structs to and from the database.

[1] http://gobuffalo.io/docs/getting-started

[2] https://github.com/markbates/pop

Re:Web Development in Go by segmondy on Monday April 10, 2017 @02:22PM (#14081176)
How many times have you changed databases in your production apps or are you building and selling software and wanting users to be able to pick their own database?
Re:Web Development in Go by ksubedi on Monday April 10, 2017 @02:35PM (#14081274)
I don't think that is the only reason to use ORM's. They definitely help me be more productive while building apps where super-high performance is not an issue.
Re:Web Development in Go by deckiedan on Tuesday April 11, 2017 @02:58AM (#14085472)
I really like the flexibility of being able to swap around dbs during initial development. At some point along the way once almost the whole major systems are working, I'll need to decide if I need FTS, sharding, to work on a shared host that already has MySQL / interact with a wordpress site, etc.
Re:Web Development in Go by frik on Tuesday April 11, 2017 @01:12AM (#14085032)
You are coming from the opposite side. Go is leaner, like Nodejs and PHP can be used without any frameworks as batteries are included.

Asking for ORM means you are comfortable in your framework world. You will have to adopt, if you want to go a leaner way, with direct SQL or NoSQL API. Or find an ORM library (but learn about pro/cons).