module LicenseScout::GoModulesTxtParser
Public Class Methods
parse(data, base_path)
click to toggle source
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.
# 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