Class: Dependabot::GoModules::FileUpdater::GoModUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/go_modules/file_updater/go_mod_updater.rb

Constant Summary collapse

RESOLVABILITY_ERROR_REGEXES =
[
  # The checksum in go.sum does not match the downloaded content
  /verifying .*: checksum mismatch/.freeze,
  /go(?: get)?: .*: go.mod has post-v\d+ module path/
].freeze
REPO_RESOLVABILITY_ERROR_REGEXES =
[
  /fatal: The remote end hung up unexpectedly/,
  /repository '.+' not found/,
  # (Private) module could not be fetched
  /go(?: get)?: .*: git (fetch|ls-remote) .*: exit status 128/m.freeze,
  # (Private) module could not be found
  /cannot find module providing package/.freeze,
  # Package in module was likely renamed or removed
  /module .* found \(.*\), but does not contain package/m.freeze,
  # Package pseudo-version does not match the version-control metadata
  # https://golang.google.cn/doc/go1.13#version-validation
  /go(?: get)?: .*: invalid pseudo-version/m.freeze,
  # Package does not exist, has been pulled or cannot be reached due to
  # auth problems with either git or the go proxy
  /go(?: get)?: .*: unknown revision/m.freeze,
  # Package pointing to a proxy that 404s
  /go(?: get)?: .*: unrecognized import path/m.freeze
].freeze
MODULE_PATH_MISMATCH_REGEXES =
[
  /go(?: get)?: ([^@\s]+)(?:@[^\s]+)?: .* has non-.* module path "(.*)" at/,
  /go(?: get)?: ([^@\s]+)(?:@[^\s]+)?: .* unexpected module path "(.*)"/,
  /go(?: get)?: ([^@\s]+)(?:@[^\s]+)?:? .* declares its path as: ([\S]*)/m
].freeze
OUT_OF_DISK_REGEXES =
[
  %r{input/output error}.freeze,
  /no space left on device/.freeze
].freeze
GO_MOD_VERSION =
/^go 1\.[\d]+$/.freeze

Instance Method Summary collapse

Constructor Details

#initialize(dependencies:, credentials:, repo_contents_path:, directory:, options:) ⇒ GoModUpdater

Returns a new instance of GoModUpdater.



52
53
54
55
56
57
58
59
60
61
# File 'lib/dependabot/go_modules/file_updater/go_mod_updater.rb', line 52

def initialize(dependencies:, credentials:, repo_contents_path:,
               directory:, options:)
  @dependencies = dependencies
  @credentials = credentials
  @repo_contents_path = repo_contents_path
  @directory = directory
  @tidy = options.fetch(:tidy, false)
  @vendor = options.fetch(:vendor, false)
  @goprivate = options.fetch(:goprivate)
end

Instance Method Details

#updated_go_mod_contentObject



63
64
65
# File 'lib/dependabot/go_modules/file_updater/go_mod_updater.rb', line 63

def updated_go_mod_content
  updated_files[:go_mod]
end

#updated_go_sum_contentObject



67
68
69
# File 'lib/dependabot/go_modules/file_updater/go_mod_updater.rb', line 67

def updated_go_sum_content
  updated_files[:go_sum]
end