Sha256: 38ed38c1cab55a6711d20acb416c49cafe1fa2d4bc13278191177b56c912b21a
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 'GOMOD111MODULE=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.1 | lib/license_finder/package_managers/go_modules.rb |