A

Ardan Labs Blog on

Recent content in Ardan Labs Blog on

Concurrency, Goroutines and GOMAXPROCS

29 Jan 2014

Introduction When new people join the Go-Miami (http://www.meetup.com/Go-Miami/) group they always write that they want to learn more about Go’s concurrency model. Concurrency seems to be the big

Decode JSON Documents In Go

21 Jan 2014

Introduction We are working on a project where we have to make calls into a web service. Many of the web calls return very large documents that contain many sub-documents. The worst part is, we

Be Selected To Attend GopherCon 2014

16 Jan 2014

Gopher Academy announced (http://blog.gopheracademy.com/scholarship-for-women) a great program today. Today I’d like to announce the GopherCon Scholarship Program. It’s goal is to increase the

Go Package Management For 2014

16 Jan 2014

Introduction In October 2013 I sent out a call to action to the Go community. I wanted to form a group of Gophers that would come together and help write a specification and build a working

Macro View of Map Internals In Go

31 Dec 2013

Introduction There are lots of posts that talk about the internals of slices, but when it comes to maps, we are left in the dark. I was wondering why and then I found the code for maps and it all

Queue Your Way To Scalability

20 Dec 2013

Introduction The first thing I did when I started programming in Go was begin porting my Windows utilities classes and service frameworks over to Linux. This is what I did when I moved from C++ to

Three-Index Slices in Go 1.2

17 Dec 2013

With the release of Go 1.2, slices gained the ability to specify the capacity when performing a slicing operation. This doesn’t mean we can use this index to extend the capacity of the underlying

Sample Web Application Using Beego and Mgo

11 Dec 2013

Introduction I am very excited about the Beego web framework. I wanted to share with you how I use the framework to build real world web sites and web services. Here is a picture of the sample

Building A Weather App Using Go

10 Dec 2013

At Ardan Studios (http://www.ardanstudios.com/) we have spent the last 6 months, in our spare time and on weekends, building a consumer based mobile application called OutCast

Write Your Go Programs Using GEdit

23 Nov 2013

This is a guest post from Tad Vizbaras from Etasoft (http://www.etasoft.com/) in South Florida. There are a number of editors and IDEs for Go development. LiteIde, Vim, Emacs and GEdit just to

Label Breaks In Go

21 Nov 2013

Have you ever found yourself in this situation. You have a case statement inside of a for loop and you would like to break from both the case and for statements in a single call? var err error

Using The Log Package In Go

5 Nov 2013

Linux is unique to Windows in many ways, and writing programs in Linux is no exception. The use of standard out, standard err and null devices is not only a good idea but it’s the law. If your

Using XSLT With Go

3 Nov 2013

I am working on a project that requires pulling and processing different XML feeds from the web and storing the data into MongoDB as JSON. Since new feeds come up everyday, changing the Go program to

Manage Dependencies With GODEP

26 Oct 2013

Introduction If you are using 3rd party packages, (packages that you don't own or control), you will want a way to create a reproducible build every time you build your projects. If you use 3rd party

My Channel Select Bug

17 Oct 2013

I was testing new functionality on a program that is already running in production when suddenly the code behaved very badly. What I saw shocked me and then it became obvious why it happened. I also

Functions and Naked Returns In Go

10 Oct 2013

In Go values that are returned from functions are passed by value. Go gives you some nice flexibility when it comes to returning values from a function. Here is a simple example of returning two

Cross Compile Your Go Programs

2 Oct 2013

Introduction In my post about building and running programs in Iron.Io (https://www.ardanlabs.com/blog/2013/09/running-go-programs-in-ironworker.html), I needed to switched over to my Ubuntu VM to

Go Package Management Call To Action

1 Oct 2013

Nathan Youngman, with the help of others, has produced this document outlining months of research and discovery. I would appreciate everyone to honestly read it before continuing with my post.

Detecting Race Conditions With Go

26 Sep 2013

I always find it interesting when I realize that something I have been practicing or dealing with for a long time has a name. This time it happens to be race conditions. This is something you can’t

Recursion And Tail Calls In Go

26 Sep 2013

This article was written for and published by Gopher Academy (http://www.gopheracademy.com/) I was looking at a code sample that showed a recursive function in Go and the writer was very quick to

Iterating Over Slices In Go

23 Sep 2013

Slices are used everywhere in my code. If I am working with data from MongoDB, it is stored in a slice. If I need to keep track of a collection of problems after running an operation, it is stored in

Pool Go Routines To Process Task Oriented Work

14 Sep 2013

After working in Go for some time now, I learned how to use an unbuffered channel to build a pool of goroutines. I like this implementation better than what is implemented in this post.  That being

Slices of Slices of Slices in Go

10 Sep 2013

I am working on building code to load polygons for the different Marine Forecast areas in the United States. These polygons need to be stored in MongoDB and there is a special way that needs to be

Running Go Programs In IronWorker

7 Sep 2013

Introduction Iron.io has a product called IronWorker which provides a task oriented Linux container that you can run your programs inside. If you are not sure what I mean, think of this as having a

Timer Routines And Graceful Shutdowns In Go

4 Sep 2013

In my Outcast data server I have several data retrieval jobs that run using different go routines. Each routine wakes up on a set interval. The most complex job is the downloading of radar images.

Using CGO with Pkg-Config And Custom Dynamic Library Locations

31 Aug 2013

Earlier in the month I wrote a post about using C Dynamic Libraries in Go Programs (https://www.ardanlabs.com/blog/2013/08/using-c-dynamic-libraries-in-go-programs.html). The article built a dynamic

Organizing Code to Support Go Get

28 Aug 2013

For those of you who are like me, trying to learn the Mac and Linux operating systems, Golang programming and deployment constructs all at the same time, I feel your pain. I have been building a Go

Collections Of Unknown Length in Go

26 Aug 2013

If you are coming to Go after using a programming language like C# or Java, the first thing you will discover is that there are no traditional collection types like List and Dictionary. That really

Using C Dynamic Libraries In Go Programs

20 Aug 2013

My son and I were having fun last weekend building a console based game in Go. I was recreating a game from my youth, back when I was programming on a Kaypro II. I loved this computer. I would write

Understanding Slices in Go Programming

15 Aug 2013

Since I started programming in Go the concept and use of slices has been confusing. This is something completely new to me. They look like an array, and feel like an array, but they are much more

Using Time, Timezones and Location in Go

8 Aug 2013

I ran into a problem today. I was building code to consume NOAA’s tide station XML document and quickly realized I was in trouble. Here is a small piece of that XML document:

Gustavo's IEEE-754 Brain Teaser

5 Aug 2013

Back in June, Gustavo Niemeyer posted the following question on his Labix.org (http://blog.labix.org/) blog: Assume uf is an unsigned integer with 64 bits that holds the IEEE-754 representation for

An RSS Feed Searching Framework Using Go

29 Jul 2013

This article was written for and published by Safari Books Online Back in May, I finally decided that it was time to move away from the Microsoft stack to Linux. The cost of developing, licensing,

An Open Source Debate

27 Jul 2013

This article was written for and published by Safari Books Online If you read my article titled Analyze Data With MongoDB and Go, then you will understand the context of this debate with the idea of

Understanding Pointers and Memory Allocation

27 Jul 2013

In the documentation provided by the Go language team you will find great information on pointers and memory allocation. Here is a link to that documentation: http://golang.org/doc/faq#Pointers

Analyze Data With MongoDB and Go

24 Jul 2013

This article was written for and published by Safari Books Online My company is building a mobile application called Outcast. The idea behind Outcast is to give people who love the outdoors the

OSCON 2013 - The Gophers Are Coming

20 Jul 2013

On June 22nd through the 26th, Portland Oregon is hosting OSCON (Open Source Convention). The event is run by O’Reilly. After looking at the speakers list it appears it is going to be a great

Understanding Type in Go

12 Jul 2013

When I was coding in C/C++ it was imperative to understand type. If you didn’t, you would get into a lot of trouble with both the compiler and running your code. Regardless of the language, type

Object Oriented Programming in Go

10 Jul 2013

Someone asked a question on the forum today on how to gain the benefits of inheritance without embedding. It is really important for everyone to think in terms of Go and not the languages they are

Singleton Design Pattern in Go

6 Jul 2013

Multi-threaded applications are very complicated, especially when your code is not organized and consistent with how resources are accessed, managed and maintained. If you want to minimize bugs you

How Packages Work in Go

5 Jul 2013

Since I started writing code in Go it has been a mystery to me how best to organize my code and use the package keyword. The package keyword is similar to using a namespace in C#, however the

Running Go Programs as a Background Process

24 Jun 2013

I have been writing Windows services in C/C++ and then in C# since 1999. Now that I am writing server based software in Go for the Linux OS I am completely lost. What is even more frustrating, is

Reading XML Documents in Go

17 Jun 2013

I was really surprised how easy it was to read an XML document using the encoding/xml package that comes with the standard library. The package works by defining structs that map the XML document. If

Send an email in Go with smtp.SendMail

13 Jun 2013

I wanted to send an email from my TraceLog package when a critical exception occurred. Fortunately Go’s standard library has a package called smpt which can be found inside the net package. When

Go's time.Duration Type Unravelled

11 Jun 2013

I have been struggling with using the Time package that comes in the Go standard library. My struggles have come from two pieces of functionality. First, trying to capture the number of milliseconds

Understanding Defer, Panic and Recover

8 Jun 2013

I am building my TraceLog package and it is really important that the package logs any internal exceptions and prevents panics from shutting down the application. The TraceLog package must never be

Documenting Go Code With Godoc

5 Jun 2013

As you know if you read my blog, I have been building a set of new utility packages so I can start developing an application server I need for a new project. I am brand new to Go and the Mac OS.

Installing Go, Gocode, GDB and LiteIDE

2 Jun 2013

Check out my new installtion document: https://www.ardanlabs.com/blog/2016/05/installing-go-and-your-workspace.html (https://www.ardanlabs.com/blog/2016/05/installing-go-and-your-workspace.html) I

Thread Pooling in Go Programming

31 May 2013

After working in Go for some time now, I learned how to use an unbuffered channel to build a pool of goroutines. I like this implementation better than what is implemented in this post.  That being

Why Go Programming

31 May 2013

For the past 20 years I have been writing server based and application software on the Microsoft stack. First in C/C++ leveraging the Win32 API and then in C# when .Net first was released. Over the