0
我有一個錯誤。 Document
是goquery庫上的struct對象。 我無法在下面的代碼中使用它。我能怎麼做?如何使用庫對象?
package main
import (
"log"
"github.com/PuerkitoBio/goquery"
"os"
)
func getLocalFile(filename string) (*Document) { // Error
f, e := os.Open(FILTER_FILE)
if e != nil {
log.Fatal(e)
}
defer f.Close()
doc, e := goquery.NewDocumentFromReader(f)
if e != nil {
log.Fatal(e)
}
return doc
}
const FILE_NAME = "input.html"
func main() {
doc := getLocalFile(FILE_NAME)
println(doc)
}
哦,我明白了。我需要在對象名稱前面提供庫名稱。我的問題已清理完畢。謝謝您的回答。 –