Determines if a file is generated or hand crafted.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
main.go

README.md

isFileGenerated

isFileGenerated checks if a file is generated. A file is generated if

  • file contains a "// Code generated … DO NOT EDIT." line comment, as specified at https://golang.org/s/generatedcode, or
  • path contains a directory named vendor, or
  • path starts with a directory named Godeps, or
  • path contains a directory named testdata.

Sets the exit status 0 if file is generated, 1 if not generated, or > 1 for other error.

Install

go install github.com/gopherci/isFileGenerated

Usage

isFileGenerated <root directory> <path to file>

Example

isFileGenerated $GOPATH/src/github.com/hydroflame/fuzzi fuzzi/fuzzy.go; echo $?
github.com/hydroflame/fuzzi/fuzzi/fuzzy.go was not generated
1
isFileGenerated $GOPATH/src/github.com/hydroflame/fuzzi vendor/github.com/go-kit/kit/endpoint/endpoint.go; echo $?
github.com/hydroflame/fuzzi/vendor/github.com/go-kit/kit/endpoint/endpoint.go was generated
0