Golang News http://golangnews.com Jobs, Code, Videos and News for Go hackers - everything about the go programming language Wed, 06 Feb 2019 19:13:00 +0000 Deploying go with docker to heroku 5 points posted by kenny https://mycodesmells.com/post/deploying-go-with-docker-to-heroku 3783 Tue, 29 Jan 2019 15:02:00 +0000 My "aha!" moment - Accept interfaces return struct in go One of the first things I've learned when starting working with Go was that it has so-called <em style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Open Sans"; font-size: 17.5px; text-align: justify; background-color: rgb(255, 255, 255);">proverbs</em>. They are a list of rules, which sound like some smart quotes, which should guide you during your journey. For a long time, I didn't quite understand why I should <em style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Open Sans"; font-size: 17.5px; text-align: justify; background-color: rgb(255, 255, 255);">accept interfaces but return structs</em>. I wanted to return interfaces as well since this would define what my return type does, not what it is exactly. It struck me almost a one full year or working with Go exclusively, how wrong I was. This post explains my line of thought, I hope it might save some of you sometime before you have your <em style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Open Sans"; font-size: 17.5px; text-align: justify; background-color: rgb(255, 255, 255);">Aha!</em> moment. 5 points posted by slomek https://mycodesmells.com/post/accept-interfaces-return-struct-in-go 3221 Mon, 05 Mar 2018 21:54:00 +0000 Introducing slomek/mappy for easy map <-> struct conversion A blog post describing how you can define and handle custom struct tags, plus the introduction of <a href="https://github.com/slomek/mappy">slomek/mappy</a> a tool that converts string maps to structs and vice versa.<br> 3 points posted by slomek https://mycodesmells.com/post/go-struct-tags-with-mappy 3178 Sun, 11 Feb 2018 21:14:00 +0000