code: def _resolve(self, dependent_remote_lib, address, pkg, rev, implicit_ok):
      
      try:
        self.context.build_graph.inject_address_closure(address)
      except AddressLookupError:
        if implicit_ok:
          self.context.add_new_target(address=address,
                                      target_base=dependent_remote_lib.target_base,
                                      target_type=GoRemoteLibrary,
                                      pkg=pkg,
                                      rev=rev)
        else:
          raise self.UndeclaredRemoteLibError(address)
      return self.context.build_graph.get_target(address)
docs: Resolves the GoRemoteLibrary at `address` defining the given `pkg`.
  
      If `implicit_ok` is True, then a GoRemoteLibrary to own `pkg` is always synthesized if it does
      not already exist; otherwise the address must already exist in the build graph (a BUILD file
      must exist on disk that owns the given `pkg` and declares a `rev` for it).
  
      :param dependent_remote_lib: The remote library that depends on the remote `pkg`.
      :type: :class:`pants.contrib.go.targets.go_remote_library.GoRemoteLibrary`
      :param address: The address of the remote library that should own `pkg`.
      :type: :class:`pants.base.Address`
      :param string pkg: The remote package path whose owning target needs to be resolved.
      :param string rev: The revision of the package. None defaults to `master`.
      :param bool implicit_ok: `False` if the given `address` must be defined in a BUILD file on disk;
                               otherwise a remote library to own `pkg` will always be created and
                               returned.
      :returns: The resulting resolved remote library after injecting it in the build graph.
      :rtype: :class:`pants.contrib.go.targets.go_remote_library.GoRemoteLibrary`
      :raises: :class:`GoFetch.UndeclaredRemoteLibError`: If no BUILD file exists for the remote root
               `pkg` lives in.