File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -63,8 +63,6 @@ func runServer() {
6363
6464 printSuccessMessage ()
6565
66- openURL (localURL )
67-
6866 rootDir := "./web"
6967 log .Fatal (http .Serve (addr , http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
7068 // if the file is not found, serve the index.html file
@@ -129,7 +127,7 @@ func runWebsockerServer() {
129127 http .Serve (addr , nil )
130128}
131129
132- func handleChange () {
130+ func handleChange (starting bool ) {
133131 removeLines (linesToRemove )
134132 printCompilingMessage ()
135133 err := build ()
@@ -139,6 +137,9 @@ func handleChange() {
139137 printErrorMessage (err )
140138 } else {
141139 printSuccessMessage ()
140+ if starting {
141+ openURL (localURL )
142+ }
142143 chReload <- struct {}{}
143144 }
144145}
@@ -168,7 +169,7 @@ func watch() {
168169 }
169170
170171 if ! initial {
171- handleChange ()
172+ handleChange (false )
172173 }
173174
174175 watchFiles [path ] = true
@@ -181,7 +182,7 @@ func watch() {
181182 }
182183
183184 walkdir (true )
184- handleChange ()
185+ handleChange (true )
185186
186187 ticker := time .NewTicker (500 * time .Millisecond )
187188 defer ticker .Stop ()
@@ -207,7 +208,7 @@ func watch() {
207208 log .Printf ("error: %v" , err )
208209 case <- ticker .C :
209210 if hasChanged .CompareAndSwap (true , false ) {
210- handleChange ()
211+ handleChange (false )
211212 }
212213 case <- ticker2 .C :
213214 walkdir (false )
You can’t perform that action at this time.
0 commit comments