Language: Go
Label: safe
CWE: NVD-CWE-noinfo \u2014 

Code:
func hasBadPathComponent(path string) bool {
	path = filepath.ToSlash(strings.TrimSpace(path)) // For windows '\' must be converted to '/'
	for _, p := range strings.Split(path, SlashSeparator) {
		switch strings.TrimSpace(p) {
		case dotdotComponent:
			return true
		case dotComponent:
			return true
		}
	}
	return false
}