Golang code generation

Programs that produce source code are important elements in software engineering. Since Go 1.4, the language ecosystem includes a command line tool that makes it easier to run such tools. It’s called go generate. It scans for special comments in Go source code that identify general commands to run: //go:generate <subcommand> <arguments> Go generate is not part of go build. It does not do dependency analysis and must be run explicitly before running go build....

October 4, 2015 · 3 min · Svetlin Ralchev

Golang: Working with Gzip and Tar

Gzip Gzip is another file compression format that was created to replace the compress program used in early unix system. It is normally used to compress just single files. Compressed archives are created by packaging collections of files into a single tar archive, and then compressing that archive with gzip. The final .tar.gz or .tgz file is a tarball. Compressing a file Compressing operation is very simple to implement. The package exposes gzip....

September 27, 2015 · 4 min · Svetlin Ralchev

Golang: Working with ZIP archives

Golang has several packages that work with different type of archives. In this post I will show you how to use archive/zip package to compress and uncompress zip archives. Zip is one of the most common file formats. It supports lossless data compression of one ore more files and directories. Extracting You can read the content of zip package by using zip reader. Its File property exposes all files and directories of particular zip package....

September 20, 2015 · 2 min · Svetlin Ralchev

Golang code inspection tools

As a software engineer, you always try to improve the quality of your programs. We are looking for the best software development practices and TDD techniques. "Have no fear of perfection - you'll never reach it." ― Salvador Dalí In this article we will explore different code inspection tools in Go ecosystem. We will increase our code quality and engineering skills by running tools that will do analysis on our code base and report the suspicious parts of it....

September 13, 2015 · 7 min · Svetlin Ralchev

Golang code comprehension tools

Software engineers spend a greater part of time reading and understanding programs. Indeed, most of the time it takes to develop a program is spent reading it and making logical conclusion about what it does. Go programmers are no exception. Thanks to gofmt they should not worry about source code formatting. The machines are better suited to analyse source code and accomplish comprehension tasks than us. In this article we will explore several of Go comprehension tools that are responsible for locating definitions, ascertaining types of expressions, deducing implementation relation, computing method sets, finding callers/callees, jumping through channels, understanding aliasing....

September 6, 2015 · 3 min · Svetlin Ralchev