Skip to content

Commit

Permalink
gen-accessors: fix list of blacklisted structs and fields
Browse files Browse the repository at this point in the history
- Remove "service" from list of blacklisted fields because that was a
  mistake in the previous commit.
- Add "service" to list of blacklisted structs because it  would make
  more sense to not generate accessors for its fields.
- Remove all debug printf statements.
  • Loading branch information
sahildua2305 committed Nov 22, 2017
1 parent 0206cdc commit 682770b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions github/gen-accessors.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ var (
// this blacklist lists structs for which we don't want to generate
// accessors.
blacklistStruct = map[string]bool{
"Client": true,
"Client": true,
"service": true,
}
// this blacklist lists fields for which we don't want to generate
// accessors.
blacklistField = map[string]bool{
"client": true,
"service": true,
}
)

Expand Down Expand Up @@ -119,19 +119,16 @@ func (t *templateData) processAST(f *ast.File) error {
fieldName := field.Names[0]
// check in blacklist if the ts.Name struct is blacklisted
if key := fmt.Sprintf("%v", ts.Name); blacklistStruct[key] {
fmt.Printf("Struct %v blacklisted; skipping.\n", key)
logf("Struct %v blacklisted; skipping.", key)
continue
}
// check in blacklist if the field is blacklisted
if key := fmt.Sprintf("%v", fieldName); blacklistField[key] {
fmt.Printf("Field %v is blacklisted; skipping.\n", key)
logf("Field %v is blacklisted; skipping.", key)
continue
}
// check for "struct.method" in blacklist
if key := fmt.Sprintf("%v.Get%v", ts.Name, fieldName); blacklistStructMethod[key] {
fmt.Printf("%+v\n", key)
logf("Method %v blacklisted; skipping.", key)
continue
}
Expand Down

0 comments on commit 682770b

Please sign in to comment.