Changed code to use new rune type unicode code points.

This commit is contained in:
jim teeuwen 2011-10-26 11:59:30 +02:00
parent 2985202b2b
commit 5b255b58ee

View File

@ -63,7 +63,7 @@ func main() {
fmt.Fprintln(os.Stderr, "[w] No package name specified. Using 'main'.") fmt.Fprintln(os.Stderr, "[w] No package name specified. Using 'main'.")
*pkgname = "main" *pkgname = "main"
} else { } else {
if unicode.IsDigit(int((*pkgname)[0])) { if unicode.IsDigit(rune((*pkgname)[0])) {
// Identifier can't start with a digit. // Identifier can't start with a digit.
*pkgname = "_" + *pkgname *pkgname = "_" + *pkgname
} }
@ -80,7 +80,7 @@ func main() {
file = strings.Replace(file, " ", "_", -1) file = strings.Replace(file, " ", "_", -1)
file = strings.Replace(file, ".", "_", -1) file = strings.Replace(file, ".", "_", -1)
file = strings.Replace(file, "-", "_", -1) file = strings.Replace(file, "-", "_", -1)
if unicode.IsDigit(int(file[0])) { if unicode.IsDigit(rune(file[0])) {
// Identifier can't start with a digit. // Identifier can't start with a digit.
file = "_" + file file = "_" + file
} }