IsGoIdentity checks if the given string can be used as an identity in the generated code like a type name or constant name. See https://golang.org/ref/spec#Identifiers
(str string)
| 722 | // |
| 723 | // See https://golang.org/ref/spec#Identifiers |
| 724 | func IsGoIdentity(str string) bool { |
| 725 | for i, c := range str { |
| 726 | if !isValidRuneForGoID(i, c) { |
| 727 | return false |
| 728 | } |
| 729 | } |
| 730 | |
| 731 | return IsGoKeyword(str) |
| 732 | } |
| 733 | |
| 734 | func isValidRuneForGoID(index int, char rune) bool { |
| 735 | if index == 0 && unicode.IsNumber(char) { |
no test coverage detected