code: func urlsMatch(globUrl *url.URL, targetUrl *url.URL) (bool, error) {
  	globUrlParts, globPort := splitUrl(globUrl)
  	targetUrlParts, targetPort := splitUrl(targetUrl)
  	if globPort != targetPort {
  		// port doesn't match
  		return false, nil
  	}
  	if len(globUrlParts) != len(targetUrlParts) {
  		// host name does not have the same number of parts
  		return false, nil
  	}
  	if !strings.HasPrefix(targetUrl.Path, globUrl.Path) {
  		// the path of the credential must be a prefix
  		return false, nil
  	}
  	for k, globUrlPart := range globUrlParts {
  		targetUrlPart := targetUrlParts[k]
  		matched, err := filepath.Match(globUrlPart, targetUrlPart)
  		if err != nil {
  			return false, err
  		}
  		if !matched {
  			// glob mismatch for some part
  			return false, nil
  		}
  	}
  	// everything matches
  	return true, nil
  }
docs: // check whether the given target url matches the glob url, which may have
  // glob wild cards in the host name.
  //
  // Examples:
  //    globUrl=*.docker.io, targetUrl=blah.docker.io => match
  //    globUrl=*.docker.io, targetUrl=not.right.io   => no match
  //
  // Note that we don't support wildcards in ports and paths yet.