1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

CHORE: linting (#2098)

This commit is contained in:
Tom Limoncelli
2023-02-27 20:28:17 -05:00
committed by GitHub
parent 4eab96226c
commit 169d7c8062
9 changed files with 35 additions and 31 deletions

View File

@@ -2,6 +2,8 @@ package models
// Functions that make it easier to deal with a group of records.
// RecordDB is a container of many RecordConfig, queryable by various methods.
// The first to be implemented is as a hash with label:type as the index.
type RecordDB struct {
labelAndTypeMap map[RecordKey]struct{}
}
@@ -10,10 +12,8 @@ type RecordDB struct {
func NewRecordDBFromRecords(recs Records, zone string) *RecordDB {
result := &RecordDB{}
//fmt.Printf("DEBUG: BUILDING RecordDB: zone=%v\n", zone)
result.labelAndTypeMap = make(map[RecordKey]struct{}, len(recs))
for _, rec := range recs {
//fmt.Printf(" DEBUG: Adding %+v\n", rec.Key())
result.labelAndTypeMap[rec.Key()] = struct{}{}
}
//fmt.Printf("DEBUG: BUILDING RecordDB: DONE!\n")
@@ -25,6 +25,5 @@ func NewRecordDBFromRecords(recs Records, zone string) *RecordDB {
// on the record's label and type (i.e. the RecordKey)
func (recdb *RecordDB) ContainsLT(rec *RecordConfig) bool {
_, ok := recdb.labelAndTypeMap[rec.Key()]
//fmt.Printf("DEBUG: ContainsLT(%q) = %v (%v)\n", rec.Key(), ok, recdb)
return ok
}