Changed code to use new rune type unicode code points.
This commit is contained in:
parent
2985202b2b
commit
5b255b58ee
4
main.go
4
main.go
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user