func _http(port int) { p := strconv.Itoa(port) http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir(conf.DirHtml()+"/assets/")))) http.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir(conf.DirHtml())))) log.Println("监听端口 :" + p + "...") err := http.ListenAndServe(":"+p, nil) if err != nil { log.Printf("ListenAndServe: %s\n", err) } }
"io" "io/ioutil" "os" "path" "path/filepath" "sort" "strings" "time" "github.com/guhao022/chca/conf" "github.com/guhao022/chca/utils" "gopkg.in/yaml.v2" ) var ( htmlStor = conf.DirHtml() //编译后保存的文件夹 contents []*Article cates map[string]*Category tags map[string]*Tag ) func LoadArticle() { contents = make([]*Article, 0) cates = make(map[string]*Category) tags = make(map[string]*Tag) mdlist := Marklist()