Skip to content

Commit 413cd88

Browse files
committed
WIP 3
1 parent ede198f commit 413cd88

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tool.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,11 @@ func main() {
507507
root = args[0]
508508
}
509509

510+
_, err := gbuild.NewSession(options)
511+
if err != nil {
512+
options.PrintError("%s\n", err)
513+
os.Exit(1)
514+
}
510515
sourceFiles := http.FileServer(serveCommandFileSystem{
511516
serveRoot: root,
512517
options: options,
@@ -587,11 +592,13 @@ func (fs serveCommandFileSystem) Open(requestName string) (http.File, error) {
587592
isIndex := file == "index.html"
588593

589594
if isPkg || isMap || isIndex {
590-
// If we're going to be serving our special files, make sure there's a Go command in this folder.
595+
// TODO: a single session should probably be able to detect changes to source code on disk
596+
// Create a new session to pick up changes to source code on disk.
591597
s, err := gbuild.NewSession(fs.options)
592598
if err != nil {
593599
return nil, err
594600
}
601+
// If we're going to be serving our special files, make sure there's a Go command in this folder.
595602
pkg, err := gbuild.Import(path.Dir(name), 0, s.InstallSuffix(), fs.options.BuildTags)
596603
if err != nil || pkg.Name != "main" {
597604
isPkg = false

0 commit comments

Comments
 (0)