MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / IsGoIdentity

Function IsGoIdentity

pkg/codegen/utils.go:724–732  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

722//
723// See https://golang.org/ref/spec#Identifiers
724func 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
734func isValidRuneForGoID(index int, char rune) bool {
735 if index == 0 && unicode.IsNumber(char) {

Callers 1

IsValidGoIdentityFunction · 0.85

Calls 2

isValidRuneForGoIDFunction · 0.85
IsGoKeywordFunction · 0.85

Tested by

no test coverage detected