Tech a Break x GoJakarta - The Power of Go

 • 

On 18 January 2018, Tokopedia–joined up with GoJakarta–hosted the 19th Tech a Break at Tokopedia Tower. In this event, we discussed on the rise of Go programming language after its 8 years of establishment, with Tahir Hashmi (VP of Engineering at Tokopedia) and Kenneth “Ken” Shaw (Founder/CTO of Brankas) as the speakers. This was also our second collaboration with GoJakarta, which the previous one was held last year.

TaB 19
TaB 19

Considering Tokopedia use Go on a daily basis, Tahir Hashmi has a lot of understanding on how to bring the most of Go’s main features. Tahir has been programming in plenty of languages such as C, C++, PHP, Python, Javascript, and Java since 1990; with experiences developing large applications while working as a Cloud Platform Architect at Flipkart, Zynga, and Yahoo.

Kenneth Shaw has been building large-scale payment and transaction systems using various programming languages and frameworks in the last 15 years. After being the CTO of Multiply and establishing two technology companies, Kenneth founded Brankas in 2016. He started programming in Go late 2012, has been producing a number of Go packages and is currently the representative of GoJakarta.

Tahir Hashmi - A 5-Year Retrospective, The Best Feature of Go

It all started in 2012 when Tahir decided to step into this language. After five years practicing Go, he realised that Go has some features that set it ahead of other languages. As most people already agreed, Go is a very straightforward language with clean syntax, makes less effort to learn compared to some older languages such as Perl and Scala which extremely care about expressions. Its standardised formatting improves the code readability and there are a lot of easily accessible open source code available that we can use for libraries or references. Go compiler would tell assistive error messages e.g. useless variables, which is very helpful to achieve the efficiency and high performance.

Go has a feature called go routine that is used for parallel programming. This feature is so convenient since we just need to put go syntax before any function–with no callback mess–and the function will be executed asynchronously. Even though it may look so powerful, Tahir explained that it is not the best feature of Go, but go test is. In Go, testing is part of the development. Unlike other languages that might need external libraries to perform testing, Go already provides the standard library. Go test is used to find any unnecessary code and improve documentation. Additionally, it can be used for benchmarking; for instance, to check how fast a function completed and observe multi-core scalability. With these functionalities, he can assure that go test is like a programmer’s assistant.

Kenneth Shaw - Running Go Everywhere

Because of its convenience, Go has a potential to become an ideal language. But what is considered as an ideal language? In history, several languages such as Java, ActiveX, and PNaCL have attempted to be ideal languages, yet they all have some tradeoffs: complex, not standard/cross-platform, may cause developer fatigue, and performance issues. Meanwhile, Go is fast, easy to use and deploy. It also has powerful standard libraries, well documented open sources, and compiles so efficiently. However, Kenneth believes an ideal language must be able to implement a single, unified code-base that is write-once and run everywhere. It is still questionable whether Go can run on some platform, especially web browser.

WebAssembly (WASM) has been designed previously for many languages to run machine code in most modern browsers. Its approach to Go has made Go compilable to web languages. Moreover, running WASM code from Go is simpler than other languages. One single Go build toolchain can produce efficient machine code that runs everywhere. Achieving cross-platform support with Go is trivial, since compiling for other architectures/OS is quite challenging with Go. It is still possible to build native iOS and Android code with Go, but it requires SDKs config and setup.

Because WASM already has wide, industry support and toolchains available for numerous languages, it might be possible to call C, C++, Rust, or even Java natively from within Go without external dependencies in the future.

Conclusion

Go is a powerful language that combines the code simplicity and the efficiency of its built-in features, yet can achieve high performance. Developers’ contribution in open sources has made Go so rapidly grown in the past few years, and we can expect the popularity would still be increasing this year. Having all these capabilities, it will not be a surprise if 2018 might become the year of Go.