This is the chapter 12 of the golang comprehensive tutorial series. Refer to this link for other chapters of the series – Golang Comprehensive Tutorial Series Next Tutorial – SwitchPrevious Tutorial – For Range loop Now…
Tag: go
cd command in Go or change current working directory in Go (Golang)
Overview os.Chdir() is used to change the current working directory to the named directory in golang. It is similar to the cd command. Below is the signature of the function Code Output:
Get Current User’s Home Directory in Go (Golang)
Overview ‘os/user’ package can be used to get the current user home directory Let’s see a working code Code Output
Get current Username in Go (Golang)
Overview ‘os/user’ package can be used to get the current user name. Let’s see a working code Code Output
Get ASCII code/value of any Alphabet or Number in Go (Golang)
range over a string can give the ASCII of all the characters in the string. In below code we are printing the ASCII value of a lowercase alphabets, uppercase alphabets and numbers….
Change folder/directory permissions in Go (Golang)
os.Chmod() function can be used to change the permissions of an existing folder or directory. Below is the signature of the function Code Output:
Change file permissions in Go (Golang)
os.Chmod() function can be used to change the permissions of an existing file. Below is the signature of the function Code Output:
Make a copy of a file in Go (Golang)
In this article we will see two methods of copying a file. First Method io.Copy() can be used to create a copy of the file from src to dest. A successful copy…
Create a directory or folder in Go (Golang)
Overview os.Mkdir() function can be used to create a directory or folder in go. Below is the signature of the function. It takes in two parameters The first parameter is the named…
Get File Name, Size, Permission Bits, Mode, Modified Time in Go (Golang)
Overview os.Stat() function can be used to the info of a file in go. This function returns stats which can be used to get Name of the file Size of the file…