Skip to content

Instantly share code, notes, and snippets.

@tomcam
Created December 25, 2021 02:02
Show Gist options
  • Save tomcam/9284f5cded108492706175ee9eb29047 to your computer and use it in GitHub Desktop.
Save tomcam/9284f5cded108492706175ee9eb29047 to your computer and use it in GitHub Desktop.
Golang filepath.Join removes a trailing path separator
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
// golang removes thet trailing path separator.
// The output will be "a/b/c"
// See also https://go.dev/play/p/42x3HiccT6_S
fmt.Println(filepath.Join("a", "b", "c", string(os.PathSeparator)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment