...

Source file src/github.com/letsencrypt/boulder/ctpolicy/loglist/lintlist.go

Documentation: github.com/letsencrypt/boulder/ctpolicy/loglist

     1  package loglist
     2  
     3  import "sync"
     4  
     5  var lintlist struct {
     6  	sync.Once
     7  	list List
     8  	err  error
     9  }
    10  
    11  // InitLintList creates and stores a loglist intended for linting (i.e. with
    12  // purpose Validation). We have to store this in a global because the zlint
    13  // framework doesn't (yet) support configuration, so the e_scts_from_same_operator
    14  // lint cannot load a log list on its own. Instead, we have the CA call this
    15  // initialization function at startup, and have the lint call the getter below
    16  // to get access to the cached list.
    17  func InitLintList(path string) error {
    18  	lintlist.Do(func() {
    19  		l, err := New(path)
    20  		if err != nil {
    21  			lintlist.err = err
    22  			return
    23  		}
    24  
    25  		l, err = l.forPurpose(Validation)
    26  		if err != nil {
    27  			lintlist.err = err
    28  			return
    29  		}
    30  
    31  		lintlist.list = l
    32  	})
    33  
    34  	return lintlist.err
    35  }
    36  
    37  // GetLintList returns the log list initialized by InitLintList. This must
    38  // only be called after InitLintList has been called on the same (or parent)
    39  // goroutine.
    40  func GetLintList() List {
    41  	return lintlist.list
    42  }
    43  

View as plain text