mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-06 02:30:57 -08:00
upgrade to yaml.v3 (#1148)
Some checks are pending
gofmt / Run gofmt (push) Waiting to run
smoke-extra / Run extra smoke tests (push) Waiting to run
smoke / Run multi node smoke test (push) Waiting to run
Build and test / Build all and test on ubuntu-linux (push) Waiting to run
Build and test / Build and test on linux with boringcrypto (push) Waiting to run
Build and test / Build and test on linux with pkcs11 (push) Waiting to run
Build and test / Build and test on ${{ matrix.os }} (macos-latest) (push) Waiting to run
Build and test / Build and test on ${{ matrix.os }} (windows-latest) (push) Waiting to run
Some checks are pending
gofmt / Run gofmt (push) Waiting to run
smoke-extra / Run extra smoke tests (push) Waiting to run
smoke / Run multi node smoke test (push) Waiting to run
Build and test / Build all and test on ubuntu-linux (push) Waiting to run
Build and test / Build and test on linux with boringcrypto (push) Waiting to run
Build and test / Build and test on linux with pkcs11 (push) Waiting to run
Build and test / Build and test on ${{ matrix.os }} (macos-latest) (push) Waiting to run
Build and test / Build and test on ${{ matrix.os }} (windows-latest) (push) Waiting to run
* upgrade to yaml.v3 The main nice fix here is that maps unmarshal into `map[string]any` instead of `map[any]any`, so it cleans things up a bit. * add config.AsBool Since yaml.v3 doesn't automatically convert yes to bool now, for backwards compat * use type aliases for m * more cleanup * more cleanup * more cleanup * go mod cleanup
This commit is contained in:
parent
75faa5f2e5
commit
879852c32a
36 changed files with 257 additions and 258 deletions
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
// CommandFlags is a function called before help or command execution to parse command line flags
|
||||
// It should return a flag.FlagSet instance and a pointer to the struct that will contain parsed flags
|
||||
type CommandFlags func() (*flag.FlagSet, interface{})
|
||||
type CommandFlags func() (*flag.FlagSet, any)
|
||||
|
||||
// CommandCallback is the function called when your command should execute.
|
||||
// fs will be a a pointer to the struct provided by Command.Flags callback, if there was one. -h and -help are reserved
|
||||
|
|
@ -21,7 +21,7 @@ type CommandFlags func() (*flag.FlagSet, interface{})
|
|||
// w is the writer to use when sending messages back to the client.
|
||||
// If an error is returned by the callback it is logged locally, the callback should handle messaging errors to the user
|
||||
// where appropriate
|
||||
type CommandCallback func(fs interface{}, a []string, w StringWriter) error
|
||||
type CommandCallback func(fs any, a []string, w StringWriter) error
|
||||
|
||||
type Command struct {
|
||||
Name string
|
||||
|
|
@ -34,7 +34,7 @@ type Command struct {
|
|||
func execCommand(c *Command, args []string, w StringWriter) error {
|
||||
var (
|
||||
fl *flag.FlagSet
|
||||
fs interface{}
|
||||
fs any
|
||||
)
|
||||
|
||||
if c.Flags != nil {
|
||||
|
|
@ -85,7 +85,7 @@ func lookupCommand(c *radix.Tree, sCmd string) (*Command, error) {
|
|||
|
||||
func matchCommand(c *radix.Tree, cmd string) []string {
|
||||
cmds := make([]string, 0)
|
||||
c.WalkPrefix(cmd, func(found string, v interface{}) bool {
|
||||
c.WalkPrefix(cmd, func(found string, v any) bool {
|
||||
cmds = append(cmds, found)
|
||||
return false
|
||||
})
|
||||
|
|
@ -95,7 +95,7 @@ func matchCommand(c *radix.Tree, cmd string) []string {
|
|||
|
||||
func allCommands(c *radix.Tree) []*Command {
|
||||
cmds := make([]*Command, 0)
|
||||
c.WalkPrefix("", func(found string, v interface{}) bool {
|
||||
c.WalkPrefix("", func(found string, v any) bool {
|
||||
cmd, ok := v.(*Command)
|
||||
if ok {
|
||||
cmds = append(cmds, cmd)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ func NewSSHServer(l *logrus.Entry) (*SSHServer, error) {
|
|||
s.RegisterCommand(&Command{
|
||||
Name: "help",
|
||||
ShortDescription: "prints available commands or help <command> for specific usage info",
|
||||
Callback: func(a interface{}, args []string, w StringWriter) error {
|
||||
Callback: func(a any, args []string, w StringWriter) error {
|
||||
return helpCallback(s.commands, args, w)
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ func NewSession(commands *radix.Tree, conn *ssh.ServerConn, chans <-chan ssh.New
|
|||
s.commands.Insert("logout", &Command{
|
||||
Name: "logout",
|
||||
ShortDescription: "Ends the current session",
|
||||
Callback: func(a interface{}, args []string, w StringWriter) error {
|
||||
Callback: func(a any, args []string, w StringWriter) error {
|
||||
s.Close()
|
||||
return nil
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue