@@ -56,33 +56,27 @@ type PackageManager struct {
56
56
// Builder is used to create a new PackageManager. The builder
57
57
// has methods to load patforms and tools to actually build the PackageManager.
58
58
// Once the PackageManager is built, it cannot be changed anymore.
59
- type Builder struct {
60
- * PackageManager
61
- }
59
+ type Builder PackageManager
62
60
63
61
// Explorer is used to query the PackageManager. When used it holds
64
62
// a read-only lock on the PackageManager that must be released when the
65
63
// job is completed.
66
- type Explorer struct {
67
- * PackageManager
68
- }
64
+ type Explorer PackageManager
69
65
70
66
var tr = i18n .Tr
71
67
72
68
// NewBuilder returns a new Builder
73
69
func NewBuilder (indexDir , packagesDir , downloadDir , tempDir * paths.Path , userAgent string ) * Builder {
74
70
return & Builder {
75
- PackageManager : & PackageManager {
76
- log : logrus .StandardLogger (),
77
- packages : cores .NewPackages (),
78
- IndexDir : indexDir ,
79
- PackagesDir : packagesDir ,
80
- DownloadDir : downloadDir ,
81
- tempDir : tempDir ,
82
- packagesCustomGlobalProperties : properties .NewMap (),
83
- discoveryManager : discoverymanager .New (),
84
- userAgent : userAgent ,
85
- },
71
+ log : logrus .StandardLogger (),
72
+ packages : cores .NewPackages (),
73
+ IndexDir : indexDir ,
74
+ PackagesDir : packagesDir ,
75
+ DownloadDir : downloadDir ,
76
+ tempDir : tempDir ,
77
+ packagesCustomGlobalProperties : properties .NewMap (),
78
+ discoveryManager : discoverymanager .New (),
79
+ userAgent : userAgent ,
86
80
}
87
81
}
88
82
@@ -128,7 +122,18 @@ func (pm *PackageManager) NewBuilder() (builder *Builder, commit func()) {
128
122
// to correctly dispose it.
129
123
func (pm * PackageManager ) NewExplorer () (explorer * Explorer , release func ()) {
130
124
pm .packagesLock .RLock ()
131
- return & Explorer {pm }, pm .packagesLock .RUnlock
125
+ return & Explorer {
126
+ log : pm .log ,
127
+ packages : pm .packages ,
128
+ IndexDir : pm .IndexDir ,
129
+ PackagesDir : pm .PackagesDir ,
130
+ DownloadDir : pm .DownloadDir ,
131
+ tempDir : pm .tempDir ,
132
+ packagesCustomGlobalProperties : pm .packagesCustomGlobalProperties ,
133
+ profile : pm .profile ,
134
+ discoveryManager : pm .discoveryManager ,
135
+ userAgent : pm .userAgent ,
136
+ }, pm .packagesLock .RUnlock
132
137
}
133
138
134
139
// GetProfile returns the active profile for this package manager, or nil if no profile is selected.
0 commit comments