Skip to content

Commit

Permalink
Treat go.mod and go.sum as generated files. (#4306)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighlondon authored and lildude committed Nov 1, 2018
1 parent 58161f6 commit ba0c5e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/linguist/generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def generated?
go_lock? ||
npm_shrinkwrap_or_package_lock? ||
godeps? ||
go_mod? ||
generated_by_zephir? ||
minified_files? ||
has_source_map? ||
Expand Down Expand Up @@ -378,6 +379,13 @@ def godeps?
!!name.match(/Godeps\//)
end

# Internal: Is the blob a Go module metadata file?
#
# Returns true or false.
def go_mod?
name.match(/go\.mod/) || name.match(/go\.sum/)
end

# Internal: Is the blob a generated php composer lock file?
#
# Returns true or false.
Expand Down
4 changes: 4 additions & 0 deletions test/test_generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ def test_check_generated
generated_sample_without_loading_data("Godeps/Godeps.json")
generated_sample_without_loading_data("Godeps/_workspace/src/github.com/kr/s3/sign.go")

# Go module metadata files
generated_sample_without_loading_data("Dummy/go.mod")
generated_sample_without_loading_data("Dummy/go.sum")

# Generated by Zephir
generated_sample_without_loading_data("C/exception.zep.c")
generated_sample_without_loading_data("C/exception.zep.h")
Expand Down

0 comments on commit ba0c5e9

Please sign in to comment.