Git: Ignore compiled Google Go

后端 未结 4 1518
长情又很酷
长情又很酷 2021-02-09 02:58

My compiled Go code does not end with an extension on Linux.

Any tips for handling ignoring these in the .gitignore file?

4条回答
  •  爱一瞬间的悲伤
    2021-02-09 03:40

    Keep your build products separate from your source code. This has several advantages:

    • you can start many different builds of the same code at the same time without creating multiple clones
    • it's easy to be confident that you've really done a clean; rm -rf objdir will remove files that a buggy make clean will miss
    • you can kick off a build from a read-only copy of the source tree (e.g., CD-ROM)
    • you're less likely to accidentally commit generated files
    • git clean -dxf will clean your source tree, but won't touch your built files

    Note that GNU Automake and Make support a feature called VPATH to make it easy to separate the source tree from the build tree.

提交回复
热议问题