filepath.Abs() Function in Golang With Examples Last Updated : 10 May, 2020 Comments Improve Suggest changes Like Article Like Report In Go language, path package used for paths separated by forwarding slashes, such as the paths in URLs. The filepath.Abs() function in Go language used to return an absolute representation of the specified path. If the path is not absolute it will be joined with the current working directory to turn it into an absolute path. Moreover, this function is defined under the path package. Here, you need to import the "path/filepath" package in order to use these functions. Syntax: func Abs(path string) (string, error) Here, 'path' is the specified path. Return Value: It return an absolute representation of the specified path. Example 1: C // Golang program to illustrate the usage of // filepath.Abs() function // Including the main package package main // Importing fmt and path/filepath import ( "fmt" "path/filepath" ) // Calling main func main() { // Calling the Abs() function to get // absolute representation of the specified path fmt.Println(filepath.Abs("/home/gfg")) fmt.Println(filepath.Abs(".gfg")) fmt.Println(filepath.Abs("/gfg")) fmt.Println(filepath.Abs(":gfg")) } Output: /home/gfg <nil> /.gfg <nil> /gfg <nil> /:gfg <nil> Example 2: C // Golang program to illustrate the usage of // filepath.Abs() function // Including the main package package main // Importing fmt and path/filepath import ( "fmt" "path/filepath" ) // Calling main func main() { // Calling the Abs() function to get // absolute representation of the specified path fmt.Println(filepath.Abs("/")) fmt.Println(filepath.Abs(".")) fmt.Println(filepath.Abs(":")) fmt.Println(filepath.Abs("/.")) fmt.Println(filepath.Abs("//")) fmt.Println(filepath.Abs(":/")) } Output: / <nil> / <nil> /: <nil> / <nil> / <nil> /: <nil> Comment More infoAdvertise with us Next Article filepath.Abs() Function in Golang With Examples K Kanchan_Ray Follow Improve Article Tags : Go Language Golang-filepath Similar Reads filepath.IsAbs() Function in Golang With Examples In Go language, path package used for paths separated by forwarding slashes, such as the paths in URLs. The filepath.IsAbs() function in Go language used to report whether the path is absolute or not. Moreover, this function is defined under the path package. Here, you need to import the "path/filep 2 min read complx.Exp() Function in Golang With Examples complx.Exp() Function in Golang is used to returns e**x, the base-e exponential of x. Syntax: func Exp(x complex128) complex128 Here, x is the set of all complex numbers real as well as imaginary parts. Return Type: The return type of this function is a complex number. Example 1: C // Golang program 1 min read bits.Len() Function in Golang with Examples Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Len() function which is used to find the minimum number of bits required to represent a and the result is 2 min read bits.Div() function in Golang with Examples Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Div() function which is used to find the quotient and remainder of (a, b) divided by c, i.e., q = (a, b)/ 2 min read math.Expm1 Function() in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You are allowed to find base-e exponential of the specified number minus 1, i.e., e**a -1 with the help of Expm1() function provided by the math 2 min read Like