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: charmorigin.go
    path of file: ./repos/juju/api/common/charm
    
    the code of the file until where you have to start completion: // Copyright 2020 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package charm

import (
	"github.com/ju
    
func (o Origin) CoreCharmOrigin() corecharm.Origin {
	var track string
	if o.Track != nil {
		track = *o.Track
	}
	var branch string
	if o.Branch != nil {
		branch = *o.Branch
	}
	var channel *charm.Channel
	if o.Risk != "" {
		channel = &charm.Channel{
			Risk:   charm.Risk(o.Risk),
			Track:  track,
			Branch: branch,
		}
	}
	return corecharm.Origin{
		Source:   corecharm.Source(o.Source),
		Type:     o.Type,
		ID:       o.ID,
		Hash:     o.Hash,
		Revision: o.Revision,
		Channel:  channel,
		Platform: corecharm.Platform{
			Architecture: o.Architecture,
			OS:           o.Base.OS,
			Channel:      o.Base.Channel.Track,
		},
		InstanceKey: o.InstanceKey,
	}
}