Dynamically Insert Version Info From git tag to Your App
· β˜• 5 min read
Introduction Have you ever ran into a situation where you wanted to version your application, but doing git tag and making a separate commit for updating version number was a two-step process? Isn’t that kinda frustrating? You can even miss to update the version number in your code, which happens to be with me a lot. In this post we’ll see how to convert this two-step process into one. Contents:

Continuous Integration and Deployment to Beanstalk With Docker
· β˜• 4 min read
In a previous post we discovered how can we run commands on each push and check if the test is passing against multiple versions of go. This is a continuation of the same concept. We are going to deploy our code to Elastic Beanstalk, straight from git push. Elastic Beanstalk is nothing but a wrapper around it’s EC2 infrastructure. It is a developer-centric view of deploying an application on AWS. Developers just have to push the code and Beanstalk can take care of Auto Scaling Group, Elastic Load Balancer, databases etc.

Unit Testing, Test Coverage and CI with Travis in Go
· β˜• 7 min read
You can’t think of deploying your application to production without testing it. Neither you can manage a large codebase with confidence without it. Let us go through some basics of unit testing in golang. This post is structured in the following manner: unit testing basics in golang (jump) inbuilt code coverage command understanding subtests and helper function (jump) Travis CI integration (jump) running test against multiple version of go Unit Testing in golang Before I start, I must say that do not test code, test the behavior.

Create Lightweight Docker Images With Multi Staged Build
· β˜• 4 min read
Me Before 1 2 3 4 5 6 7 8 9 10 11 12 FROMgolang:alpineWORKDIR/go/src/ . .RUN go get -dRUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o app .EXPOSE8080CMD ["./app"] Me building the image. $ docker build -t sntshk/qagine . Sending build context to Docker daemon 259.6kB Step 1/7 : FROM golang:alpine ---> 760fdda71c8f Step 2/7 : WORKDIR /go/src/ ---> Running in e2cf75dd1655 Removing intermediate container e2cf75dd1655 ---> 8b4955b2e885 Step 3/7 : COPY .

Run Unit Test Before Every Commit with pre-commit Hook
· β˜• 3 min read
Introduction Why wait for CI/CD services to run your test? And in case you’ve already submitted a pull request, you’ll have to push another commit to fix the cause of failed test held by CI provider. You can prevent that by running unit tests locally before every commit. I’m building my website using the golang. On every git push, Travis CI runs test and create a docker image and pushes it to DockerHub.

Software Testing and Test Driven Development
· β˜• 3 min read
In this post, I’ll show a glimpse of software testing and how test-driven development works in a nutshell. Why Do We Test Every little software grows big, trying to solve more problem regarding its particular domain. It faces bugs in the way which also needs to be taken care of. As software grows big. It becomes harder to go and test if every part of the software is behaving the way it should.

How would you exclude all extension-less executable from your repo?
· β˜• 2 min read
In last post, I expressed how we can export a single file from a git repo the its own repo, preserving their commit history. In this post, I will tell how I dealt with extension-less file to ignore them in my repo. I have recently started learning C++ from Udemy, it’s a free course. I encourage you to take it if you are willing to learn C++. I was following the instructions on Linux.

Extract a File from Git Repo to its own, Preserving the History
· β˜• 1 min read
Today I will walk through how you can take out a single file from a git repository and create its own repository with all the file commit history preserved. When I started working at my workplace I initialized Maya script directory to git. At that time one repo was looking enough for entire folder. But when I started working with a tool, I realized an entire repo would be good for that tool.

Merge more than one Commits before Pushing
· β˜• 2 min read
When I first came to know about this, I was like: I didn't know I can merge more than one commit into one until I read this: #Git #WebDev #Programming — Santosh Kumar (@sntshk) January 4, 2017 What is Squashing The process of merging commits together is called squashing.Β There are many commands to do the same thing, but I will discuss the one I learned. There’s a read more section below if you want to know more about this topic.