Home »
Golang
Golang Programs
The Go programming language (often referred to as Golang) is an open-source, expressive, concise, clean, and efficient programming language to make programmers more productive. It was developed by Robert Griesemer, Rob Pike, and Ken Thompson, and launched in 2009 by Google as an open-source project.
Golang programs / examples: This section contains solved Golang programs/examples on the various topics such as basic programs, conditions & control statement-based programs, looping programs, array & string programs, structure programs, function & package-based programs, etc. with examinations and outputs.
Golang Programs Index
Golang Basic Programs
- Golang program to print Hello World
- Golang program to add two integer numbers
- Golang program to find the average of three numbers
- Golang program to swap two integer numbers
- Golang program to read and print an integer variable
- More Golang Basic Programs ...
Golang Switch Statement Programs
- Golang program to demonstrate the switch case with optional statement and expression
- Golang program to demonstrate the switch case without optional statement and expression
- Golang program to demonstrate the switch case with expression
- Golang program to use the expression in the case statement
- Golang program to create a simple calculator using switch case
- More Golang Switch Statement Programs ...
Golang goto Statement Programs
- Golang program to print 'Hello World' 5 times using the goto statement
- Golang program to print the table of the given number using the goto statement
- Golang program to read the name and print it 5 times using the goto statement
- Golang program to print the Hex value of numbers from 1 to 100 using the goto statement
- Golang program to print the Octal value of numbers from 1 to 100 using the goto statement
- More Golang goto Statement Programs ...
Golang Looping Programs
- Golang program to calculate the Highest Common Factor (HCF)
- Golang program to calculate the multiplication of two numbers using the '+' operator
- Golang program to print table of a given number using for loop
- Golang program to print the tables up to given number using for loop
- Golang program to calculate the factorial of given number using for loop
- More Golang Looping Programs ...
Golang Array Programs
- Golang program to demonstrate the example of an Array
- Golang program to demonstrate the shorthand declaration of an Array
- Golang program to create an array without specifying its size
- Golang program to get the size of the array
- Golang program to print the array elements without using the loop
- More Golang Array Programs ...
Golang String Programs
- Golang program to check a string contains a specified substring
- Golang program to convert specified string in uppercase
- Golang program to convert specified string in lowercase
- Golang program to get the index of a specified character in the string
- Golang program to get the length of the specified string
- More Golang String Programs ...
Golang Structure Programs
- Golang program to demonstrate the implementation of structure
- Golang program to initialize the object of structure in a single line
- Golang program to print the object of structure
- Golang program to get the size of structure using Sizeof() operator
- Golang program to demonstrate the array of the structure
- More Golang Structure Programs ...
Golang User-defined Function Programs
- Golang program to create a user-defined function
- Golang program to create a user-defined function to add two integer numbers
- Golang program to demonstrate the call by value mechanism in a user-defined function
- Golang program to demonstrate the call by reference mechanism in a user-defined function
- Golang program to pass an array in a user-defined function
- More Golang User-defined Function Programs ....
Golang Variadic Function Programs
- Golang program to demonstrate the variadic function
- Golang program to create a function with the variable number of arguments to calculate the sum of all arguments
- Golang program to pass a slice of integers in a variadic function
- More Golang Variadic Function Programs ...
Golang Recursion Programs
- Golang program to demonstrate the recursion
- Golang program to calculate the factorial using recursion
- Golang program to print the Fibonacci series using recursion
- Golang program to calculate the power of a given number using recursion
- Golang program to count digits of given number using recursion
- More Golang Recursion Programs ...
Golang Pointer Programs
- Golang program to demonstrate the pointer
- Golang program to demonstrate the pointer to pointer
- Golang program to demonstrate the float pointer
- Golang program to demonstrate pointer to an array
- Golang program to demonstrate pointer to an array as a function argument
- More Golang Pointer Programs ...
Golang Conversion Programs
- Golang program to convert a numerical string into an integer number
- Golang program to convert the string into float number using ParseFloat() function
- Golang program to convert a float number into an integer number
- Golang program to convert 64-bit float number into 32-bit float number
- Golang program to convert 64-bit integer number into a 32-bit integer number
- More Golang Conversion Programs ...
Golang Slices Programs
- Golang program to create a slice from an integer array
- Golang program to find the length of a slice
- Golang program to find the capacity of a slice
- Golang program to demonstrate the different ways to create slices
- Golang program to create a new slice from the existing slice
- More Golang Slices Programs ...
Golang Date & Time Programs
- Golang program to get current date and time
- Golang program to print current date-time in different formats using Format() function
- Golang program to get the date, month, year in different variables using Date() function
- Golang program to print date and time in different formats using format constants
- Golang program to print individual elements of date and time using the inbuilt function
- More Golang Date & Time Programs ...
Golang Timers & Tickers Programs
- Golang program to implement the ticker for every second
- Golang program to implement the multiple tickers
- Golang program to print the received value from the ticker
- Golang program to implement a global ticker
- Golang program to perform some other activities with the ticker
- Golang Timers & Tickers Programs
Golang Goroutines Programs
- Go program to demonstrate a simple Goroutine
- Go program to call a Goroutine with another normal function concurrently
- Go program to create an anonymous Goroutine
- Go program to demonstrate the multiple Goroutines
- More Golang Goroutines Programs ...
Golang Reflection Programs
- Golang program to get the type of specified variable
- Golang program to demonstrate the reflect.NumField() function
- Golang program to demonstrate the use of fallthrough keyword
- Golang program to demonstrate the errors.New() function
- More Golang Reflection Programs ...
Golang Maps Programs
- Golang program to create a simple map
- Golang program to delete an item from a map
- Golang program to count the items of a map
- Golang program to create a copy of the map
- Golang program to iterate map elements using the range
- More Golang Maps Programs ...
Golang Range Programs
- Golang program to iterate different types of data structures using the range
- More Golang Range Programs ...
Golang Channels Programs
- Golang program to create a simple channel
- Golang program to create the buffered channel
- Golang program to pass buffered channel into a user-defined function
- Golang program to receive items from a channel using the loop
- Golang program to create the unidirectional channel
- More Golang Channels Programs ...
Golang File Handling Programs
- Golang program to create a text file
- Golang program to write and read data from a text file
- Golang program to create an empty file
- Golang program to get the size of an existing file in bytes
- Golang program to print the permissions of the existing file
- More Golang File Handling Programs ...
Golang Buffered Input-Output Programs
- Golang program to write data into the file using buffer writer
- Golang program to get the buffered size using buffer writer
- Golang program to get the available buffer size of buffer writer
- Golang program to reset the buffer writer
- Golang program to get the default buffer writer size
- More Golang Buffered Input-Output Programs ...
Golang Command-Line Arguments Programs
- Golang program to demonstrate the command line arguments
- Golang program to find the count of command-line arguments
- Golang program to parse a command line flag of string type
- Golang program to parse a command line flag of integer type
- Golang program to parse multiple command-line flags
- More Golang Command-Line Arguments Programs ...
Golang Regular Expressions Programs
- Golang program to check a specified string is started with a given character using regular expression
- Golang program to check a specified string pattern within a specified string using regular expression
- Golang program to demonstrate the regular expression function FindString()
- Golang program to demonstrate the regular expression function FindStringIndex()
- Golang program to demonstrate the regular expression function FindStringSubmatch()
- More Golang Regular Expressions Programs ...
Golang JSON Programs
- Golang program to encode Boolean, integer, and float data using json.Marshal() function
- Golang program to encode a string array using json.Marshal() function
- Golang program to encode a map using json.Marshal() function
- Golang program to encode a structure using json.Marshal() function
- Golang program to decode a JSON string using Unmarshal() function
- More Golang JSON Programs ...
Golang os Package Programs
- Golang program to get the hostname of the computer
- Golang program to demonstrate the os.Exit() function
- Golang program to get path separator using os.PathSeparator constant
- Golang program to get the null device
- Golang program to print environment detail
- More Golang os Package Programs ...
Golang strconv Package Programs
- Golang program to convert a specified numeric string into integer using strconv.Atoi() function
- Golang program to convert a specified integer number to a numeric string using strconv.Itoa() function
- Golang program to convert a specified string into Boolean value
- Golang program to convert a Boolean value to string
- Golang program to convert a signed integer value to a hexadecimal string
- More Golang strconv Package Programs...
Golang log Package Programs
- Golang program to demonstrate the log.Print() function
- Golang program to demonstrate the log.Printf() function
- Golang program to demonstrate the log.Fatal() function
- Golang program to demonstrate the log.Fatalf() function
- Golang program to demonstrate the log.Panic() function
- More Golang log Package Programs ...
Golang math/rand Package Programs
- Golang program to demonstrate the rand.Intn() function
- Golang program to demonstrate the rand.Seed() function
- Golang program to generate the slice of random numbers
- Golang program to shuffle words of a string
- Golang program to generate the random number of integer types
- More Golang math/rand Package Programs ...
Golang math/bits Package Programs
- Golang program to print the number of leading zeros in an 8-bit binary number
- Golang program to print the number of leading zeros in a 32-bit binary number
- Golang program to print the number of leading zeros in a 64-bit binary number
- Golang program to print the minimum number of bits required to represent a number
- Golang program to print the minimum number of bits required to represent an 8, 16, 32, 64 bits number
- More Golang math/bits Package Programs ...
Golang sync/atomic Package Programs
- Golang program to add value to a 32-bit integer in an uninterruptible manner
- Golang program to add value to a 64-bit integer in an uninterruptible manner
- Golang program to add value to a 32-bit unsigned integer in an uninterruptible manner
- Golang program to add value to a 64-bit unsigned integer in an uninterruptible manner
- Golang program to add value to a uintprt variable in an uninterruptible manner
- More Golang sync/atomic Package Programs ...
Golang path/filepath Package Programs
- How to split the path into a list of individual paths in Golang?
- How to get the absolute path from a relative path in Golang?
- How to get the directory name from a path in Golang?
- How to get the file name extension used by path in Golang?
- More Golang path/filepath Package Programs ...
Golang syscall Package Programs
Golang Signals Programs
- Golang program to demonstrate the SIGINT signal
- Golang program to handle different types of signals
- More Golang Signals Programs ...
Golang Shell Script Programs
- Golang program to check specified shell command exists or not
- Golang program to execute a specified shell command without options
- Golang program to execute a specified shell command with specified option
- Golang program to execute a specified shell command with multiple options
- Golang program to execute the specified shell script
- More Golang Shell Script Programs ...
Golang Miscellaneous Programs
- Finding the Square Root of the Complex Number in Golang
- Golang program to demonstrate the panic() function
- Golang program to terminate the program with a specified exit code
- Golang program to recover program after panic condition
- Golang program to print the current user id
- Golang program to print the group id of the current process