mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-20 07:41:31 +02:00
cmd/headscale/cli: move errMissingParameter and Error type to their users
Move errMissingParameter from users.go to utils.go alongside the other shared sentinel errors; the variable is referenced by api_key.go and preauthkeys.go. Move the Error constant-error type from debug.go to mockoidc.go, its only consumer.
This commit is contained in:
@@ -9,11 +9,6 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Error is used to compare errors as per https://dave.cheney.net/2016/04/07/constant-errors
|
|
||||||
type Error string
|
|
||||||
|
|
||||||
func (e Error) Error() string { return string(e) }
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(debugCmd)
|
rootCmd.AddCommand(debugCmd)
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Error is used to compare errors as per https://dave.cheney.net/2016/04/07/constant-errors
|
||||||
|
type Error string
|
||||||
|
|
||||||
|
func (e Error) Error() string { return string(e) }
|
||||||
|
|
||||||
const (
|
const (
|
||||||
errMockOidcClientIDNotDefined = Error("MOCKOIDC_CLIENT_ID not defined")
|
errMockOidcClientIDNotDefined = Error("MOCKOIDC_CLIENT_ID not defined")
|
||||||
errMockOidcClientSecretNotDefined = Error("MOCKOIDC_CLIENT_SECRET not defined")
|
errMockOidcClientSecretNotDefined = Error("MOCKOIDC_CLIENT_SECRET not defined")
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ func init() {
|
|||||||
mustMarkRequired(renameUserCmd, "new-name")
|
mustMarkRequired(renameUserCmd, "new-name")
|
||||||
}
|
}
|
||||||
|
|
||||||
var errMissingParameter = errors.New("missing parameters")
|
|
||||||
|
|
||||||
var userCmd = &cobra.Command{
|
var userCmd = &cobra.Command{
|
||||||
Use: "users",
|
Use: "users",
|
||||||
Short: "Manage the users of Headscale",
|
Short: "Manage the users of Headscale",
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ const (
|
|||||||
outputFormatYAML = "yaml"
|
outputFormatYAML = "yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
var errAPIKeyNotSet = errors.New("HEADSCALE_CLI_API_KEY environment variable needs to be set")
|
var (
|
||||||
|
errAPIKeyNotSet = errors.New("HEADSCALE_CLI_API_KEY environment variable needs to be set")
|
||||||
|
errMissingParameter = errors.New("missing parameters")
|
||||||
|
)
|
||||||
|
|
||||||
// mustMarkRequired marks the named flags as required on cmd, panicking
|
// mustMarkRequired marks the named flags as required on cmd, panicking
|
||||||
// if any name does not match a registered flag. This is only called
|
// if any name does not match a registered flag. This is only called
|
||||||
|
|||||||
Reference in New Issue
Block a user