You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: reference.go
    path of file: ./repos/devspace/vendor/github.com/xeipuuv/gojsonreference
    
    the code of the file until where you have to start completion: // Copyright 2015 xeipuuv ( https://github.com/xeipuuv )
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the Lice
    
func (r *JsonReference) Inherits(child JsonReference) (*JsonReference, error) {
	if child.GetUrl() == nil {
		return nil, errors.New("childUrl is nil!")
	}

	if r.GetUrl() == nil {
		return nil, errors.New("parentUrl is nil!")
	}

	// Get a copy of the parent url to make sure we do not modify the original.
	// URL reference resolving fails if the fragment of the child is empty, but the parent's is not.
	// The fragment of the child must be used, so the fragment of the parent is manually removed.
	parentUrl := *r.GetUrl()
	parentUrl.Fragment = ""

	ref, err := NewJsonReference(parentUrl.ResolveReference(child.GetUrl()).String())
	if err != nil {
		return nil, err
	}
	return &ref, err
}