Tutorials
Golang : Delete item from slice based on index/key position
Problem :
You want to delete an element from a slice or array and you know the index(position number) of….... read more
Golang : When to use make or new?
Problem :
When to use make
or new
in Golang ? It can be confusing for newbie to Golang.
Solution….... read more
Golang : Channels and buffered channels examples
Continue from previous tutorial on goroutines. Goroutines run in the same memory address space and how does Golang….... read more
Golang : How to protect your source code from client, hosting company or hacker?
My friend is bidding for a project and was asked by his client to let them host his program on….... read more
Golang : How to check if slice or array is empty?
Problem :
One of your code is throwing out panic error and apparently it is trying to do a for….... read more
Golang : Check if a string contains multiple sub-strings in []string?
Problem :
You have a string and you use strings.Contains()
function to determine if there is a sub-string inside the….... read more
Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
Problem :
Your program accepts user input from console(terminal). It was working fine if the user input is in one….... read more
Golang : Removes punctuation or defined delimiter from the user's input
Problem :
You need to clean up your user's input from punctuation or certain delimiter defined by you. For example,….... read more
Golang : What is StructTag and how to get StructTag's value?
For those who code or read Golang's code and left wondering what are those string inside the '``'
such as….... read more
Golang : How to tokenize source code with text/scanner package?
It has been a while since I touch the topic on tokenizer.....err... since the day I actually built a compiler….... read more
Golang : Get user input until a command or receive a word to stop
Just a code fragment below as supplement to tutorial on how to read until certain character to break….... read more
Golang : How to get a user home directory path?
Problem :
You need to get a user's home directory path in a Unix/Linux machine for storing or processing customized….... read more
Golang : How to display image file or expose CSS, JS files from localhost?
Problem :
You execute your Golang program on localhost
and want to see images on localhost:8080
, but your <img>
HTML….... read more
Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
Problem :
Your server needs to perform some clean up operation or flush everything in memory to disk before shutting….... read more
Golang : How to pipe input data to executing child process?
Problem :
Your program is executing a child process via os/exec
and you want to pipe input data to the….... read more
Unix/Linux : How to pipe/save output of a command to file?
Problem :
You need to capture/pipe or save the output of a command execution in Unix/Linux to a file. How….... read more
Golang : JQuery AJAX post data to server and send data back to client example
Just want to write this tutorial for fun.
In this tutorial, we will learn how to use JQuery's AJAX to….... read more
Golang : Decode/unmarshal unknown JSON data type with map[string]interface
This tutorial is courtesy of Rohan Allison on how to decode or unmarshal JSON into map[string]interface. There are….... read more