16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/dependabot/go_modules/go_work_parser.rb', line 16
def self.use_paths(content)
paths = T.let([], T::Array[String])
content.scan(/^use\s+\(([^)]+)\)/m).each do |block_match|
T.must(block_match[0]).each_line do |line|
path = line.split("//").first&.strip || ""
next if path.empty?
paths << path.sub(%r{^\./}, "")
end
end
content.scan(/^use\s+(?!\()(\.[^\s]*)/m).each do |match|
path = T.must(match[0]).sub(%r{^\./}, "")
paths << path
end
paths.uniq
end
|