亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Godooc不會讀取我的代碼,或者godoc無法讀取anonymouse函數?

Godooc不會讀取我的代碼,或者godoc無法讀取anonymouse函數?

Go
慕標琳琳 2022-08-24 20:14:03
最近我試圖記錄我的代碼,但我在使用時遇到了一些麻煩,因為當我運行時沒有出現一些函數godocgodoc -http:localhost:6060這是我的代碼的樣子:type MongoDBInterface interface {    ExecuteTransaction(operation func(mongoClient MongoDBInterface) error) error    Count(tableName string, clause bson.M) (int, error)    Distinct(tableName, fieldName string, clause bson.M) ([]interface{}, error)    InsertOrUpdate(tableName string, clause bson.M, data models.BaseModelInterface) (primitive.ObjectID, error)    InsertOrUpdateFields(tableName string, clause bson.M, data interface{}) (primitive.ObjectID, error)    Insert(tableName string, data models.BaseModelInterface) (primitive.ObjectID, error)    Update(tableName string, clause bson.M, data models.BaseModelInterface) error    UpdateFields(tableName string, clause bson.M, data interface{}) error    FindOne(tableName string, clause, opt bson.M, result interface{}) error    FindMany(tableName string, clause, opt bson.M, result interface{}) error    Truncate(tableName string) error    Delete(tableName string, clause bson.M) error    Aggregate(tableName string, pipelines interface{}, result interface{}) error    EnsureCollections() error}type mongoDB struct {    session              mongo.Session    db                   *mongo.Database    ctx                  context.Context    isTransactionEnabled bool    isConnected          bool    connString string}// NewMongoDB definitionfunc NewMongoDB() MongoDBInterface {    mongoClient := new(mongoDB)    mongoClient.ctx = context.Background()    dbHost := os.Getenv("DB_HOST")    if dbHost == "" {        dbHost = "localhost"    }    dbUser := os.Getenv("DB_USERNAME")    if dbUser == "" {        dbUser = "dbadmin"    }問題是永遠不會渲染,但我需要它被記錄下來,你們能向我解釋一下發生了什么嗎?或者,也許您可以給我一些記錄Go代碼的解決方案和提示。godocfunc (s *mongoDB) 
查看完整描述

1 回答

?
楊__羊羊

TA貢獻1943條經驗 獲得超7個贊

您可以參考此文檔:https://pkg.go.dev/golang.org/x/tools/cmd/godoc


The presentation mode of web pages served by godoc can be controlled with the "m" URL parameter; it accepts a comma-separated list of flag names as value:


- all   show documentation for all declarations, not just the exported ones

- methods   show all embedded methods, not just those of unexported anonymous fields

- src   show the original source code rather than the extracted documentation

- flat  present flat (not indented) directory listings using full paths


For instance, https://golang.org/pkg/math/big/?m=all shows the documentation for all (not just the exported) declarations of package big. 

?m=all文件所有申報,包括非出口方式


查看完整回答
反對 回復 2022-08-24
  • 1 回答
  • 0 關注
  • 89 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號