gitignore for Go missing necessary files
Issue Template
Frequently Asked Questions
Q: How do I submit a new .gitignore template?
A: Please submit all new templates to @toptal/gitignore.
Q: How do I suggest modifications to existing .gitignore templates?
A: Modifications should come in the form of pull requests at @toptal/gitignore.
Issue
Development Environment:
- Machine: Ubuntu
- Operating System: Ubuntu 24.10
- Web Browser: Google Chrome
- Go Version: 1.23
Expected Behavior:
The .gitignore template for Go projects should exclude common files and directories like:
-
.envfiles (which often contain sensitive environment variables) -
./main(commonly used binary output) -
build/(directory for compiled binaries) -
tmp/(temporary files)
Actual Behavior:
The default Go .gitignore template does not exclude the following:
-
.env -
./main -
build/ -
tmp/
Reproduction Steps:
-
Create a new Go project and initialize a Git repository:
go mod init example.com/myapp git init -
Go to https://www.toptal.com/developers/gitignore/ and request for a new .gitignore file for Go/Goland: https://www.toptal.com/developers/gitignore/api/go,goland
-
Install air and initialize
.air.tomlfile -
Add a
.envfile, test your app and build it for production.
Expected behaviour: