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: gw_gc.go
    path of file: ./repos/erda/tools/cli/cmd
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// 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 License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cmd

import (
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"
	"strings"
	"time"

	"github.com/pkg/errors"

	"github.com/erda-project/erda/tools/cli/command"
)

var GwGc = command.Command{
	ParentName: "Gw",
	Name:       "gc",
	ShortHelp:  "Erda G
    
func deleteItem(ctx command.Context, w io.Writer, item InvalidEndpointsItem, kongAdmin string, needSure bool) error {
	ctx.Info("%s/%s ", item.PackageID, item.PackageApiID)
	_, _ = fmt.Fprintf(w, "%s/%s: ", item.PackageID, item.PackageApiID)
	defer fmt.Fprintf(w, "\n")

	client := http.DefaultClient
	client.Timeout = time.Second * 100

	const (
		Route   = "Route"
		Service = "Service"
	)
	var deleting = func(typ, id string) error {
		if err := sure(ctx, needSure, typ, id); err != nil {
			return err
		}
		var uri string
		switch typ {
		case Route:
			uri = kongAdmin + "/routes/" + id
		case Service:
			uri = kongAdmin + "/services/" + id
		default:
			return errors.New("invalid Kong Object")
		}
		request, err := http.NewRequest(http.MethodDelete, uri, nil)
		if err != nil {
			return err
		}
		response, err := client.Do(request)
		if err != nil {
			return err
		}
		_, _ = fmt.Fprintf(w, "Delete Kong %s %v ", typ, response.StatusCode)
		if response.StatusCode >= 200 && response.StatusCode < 300 {
			return nil
		}
		ctx.Warn("failed to delete")
		if data, err := ioutil.ReadAll(response.Body); err == nil {
			defer response.Body.Close()
			_, _ = fmt.Fprint(w, string(data))
		}
		return nil
	}

	if item.KongRouteID == "" {
		ctx.Warn("No KongRouteID in the Item. %s/%s", item.PackageID, item.PackageApiID)
		_, _ = fmt.Fprintf(w, "No Kong Route. ")
	} else if err := deleting(Route, item.KongRouteID); err != nil {
		return err
	}
	if item.KongServiceID == "" {
		ctx.Warn("No KongServiceID in the Item. %s/%s", item.PackageID, item.PackageApiID)
		_, _ = fmt.Fprintf(w, "No Kong Service. ")
	} else if err := deleting(Service, item.KongServiceID); err != nil {
		return err
	}

	return nil
}