package api

import "github.com/labstack/echo"

// GetProjectID returns projectID for current HTTP request
func GetProjectID(c echo.Context) int64 {
	return c.Get("projectID").(int64)
}

package api

import (
	"errors"

	"github.com/labstack/echo"
)

// GetProjectID returns projectID for current HTTP request
func GetProjectID(c echo.Context) int64 {
	if projectID, ok := c.Get("projectID").(int64); ok {
		return projectID
	}
	panic(errors.New("failed to get projectID, is mw.RequireProject call missing?"))
}

Use safe type assertion in GetProjectID
Use safe type assertion in GetProjectID
