package commands
import (
- "github.com/spf13/cobra"
"os"
"runtime/pprof"
+
+ "github.com/spf13/cobra"
)
var (
return err
}
for i := 0; i < benchmarkTimes; i++ {
- mainSite = nil
+ MainSite = nil
_ = buildSite()
}
pprof.WriteHeapProfile(f)
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
for i := 0; i < benchmarkTimes; i++ {
- mainSite = nil
+ MainSite = nil
_ = buildSite()
}
}
"gopkg.in/fsnotify.v1"
)
-var mainSite *hugolib.Site
+var MainSite *hugolib.Site
// userError is an error used to signal different error situations in command handling.
type commandError struct {
}
func buildSite(watching ...bool) (err error) {
+ fmt.Println("Started building site")
startTime := time.Now()
- if mainSite == nil {
- mainSite = new(hugolib.Site)
+ if MainSite == nil {
+ MainSite = new(hugolib.Site)
}
if len(watching) > 0 && watching[0] {
- mainSite.RunMode.Watching = true
+ MainSite.RunMode.Watching = true
}
- err = mainSite.Build()
+ err = MainSite.Build()
if err != nil {
return err
}
- mainSite.Stats()
+ MainSite.Stats()
jww.FEEDBACK.Printf("in %v ms\n", int(1000*time.Since(startTime).Seconds()))
return nil
func rebuildSite(events []fsnotify.Event) error {
startTime := time.Now()
- err := mainSite.ReBuild(events)
+ err := MainSite.ReBuild(events)
if err != nil {
return err
}
- mainSite.Stats()
+ MainSite.Stats()
jww.FEEDBACK.Printf("in %v ms\n", int(1000*time.Since(startTime).Seconds()))
return nil