Skip to content

Commit

Permalink
[FIXED] Ignore packages with nil modules
Browse files Browse the repository at this point in the history
Signed-off-by: Julia Pu <jpu@pivotal.io>
  • Loading branch information
pivotal-pmital authored and julia-pu committed Apr 27, 2021
1 parent bc51ec0 commit 4eca0ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/license_finder/package_managers/go_modules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def packages_info
# * Only list dependencies (packages not listed in the project directory)
# (.DepOnly)
# * Ignore packages that have nil modules
# (ne .Module nil)
# (.Module)
# * Ignore standard library packages
# (not .Standard)
# * Replacement modules are respected
# (or .Module.Replace .Module)
# * Module cache directory or (vendored) package directory
# (or $mod.Dir .Dir)
format_str = \
'{{ if and (.DepOnly) (ne .Module nil) (not .Standard) }}'\
'{{ if and (.DepOnly) (.Module) (not .Standard) }}'\
'{{ $mod := (or .Module.Replace .Module) }}'\
'{{ $mod.Path }},{{ $mod.Version }},{{ or $mod.Dir .Dir }}'\
'{{ end }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module LicenseFinder
let(:src_path) { '/workspace/code' }
let(:mod_path) { "#{src_path}/go.mod" }
let(:vendor_path) { "#{src_path}/vendor" }
let(:go_list_format) { '{{ if and (.DepOnly) (not .Standard) }}{{ $mod := (or .Module.Replace .Module) }}{{ $mod.Path }},{{ $mod.Version }},{{ or $mod.Dir .Dir }}{{ end }}' }
let(:go_list_format) { '{{ if and (.DepOnly) (.Module) (not .Standard) }}{{ $mod := (or .Module.Replace .Module) }}{{ $mod.Path }},{{ $mod.Version }},{{ or $mod.Dir .Dir }}{{ end }}' }
let(:go_list_string) do
"foo,,/workspace/code/\ngopkg.in/check.v1,v0.0.0-20161208181325-20d25e280405,"\
"/workspace/LicenseFinder/features/fixtures/go_modules/vendor/gopkg.in/check.v1\n"\
Expand Down

0 comments on commit 4eca0ec

Please sign in to comment.