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: create.go
    path of file: ./repos/glab/commands/release/create
    
    the code of the file until where you have to start completion: package create

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"strings"
	"time"

	"github.com/profclems/glab/commands/release/releaseutils"
	"github.com/profclems/glab/commands/release/releaseutils/upload"

	"github.com/AlecAivazis/survey/v2"
	"github.com/MakeNowJust/heredoc"
	"github.com/profclems/glab/internal/config"
	"github.com/profclems/glab/internal/run"
	"github.com/profclems/glab/pkg/git"
	"github.com/profclems/glab/pkg/prompt"
	"github.com/profclems/glab/pkg/surveyext"
	"github.com/profclems/glab/pkg/utils"

	"github.com/profclems/glab/internal/glrepo"
	"github.com/profclems/glab/pkg/glinstance"
	"github.com/profclems/glab/pkg/iostreams"

	"github.com/profclems/glab/commands/cmdutils"
	"github.com/spf13/cobra"
	"github.com/xanzy/go-gitlab"
)

type CreateOpts struct {
	Name             string
	Ref              string
	TagName          string
	Notes            string
	NotesFile        string
	Milestone        []string
	AssetLinksAsJson string
	ReleasedAt       string
	RepoOverride     string

	NoteProvided       bool
	ReleaseNotesAction string

	AssetLinks []*upload.ReleaseAsset
	AssetFiles []*upload.ReleaseFile

	IO         *iostreams.IOStreams
	HTTPClient func() (*gitlab.Client, error)
	BaseRepo   func() (glrepo.Interface, error)
	Config     func() (config.Config, error)
}

func NewCmdCreate(f *cmdutils.Factory, runE func(opts *CreateOpts) error) *cobra.Command {
	opts := &CreateOpts{
		IO:     f.IO,
		Config: f.Config,
	}

	cmd := &cobra.Command{
		Use:   "create <tag> [<files>...]",
		Short: "Create a new or update a GitLab Release for a repository",
		Long: heredoc.Docf(`Create a new or update a GitLab Release for a repository.

				If the release already exists, glab updates the release with the new info provided.

				If a git tag specified does not yet exist, the release will automatically get created
				from the latest state of the default branc
    
func NewCmdCreate(f *cmdutils.Factory, runE func(opts *CreateOpts) error) *cobra.Command {
	opts := &CreateOpts{
		IO:     f.IO,
		Config: f.Config,
	}

	cmd := &cobra.Command{
		Use:   "create <tag> [<files>...]",
		Short: "Create a new or update a GitLab Release for a repository",
		Long: heredoc.Docf(`Create a new or update a GitLab Release for a repository.

				If the release already exists, glab updates the release with the new info provided.

				If a git tag specified does not yet exist, the release will automatically get created
				from the latest state of the default branch and tagged with the specified tag name.
				Use %[1]s--ref%[1]s to override this.
				The %[1]sref%[1]s can be a commit SHA, another tag name, or a branch name.
				To fetch the new tag locally after the release, do %[1]sgit fetch --tags origin%[1]s.

				To create a release from an annotated git tag, first create one locally with
				git, push the tag to GitLab, then run this command.

				NB: Developer level access to the project is required to create a release.
		`, "`"),
		Args: cmdutils.MinimumArgs(1, "no tag name provided"),
		Example: heredoc.Doc(`
			Interactively create a release
			$ glab release create v1.0.1

			Non-interactively create a release by specifying a note
			$ glab release create v1.0.1 --notes "bugfix release"

			Use release notes from a file
			$ glab release create v1.0.1 -F changelog.md

			Upload a release asset with a display name
			$ glab release create v1.0.1 '/path/to/asset.zip#My display label'

			Upload a release asset with a display name and type
			$ glab release create v1.0.1 '/path/to/asset.png#My display label#image'

			Upload all assets in a specified folder
			$ glab release create v1.0.1 ./dist/*

			Upload all tarballs in a specified folder
			$ glab release create v1.0.1 ./dist/*.tar.gz

			Create a release with assets specified as JSON object
			$ glab release create v1.0.1 --assets-links='
				[
					{
						"name": "Asset1", 
						"url":"https://<domain>/some/location/1", 
						"link_type": "other", 
						"filepath": "path/to/file"
					}
				]'
`),
		RunE: func(cmd *cobra.Command, args []string) error {
			var err error
			opts.RepoOverride, _ = cmd.Flags().GetString("repo")
			opts.HTTPClient = f.HttpClient
			opts.BaseRepo = f.BaseRepo

			opts.TagName = args[0]

			opts.AssetFiles, err = releaseutils.AssetsFromArgs(args[1:])
			if err != nil {
				return err
			}

			if opts.AssetLinksAsJson != "" {
				err := json.Unmarshal([]byte(opts.AssetLinksAsJson), &opts.AssetLinks)
				if err != nil {
					return fmt.Errorf("failed to parse JSON string: %w", err)
				}
			}

			opts.NoteProvided = cmd.Flags().Changed("notes")
			if opts.NotesFile != "" {
				var b []byte
				var err error
				if opts.NotesFile == "-" {
					b, err = ioutil.ReadAll(opts.IO.In)
					_ = opts.IO.In.Close()
				} else {
					b, err = ioutil.ReadFile(opts.NotesFile)
				}

				if err != nil {
					return err
				}

				opts.Notes = string(b)
				opts.NoteProvided = true
			}

			if runE != nil {
				return runE(opts)
			}

			return createRun(opts)
		},
	}

	cmd.Flags().StringVarP(&opts.Name, "name", "n", "", "The release name or title")
	cmd.Flags().StringVarP(&opts.Ref, "ref", "r", "", "If a tag specified doesn't exist, the release is created from ref and tagged with the specified tag name. It can be a commit SHA, another tag name, or a branch name.")
	cmd.Flags().StringVarP(&opts.Notes, "notes", "N", "", "The release notes/description. You can use Markdown")
	cmd.Flags().StringVarP(&opts.NotesFile, "notes-file", "F", "", "Read release notes `file`. Specify `-` as value to read from stdin")
	cmd.Flags().StringVarP(&opts.ReleasedAt, "released-at", "D", "", "The `date` when the release is/was ready. Defaults to the current datetime. Expected in ISO 8601 format (2019-03-15T08:00:00Z)")
	cmd.Flags().StringSliceVarP(&opts.Milestone, "milestone", "m", []string{}, "The title of each milestone the release is associated with")
	cmd.Flags().StringVarP(&opts.AssetLinksAsJson, "assets-links", "a", "", "`JSON` string representation of assets links (e.g. `--assets='[{\"name\": \"Asset1\", \"url\":\"https://<domain>/some/location/1\", \"link_type\": \"other\", \"filepath\": \"path/to/file\"}]')`")

	return cmd
}