From 57ca38586051eb56e257aac58f2579c302f280fa Mon Sep 17 00:00:00 2001 From: Jon Ruskin Date: Mon, 2 Jan 2023 10:23:02 -0700 Subject: [PATCH] minimum go version support 1.17 --- lib/licensed/sources/go.rb | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/lib/licensed/sources/go.rb b/lib/licensed/sources/go.rb index 66a5fc35..0384e634 100644 --- a/lib/licensed/sources/go.rb +++ b/lib/licensed/sources/go.rb @@ -36,27 +36,13 @@ def enumerate_dependencies # Returns an array of dependency package import paths def packages - dependency_packages = - if go_version < Gem::Version.new("1.11.0") - root_package_deps - else - go_list_deps - end - # don't include go std packages # don't include packages under the root project that aren't vendored - dependency_packages + go_list_deps .reject { |pkg| go_std_package?(pkg) } .reject { |pkg| local_package?(pkg) } end - # Returns non-ignored packages found from the root packages "Deps" property - def root_package_deps - # check for ignored packages to avoid raising errors calling `go list` - # when ignored package is not found - Parallel.map(Array(root_package["Deps"])) { |name| package_info(name) } - end - # Returns the list of dependencies as returned by "go list -json -deps" # available in go 1.11 def go_list_deps @@ -188,13 +174,6 @@ def non_vendored_import_path(package) package["ImportPath"] end - # Returns a hash of information about the package with a given import path - # - # import_path - Go package import path - def package_info(import_path) - JSON.parse(package_info_command(import_path)) - end - # Returns package information as a JSON string # # args - additional arguments to `go list`, e.g. Go package import path @@ -202,11 +181,6 @@ def package_info_command(*args) Licensed::Shell.execute("go", "list", "-e", "-json", *Array(args)).strip end - # Returns the info for the package under test - def root_package - @root_package ||= package_info(".") - end - # Returns whether go source is found def go_source? with_configured_gopath { Licensed::Shell.success?("go", "doc") } @@ -230,15 +204,6 @@ def gopath end end - # Returns the current version of go available, as a Gem::Version - def go_version - @go_version ||= begin - full_version = Licensed::Shell.execute("go", "version").strip - version_string = full_version.gsub(%r{.*go(\d+\.\d+(\.\d+)?).*}, "\\1") - Gem::Version.new(version_string) - end - end - private # Execute a block with ENV["GOPATH"] set to the value of #gopath.