Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-path
Commits
f7108d98
Commit
f7108d98
authored
Apr 19, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address comments from CR
parent
7058d559
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
path.go
path.go
+12
-5
No files found.
path.go
View file @
f7108d98
...
...
@@ -49,11 +49,13 @@ func FromSegments(seg ...string) Path {
}
func
ParsePath
(
txt
string
)
(
Path
,
error
)
{
kp
,
err
:=
ParseKeyToPath
(
txt
)
if
err
==
nil
{
return
kp
,
nil
}
parts
:=
strings
.
Split
(
txt
,
"/"
)
if
len
(
parts
)
==
1
{
kp
,
err
:=
ParseKeyToPath
(
txt
)
if
err
==
nil
{
return
kp
,
nil
}
}
if
len
(
parts
)
<
3
{
return
""
,
ErrBadPath
}
...
...
@@ -66,7 +68,7 @@ func ParsePath(txt string) (Path, error) {
return
""
,
ErrBadPath
}
_
,
err
=
ParseKeyToPath
(
parts
[
2
])
_
,
err
:
=
ParseKeyToPath
(
parts
[
2
])
if
err
!=
nil
{
return
""
,
err
}
...
...
@@ -86,3 +88,8 @@ func ParseKeyToPath(txt string) (Path, error) {
}
return
FromKey
(
u
.
Key
(
chk
)),
nil
}
func
(
p
*
Path
)
IsValid
()
error
{
_
,
err
:=
ParsePath
(
p
.
String
())
return
err
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment