Go Challenge - 3


The author of the challenge has written a blog post that explains how he used concurrency to improve the performance 10x without changing the basic algorithm.

Winners have been declared

The challenge author has this to say about the winners:

I am choosing the submission of David Le Corfec as the first winner and Craig Peterson as the second winner, but they are very close.

David Le Corfec - Good mosaic created. Good documentation, easy parameters, fine-grained and simple to use. Simple and easy to read code, well-structured. Good performance when creating the mosaic.

Craig Peterson - Excellent mosaic created but not easy to read documentation, good parameters, fine-grained but required to read the code to know which flags to use. Code structure a bit messier.

Additionally, the other submissions that are very close are:

Eujon Sellers - Excellent mosaic created, very good web app (although this is irrelevant). The submitter made a silly mistake and 1 test couldn’t run properly and failed (I skipped it and the rest is fine).

Steven LoFurno - Excellent mosaic created, but the interface is awkward and it is pretty slow.

Yury Smolsky - excellent mosaic created, but it requires a lot of tiles, the controls are not as fine-grained as the rest.

Andriel Nuernberg - great looking web app, but the mosaic created is not as good as the rest, and there is little control over the tile set to be used.

I went through all of the submissions and used a single set of uniform tiles (extracted from Instagram) with the theme ‘cat’ to create a mosaic based on a single cat picture. All the mosaics are in the zip file at this link: https://www.dropbox.com/s/48whh7gfjgrb61i/comparison_of_mosaics.zip?dl=0.

With the exception of those which I cannot run the submissions (too complex requirements and dependencies) or those which used 3rd party libraries (automatic disqualification) or both. Some of the mosaics cannot choose tileset, in those cases I used the same search theme ‘cat’ to generate the mosaic.

There’s been a major update to the original challenge.

  • The last date of submission has been changed from the original 18th May to 25th May 2015.
  • The challenge is to just write a photo-mosaic generating program that:
    • Allows the user to select a target picture, which is the picture that will be made into a photo-mosaic
    • Allows the user to select a directory containing a set of tile pictures
    • Generates a photo-mosaic of the target picture using the tile pictures
  • Originally, you had to create a web application that generated the photo-mosaic. This not required now.

The May 2015 Go Challenge for developers (newbies included)

Sau Sheong Chang: Author of the third Go Challenge

Sau Sheong Chang The third Go Challenge author is Sau Sheong Chang. He has been doing software development for 20 years, mostly in web application development. He is active in the Ruby and Go developer communities and has contributed to open source projects and spoke at meetups and conferences. Sau Sheong has also published 3 programming-related books, mostly on Ruby and is working on a 4th book titled Go Web Programming. He is currently a Director of Global Consumer Engineering in PayPal, based out of sunny Singapore and has in his career worked for HP, Yahoo, and also ran a technology startup during the dot-com days.

Sau has this to say about the challenge:

“This is a challenge for beginners to start learning about writing web applications in Go. Generating photo-mosaics is the fun bit. After the challenge, the challenge participant should be able to write a web application, write test cases, call REST-based API and at the very least, manipulate images all using the standard Go library.”

“And of course, have lots of fun in the process.”

The Go Challenge 3

Go Picture This!

A photographic mosaic, or a photo-mosaic is a picture (usually a photograph) that has been divided into (usually equal sized) rectangular sections, each of which is replaced with another picture (called a tile picture). If we view it from far away or if you squint at it, then the original picture can be seen. If we look closer though, we will see that the picture is in fact made up of many hundreds or thousands of smaller tile pictures.

Goals of the challenge

Your mission, should you accept it, is to write a photo-mosaic generating program that:

  • Allows the user to select a target picture, which is the picture that will be made into a photo-mosaic
  • Allows the user to select a directory containing a set of tile pictures
  • Generates a photo-mosaic of the target picture using the tile pictures
Bonus goals (optional, not part of the challenge)

Create a web application that generates the photo-mosaic that:

  • Allows the user to log in (can be your own database or log in through a third party like GitHub or Twitter or Facebook, through OAuth2). (Note: if you are authenticating the user through OAuth2, you should use the OAuth2 login flow instead of an external library).
  • Allows the user to connect to one or more photo-sharing sites like Instagram or Flickr or Facebook Photos (or any photo-sharing site of your choice) to get tile pictures. Your user doesn’t necessarily need to log in, you can use the image search APIs to get the tile pictures
  • Allows the user to use a search filter (for e.g. use only pictures with cats in it) to filter out a set of tile pictures
  • Allows the user to save the photo-mosaic, either on the site or upload it back to the photo-sharing site
Requirements of the challenge
  • Use the latest version of Go i.e. version 1.4.2
  • Individual tile pictures must be clearly visible when magnified, though it is expected to be smaller.
  • You need to write test cases for the main flow. Do submit your test cases.
  • Do organize your code.
  • Submit a photo-mosaic generated with your program, along with instructions to run the program as part of the submission.

You can find out more about photo-mosaics from this Wikipedia entry - http://en.wikipedia.org/wiki/Photographic_mosaic

You can also look at some photo-mosaic sites that are already available:

Remember not to use the ‘ghosting’ technique when creating photo-mosaics, that’s a big no-no. ‘Ghosting’ is when you place a faint picture of the target under your mosaic to create an illusion of a mosaic. It’s kind of like cheating!

If you’re writing a photo-mosaic web application, you can read this eBook:

How to Deploy a Go Web App to the Google App Engine 101

Or you can view this YouTube video to learn more - https://www.youtube.com/watch?v=XCsL89YtqCs

If you find this challenge daunting or find yourself stuck, do go to the Gophers Slack channel #golang-challenge and chat with me (@sausheong) - I will help you along the way.

Challenge Rules and how to enter the Go Challenge?

By participating in this challenge, you agree to be bound by the Challenge Rules below:

  • The Challenge is open to individuals.
  • Evaluators cannot enter the challenge except under the “Just for Fun” category.
  • Each entrant shall indemnify, defend, and hold JoshSoftware Pvt. Ltd. (who has sponsored the domain and is the organizer of these challenges) harmless from any third party claims arising from or related to that entrant’s participation in the Challenge. In no event shall JoshSoftware Pvt. Ltd. be liable to an entrant for acts or omissions arising out of or related to the Challenge or that entrant’s participation in the Challenge.
  • Odds of winning depend on the number and quality of entries received.
  • All taxes, including income taxes, are the sole responsibility of the winners.
  • No prize substitution is permitted.
  • Create a zip of your Go source code, images and test cases and send the zip file to golangchallenge [at] gmail.com before 25th of May 2015 (6 am IST). Use this link to find the equivalent time in your city/country. No new solutions will be accepted after that. In the email mention **your full name, country of residence, twitter or GitHub id (if any) and participating under which category - Just participating Participating and exploring further Just for Fun Anonymous entry**. We are accepting anonymous submissions and will evaluate them too but then these participants are not eligible for the prizes.
  • We will give your zip file to the evaluation team.
  • We shall be publishing on this blog, a list of participant names. If you don’t want your name to appear kindly mention the same in your email.
  • You are allowed to re-submit your code if you feel it is necessary.
  • Note: Avoid sharing your code with anyone else; if your solution becomes available to the general public it might impact evaluation of your submission.
  • After the challenge is over, all submissions will be made available online on GitHub under the BSD 3-Clause License or the GNU General Public License, version 3 - GPL-3.0 unless a participant has indicated that his/her solution should not be made public before the challenge ends.

How will the challenge be evaluated?

Entries will be anonymized and evaluated by the challenge author and a team of evaluators.

  • Functioning code and a test suite that passes.
  • Code hygiene. Use gofmt, vet and lint. Review CodeReviewComments.
  • Readability. How easy is it for another programmer to grasp what your entry is doing?
  • Code structure. Do types and files have good names?
  • Reliability. Are errors properly handled?
  • Appropriate consideration given to memory and performance (nothing is unnecessarily expensive).


If you have any questions about this challenge, please join the golang-challenge channel on slack and ask your questions with the tag @sausheong so that the challenge author is aware of your question(s) and can reply to the same. This is a room for people who are going to participate in the Go Challenge. You can also send us an email at golangchallenge [at] gmail.com


Nathan Youngman had set the guidelines for evaluation for the first Go Challenge. Subsequently Dominik Honnef modified the guidelines based on his experience as an evaluator for the first challenge. Austin Riendeau, Cory LaNou, Edd Robinson, Gautam Dey, Jyotiska NK, Kevin Gillette and Pravin Mishra have agreed to go through all the submitted solutions of a challenge. They will comment and rank these solutions.

Best Solution

The author of the Go Challenge will decide the best five solutions. The author shall have the sole authority and discretion to select the award recipients.


The winning entries will be announced here on this blog. The winners will be sent their prizes by email/postal mail.


The author of the challenge will select 5 winners.

Here are some great prizes provided by our sponsors for the event.

Winner 1:

Winner 2:

Winner 3:

Winner 4:

Winner 5:

Anyone can a get 42% off on the price of the following eBooks from Manning Publications Co.:

Winner Interviews

After a winner wins the monthly challenge, he/she would be interviewed by Sourcegraph and the interview will be published on their blog.

Challenge Solutions

All the solutions submitted by the participants will be available here after the challenge ends.

The Winners


Since we had only 15 submissions, the author selected only the top 2 winners. They are:

David Le Corfec

Winner #1 - David Le Corfec started programming on Amiga in the 90’s. After Computer Science studies, he started in software development before changing to system engineering, supporting the web operations of the largest French broadcaster.

In 2013, he became interested in Go by stumbling upon groupcache, while researching caching solutions for streaming video. Shortly afterwards, Go replaced C as his favorite language, leading him to even consider a comeback to full-time programming!

His solution.

Craig Peterson

Winner #2 - Craig Peterson is a Developer for Stack Exchange working remotely from Utah. He works on the site reliability team, mostly on the bosun open source monitoring system, written in Go.

Craig has been a programmer since 2004, working mostly in .Net and Java environments. He stumbled into Go about a year and a half ago, and has been hooked ever since.

His solution.


This challenge’s sponsors are: Anand D N, Apcera, CoreOS, Crowd Interactive, Cube Root Software, DigitalOcean, Docker, GitHub, GopherCasts, Helpshift, InfluxDB, John Sonmez, JoshSoftware Pvt. Ltd., Manning Publications Co., NodePrime, O’Reilly, Packt Publishing, Qwinix Technologies, RainingClouds, SoStronk and Sourcegraph.


  • The Gopher character is based on the Go mascot designed by Renée French and copyrighted under the Creative Commons Attribution 3.0 license.
  • GitHub for the yearly sponsorship of a GitHub Bronze Organisation plan for the Go Challenge.
  • The Go Challenge is being organized by JoshSoftware Pvt. Ltd. with help from the Go community.
Written on April 18, 2015