Using Go Templates can be quite confusing at the start but once you get used to what all it can do, you will simply love it. Right from printing simple text or parsing the text into an HTML to display it on a web page or to send it via email is what Go Templates can do.

I am going to show you 6 simple tricks in with how does each functionality work and a sample working code of each of those simple tricks in Go with Github Gist Page and Go Playground link.

Let us get started-

1. Using functions in Go templates

You can…


Photo by Remi Moebs on Unsplash

This is a common issue: We fork a Github Repository and, after a while, when the same repository is untouched for a month, we don’t know how to pull the latest updates from the original repository.

In this article, you’ll learn how to get the latest updates from an original repository into a forked repository.

This article assumes some git basics, but we’ll also dive into those below, before moving forward with the required steps to get updates from an original repository into a forked repository.

Add Remote Repository in Git

Every repository in your local git needs to be linked to one or many…


JSON capture with Awesome JSON and sample JSON taken from here.

Hello programmers,

So today we are going to know how Go actually works with Marshaling and Unmarshaling JSON. There are various ways of doing both but what is the best and the most efficient way can be known only through benchmarking.

Through out this demonstration, I am going to cover the following-

  1. What is JSON Marshaling?
  2. What is JSON Unmarshaling?
  3. JSON Parsing Encoder/Decoder in the encoding/json package.
  4. Benchmarking both the techniques and observing which technique is faster and efficient.

What is JSON Marshaling?

Here is how, Marshal function is declared in the encoding/json package.

func Marshal(v interface{}) ([]byte, error)

So simply speaking, Marshal takes…


Image by https://unsplash.com/@thomasjsn

This is a simple college assignment which I wanted to share with you all people.

Let's start with the problem statement : -

Problem Statement —

In this assignment, you will implement a simplified version of the Distance Vector Routing Protocol. The protocol will be run on top of four servers/laptops (behaving as routers) using TCP or UDP. Each server runs on a machine at a pre-defined port number. The servers should be able to output their forwarding tables along with the cost and should be robust to link changes. A server should send out routing packets only in the following two conditions:


Building RESTful APIs in different languages with different approaches and design patterns have always been as trending as being on a harder learning curve. This is due to focus on a lot of abstraction in code, the pain to get the project started and many more reasons. Upon that, to write test cases for the implemented services is also a pain in the neck.

Go gives you the privilege to write REST APIs in a very easy, elegant and concise way. …


I have seen many of the front-end developers always getting confused with these concepts and they end up trying every possibility that matches their scenario. Thus, I thought of describing all of these concepts one by one with proper figures.

First things first, I would like to start by describing some of the CSS properties before I jump into position property.

Unlocked properties :-

The Position property unlocks four CSS properties to access. They are as follows: -

  1. top
  2. right
  3. bottom
  4. left

Lets discuss first what do each of these properties mean -

  1. top: - With the top property, you can actually push…


Converting from one datatype to another is a frequent task we programmers do. Let’s dig around how type conversions work in Go.

Let me go and tell you how this article is going to be structured.

  1. General syntax of Type Conversions.
  2. Type Conversion from string to int/int64, int/int64 to string

General syntax of Type Conversions

If you have to convert a value from one datatype to another, then you have to follow the following syntax -

newDataTypeVariable = T(oldDataTypeVariable)

where T is the new data type.

Some numeric conversions:

var i int = 22
var floatVar = float64(i)
var uIntVar = uint(floatVar)

Unlike in C…


It is always a huge concern about building your CSS with proper classes and reduced duplicity. In this post, you would be reading about how you set up your CSS according to your own needs when you start to build your own website/portfolio/application.

There are a number of practices which are held while writing HTML and CSS together. Some use the practice of writing HTML first, and then CSS. Some write CSS first and then HTML or some write both along each other.

The practice which I use, is writing the basic HTML and CSS first. Meaning, writing the layout/structure…


There has been a lot of confusion about the use of let and var in Javascript. So here is the difference where you would be now easily to decide what to use where and when.

Description

let gives you the privilege to declare variables that are limited in scope to the block, statement of expression unlike var.

var is rather a keyword which defines a variable globally regardless of block scope.

Now, let me show you how they differ.

Global window object

Even if the let variable is defined as same as var variable globally, the let variable will not be added to the…

Krish S Bhanushali

Analytic problem solver by birth and programmer by choice. Motivator and spiritual. Portfolio: www.krishbhanushali.me

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store