All non-built in types can have methods
未關閉
適合新手
- 主要語言
- 沒有語言資料
- 星號
- 8.8k
- 分支
- 1.1k
- PR 合併指標
- 30 天內沒有已合併 PR
描述
https://github.com/basti1302/go-lang-cheat-sheet/blame/master/README.markdown#L345
and
https://github.com/basti1302/go-lang-cheat-sheet/blame/master/README.markdown#L361-L363
Seem to imply that functions can only be assigned to structs, however all user defined types can have methods. There is nothing unique about structs with regard to method/function declaration.
see example:
https://play.golang.org/p/DPFZz0mCbi
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
該 issue 指出了 README.markdown 中的特定行(第 345 行和第 361-363 行),這些行錯誤地說明方法僅適用於 structs。修正內容是更新文件,明確所有使用者定義的型別都可以擁有方法。查看連結的 Go playground 範例,以了解正確的行為。編輯 markdown 檔案,在本機驗證變更,並確保 cheat sheet 仍然準確清楚。
由索引模型根據 Issue 內容生成。
評估
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 90/100