Golang refactoring tools

Go language provides many useful tools as part of its development eco system. We will explore most of them in the upcoming blog posts. But in the article lets focus on refactoring tools. Gofmt In average programming languages developers can adapt to different formatting styles. Common problem is how to approach unknown code base without a long prescriptive style guide. Go takes an unusual approach and keep this responsibility to format the source code for you....

August 30, 2015 · 6 min · Svetlin Ralchev

Sharing Golang packages to C and Go

The latest Go 1.5 version is out. As part of the new features, Go compiler can compile packages as a shared libraries. It accepts -buildmode argument that determines how a package is compiled. These are the following options: archive: Build the listed non-main packages into .a files. Packages named main are ignored. c-archive: Build the listed main package, plus all packages it imports, into a C archive file. c-shared: Build the listed main packages, plus all packages that they import, into C shared libraries....

August 23, 2015 · 4 min · Svetlin Ralchev

Conditional compilation in Golang

When developing Go package or application that depends on specific features of the underlying platform or architecture it is often necessary to use a specialised implementation. There are two parts of Go conditional compilation system, which we will now explore in more detail. Build constraints A build constraints (known as build tags) is an optional top line comment that starts with // +build package api Declaration of build constraints follows the following rules:...

August 16, 2015 · 4 min · Svetlin Ralchev

Delve: Next generation debugger for Golang

In my previous post I demonstrated how you can debug golang applications with LLDB. In this article I will illustrate the most recent debugger for Go: Delve The debugger is a community effort to bring a debugger in the toolchain of every Go developer. It’s written in Go to debug Go code. It’s still in active development, but we can still benefit from its basic features. Installation You should install Delve with the following command:...

August 8, 2015 · 4 min · Svetlin Ralchev

Debug Golang applications: LLDB

Even that ease and simplicity of using go are one of its main advanatages, there are difficulties in debugging applications written in go. The lack of mature tools (like supported vim plugin) push most of us to use logging techniques to inspect and track down issues. In this article, I will demonstrates how you can use vim and lldb to debug a go application. Before that you should make the application capable for debugging....

August 1, 2015 · 3 min · Svetlin Ralchev