Detect Go files generated by Protocol Buffers

This commit is contained in:
Paul Chaignon
2015-02-22 10:50:47 +01:00
parent ad9a2d231e
commit 2ca5868610
3 changed files with 1166 additions and 0 deletions

View File

@@ -62,6 +62,7 @@ module Linguist
generated_parser? ||
generated_net_docfile? ||
generated_postscript? ||
generated_protocol_buffer_go? ||
generated_protocol_buffer? ||
generated_jni_header? ||
vcr_cassette?
@@ -202,6 +203,13 @@ module Linguist
creator.include?("ImageMagick")
end
def generated_protocol_buffer_go?
return false unless extname == '.go'
return false unless lines.count > 1
return lines[0].include?("Code generated by protoc-gen-go")
end
# Internal: Is the blob a C++, Java or Python source file generated by the
# Protocol Buffer compiler?
#

1157
samples/Go/api.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -216,6 +216,7 @@ class TestBlob < Minitest::Test
assert sample_blob("C++/protocol-buffer.pb.cc").generated?
assert sample_blob("Java/ProtocolBuffer.java").generated?
assert sample_blob("Python/protocol_buffer_pb2.py").generated?
assert sample_blob("Go/api.pb.go").generated?
# Generated JNI
assert sample_blob("C/jni_layer.h").generated?