Skip to content

Commit

Permalink
add nil check in format string for go list command
Browse files Browse the repository at this point in the history
Signed-off-by: Parv Mital <pmital@pivotal.io>
  • Loading branch information
julia-pu authored and pivotal-pmital committed Apr 22, 2021
1 parent 8d22107 commit bc51ec0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/license_finder/package_managers/go_modules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ def packages_info
# Explanations:
# * Only list dependencies (packages not listed in the project directory)
# (.DepOnly)
# * Ignore packages that have nil modules
# (ne .Module nil)
# * 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) (not .Standard) }}'\
'{{ if and (.DepOnly) (ne .Module nil) (not .Standard) }}'\
'{{ $mod := (or .Module.Replace .Module) }}'\
'{{ $mod.Path }},{{ $mod.Version }},{{ or $mod.Dir .Dir }}'\
'{{ end }}'
Expand Down

0 comments on commit bc51ec0

Please sign in to comment.