class AsdfDiscover::Searchers::GoMod

Searches for a Go version in the go.mod file

Constants

GO_MOD

Public Instance Methods

call() click to toggle source
# File lib/asdf_discover/searchers/go_mod.rb, line 7
def call
  return NotFound unless File.exist?(GO_MOD)

  File.open(GO_MOD, "r").each_line do |line|
    return Found.new("golang", Regexp.last_match(1), GO_MOD) if line =~ /go ([0-9.]+)$/
  end

  NotFound
end