Merge pull request #2843 from github/go-vendor

Go vendor
This commit is contained in:
Arfon Smith
2016-10-28 00:24:06 -04:00
committed by GitHub
4 changed files with 20 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ module Linguist
generated_net_specflow_feature_file? ||
composer_lock? ||
node_modules? ||
go_vendor? ||
npm_shrinkwrap? ||
godeps? ||
generated_by_zephir? ||
@@ -304,6 +305,14 @@ module Linguist
!!name.match(/node_modules\//)
end
# Internal: Is the blob part of the Go vendor/ tree,
# not meant for humans in pull requests.
#
# Returns true or false.
def go_vendor?
!!name.match(/vendor\/((?!-)[-0-9A-Za-z]+(?<!-)\.)+(com|edu|gov|in|me|net|org|fm|io)/)
end
# Internal: Is the blob a generated npm shrinkwrap file.
#
# Returns true or false.

1
test/fixtures/go/food_vendor/candy.go vendored Normal file
View File

@@ -0,0 +1 @@
// empty file for testing that paths with vendor in them don't get ingored

View File

@@ -216,6 +216,11 @@ class TestBlob < Minitest::Test
# Generated by Zephir
assert !sample_blob_memory("Zephir/Router.zep").generated?
# Go vendored dependencies
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?
# Cython-generated C/C++
assert sample_blob_memory("C/sgd_fast.c").generated?
assert sample_blob_memory("C++/wrapper_inner.cpp").generated?

View File

@@ -42,6 +42,11 @@ class TestGenerated < Minitest::Test
generated_sample_without_loading_data("Dummy/foo.xcworkspacedata")
generated_sample_without_loading_data("Dummy/foo.xcuserstate")
# Go-specific vendored paths
generated_sample_without_loading_data("go/vendor/github.com/foo.go")
generated_sample_without_loading_data("go/vendor/golang.org/src/foo.c")
generated_sample_without_loading_data("go/vendor/gopkg.in/some/nested/path/foo.go")
# .NET designer file
generated_sample_without_loading_data("Dummu/foo.designer.cs")