Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

Commit 9d3c2ed

Browse files
author
Anthony Emengo
committed
Remove duplicate workspace declaration in cmd/start.go
[ci skip]
1 parent 8945cca commit 9d3c2ed

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

cmd/root.go

-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ func NewRoot(exit chan struct{}, ui UI, config config.Config, analyticsClient An
140140
AnalyticsD: analyticsD,
141141
Provisioner: provisioner,
142142
Provision: provision,
143-
MetaDataReader: workspace,
144143
Stop: stop,
145144
OS: &cfdevos.OS{},
146145
}

cmd/start/start.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,14 @@ type Stop interface {
7070
type Workspace interface {
7171
CreateDirs() error
7272
SetupState(depsFile string) error
73+
Metadata() (workspace.Metadata, error)
7374
}
7475

7576
//go:generate mockgen -package mocks -destination mocks/cache.go code.cloudfoundry.org/cfdev/cmd/start Cache
7677
type Cache interface {
7778
Sync(resource.Catalog) error
7879
}
7980

80-
//go:generate mockgen -package mocks -destination mocks/isoreader.go code.cloudfoundry.org/cfdev/cmd/start MetaDataReader
81-
type MetaDataReader interface {
82-
Metadata() (workspace.Metadata, error)
83-
}
84-
8581
type Args struct {
8682
Registries string
8783
DeploySingleService string
@@ -96,7 +92,6 @@ type Start struct {
9692
Exit chan struct{}
9793
UI UI
9894
Config config.Config
99-
MetaDataReader MetaDataReader
10095
Analytics AnalyticsClient
10196
AnalyticsToggle Toggle
10297
Cache Cache
@@ -212,7 +207,7 @@ func (s *Start) Execute(args Args) error {
212207
return e.SafeWrap(err, "Unable to setup directories")
213208
}
214209

215-
metaData, err := s.MetaDataReader.Metadata()
210+
metaData, err := s.Workspace.Metadata()
216211
if err != nil {
217212
return e.SafeWrap(err, fmt.Sprintf("%s is not compatible with CF Dev. Please use a compatible file.", depsPath))
218213
}

main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ func main() {
6565
os.Exit(1)
6666
}
6767

68-
analyticsToggle := toggle.New(filepath.Join(conf.CFDevHome, "analytics", "analytics.txt"))
69-
baseAnalyticsClient, _ := analytics.NewWithConfig(conf.AnalyticsKey, analytics.Config{
70-
Logger: analytics.StdLogger(log.New(ioutil.Discard, "", 0)),
71-
})
72-
7368
o := cfdevos.OS{}
7469
osVersion, err := o.Version()
7570
if err != nil {
7671
osVersion = "unknown-os-version"
7772
}
7873

74+
analyticsToggle := toggle.New(filepath.Join(conf.CFDevHome, "analytics", "analytics.txt"))
75+
baseAnalyticsClient, _ := analytics.NewWithConfig(conf.AnalyticsKey, analytics.Config{
76+
Logger: analytics.StdLogger(log.New(ioutil.Discard, "", 0)),
77+
})
78+
7979
analyticsClient := cfanalytics.New(analyticsToggle, baseAnalyticsClient, conf.CliVersion.Original, osVersion, config.IsBehindProxy(), exitChan, ui)
8080
defer analyticsClient.Close()
8181

0 commit comments

Comments
 (0)