Skip to content
This repository was archived by the owner on May 8, 2023. It is now read-only.

Commit 5d261f7

Browse files
Add omitempty to launch checks.
Don't autogenerate watch dirs. Skip the current directory when searching for edward.json files to import.
1 parent 4700b6b commit 5d261f7

4 files changed

Lines changed: 19 additions & 27 deletions

File tree

generators/edward.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ func (v *EdwardGenerator) Name() string {
2222
// VisitDir searches a directory for edward.json files, and will store an import
2323
// for any found. Returns true in the first return value if an import was found.
2424
func (v *EdwardGenerator) VisitDir(path string) (bool, error) {
25+
if path == v.basePath {
26+
return false, nil
27+
}
2528
files, _ := ioutil.ReadDir(path)
2629
for _, f := range files {
2730
if f.Name() == "edward.json" {

generators/generators_test.go

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ func TestEdwardGenerator(t *testing.T) {
6868
},
6969
outServices: []*services.ServiceConfig{
7070
{
71-
Name: "goproject",
72-
Path: common.StringToStringPointer("goproject"),
73-
Env: []string{},
74-
WatchJSON: []byte("{\"include\":[\"goproject\"]}"),
71+
Name: "goproject",
72+
Path: common.StringToStringPointer("goproject"),
73+
Env: []string{},
7574
Commands: services.ServiceConfigCommands{
7675
Build: "go install",
7776
Launch: "goproject",
@@ -118,10 +117,9 @@ func TestGoGenerator(t *testing.T) {
118117
path: "testdata/go/simple/",
119118
outServices: []*services.ServiceConfig{
120119
{
121-
Name: "simple",
122-
Path: common.StringToStringPointer("gocode/src/yext/simple"),
123-
Env: []string{},
124-
WatchJSON: []byte("{\"include\":[\"gocode/src/yext/simple\"]}"),
120+
Name: "simple",
121+
Path: common.StringToStringPointer("gocode/src/yext/simple"),
122+
Env: []string{},
125123
Commands: services.ServiceConfigCommands{
126124
Build: "go install",
127125
Launch: "simple",
@@ -135,20 +133,18 @@ func TestGoGenerator(t *testing.T) {
135133
path: "testdata/go/multiple/",
136134
outServices: []*services.ServiceConfig{
137135
{
138-
Name: "service1",
139-
Path: common.StringToStringPointer("service1"),
140-
Env: []string{},
141-
WatchJSON: []byte("{\"include\":[\"service1\"]}"),
136+
Name: "service1",
137+
Path: common.StringToStringPointer("service1"),
138+
Env: []string{},
142139
Commands: services.ServiceConfigCommands{
143140
Build: "go install",
144141
Launch: "service1",
145142
},
146143
},
147144
{
148-
Name: "service2",
149-
Path: common.StringToStringPointer("service2"),
150-
Env: []string{},
151-
WatchJSON: []byte("{\"include\":[\"service2\"]}"),
145+
Name: "service2",
146+
Path: common.StringToStringPointer("service2"),
147+
Env: []string{},
152148
Commands: services.ServiceConfigCommands{
153149
Build: "go install",
154150
Launch: "service2",
@@ -163,10 +159,9 @@ func TestGoGenerator(t *testing.T) {
163159
targets: []string{"service1"},
164160
outServices: []*services.ServiceConfig{
165161
{
166-
Name: "service1",
167-
Path: common.StringToStringPointer("service1"),
168-
Env: []string{},
169-
WatchJSON: []byte("{\"include\":[\"service1\"]}"),
162+
Name: "service1",
163+
Path: common.StringToStringPointer("service1"),
164+
Env: []string{},
170165
Commands: services.ServiceConfigCommands{
171166
Build: "go install",
172167
Launch: "service1",

generators/go.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ func (v *GoGenerator) goService(name, packagePath string) (*services.ServiceConf
9090
},
9191
}
9292

93-
watch, err := v.createWatch(service)
94-
if err != nil {
95-
return nil, errors.WithStack(err)
96-
}
97-
service.SetWatch(watch)
98-
9993
return service, nil
10094
}
10195

services/serviceconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type ServiceConfig struct {
3939
Commands ServiceConfigCommands `json:"commands"`
4040

4141
// Checks to perform to ensure that a service has started correctly
42-
LaunchChecks *LaunchChecks `json:"launch_checks"`
42+
LaunchChecks *LaunchChecks `json:"launch_checks,omitempty"`
4343

4444
// Env holds environment variables for a service, for example: GOPATH=~/gocode/
4545
// These will be added to the vars in the environment under which the Edward command was run

0 commit comments

Comments
 (0)