diff --git a/rhel/repo2cpe/updater.go b/rhel/repo2cpe/updater.go index 5f1f1f38b..3ec9c1144 100644 --- a/rhel/repo2cpe/updater.go +++ b/rhel/repo2cpe/updater.go @@ -31,10 +31,12 @@ func NewLocalUpdaterJob(url string, client *http.Client) *LocalUpdaterJob { if client == nil { client = http.DefaultClient } - return &LocalUpdaterJob{ + lu := &LocalUpdaterJob{ URL: url, Client: client, } + lu.mapping.Store((*MappingFile)(nil)) + return lu } // Get translates repositories into CPEs using a mapping file. @@ -49,9 +51,10 @@ func (updater *LocalUpdaterJob) Get(ctx context.Context, repositories []string) } cpes := []string{} - var mapping *MappingFile = updater.mapping.Load().(*MappingFile) + // interface conversion guaranteed to pass, see + // constructor. + mapping := updater.mapping.Load().(*MappingFile) if mapping == nil { - // mapping not set yet. not an error return cpes, nil }