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

ENVIRONMENT =

Turn off the module proxy for now, as it’s causing issues with private git dependencies

{ "GOPRIVATE" => "*" }.freeze
RESOLVABILITY_ERROR_REGEXES =
[
  # (Private) module could not be fetched
  /go: .*: git fetch .*: exit status 128/.freeze,
  # The checksum in go.sum does not match the dowloaded content
  /verifying .*: checksum mismatch/.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 does not exist, has been pulled or cannot be reached due to
  # auth problems with either git or the go proxy
  /go: .*: unknown revision/m.freeze,
  # Package version doesn't match the module major version
  /go: .*: go.mod has post-v1 module path/m.freeze
].freeze
MODULE_PATH_MISMATCH_REGEXES =
[
  /go: ([^@\s]+)(?:@[^\s]+)?: .* has non-.* module path "(.*)" at/,
  /go: ([^@\s]+)(?:@[^\s]+)?: .* unexpected module path "(.*)"/,
  /go: ([^@\s]+)(?:@[^\s]+)?: .* declares its path as: ([\S]*)/m
].freeze

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of GoModUpdater.



38
39
40
41
42
43
44
45
46
# File 'lib/dependabot/go_modules/file_updater/go_mod_updater.rb', line 38

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)
end

Instance Method Details

#updated_go_mod_contentObject



48
49
50
# File 'lib/dependabot/go_modules/file_updater/go_mod_updater.rb', line 48

def updated_go_mod_content
  updated_files[:go_mod]
end

#updated_go_sum_contentObject



52
53
54
# File 'lib/dependabot/go_modules/file_updater/go_mod_updater.rb', line 52

def updated_go_sum_content
  updated_files[:go_sum]
end