Created
December 25, 2021 02:02
-
-
Save tomcam/9284f5cded108492706175ee9eb29047 to your computer and use it in GitHub Desktop.
Golang filepath.Join removes a trailing path separator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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