github.com/Schaudge/hts@v0.0.0-20240223063651-737b4d69d68c/htstestutil/htstestutil.go (about) 1 package htstestutil 2 3 import ( 4 "sync" 5 6 "github.com/Schaudge/hts/sam" 7 "github.com/grailbio/testutil/h" 8 ) 9 10 var once = sync.Once{} 11 12 // RegisterSAMRecordComparator adds a github.com/grailbio/testutil/h comparator 13 // for sam.Record. This function is threadsafe & idempotent. 14 func RegisterSAMRecordComparator() { 15 once.Do(func() { 16 h.RegisterComparator(func(f0, f1 sam.Record) (int, error) { 17 if f0.Equal(&f1) { 18 return 0, nil 19 } 20 return 1, nil 21 }) 22 }) 23 }