github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/brutecheck/check/lengthsingle.go (about)

     1  package check
     2  
     3  func Len1Ch(name string) bool {
     4  	switch len(name) {
     5  	case 2: // go, if
     6  		switch name[0] {
     7  		case 'g':
     8  			return name == "go"
     9  		case 'i':
    10  			return name == "if"
    11  		}
    12  		return false
    13  	case 3: // for, map, var
    14  		switch name[0] {
    15  		case 'f':
    16  			return name == "for"
    17  		case 'm':
    18  			return name == "map"
    19  		case 'v':
    20  			return name == "var"
    21  		}
    22  		return false
    23  	case 4: // case, chan, else, func, goto, type
    24  		switch name[1] {
    25  		case 'a':
    26  			return name == "case"
    27  		case 'h':
    28  			return name == "chan"
    29  		case 'l':
    30  			return name == "else"
    31  		case 'u':
    32  			return name == "func"
    33  		case 'o':
    34  			return name == "goto"
    35  		case 'y':
    36  			return name == "type"
    37  		}
    38  		return false
    39  	case 5: // break, const, defer, range
    40  		switch name[0] {
    41  		case 'b':
    42  			return name == "break"
    43  		case 'c':
    44  			return name == "const"
    45  		case 'd':
    46  			return name == "defer"
    47  		case 'r':
    48  			return name == "range"
    49  		}
    50  		return false
    51  	case 6: // import, return, select, struct, switch
    52  		switch name[2] {
    53  		case 'p':
    54  			return name == "import"
    55  		case 't':
    56  			return name == "return"
    57  		case 'l':
    58  			return name == "select"
    59  		case 'r':
    60  			return name == "struct"
    61  		case 'i':
    62  			return name == "switch"
    63  		}
    64  		return false
    65  	case 7: // default, package
    66  		switch name[0] {
    67  		case 'd':
    68  			return name == "default"
    69  		case 'p':
    70  			return name == "package"
    71  		}
    72  		return false
    73  	case 8: // continue
    74  		return name == "continue"
    75  	case 9: // interface
    76  		return name == "interface"
    77  	}
    78  	return false
    79  }