Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
bfac91a6
Commit
bfac91a6
authored
Dec 07, 2010
by
Michael Hoisie
Committed by
Russ Cox
Dec 07, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exec.LookPath: return os.PathError instad of os.ENOENT, it's more descriptive.
R=rsc CC=golang-dev
https://golang.org/cl/3448042
parent
688a8312
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
src/pkg/exec/lp_unix.go
src/pkg/exec/lp_unix.go
+2
-2
src/pkg/exec/lp_windows.go
src/pkg/exec/lp_windows.go
+2
-2
No files found.
src/pkg/exec/lp_unix.go
View file @
bfac91a6
...
@@ -29,7 +29,7 @@ func LookPath(file string) (string, os.Error) {
...
@@ -29,7 +29,7 @@ func LookPath(file string) (string, os.Error) {
if
canExec
(
file
)
{
if
canExec
(
file
)
{
return
file
,
nil
return
file
,
nil
}
}
return
""
,
os
.
ENOENT
return
""
,
&
os
.
PathError
{
"lookpath"
,
file
,
os
.
ENOENT
}
}
}
pathenv
:=
os
.
Getenv
(
"PATH"
)
pathenv
:=
os
.
Getenv
(
"PATH"
)
for
_
,
dir
:=
range
strings
.
Split
(
pathenv
,
":"
,
-
1
)
{
for
_
,
dir
:=
range
strings
.
Split
(
pathenv
,
":"
,
-
1
)
{
...
@@ -41,5 +41,5 @@ func LookPath(file string) (string, os.Error) {
...
@@ -41,5 +41,5 @@ func LookPath(file string) (string, os.Error) {
return
dir
+
"/"
+
file
,
nil
return
dir
+
"/"
+
file
,
nil
}
}
}
}
return
""
,
os
.
ENOENT
return
""
,
&
os
.
PathError
{
"lookpath"
,
file
,
os
.
ENOENT
}
}
}
src/pkg/exec/lp_windows.go
View file @
bfac91a6
...
@@ -49,7 +49,7 @@ func LookPath(file string) (string, os.Error) {
...
@@ -49,7 +49,7 @@ func LookPath(file string) (string, os.Error) {
if
f
,
ok
:=
canExec
(
file
,
exts
);
ok
{
if
f
,
ok
:=
canExec
(
file
,
exts
);
ok
{
return
f
,
nil
return
f
,
nil
}
}
return
``
,
os
.
ENOENT
return
``
,
&
os
.
PathError
{
"lookpath"
,
file
,
os
.
ENOENT
}
}
}
if
pathenv
:=
os
.
Getenv
(
`PATH`
);
pathenv
==
``
{
if
pathenv
:=
os
.
Getenv
(
`PATH`
);
pathenv
==
``
{
if
f
,
ok
:=
canExec
(
`.\`
+
file
,
exts
);
ok
{
if
f
,
ok
:=
canExec
(
`.\`
+
file
,
exts
);
ok
{
...
@@ -62,5 +62,5 @@ func LookPath(file string) (string, os.Error) {
...
@@ -62,5 +62,5 @@ func LookPath(file string) (string, os.Error) {
}
}
}
}
}
}
return
``
,
os
.
ENOENT
return
``
,
&
os
.
PathError
{
"lookpath"
,
file
,
os
.
ENOENT
}
}
}
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