Tag: Go

  • Testing concurrent code in Golang

    I wrote a package which tracks certain hashtags on twitter and part of the package is adding and removing hashtag from list of hashtags. Plan is that this can be done from different goroutines hence tracking/untracking is done by putting hashtag in channels. It looks like this: var ( trackChan = make(chan string) untrackChan =…

  • Channels in Go

    Do not communicate by sharing memory; instead, share memory by communicating. Channels are for orchestration, mutexes are for serialization. Go Proverbs – Rob Pike Yesterday I wrote my first project ((It’s URL shorterer, a project which I write in every new programming language I learn.)) in Go which does not use traditional locks when dealing…

  • Table-driven tests are a good stuff

    In Go there is a great emphasize on writing a table-driven tests. Main goal of these tests is to reduce copy-pasting test skeleton from test to test where only input and expected output are changed. You first define an array of test cases where each test case contains input and expected output. Then you iterate…

  • 4 best things that happened to me in 2015

    4 best things that happened to me in 2015

    1. Graduating and obtaining BS in Computer Science. This one is the most important for me. It took me 7 years to get it (2008 – 2015), which is an average. What can I say, I’m an average guy when it comes to this things. For example I also scored an average when graduating from…

  • Exporting data as CSV file from web apps (with Golang)

    While you can certainly export data from javascript with two different ways, they both aren’t good solutions. First one doesn’t allow you to name the downloaded file (it’s just download), second is only supported in Chrome, Firefox and latest version of Microsoft Edge (by the time of writing this post). So the only acceptable option…