gogitignore searches a given directory for Go source files with package main
and adds the resulting go build file (binary) to the .gitignore file. Find some additional information in this short blog post.
go get github.com/breml/gogitignore
For basic usage, just enter the directory, which contains the Go source code and run gogitignore
.
For help run gogitignore
with flag -h
or -help
.
- Find package main within provided directory
- Find executables (executable bit set) within directory
- Generate respective .gitignore entries
- Find existing gogitignore block in .gitigore, replace if existing, create new otherwise
- Print usage
- Allow for inplace update of .gitignore
- Make inplace mode default
- Allow dryrun
- Sort entries in .gitignore alphabetically
- Cleanup variable names, find better ones
- Write some tests, make it testable
- Better duplicates check
- Create .gitignore file if not yet present
- Check with metalinter
- Remove the autogenerated part (between # gogitignore start and # gogitignore end) from .gitignore
- Use os.PathSeparator for better OS compatibility
- Use fmt.Println istead of /dev/stdout for better OS compatibility
- Add to travis
- Add to coveralls
- Add to go report
- Add godoc