如果你有這樣的代碼: func MyFunc(a int, b int)gofmt 重寫規則是否可以將其更改為: func MyFunc(a, b int)我試過了: gofmt -r "f(x t, y t) -> f(x, y t)" myfile.go但我得到: parsing pattern f(x t, y t) at 1:5: expected ')', found 'IDENT' t我也試過: gofmt -r "f(x int, y int) -> f(x, y int)" myfile.go但它為 int 而不是 t 給出了類似的錯誤我已經閱讀了gofmt 文檔。網絡搜索沒有發現任何有用的東西。我故意使用單字符標識符來匹配表達式。我懷疑問題可能在于試圖匹配類型,因為它可能不被視為“表達式”可以用 gofmt 做到這一點嗎?
- 1 回答
- 0 關注
- 202 瀏覽
添加回答
舉報
0/150
提交
取消