code: func ResolveReferenceURL(baseURL, refURL string) (string, error) {
  	parsedBaseURL, err := url.Parse(baseURL)
  	if err != nil {
  		return "", fmt.Errorf("failed to parse %s as URL: %v", baseURL, err)
  	}
  
  	parsedRefURL, err := url.Parse(refURL)
  	if err != nil {
  		return "", fmt.Errorf("failed to parse %s as URL: %v", refURL, err)
  	}
  
  	// We need a trailing slash for ResolveReference to work, but make sure there isn't already one
  	parsedBaseURL.Path = strings.TrimSuffix(parsedBaseURL.Path, "/") + "/"
  	resolvedURL := parsedBaseURL.ResolveReference(parsedRefURL)
  	// if the base URL contains query string parameters,
  	// propagate them to the child URL but only if the
  	// refURL is relative to baseURL
  	if (resolvedURL.Hostname() == parsedBaseURL.Hostname()) && (resolvedURL.Port() == parsedBaseURL.Port()) {
  		resolvedURL.RawQuery = parsedBaseURL.RawQuery
  	}
  
  	return resolvedURL.String(), nil
  }
docs: // ResolveReferenceURL resolves refURL relative to baseURL.
  // If refURL is absolute, it simply returns refURL.