lib/licensed/sources/dep.rb in licensed-2.6.1 vs lib/licensed/sources/dep.rb in licensed-2.6.2

- old
+ new

@@ -18,11 +18,11 @@ version: package[:version], path: package_dir.to_s, search_root: search_root.to_s, metadata: { "type" => Dep.type, - "homepage" => "https://#{package[:name]}" + "homepage" => homepage(package[:name]) } ) end end @@ -38,13 +38,20 @@ .reject { |import_path| go_std_package?(import_path) } .map { |import_path| { name: import_path, version: project[:revision], project: project[:name] } } end end + # Returns the godoc.org page for a package. + def homepage(import_path) + return unless import_path + "https://godoc.org/#{import_path}" + end + # Returns whether the package is part of the go std list. Replaces # "golang.org" with "golang_org" to match packages listed in `go list std` # as "vendor/golang_org/*" but are vendored as "vendor/golang.org/*" def go_std_package?(import_path) + return true if go_std_packages.include? "vendor/#{import_path}" go_std_packages.include? "vendor/#{import_path.sub(/^golang.org/, "golang_org")}" end def go_dep_available? gopkg_lock_path.exist?