dongmi1941 2018-05-26 00:08
浏览 82
已采纳

nano上的golang格式搞乱了,而在vscode上就可以了。 纳米格式被推送到git

I am new with golang and we just had our first git commit of it and to our surprise the indentations were different.

On vscode my code looks like this : The indentations/tabs are well formatted.

vscode-golang-formatting

and on nano and github it got broken.

nano-golang-formatting

I found an answer related, a tool here that formats the tabs and spaces but do I really have to invoke go fmt every time I have to git?

  • 写回答

1条回答 默认 最新

  • dovs36921 2018-05-26 00:11
    关注

    do I really have to invoke go fmt every time I have to git?

    You should rather invoke go fmt every time you are saving your file locally with your IDE.
    That way, and add, commit and push will be done with a consistent format.

    For VSCode, see Format on save, the the vscode-go extension.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?