Merge pull request #2426 from tamird/generated-go-bindata

Detect Go files generated by go-bindata
This commit is contained in:
Arfon Smith
2015-05-31 15:53:49 +02:00
4 changed files with 860 additions and 8 deletions

View File

@@ -65,7 +65,7 @@ module Linguist
generated_net_docfile? ||
generated_postscript? ||
compiled_cython_file? ||
generated_protocol_buffer_go? ||
generated_go? ||
generated_protocol_buffer? ||
generated_apache_thrift? ||
generated_jni_header? ||
@@ -181,11 +181,11 @@ module Linguist
def generated_net_designer_file?
name.downcase =~ /\.designer\.cs$/
end
# Internal: Is this a codegen file for Specflow feature file?
#
# Visual Studio's SpecFlow extension generates *.feature.cs files
# from *.feature files, they are not meant to be consumed by humans.
# from *.feature files, they are not meant to be consumed by humans.
# Let's hide them.
#
# Returns true or false
@@ -233,11 +233,11 @@ module Linguist
creator.include?("ImageMagick")
end
def generated_protocol_buffer_go?
def generated_go?
return false unless extname == '.go'
return false unless lines.count > 1
return lines[0].include?("Code generated by protoc-gen-go")
return lines[0].include?("Code generated by")
end
# Internal: Is the blob a C++, Java or Python source file generated by the
@@ -250,7 +250,7 @@ module Linguist
return lines[0].include?("Generated by the protocol buffer compiler. DO NOT EDIT!")
end
# Internal: Is the blob generated by Apache Thrift compiler?
#
# Returns true or false