mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
skipping private constants
This commit is contained in:
parent
02c6df601e
commit
0378e169a7
@ -163,13 +163,17 @@ func loadConstants(pkg *ast.Package) map[string]*ast.BasicLit {
|
|||||||
spec := spec.(*ast.ValueSpec)
|
spec := spec.(*ast.ValueSpec)
|
||||||
for _, val := range spec.Values {
|
for _, val := range spec.Values {
|
||||||
if reflect.ValueOf(val).Type().String() == "*ast.BasicLit" {
|
if reflect.ValueOf(val).Type().String() == "*ast.BasicLit" {
|
||||||
|
|
||||||
firstValueLit := val.(*ast.BasicLit)
|
firstValueLit := val.(*ast.BasicLit)
|
||||||
//fmt.Println("a value spec", spec.Names[0], firstValueLit.Kind, firstValueLit.Value)
|
constName := spec.Names[0].String()
|
||||||
constants[spec.Names[0].String()] = firstValueLit //.Value
|
for indexRune, r := range constName {
|
||||||
|
if indexRune == 0 {
|
||||||
|
if string(r) == strings.ToUpper(string(r)) {
|
||||||
|
constants[constName] = firstValueLit
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user