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: inventory.go
    path of file: ./repos/semaphore/api/projects
    
    the code of the file until where you have to start completion: package projects

import (
	log "github.com/sirupsen/logrus"
	"github.com/ansible-semaphore/semaphore/api/helpers"
	"github.com/ansible-semaphore/semaphore/db"
	"net/http"

	"os"
	"path/filepath"
	"strings"

	"github.com/gorilla/context"
)

/
    
func UpdateInventory(w http.ResponseWriter, r *http.Request) {
	oldInventory := context.Get(r, "inventory").(db.Inventory)

	var inventory db.Inventory

	if !helpers.Bind(w, r, &inventory) {
		return
	}

	if inventory.ID != oldInventory.ID {
		helpers.WriteJSON(w, http.StatusBadRequest, map[string]string{
			"error": "Inventory ID in body and URL must be the same",
		})
		return
	}

	if inventory.ProjectID != oldInventory.ProjectID {
		helpers.WriteJSON(w, http.StatusBadRequest, map[string]string{
			"error": "Project ID in body and URL must be the same",
		})
		return
	}

	switch inventory.Type {
	case db.InventoryStatic, db.InventoryStaticYaml:
		break
	case db.InventoryFile:
		if !IsValidInventoryPath(inventory.Inventory) {
			w.WriteHeader(http.StatusBadRequest)
			return
		}
	default:
		w.WriteHeader(http.StatusBadRequest)
		return
	}

	err := helpers.Store(r).UpdateInventory(inventory)

	if err != nil {
		helpers.WriteError(w, err)
		return
	}

	w.WriteHeader(http.StatusNoContent)
}