tag:blogger.com,1999:blog-81106577545198298852024-03-13T20:18:19.144-07:00GoLang TutorialsSathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.comBlogger40125tag:blogger.com,1999:blog-8110657754519829885.post-20522362720816816272013-08-15T15:54:00.000-07:002013-08-15T15:54:30.932-07:00Installing and Configuring Go
Other topics in this series - Table of Contents
In preparation for a few beginner workshops, I created videos for people to follow to install and configure the Go development tools. Just adding them here.
On Mac OSX:
On Ubuntu Linux:
The steps that I've followed are pretty much this (with my username 'vj'):
Download the zip or .tar.gz file for your platform from https://Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com4tag:blogger.com,1999:blog-8110657754519829885.post-51805591656143657522012-09-07T09:11:00.001-07:002013-08-15T15:56:03.549-07:00Filtering AppEngine dev_appserver logs on unix bash
Other topics in this series - Table of Contents
Just a small post to make a note of something effective that I use. While working with the appengine, one often has to wade through lots of log statements, and having a lot of log statements is a good thing in my opinion. However, one can miss crucial information when the output isn’t very readable. I use the following command to filter and Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com3tag:blogger.com,1999:blog-8110657754519829885.post-53514193355848203772012-07-12T07:59:00.002-07:002012-07-12T14:50:38.076-07:00My favorite ideas in the Go ecosystem - a usability perspective
Other topics in this series - Table of Contents
At the Meet the Go Team session at Google I/O 2012, a question that brought a bunch of different responses from the main people working on Go was ‘What is your favorite Go feature?’. But I lie. The question was actually ‘What feature or design decision of Go had the most surprising effect on how code was written?’. Ken Thompson thought it wasSathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com2tag:blogger.com,1999:blog-8110657754519829885.post-44362814373412311862012-07-03T09:22:00.000-07:002012-08-06T02:50:36.681-07:00GoLang talks and tutorials - videos
Other topics in this series - Table of Contents
Google Dev, 2012: Getting started with Go, Andrew Gerrand
Boston GDG, 2012: A Tour of Go - interfaces, reflection, and concurrency. Builds a toy web crawler to demonstrate these, Russ Cox (Q&A page)
A Hangout, 2012: Building Go Apps on App Engine, Johan Euphrosine, Andrew Gerrand
Google IO, 2012: Go Concurrency Patterns, Rob Pike
Google IO, Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com1tag:blogger.com,1999:blog-8110657754519829885.post-80179160411576818032012-01-05T04:48:00.000-08:002012-04-13T12:09:17.819-07:00Jobs and opportunities in the Go world
Other topics in this series - Table of Contents
To assist those who are learning to also find available opportunities, I wanted to maintain a list of the early job postings. If you know of any other openings apart from this list or if any of these are not relevant any more, kindly let me know at sathishvj at gmail.com so that I may update this list.
Job Openings
Torbit is hiring!- http://Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com0tag:blogger.com,1999:blog-8110657754519829885.post-27391159761940519392012-01-01T13:53:00.000-08:002012-01-02T23:59:30.765-08:00Interfaces in Go - Part 2: Aiding adaptable, evolutionary design
Other topics in this series - Table of Contents
In discussing interfaces in the first post, I had started off with a familiar example from OOP - a Shaper interface and a couple of concrete shapes that implemented the interface. But as Rob pointed out in this this groups thread, "Go's interfaces aren't a variant on Java or C# interfaces, they're much more. They are a key to large-scale Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com17tag:blogger.com,1999:blog-8110657754519829885.post-68712944495859210142011-11-22T14:54:00.000-08:002013-05-01T20:49:37.666-07:00OAuth2: 3-legged authorization in a Go web application
Other topics in this series - Table of Contents
OAuth is currently the recommended standard for user authorization. I’ll limit this write up to just examples of using the OAuth standard with Google using Go. However there are a lot of good write ups on the web that explains the process well.
One of the major uses of OAuth is that a user can authorize your application, using a 3-legged Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com10tag:blogger.com,1999:blog-8110657754519829885.post-76278328780549998622011-11-18T15:41:00.001-08:002011-11-18T16:07:36.613-08:00Using an external api in a Go AppEngine program - urlshortener from Google APIsOther topics in this series - Table of Contents
This tutorial is almost exactly the same as http://golangtutorials.blogspot.com/2011/11/using-external-api-in-go-web-program.html, except that we will be doing the same program for the AppEngine. There are a few differences on how to make it work, so I shall, even at the cost of repetition for those who are coming directly to this page for Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com1tag:blogger.com,1999:blog-8110657754519829885.post-20193891610728729972011-11-18T12:07:00.000-08:002011-11-18T16:12:22.455-08:00Using an external api in a Go web program - urlshortener from Google APIsOther topics in this series - Table of Contents
In this tutorial, we will look at how to use an external API within our go program. The one that we shall use is the URL Shortener API. You can try its present functionality at http://goo.gl/. Enter a URL like http://golangtutorials.blogspot.com/ and you will see a shorter URL returned, which is much easier to embed, say, in a service like Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com6tag:blogger.com,1999:blog-8110657754519829885.post-25588486868901069632011-11-15T10:45:00.000-08:002012-06-30T10:05:10.397-07:00Go Templates - Part 3 - Template SetsOther topics in this series - Table of Contents
See also: Go Templates - Part 1
See also: Go Templates - Part 2
A template Set WAS a specific data type that allowed you to group together related templates in one group. Though it does not exist now as an individual data type, it is subsumed within the Template data structure. So if you now parsed a set of files that contains text within it Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com5tag:blogger.com,1999:blog-8110657754519829885.post-91030793064029908002011-10-31T16:03:00.000-07:002012-07-18T05:11:58.902-07:00gotest - unit testing and benchmarking Go programsOther topics in this series - Table of Contents
The Go installation that you have comes with a unit testing package called testing and a tool called go test that you can use to write unit tests. This unit testing framework, like frameworks in other languages, allow you to write any number of tests that you can run frequently to check the correctness of your code in small units. You can also Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com6tag:blogger.com,1999:blog-8110657754519829885.post-39231187627254222532011-10-30T20:11:00.000-07:002011-11-01T19:27:12.952-07:00Analysing a Google AppEnginge for Go programOther topics in this series - Table of Contents
In this section, we shall look at an existing demo program that we ran in the Installation and Setup tutorial. This will be a good place to start analysing and understanding Go programs for the Google AppEngine and will allow us to move on to larger programs of our own.
Directory Structure
The list of files under google_appengine/demos/Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com1tag:blogger.com,1999:blog-8110657754519829885.post-74774425749804104072011-10-30T05:17:00.000-07:002011-11-01T18:01:48.410-07:00Go packages and goinstall - creating and using your own packages in GoOther topics in this series - Table of Contents
For a small beginner’s introduction to packages you can read my other writeup: Go ‘Hello World’ - A line by line approach. In this tutorial we will look at how you can work with the goinstall tool to create, install, and use your own packages locally. goinstall has larger functionality than this alone and you can read more about it here: CommandSathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com5tag:blogger.com,1999:blog-8110657754519829885.post-43224046163117525632011-10-25T18:56:00.000-07:002012-06-30T08:59:29.171-07:00Go Templates - Part 2Other topics in this series - Table of Contents
See also: Go Templates - Part 1
See also: Go Templates - Part 3 - Template Sets
There is some documentation, which I consider inadequate, about the template packages at http://golang.org/pkg/text/template/ and http://golang.org/pkg/html/template/ - the html sub-package having additional security features against attacks like code injection and Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com1tag:blogger.com,1999:blog-8110657754519829885.post-43192581178970341432011-10-24T17:02:00.000-07:002011-11-01T18:02:55.523-07:00Google AppEngine for Go - Installation and Setup
Other topics in this series - Table of Contents
Setting up Google AppEngine for Go is real simple and can have you testing out functionality quickly. There are a few things that might be better to inform you early - they are simpler than setting up certain other development environments, so you might end up searching for complexity and ending up confused for not finding it.
A few things to Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com3tag:blogger.com,1999:blog-8110657754519829885.post-18166500351346362772011-06-24T08:22:00.000-07:002011-11-01T18:04:05.216-07:00Control structures - Go defer statementOther topics in this series - Table of ContentsThe defer statement allows you to designate specified functions to be executed just before returning from the current function block. Why would this be useful? In programming we often have to allocate/block/lock resources, but then the program abruptly ends in between and is unable to reach the part of the code where we un-allocate/unblock/unlock Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com5tag:blogger.com,1999:blog-8110657754519829885.post-73333481264317020342011-06-23T08:03:00.000-07:002012-10-03T23:17:22.393-07:00Control structures - Go switch case statementOther topics in this series - Table of ContentsThe switch statement may be considered a more powerful version of the if statement where multiple if-else blocks are replaced with a single switch and multiple case blocks. There are differences though between the two and we shall see them in some examples.
switch any expression of type T {
case any expression of same type T: { code to be Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com6tag:blogger.com,1999:blog-8110657754519829885.post-47196229710560732662011-06-22T07:16:00.000-07:002012-07-18T05:26:31.741-07:00Control structures - Go for loop, break, continue, rangeOther topics in this series - Table of ContentsThe for statement is the only available looping statement in Go. The generic statement definition is:
for "initialization statements"; "bool expression that has to evaluate to true"; "statements run prior to every loop except the first" {
//code to be executed if the boolean expression evaluates to true
}
Any of the parts of the for Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com6tag:blogger.com,1999:blog-8110657754519829885.post-8104833057118782362011-06-21T11:51:00.000-07:002011-11-01T18:05:39.253-07:00Control structures - Go if else statementOther topics in this series - Table of ContentsPrograms need to be able to take up different courses of action based on different situations - if you want to go to the beach turn left, or if you want to go the movies, turn right. The if else statement is a simple control structure. The general statement in Go is similar to:
if some_boolean_expression {
// execute this block if Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com1tag:blogger.com,1999:blog-8110657754519829885.post-33877771359353758512011-06-15T05:29:00.000-07:002012-07-19T02:20:21.134-07:00Multiple return values from Go functionsOther topics in this series - Table of ContentsGo allows you to have a function that returns multiple values. A function definition that returns three values would be defined similar to:
func SumProdDiff(i, j int) (int, int, int)
Since there is more than one return value, it is necessary to enclose it within parentheses. To return values from a function such as the above, you would have a Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com12tag:blogger.com,1999:blog-8110657754519829885.post-35155448791888883782011-06-14T08:03:00.000-07:002012-06-30T15:40:31.802-07:00Go TemplatesOther topics in this series - Table of Contents
See also: Go Templates - Part 2
See also: Go Templates - Part 3 - Template Sets
When a web service responds with data or html pages, there is usually a lot of content that is standard. Within that there needs to be modifications done based on the user and what has been requested. Templates are a way to merge generic text with more specific text. Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com18tag:blogger.com,1999:blog-8110657754519829885.post-53081989656636662662011-06-11T16:00:00.000-07:002012-07-19T15:09:07.523-07:00Web Programming with Go - first web Hello worldOther topics in this series - Table of ContentsIf you’ve already gone through some of the earlier tutorials in this series, you should be quite comfortable getting onto programming the web with Go. Let’s jump right to it and then we shall analyze the code. There is a chance that there might be people arriving here for the first time, so we shall also take some time to go over the basic conceptsSathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com19tag:blogger.com,1999:blog-8110657754519829885.post-80607420578179313462011-06-11T05:45:00.000-07:002011-11-01T18:07:26.868-07:00Channels in Go - range and selectOther topics in this series - Table of ContentsChannels and rangeThis is the second part of tutorial on channels in Go. If you haven’t yet gone through the first part, Channels in Go, please go through it now.
Receivers of data have a problem of knowing when to stop waiting for data. Is there more to come or is it all done? Should we wait or should we move on? One option is to constantly Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com13tag:blogger.com,1999:blog-8110657754519829885.post-11621395193038479382011-06-09T16:09:00.000-07:002011-11-01T18:07:47.320-07:00Channels in GoOther topics in this series - Table of ContentsGoroutines allow you to run a piece of code in parallel to others. But to employ it usefully, there are a few additional requirements - we should be able to pass data into the running process and we should be able to get data out of the running process when it is done creating it. Channels provide the way to do that, and they work alongside Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com18tag:blogger.com,1999:blog-8110657754519829885.post-38484885261593338062011-06-09T06:43:00.000-07:002011-11-01T18:08:36.643-07:00GoroutinesOther topics in this series - Table of ContentsGoroutines allow you to execute tasks in parallel - there are many connotations to the word ‘parallel’ in computing, so, take that with a pinch of salt. Parallel for example could mean the same program running on multiple hardware chips, on multiple machines, on multiple threads within the same machine, or multiplexed on the same thread. The Go Sathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.com6