Sha256: 1f4b64134fd8240fe7f2b991230531b1b7d6c0542ec2f8ef0746e8b1a83e1b04
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
# # Copyright:: Copyright 2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # require "license_scout/dependency_manager/base" module LicenseScout module DependencyManager class Gomod < Base def name "golang_modules" end def type "golang" end def signature "go.sum file" end def install_command "go mod download" end def detected? File.exist?(go_sum_file) end def dependencies go_modules.map do |mod| next if mod["Main"] == true dep_name = mod["Path"] dep_version = mod["Version"] dep_path = mod["Dir"] new_dependency(dep_name, dep_version, dep_path) end.compact end def go_sum_file File.join(directory, "go.sum") end def go_modules FFI_Yajl::Parser.parse(go_modules_json) end def go_modules_json s = Mixlib::ShellOut.new("go list -m -json all", cwd: directory, environment: LicenseScout::Config.environment) s.run_command s.error! "[" + s.stdout.gsub("}\n{", "},\n{") + "]" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
license_scout-2.5.0 | lib/license_scout/dependency_manager/gomod.rb |