X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=cmd%2Fmicro%2Futil.go;h=833562941436689ca668456c41ef51c55c89fe06;hb=ea6a87d41a9fcaa9fff81c1a5310726b1e15c548;hp=b8a8e92a30e54b2daf13d2dcb7c51c37b6f6251f;hpb=015fcf5fec1f69d802438acef098e6d41a8be85a;p=micro.git diff --git a/cmd/micro/util.go b/cmd/micro/util.go index b8a8e92a..83356294 100644 --- a/cmd/micro/util.go +++ b/cmd/micro/util.go @@ -337,3 +337,12 @@ func ReplaceHome(path string) string { } return strings.Replace(path, "~", home, 1) } + +// GetPath returns a filename without everything following a `:` +// This is used for opening files like util.go:10:5 to specify a line and column +func GetPath(path string) string { + if strings.Contains(path, ":") { + path = strings.Split(path, ":")[0] + } + return path +}