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
76a07833
Commit
76a07833
authored
Dec 17, 2011
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
goinstall: only suggest -fix for bad imports when appropriate
R=golang-dev, r CC=golang-dev
https://golang.org/cl/5495073
parent
96a5780d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
src/cmd/goinstall/download.go
src/cmd/goinstall/download.go
+9
-5
src/cmd/goinstall/main.go
src/cmd/goinstall/main.go
+4
-0
No files found.
src/cmd/goinstall/download.go
View file @
76a07833
...
...
@@ -367,6 +367,14 @@ func (v *vcs) findURL(root string) (string, error) {
var
oldGoogleRepo
=
regexp
.
MustCompile
(
`^([a-z0-9\-]+)\.googlecode\.com/(svn|git|hg)(/[a-z0-9A-Z_.\-/]+)?$`
)
type
errOldGoogleRepo
struct
{
fixedPath
string
}
func
(
e
*
errOldGoogleRepo
)
Error
()
string
{
return
fmt
.
Sprintf
(
"unsupported import path; should be %q"
,
e
.
fixedPath
)
}
// download checks out or updates the specified package from the remote server.
func
download
(
importPath
,
srcDir
string
)
(
public
bool
,
err
error
)
{
if
strings
.
Contains
(
importPath
,
".."
)
{
...
...
@@ -376,11 +384,7 @@ func download(importPath, srcDir string) (public bool, err error) {
if
m
:=
oldGoogleRepo
.
FindStringSubmatch
(
importPath
);
m
!=
nil
{
fixedPath
:=
"code.google.com/p/"
+
m
[
1
]
+
m
[
3
]
err
=
fmt
.
Errorf
(
"unsupported import path; should be %q
\n
"
+
"Run goinstall with -fix to gofix the code."
,
fixedPath
,
)
err
=
&
errOldGoogleRepo
{
fixedPath
}
return
}
...
...
src/cmd/goinstall/main.go
View file @
76a07833
...
...
@@ -249,6 +249,10 @@ func install(pkg, parent string) error {
printf
(
"%s: download
\n
"
,
pkg
)
public
,
err
=
download
(
pkg
,
tree
.
SrcDir
())
if
err
!=
nil
{
// only suggest -fix if the bad import was not on the command line
if
e
,
ok
:=
err
.
(
*
errOldGoogleRepo
);
ok
&&
parent
!=
""
{
err
=
fmt
.
Errorf
(
"%v
\n
Run goinstall with -fix to gofix the code."
,
e
)
}
return
&
DownloadError
{
pkg
,
tree
.
Goroot
,
err
}
}
}
else
{
...
...
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