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….
Tag: golang
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…
Rename file or folder in Go (Golang)
Overview os.Rename() function can be used to rename a file or folder. Below is the signature of the function. old and new can be fully qualified as well. If the old and…
Execute an OS/System Command in Go (Golang)
Overview os/exec package can be used to trigger any OS or system command from Go. It has two functions which can be used to achieve the same Command – Used to create…
Return exit status code in Go (Golang)
Overview ‘os’ package of golang provides an Exit function that can be used to exit the current program with a status code. Status code zero means success Non-zero status code means an…
Get Hostname in Go (Golang)
Overview ‘os’ package of golang provides a Hostname function that can be used to get the hostname that is reported by the kernelBelow is the signature of this method. It returns an…