Make a path relative from absolute
https://gist.github.com/arxdsilva/4f73d6b89c9eac93d4ac887521121120
You may use
For example:
dir, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
You may use
path.Join()
or filepath.Join()
.For example:
base := "/home/bob"
fmt.Println(path.Join(base, "work/go", "src/github.com"))
Output:/home/bob/work/go/src/github.com
Comments
Post a Comment