Skip to content

.gitignore: Remove cruft and editor/OS-specific ignore files #21458

@kevinburke

Description

@kevinburke

Here's the current contents of the .gitignore file for the Go project.

.DS_Store
*.[56789ao]
*.a[56789o]
*.so
*.pyc
._*
.nfs.*
[56789a].out
*~
*.orig
*.rej
*.exe
.*.swp
core
*.cgo*.go
*.cgo*.c
_cgo_*
_obj
_test
_testmain.go

/VERSION.cache
/bin/
/build.out
/doc/articles/wiki/*.bin
/goinstall.log
/last-change
/misc/cgo/life/run.out
/misc/cgo/stdio/run.out
/misc/cgo/testso/main
/pkg/
/src/*.*/
/src/cmd/cgo/zdefaultcc.go
/src/cmd/go/internal/cfg/zdefaultcc.go
/src/cmd/go/internal/cfg/zosarch.go
/src/cmd/internal/objabi/zbootstrap.go
/src/go/build/zcgo.go
/src/go/doc/headscan
/src/runtime/internal/sys/zversion.go
/src/unicode/maketables
/test.out
/test/garbage/*.out
/test/pass.out
/test/run.out
/test/times.out

# IntelliJ-based editors
/.idea/

Many of those, like .idea and .DS_Store, are not specific to the Go project - they're specific to a user's environment or to an OS. There are large number of user-specific files that get placed in directories that we might need to exclude; we can't enumerate the list, and it also seems useful to teach users how to solve this problem for themselves.

Git has a tool for dealing with files you'd like to (privately) ignore. You can edit the .git/info/exclude file to privately ignore any files you don't want to commit to the project. You can also create a global .gitignore file for your computer to ignore those files in every Git repository on your machine, described here: https://help.github.com/articles/ignoring-files/#create-a-global-gitignore.

Finally, you can create a Git template to automatically populate the contents of .gitignore whenever a new Git repository is created, as described here: https://stackoverflow.com/a/16658321/329700

I'd like to propose that we put the above instructions in the .gitignore file and then remove all of the user and OS-specific ignore directives; the ignore file should only include artifacts that are generated by the Go project that we'd rather not check in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions