mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Detect Go files generated by Protocol Buffers
This commit is contained in:
		| @@ -62,6 +62,7 @@ module Linguist | |||||||
|       generated_parser? || |       generated_parser? || | ||||||
|       generated_net_docfile? || |       generated_net_docfile? || | ||||||
|       generated_postscript? || |       generated_postscript? || | ||||||
|  |       generated_protocol_buffer_go? || | ||||||
|       generated_protocol_buffer? || |       generated_protocol_buffer? || | ||||||
|       generated_jni_header? || |       generated_jni_header? || | ||||||
|       vcr_cassette? |       vcr_cassette? | ||||||
| @@ -202,6 +203,13 @@ module Linguist | |||||||
|         creator.include?("ImageMagick") |         creator.include?("ImageMagick") | ||||||
|     end |     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 |     # Internal: Is the blob a C++, Java or Python source file generated by the | ||||||
|     # Protocol Buffer compiler? |     # Protocol Buffer compiler? | ||||||
|     # |     # | ||||||
|   | |||||||
							
								
								
									
										1157
									
								
								samples/Go/api.pb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1157
									
								
								samples/Go/api.pb.go
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -216,6 +216,7 @@ class TestBlob < Minitest::Test | |||||||
|     assert sample_blob("C++/protocol-buffer.pb.cc").generated? |     assert sample_blob("C++/protocol-buffer.pb.cc").generated? | ||||||
|     assert sample_blob("Java/ProtocolBuffer.java").generated? |     assert sample_blob("Java/ProtocolBuffer.java").generated? | ||||||
|     assert sample_blob("Python/protocol_buffer_pb2.py").generated? |     assert sample_blob("Python/protocol_buffer_pb2.py").generated? | ||||||
|  |     assert sample_blob("Go/api.pb.go").generated? | ||||||
|  |  | ||||||
|     # Generated JNI |     # Generated JNI | ||||||
|     assert sample_blob("C/jni_layer.h").generated? |     assert sample_blob("C/jni_layer.h").generated? | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user