Sha256: a6f2cc6af81ab69ce96c9c891ce667f641af75c0c2c0b2a8858a940174de2b1d
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require 'license_finder/packages/go_package' module LicenseFinder class GoModules < PackageManager PACKAGES_FILE = 'go.sum' class << self def takes_priority_over Go15VendorExperiment end def prepare_command 'GO111MODULE=on go mod vendor' end end def active? sum_files? end def current_packages sum_file_paths.uniq.map do |file_path| read_sum(file_path) end.flatten end private def sum_files? sum_file_paths.any? end def sum_file_paths Dir[project_path.join(PACKAGES_FILE)] end def read_sum(file_path) contents = File.read(file_path) contents.each_line.map do |line| line.include?('go.mod') ? nil : read_package(file_path, line) end.compact end def read_package(file_path, line) parts = line.split(' ') install_path = File.dirname(file_path) name = parts[0] version = parts[1] info = { 'ImportPath' => name, 'InstallPath' => install_path, 'Rev' => version } GoPackage.from_dependency(info, nil, true) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
license_finder-5.5.2 | lib/license_finder/package_managers/go_modules.rb |