diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index cc64c824..8c2c1bcd 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -286,7 +286,9 @@ module Linguist # # Returns true or false. def go_vendor? - !!name.match(/vendor\//) + return false unless extname == '.go' + + !!name.match(/\Avendor\//) end # Internal: Is the blob part of Godeps/, diff --git a/test/fixtures/go/food_vendor/candy.go b/test/fixtures/go/food_vendor/candy.go new file mode 100644 index 00000000..ce65385b --- /dev/null +++ b/test/fixtures/go/food_vendor/candy.go @@ -0,0 +1 @@ +// empty file for testing that paths with vendor in them don't get ingored diff --git a/test/test_blob.rb b/test/test_blob.rb index 74cffc2b..2e50853d 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -246,8 +246,9 @@ class TestBlob < Minitest::Test assert sample_blob("node_modules/grunt/lib/grunt.js").generated? # Go vendored dependencies - assert sample_blob("vendor/vendor.json").generated? + refute sample_blob("vendor/vendor.json").generated? assert sample_blob("vendor/github.com/kr/s3/sign.go").generated? + refute fixture_blob("go/food_vendor/candy.go").generated? # Godep saved dependencies assert sample_blob("Godeps/Godeps.json").generated?