Skip to content

Commit

Permalink
refactor: should have used pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
zjrgov committed Jan 15, 2025
1 parent 923f0a0 commit e223112
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions runner/cfd/cmd/drive/read_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ type EnvCfg struct {
}

type JobResData struct {
Image JobResImg
Variables JobResVars
Services []JobResSvcs
Image *JobResImg
Variables *JobResVars
Services []*JobResSvcs
}
type JobResImg struct {
Name string
Expand All @@ -46,8 +46,8 @@ type JobResVars []struct {
Value string
}
type JobResSvcs struct {
JobResImg
Variables JobResVars
*JobResImg
Variables *JobResVars
}

type VcapAppData struct {
Expand Down
10 changes: 5 additions & 5 deletions runner/cfd/cmd/drive/read_env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ func Test_parseJobResFile(t *testing.T) {
t.Setenv("JOB_RESPONSE_FILE", "./testdata/sample_job_response.json")

wanted := &JobResData{
Image: JobResImg{
Image: &JobResImg{
Command: []string{"a", "b", "c"},
Entrypoint: []string{"d", "e", "f"},
},
Services: []JobResSvcs{{
JobResImg: JobResImg{
Services: []*JobResSvcs{{
JobResImg: &JobResImg{
Name: "postgres:wormy",
Alias: "my-pg-service",
Command: []string{"g", "h", "i"},
Entrypoint: []string{"j", "k", "l"},
},
Variables: JobResVars{{Key: "bazz", Value: "buzz"}},
Variables: &JobResVars{{Key: "bazz", Value: "buzz"}},
}},
Variables: JobResVars{{Key: "foo", Value: "bar"}},
Variables: &JobResVars{{Key: "foo", Value: "bar"}},
}

cfg := getEnvCfg()
Expand Down

0 comments on commit e223112

Please sign in to comment.