Welcome To Golang By Example

Menu
  • Home
  • Blog
  • Contact Us
  • Support this website
Menu

Category: Tech

Function Closures in Go (Golang)

Posted on March 6, 2020March 6, 2020 by admin

Overview Function closures are nothing but an anonymous function that can access variables declared outside the function and also retain the current value of those variables between different function calls. Anonymous functions…

IIF or Immediately Invoked Function in Go (Golang)

Posted on March 6, 2020March 6, 2020 by admin

Overview: IIF or Immediately Invoked Function are those function which can be defined and executed at the same time. A function can be invoked immediately by appending a () after the end…

Check if an item exists in a slice in Go (Golang)

Posted on February 29, 2020February 29, 2020 by admin

Let’s see a working code Output:

Get the IP address from an incoming HTTP request

Posted on February 29, 2020February 29, 2020 by admin

Overview In this article, we will get the IP address of the client for an incoming HTTP request using X-REAL-IP header If X-REAL-IP is empty then we will fall back to X-FORWARDED-FOR header….

Understanding WaitGroup in Go (Golang)

Posted on February 27, 2020February 27, 2020 by admin

WaitGroup is a struct that is part of sync package in Go. It is generally used to wait for a collection of goroutines to finish execution. The WaitGroup has below methods Add…

Wait for all Go routines to finish execution in Golang

Posted on February 25, 2020February 25, 2020 by admin

sync package of golang provides WaitGroup struct which can be used to wait for collection of goroutines to finish execution. The WaitGroup provides: Add method to set the number of goroutines to…

Detect OS in Go (Golang)

Posted on February 23, 2020February 23, 2020 by admin

runtime.GOOS constant can be used to detect the OS at runtime since this constant gets set only at runtime. runtime.GOARCH can be used to know the architecture target of the running program….

Change the modified/updated time and access time of a file in Go (Golang)

Posted on February 23, 2020February 23, 2020 by admin

os.Chtimes() function can be used to change the mtime(modified time) or atime(access time) of a file in Golang. Below is the signature of the function. Code: Output:

Delete/Remove a folder in Go (Golang)

Posted on February 23, 2020February 23, 2020 by admin

os.Remove() function can be used to delete a folder in Golang. Below is the signature of this function Code: Output:

Delete a file in Go (Golang)

Posted on February 23, 2020February 23, 2020 by admin

os.Remove() function can be used to delete a file in Golang. Below is the signature of this function Code: Output:

Posts pagination

Previous 1 … 49 50 51 … 62 Next
Follow @golangbyexample

Popular Articles

Golang Comprehensive Tutorial Series

All Design Patterns in Go (Golang)

Slice in golang

Variables in Go (Golang) – Complete Guide

OOP: Inheritance in GOLANG complete guide

Using Context Package in GO (Golang) – Complete Guide

All data types in Golang with examples

Understanding time and date in Go (Golang) – Complete Guide

©2025 Welcome To Golang By Example | Design: Newspaperly WordPress Theme