initDefaultNames initializes the defaultNames field of the Outputs object. We run this lazily (rather than eagerly in initOutputs) because it depends on the Package, and initOutputs is called from the Package constructor, so cannot depend on Package.
(pkg *Package)
| 30 | // We run this lazily (rather than eagerly in initOutputs) because it depends on the Package, |
| 31 | // and initOutputs is called from the Package constructor, so cannot depend on Package. |
| 32 | func (out *outputs) initDefaultNames(pkg *Package) error { |
| 33 | sysInfo, err := pkg.sysInfoIfExists() |
| 34 | if err != nil { |
| 35 | return err |
| 36 | } |
| 37 | |
| 38 | out.defaultNames = []string{} |
| 39 | if sysInfo == nil { |
| 40 | return nil |
| 41 | } |
| 42 | |
| 43 | for _, output := range sysInfo.DefaultOutputs() { |
| 44 | out.defaultNames = append(out.defaultNames, output.Name) |
| 45 | } |
| 46 | return nil |
| 47 | } |
no test coverage detected