gitignore.io icon indicating copy to clipboard operation
gitignore.io copied to clipboard

gitignore for Go missing necessary files

Open wathika-eng opened this issue 1 year ago • 0 comments

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:

  • .env files (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:

  1. Create a new Go project and initialize a Git repository:

    go mod init example.com/myapp  
    git init
    
  2. 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

  3. Install air and initialize .air.toml file

  4. Add a .env file, test your app and build it for production.

image

Expected behaviour: image

wathika-eng avatar Dec 07 '24 17:12 wathika-eng