text
stringlengths
0
1.82k
**Brian Ketelsen:** Yes.
**Erik St. Martin:** I think he abstracted those out of that, because people had kind of similar needs. I love some of that stuff, like Viper with being able to do the subcommands, and things like that. Soo much easier when you have some command line utility that just has a crap ton of functionality, you have to hide a...
**Brian Ketelsen:** Yeah, those repos are at github.com/spf13/cobra, /viper, /hugo, /pflag... I know them all really well.
**Carlisia Thompson:** I don't think there is anybody as prolific as Steve out there.
**Brian Ketelsen:** Nope. That's good stuff too, and it's funny because I've talked to several projects that were writing command line apps, and they've started with no command line-enabling libraries and then they moved to something else, and everybody ends up on Cobra, because it's just the nicest interface for writi...
**Carlisia Thompson:** Yup.
**Brian Ketelsen:** You get all these free opinions on this podcast. It's crazy. \[laughter\]
**Travis Reeder:** I gotta throw in one more project that I think is pretty good. It's the Gin Web Framework, or API framework. It seems to me it's the best one for Go so far that I've found. It gets rid of so much code, and makes everything so much easier.
**Brian Ketelsen:** Yeah, and keeps it readable. That's the trick. You can't lose readability when you're writing those big web apps, and Gin does a good job, I agree.
**Erik St. Martin:** Yeah, I think I've been through almost all of them at one point or another, and I can't decide. There's things I love about each, and there's things I hate about each. I feel like I'm going to hate web frameworks forever.
**Brian Ketelsen:** Well you know, my code generation fetish means that I have to be a goa fan. So it's goa for me and nothing else in terms of web apps. I had to get that plug in there.
**Erik St. Martin:** And I have to be fair as much as Brian tries to beat it into me, I have yet to play with goa.
**Brian Ketelsen:** \[laughs\] One day...
**Erik St. Martin:** Hey, I said the same thing - how long does it take me to convert you to Vim?
**Brian Ketelsen:** Years. But now I haven't looked back, so I think you need to trust me on goa, too.
**Erik St. Martin:** One of these days, when I have a ton of free time, right?
**Brian Ketelsen:** Exactly.
**Carlisia Thompson:** There you go, Travis, you need to try goa, and then you'll let us know.
**Travis Reeder:** Okay, I'll check it out.
**Brian Ketelsen:** You can be the objective 3rd party. Come back and tell us what you think about code generation when it comes to API development. We'll put you on the show and you can tell us what you think.
**Erik St. Martin:** Yeah. For Travis and for everybody listening who's not already familiar with goa, basically it's... Brian could probably describe this better, but it's a DSL for kind of describing your API, and then it generates the actual implementation.
**Brian Ketelsen:** Yeah. Which from my perspective, just describing your API - the idea behind goa was that you had to spend, you had to invest that time describing your API well, and then it generated an API for you, which I thought was good. I really liked the whole idea of code generation, and single source of trut...
**Carlisia Thompson:** That's what I was going to say... When you've been programming for a while and you used those old code generation tools, you kind of get burned and never try them again. I have a hard time trusting... I trust you, but just like you said about something else earlier - I have to see it to believe i...
**Brian Ketelsen:** Thank you, by the way, I did the website. The code generation will create a Swagger JSON file for you so that you can use any of the Swagger tools to provide API docs, which I think is really awesome. So you get both the Swagger schema and the JSON schema, that you can use as the documentation for y...
**Carlisia Thompson:** Get out!
**Brian Ketelsen:** Lots of code generation there.
**Travis Reeder:** Get out... \[laughs\]
**Brian Ketelsen:** My motto for 2016 is 'Generate all the things'.
**Carlisia Thompson:** Wow.
**Erik St. Martin:** Alright, I think I'm gonna have to play with that this weekend. \[laughter\]
**Travis Reeder:** So you actually define the... It looks like you define the API in Go code?
**Brian Ketelsen:** It's Go code, but if you're familiar with - what's that testing framework that is...
**Erik St. Martin:** Ginkgo?
**Brian Ketelsen:** Is it Ginkgo? Yeah, so there's a testing framework, and I think that was the inspiration for the Go DSL. It looks like a DSL, it really truly is Go code, but it uses a lot of anonymous functions to make it look like a DSL. So that's what you write, you write this DSL that describes your API, you des...
**Carlisia Thompson:** How about tests? Does it generate tests as well?
**Brian Ketelsen:** I haven't seen it yet, but I think just yesterday or the day before somebody merged in something that generates tests as well.
**Erik St. Martin:** It's interesting, because you kind of pointed out the number of anonymous functions that it uses to do this DSL, but if you look at any other language that's for DSL that's basically what they do too. So people commonly do DSLs in Ruby, but what do they use for that? They use blocks, right?
**Brian Ketelsen:** Yeah, it's all the same. And people get hung up, especially when they see goa for the first time; when they look at that DSL, there's... We use dot imports to make the DSL look prettier. Dot imports are the end of the world in Go, but it's the DSL; the code that's generated doesn't use dot imports, ...
**Erik St. Martin:** Yeah, and that's just to generate your code, right? The code that gets generates is idiomatic, so...
**Brian Ketelsen:** Correct.
**Erik St. Martin:** Now, you've been working on an extension to this for generating ORM communication.
**Brian Ketelsen:** That's right. One of the first things I did after I saw goa was say "Well, if we can build an API, why can't we build the database layer, too?" So I played around with a couple different Go database access layers and finally settled on GORM, for being the one that's the least evil in terms of ORMs. ...
**Erik St. Martin:** How's that measured anyway?
**Brian Ketelsen:** It's measured in how much crazy stuff it does behind the scenes that you don't expect. As far as GORM goes, it's almost no crazy stuff. I think we've all - on this show at least - done active record in the past and been shocked by the 38 queries that happen when you make one select statement. GORM d...
**Erik St. Martin:** That's awesome. I'm definitely gonna have to play with it.
**Brian Ketelsen:** There's a YouTube video on my YouTube channel - that's either bketelsen or brianketelsen, I can't remember which, but there's a YouTube video of me talking at the Tamp Go meetup, that's about an hour and a half long, and I do a end-to-end demo of goa and GORMA, and then I load-test it at the end jus...
**Erik St. Martin:** If I watch that video, does it count as playing with it?
**Brian Ketelsen:** Yes.
**Erik St. Martin:** Alright, alright. I'll give you that much. I'll at least watch the video this weekend.
**Brian Ketelsen:** There you go.