Commit daacba51 authored by Rob Pike's avatar Rob Pike

gc: include full text of import path in error message

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5783091
parent 677caf78
...@@ -3624,23 +3624,23 @@ isbadimport(Strlit *path) ...@@ -3624,23 +3624,23 @@ isbadimport(Strlit *path)
while(*s) { while(*s) {
s += chartorune(&r, s); s += chartorune(&r, s);
if(r == Runeerror) { if(r == Runeerror) {
yyerror("import path contains invalid UTF-8 sequence"); yyerror("import path contains invalid UTF-8 sequence: \"%s\"", path->s);
return 1; return 1;
} }
if(r < 0x20 || r == 0x7f) { if(r < 0x20 || r == 0x7f) {
yyerror("import path contains control character"); yyerror("import path contains control character: \"%s\"", path->s);
return 1; return 1;
} }
if(r == '\\') { if(r == '\\') {
yyerror("import path contains backslash; use slash"); yyerror("import path contains backslash; use slash: \"%s\"", path->s);
return 1; return 1;
} }
if(isspacerune(r)) { if(isspacerune(r)) {
yyerror("import path contains space character"); yyerror("import path contains space character: \"%s\"", path->s);
return 1; return 1;
} }
if(utfrune("!\"#$%&'()*,:;<=>?[]^`{|}~", r)) { if(utfrune("!\"#$%&'()*,:;<=>?[]^`{|}~", r)) {
yyerror("import path contains invalid character '%C'", r); yyerror("import path contains invalid character '%C': \"%s\"", r, path->s);
return 1; return 1;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment