Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
fix(server): hot-reload plan's files (#57)
Browse files Browse the repository at this point in the history
Signed-off-by: Vasek - Tom C <[email protected]>
  • Loading branch information
TomChv authored Jul 20, 2022
1 parent 43eefb0 commit 163133d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ func (p *Plan) loadImports() error {
return nil
}

func (p *Plan) loadFiles() error {
for path := range p.files {
f, err := file.New(filepath.Join(p.rootPath, path))
if err != nil {
return err
}

p.files[path] = f
}

return nil
}

// GetDefinition return a value following a path
// - `.#Foo` = definition in current plan
// - `pkg.#Bar` = definition in package pkg
Expand Down Expand Up @@ -272,6 +285,10 @@ func (p *Plan) Reload() error {
return err
}

if err := p.loadFiles(); err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit 163133d

Please sign in to comment.