Module: LicenseScout::GoModulesTxtParser
- Defined in:
- lib/license_scout/dependency_manager/gomod.rb
Class Method Summary collapse
-
.parse(data, base_path) ⇒ Object
The modules.txt file has lines that look like:.
Class Method Details
.parse(data, base_path) ⇒ Object
The modules.txt file has lines that look like:
# gopkg.in/square/go-jose.v2 v2.1.3
We parse these lines and return something that looks like ‘go list -m -json all` output.
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/license_scout/dependency_manager/gomod.rb', line 99 def self.parse(data, base_path) data.lines.map do |l| if l.start_with?("#") parts = l.split { "Main" => false, "Path" => parts[1], "Version" => parts[2], "Dir" => File.join(base_path, parts[1]), } end end.compact end |