From 800c586d8adc974a86403782e9776e879a14d55e Mon Sep 17 00:00:00 2001 From: Andreas Zahnen Date: Sat, 12 Oct 2024 20:59:39 +0200 Subject: [PATCH] refactor go --- libxtracfg/c/include/libxtracfg.h | 10 + libxtracfg/c/wrapper/libxtracfg.c | 56 +++- libxtracfg/go/go.mod | 3 + libxtracfg/go/go.sum | 0 .../go/xtracfg}/client.go | 67 ++-- .../go/xtracfg}/response.go | 2 +- xtracfg/client/mock.go | 29 -- xtracfg/cmd/root.go | 6 +- xtracfg/cmd/store/check.go | 17 +- xtracfg/cmd/store/info.go | 7 +- xtracfg/cmd/store/listen.go | 7 +- xtracfg/cmd/store/upgrade.go | 41 +-- xtracfg/go.mod | 25 +- xtracfg/go.sum | 305 +----------------- xtracfg/jni.c | 86 ----- xtracfg/main.go | 43 --- .../java/de/ii/xtraplatform/cli/XtraCfg.java | 13 + .../META-INF/native-image/jni-config.json | 12 +- xtracfg/{client => util}/console.go | 15 +- xtracfg/{client => util}/server.go | 11 +- 20 files changed, 196 insertions(+), 559 deletions(-) create mode 100644 libxtracfg/go/go.mod create mode 100644 libxtracfg/go/go.sum rename {xtracfg/client => libxtracfg/go/xtracfg}/client.go (75%) rename {xtracfg/client => libxtracfg/go/xtracfg}/response.go (99%) delete mode 100644 xtracfg/client/mock.go delete mode 100644 xtracfg/jni.c rename xtracfg/{client => util}/console.go (80%) rename xtracfg/{client => util}/server.go (90%) diff --git a/libxtracfg/c/include/libxtracfg.h b/libxtracfg/c/include/libxtracfg.h index daa9894..bbaa54f 100644 --- a/libxtracfg/c/include/libxtracfg.h +++ b/libxtracfg/c/include/libxtracfg.h @@ -1,8 +1,18 @@ #ifdef __cplusplus extern "C" { + #endif + typedef void (*progress_callback) (const char* msg); + + int xtracfg_init(); + + void xtracfg_cleanup(); + + void xtracfg_progress_subscribe(progress_callback progress_cb); + char* xtracfg_execute(const char* command, int* err); + #ifdef __cplusplus } #endif diff --git a/libxtracfg/c/wrapper/libxtracfg.c b/libxtracfg/c/wrapper/libxtracfg.c index 8f485e0..b8a7d94 100644 --- a/libxtracfg/c/wrapper/libxtracfg.c +++ b/libxtracfg/c/wrapper/libxtracfg.c @@ -2,10 +2,23 @@ #include #include #include +#include "../include/libxtracfg.h" -char* xtracfg_execute(const char* command, int* err) { - JavaVM *jvm; - JNIEnv *env; +JavaVM *jvm = NULL; +JNIEnv *env = NULL; +progress_callback progress_cb = NULL; + +// called from java with progress, pass to callback +JNIEXPORT void JNICALL Java_de_ii_xtraplatform_cli_Cli_00024NativeProgress_update + (JNIEnv *env2, jobject obj, jstring update) { + if (progress_cb != NULL) { + const char* msg = (*env)->GetStringUTFChars(env, update, NULL); + + progress_cb(msg); + } + } + +int xtracfg_init() { JavaVMInitArgs vm_args; JavaVMOption options[0]; vm_args.version = JNI_VERSION_10; @@ -14,23 +27,39 @@ char* xtracfg_execute(const char* command, int* err) { vm_args.ignoreUnrecognized = 0; jint res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args); + if (JNI_OK != res) { printf("ERR\n"); - *err = 1; - return "Could not create JVM"; + return 1; + } + + return 0; +} + +void xtracfg_cleanup() { + if (jvm != NULL) { + (*jvm)->DestroyJavaVM(jvm); } +} - jclass cls = (*env)->FindClass(env, "de/ii/xtraplatform/cli/CommandHandler"); - jmethodID cid = (*env)->GetMethodID(env, cls, "", "()V"); - jmethodID mid = (*env)->GetMethodID(env, cls, "handleCommand", "(Ljava/lang/String;)Ljava/lang/String;"); +void xtracfg_progress_subscribe(progress_callback callback) { + progress_cb = callback; +} - //printf("JVM %d %d %d\n", cls, cid, mid); +char* xtracfg_execute(const char* command, int* err) { + if (jvm == NULL || env == NULL) { + printf("ERR\n"); + *err = 1; + return "Not intialized"; + } - jobject ch = (*env)->NewObject(env, cls, cid); + jclass cls = (*env)->FindClass(env, "de/ii/xtraplatform/cli/XtraCfg"); + jmethodID mid = (*env)->GetStaticMethodID(env, cls, "execute", "(Ljava/lang/String;)Ljava/lang/String;"); + //printf("JVM %d %d\n", cls, mid); jstring command2 = (*env)->NewStringUTF(env, command); - jstring result2 = (jstring)(*env)->CallObjectMethod(env, ch, mid, command2); + jstring result2 = (jstring)(*env)->CallStaticObjectMethod(env, cls, mid, command2); (*env)->DeleteLocalRef(env, command2); @@ -38,11 +67,8 @@ char* xtracfg_execute(const char* command, int* err) { char *result3 = malloc(strlen(result) + 1); strcpy(result3,result); - //printf("%s", result3); - - (*jvm)->DestroyJavaVM(jvm); + //printf("%s", result3);D"); *err = 0; return result3; } - diff --git a/libxtracfg/go/go.mod b/libxtracfg/go/go.mod new file mode 100644 index 0000000..5134f27 --- /dev/null +++ b/libxtracfg/go/go.mod @@ -0,0 +1,3 @@ +module github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go + +go 1.23.2 diff --git a/libxtracfg/go/go.sum b/libxtracfg/go/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/xtracfg/client/client.go b/libxtracfg/go/xtracfg/client.go similarity index 75% rename from xtracfg/client/client.go rename to libxtracfg/go/xtracfg/client.go index 231d89a..2912885 100644 --- a/xtracfg/client/client.go +++ b/libxtracfg/go/xtracfg/client.go @@ -1,4 +1,15 @@ -package client +package xtracfg + +/* +#cgo CFLAGS: -I ../../c/include +#cgo LDFLAGS: -L../../c/build -lxtracfg -framework CoreServices -framework Foundation + +#include +#include "libxtracfg.h" + +void progress(char *msg); +*/ +import "C" import ( "encoding/json" @@ -6,30 +17,47 @@ import ( "path/filepath" "strconv" "strings" + "unsafe" ) -type CommandHandler func(command string) string - // Store is type Store struct { source *string driver *string verbose *bool debug *bool - progress *chan string + Progress *chan string } -var handle CommandHandler -var progress chan string +var progress_chan chan string + +//export progress +func progress(msg *C.char) { + progress_chan <- C.GoString(msg) +} + +func xtracfg_init() { + progress_chan = make(chan string, 16) + /*go func() { + for { + msg, more := <-progress_chan + if !more { + return + } + + log.Println("PROGRESS", msg) + } + }()*/ + + C.xtracfg_init() + C.xtracfg_progress_subscribe((C.progress_callback)(unsafe.Pointer(C.progress))) +} // New is func New(source *string, driver *string, verbose *bool, debug *bool) *Store { - return &Store{source: source, driver: driver, debug: debug, verbose: verbose, progress: &progress} -} + xtracfg_init() -func Init(handle_command CommandHandler, progress_chan chan string) { - handle = handle_command - progress = progress_chan + return &Store{source: source, driver: driver, debug: debug, verbose: verbose, Progress: &progress_chan} } // Label is @@ -69,7 +97,7 @@ func (store Store) Connect() error { if err == nil { if *store.verbose { - PrintResults(*response.Results, err) + //PrintResults(*response.Results, err) // fmt.Printf("Connected to store source %s\n\n", store.Label()) } return nil @@ -134,7 +162,10 @@ func (store Store) Request(request []byte) (response []byte) { fmt.Println("->", request2) } - response = requestC(request2) + var err C.int + r := C.xtracfg_execute(C.CString(request2), &err) + response = []byte(C.GoString(r)) + C.free(unsafe.Pointer(r)) if *store.debug { fmt.Println("<-", string(response)) @@ -142,13 +173,3 @@ func (store Store) Request(request []byte) (response []byte) { return response } - -func requestC(command string) (response []byte) { - if handle == nil { - handle = mockHandler - } - - response = []byte(handle(command)) - - return response -} diff --git a/xtracfg/client/response.go b/libxtracfg/go/xtracfg/response.go similarity index 99% rename from xtracfg/client/response.go rename to libxtracfg/go/xtracfg/response.go index 088063e..2daacd3 100644 --- a/xtracfg/client/response.go +++ b/libxtracfg/go/xtracfg/response.go @@ -1,4 +1,4 @@ -package client +package xtracfg import ( "encoding/json" diff --git a/xtracfg/client/mock.go b/xtracfg/client/mock.go deleted file mode 100644 index 8781622..0000000 --- a/xtracfg/client/mock.go +++ /dev/null @@ -1,29 +0,0 @@ -package client - -import "fmt" - -func mockHandler(command string) string { - fmt.Printf("MOCK JNI Command: %s\n", command) - - resp := ` - { - "results": [ - { - "status": "ERROR", - "message": "Doh!" - }, - { - "status": "WARNING", - "message": "Doh!" - }, - { - "status": "SUCCESS", - "message": "Doh!" - } - ] - }` - - fmt.Printf("MOCK JNI Result: %s\n", resp) - - return resp -} diff --git a/xtracfg/cmd/root.go b/xtracfg/cmd/root.go index f639143..fcf2b31 100644 --- a/xtracfg/cmd/root.go +++ b/xtracfg/cmd/root.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/interactive-instruments/xtraplatform-cli/xtracfg/client" + "github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go/xtracfg" "github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd/store" "github.com/spf13/cobra" @@ -25,7 +25,7 @@ func version() string { } var name string = "xtracfg" -var storeSrc client.Store +var storeSrc xtracfg.Store // RootCmd represents the base command when called without any subcommands var RootCmd = &cobra.Command{ @@ -61,7 +61,7 @@ func init() { RootCmd.PersistentFlags().MarkHidden("debug") RootCmd.PersistentFlags().Bool("help", false, "show help") - storeSrc = *client.New(src, typ, verbose, debug) + storeSrc = *xtracfg.New(src, typ, verbose, debug) infoCmd := store.InfoCmd(storeSrc, name, verbose, debug) diff --git a/xtracfg/cmd/store/check.go b/xtracfg/cmd/store/check.go index 912dce9..4b9b4c1 100644 --- a/xtracfg/cmd/store/check.go +++ b/xtracfg/cmd/store/check.go @@ -7,14 +7,15 @@ import ( "strconv" "strings" - "github.com/interactive-instruments/xtraplatform-cli/xtracfg/client" + "github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go/xtracfg" + "github.com/interactive-instruments/xtraplatform-cli/xtracfg/util" "github.com/spf13/cobra" ) var ignoreRedundant *bool // CheckCmd represents the check command -func CheckCmd(store client.Store, name string, verbose *bool, debug *bool) *cobra.Command { +func CheckCmd(store xtracfg.Store, name string, verbose *bool, debug *bool) *cobra.Command { check := &cobra.Command{ Use: "check", Short: "Check the store source", @@ -27,7 +28,7 @@ Executes all subcommands in order, see the subcommand help for details.`, } results, err := store.Handle(map[string]interface{}{"ignoreRedundant": strconv.FormatBool(*ignoreRedundant)}, "check") - client.PrintResults(results, err) + util.PrintResults(results, err) printFix(results, err, name) }, @@ -50,7 +51,7 @@ Executes all subcommands in order, see the subcommand help for details.`, results, err := store.Handle(map[string]interface{}{"ignoreRedundant": strconv.FormatBool(*ignoreRedundant)}, "check", "cfg") - client.PrintResults(results, err) + util.PrintResults(results, err) printFix(results, err, name) }, @@ -84,7 +85,7 @@ To check only a single entity, pass the path to the file relative to the source results, err := store.Handle(map[string]interface{}{"ignoreRedundant": strconv.FormatBool(*ignoreRedundant), "path": path}, "check", "entities") - client.PrintResults(results, err) + util.PrintResults(results, err) printFix(results, err, name) }, @@ -102,7 +103,7 @@ To check only a single entity, pass the path to the file relative to the source results, err := store.Handle(map[string]interface{}{"ignoreRedundant": strconv.FormatBool(*ignoreRedundant)}, "check", "layout") - client.PrintResults(results, err) + util.PrintResults(results, err) printFix(results, err, name) }, @@ -115,8 +116,8 @@ To check only a single entity, pass the path to the file relative to the source return check } -func printFix(results []client.Result, err error, name string) { - if err == nil && client.HasStatus(results, client.Warning) { +func printFix(results []xtracfg.Result, err error, name string) { + if err == nil && xtracfg.HasStatus(results, xtracfg.Warning) { fmt.Fprint(os.Stdout, "\n", "Run '", name, " ", strings.Replace(strings.Join(os.Args[1:], " "), "check", "upgrade", 1), "' to fix all detected issues.", "\n") } else { fmt.Fprint(os.Stdout, "\n") diff --git a/xtracfg/cmd/store/info.go b/xtracfg/cmd/store/info.go index ecdf9e0..c9f4ee3 100644 --- a/xtracfg/cmd/store/info.go +++ b/xtracfg/cmd/store/info.go @@ -1,12 +1,13 @@ package store import ( - "github.com/interactive-instruments/xtraplatform-cli/xtracfg/client" + "github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go/xtracfg" + "github.com/interactive-instruments/xtraplatform-cli/xtracfg/util" "github.com/spf13/cobra" ) // InfoCmd represents the check command -func InfoCmd(store client.Store, name string, verbose *bool, debug *bool) *cobra.Command { +func InfoCmd(store xtracfg.Store, name string, verbose *bool, debug *bool) *cobra.Command { info := &cobra.Command{ Use: "info", Short: "Print info about the store source", @@ -14,7 +15,7 @@ func InfoCmd(store client.Store, name string, verbose *bool, debug *bool) *cobra Run: func(cmd *cobra.Command, args []string) { results, err := store.Handle(map[string]interface{}{}, "info") - client.PrintResults(results, err) + util.PrintResults(results, err) }, } diff --git a/xtracfg/cmd/store/listen.go b/xtracfg/cmd/store/listen.go index a00858c..a497fdd 100644 --- a/xtracfg/cmd/store/listen.go +++ b/xtracfg/cmd/store/listen.go @@ -3,12 +3,13 @@ package store import ( "fmt" - "github.com/interactive-instruments/xtraplatform-cli/xtracfg/client" + "github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go/xtracfg" + "github.com/interactive-instruments/xtraplatform-cli/xtracfg/util" "github.com/spf13/cobra" ) // InfoCmd represents the check command -func ListenCmd(store client.Store, name string, version string, verbose *bool, debug *bool) *cobra.Command { +func ListenCmd(store xtracfg.Store, name string, version string, verbose *bool, debug *bool) *cobra.Command { listen := &cobra.Command{ Use: "listen [port]", Short: "Listen for command on websocket", @@ -20,7 +21,7 @@ func ListenCmd(store client.Store, name string, version string, verbose *bool, d port = ":" + args[0] } fmt.Printf("%s (%s) listening on port %s\n", name, version, port) - client.OpenWebsocket(store, port) + util.OpenWebsocket(store, port) }, } diff --git a/xtracfg/cmd/store/upgrade.go b/xtracfg/cmd/store/upgrade.go index 7d57438..7f6e08f 100644 --- a/xtracfg/cmd/store/upgrade.go +++ b/xtracfg/cmd/store/upgrade.go @@ -6,7 +6,8 @@ import ( "os" "strconv" - "github.com/interactive-instruments/xtraplatform-cli/xtracfg/client" + "github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go/xtracfg" + "github.com/interactive-instruments/xtraplatform-cli/xtracfg/util" "github.com/spf13/cobra" ) @@ -16,7 +17,7 @@ var noConfirm *bool var keepRedundant *bool // Cmd represents the entity command -func UpgradeCmd(store client.Store, name string, verbose *bool, debug *bool) *cobra.Command { +func UpgradeCmd(store xtracfg.Store, name string, verbose *bool, debug *bool) *cobra.Command { upgrade := &cobra.Command{ Use: "upgrade", Short: "Upgrade the store source", @@ -36,13 +37,13 @@ No changes are made without confirmation (unless --yes is set).`, results, err := store.Handle(map[string]interface{}{"ignoreRedundant": strconv.FormatBool(*keepRedundant)}, "pre_upgrade", "cfg") if !*noConfirm { - client.PrintResults(results, err) + util.PrintResults(results, err) } - if client.HasStatus(results, client.Confirmation) { + if xtracfg.HasStatus(results, xtracfg.Confirmation) { results, err = store.Handle(map[string]interface{}{"backup": strconv.FormatBool(*backup), "ignoreRedundant": strconv.FormatBool(*keepRedundant), "noConfirm": strconv.FormatBool(*noConfirm)}, "upgrade", "cfg") - client.PrintResults(results, err) + util.PrintResults(results, err) } fmt.Fprint(os.Stdout, "\n", "Upgrading entities", "\n") @@ -50,13 +51,13 @@ No changes are made without confirmation (unless --yes is set).`, results, err = store.Handle(map[string]interface{}{"force": strconv.FormatBool(*force), "ignoreRedundant": strconv.FormatBool(*keepRedundant)}, "pre_upgrade", "entities") if !*noConfirm { - client.PrintResults(results, err) + util.PrintResults(results, err) } - if client.HasStatus(results, client.Confirmation) { + if xtracfg.HasStatus(results, xtracfg.Confirmation) { results, err = store.Handle(map[string]interface{}{"backup": strconv.FormatBool(*backup), "force": strconv.FormatBool(*force), "ignoreRedundant": strconv.FormatBool(*keepRedundant), "noConfirm": strconv.FormatBool(*noConfirm)}, "upgrade", "entities") - client.PrintResults(results, err) + util.PrintResults(results, err) } fmt.Fprint(os.Stdout, "\n", "Upgrading layout", "\n") @@ -64,13 +65,13 @@ No changes are made without confirmation (unless --yes is set).`, results, err = store.Handle(map[string]interface{}{"ignoreRedundant": strconv.FormatBool(*keepRedundant)}, "pre_upgrade", "layout") if !*noConfirm { - client.PrintResults(results, err) + util.PrintResults(results, err) } - if client.HasStatus(results, client.Confirmation) { + if xtracfg.HasStatus(results, xtracfg.Confirmation) { results, err = store.Handle(map[string]interface{}{"backup": strconv.FormatBool(*backup), "ignoreRedundant": strconv.FormatBool(*keepRedundant), "noConfirm": strconv.FormatBool(*noConfirm)}, "upgrade", "layout") - client.PrintResults(results, err) + util.PrintResults(results, err) } fmt.Fprint(os.Stdout, "\n") @@ -99,13 +100,13 @@ No changes are made without confirmation (unless --yes is set).`, results, err := store.Handle(map[string]interface{}{"ignoreRedundant": strconv.FormatBool(*keepRedundant)}, "pre_upgrade", "cfg") if !*noConfirm { - client.PrintResults(results, err) + util.PrintResults(results, err) } - if client.HasStatus(results, client.Confirmation) { + if xtracfg.HasStatus(results, xtracfg.Confirmation) { results, err = store.Handle(map[string]interface{}{"backup": strconv.FormatBool(*backup), "ignoreRedundant": strconv.FormatBool(*keepRedundant), "noConfirm": strconv.FormatBool(*noConfirm)}, "upgrade", "cfg") - client.PrintResults(results, err) + util.PrintResults(results, err) } fmt.Fprint(os.Stdout, "\n") @@ -142,13 +143,13 @@ No changes are made without confirmation (unless --yes is set).`, results, err := store.Handle(map[string]interface{}{"force": strconv.FormatBool(*force), "ignoreRedundant": strconv.FormatBool(*keepRedundant), "path": path}, "pre_upgrade", "entities") if !*noConfirm { - client.PrintResults(results, err) + util.PrintResults(results, err) } - if client.HasStatus(results, client.Confirmation) { + if xtracfg.HasStatus(results, xtracfg.Confirmation) { results, err = store.Handle(map[string]interface{}{"backup": strconv.FormatBool(*backup), "force": strconv.FormatBool(*force), "ignoreRedundant": strconv.FormatBool(*keepRedundant), "noConfirm": strconv.FormatBool(*noConfirm), "path": path}, "upgrade", "entities") - client.PrintResults(results, err) + util.PrintResults(results, err) } fmt.Fprint(os.Stdout, "\n") @@ -169,13 +170,13 @@ No changes are made without confirmation (unless --yes is set).`, results, err := store.Handle(map[string]interface{}{"ignoreRedundant": strconv.FormatBool(*keepRedundant)}, "pre_upgrade", "layout") if !*noConfirm { - client.PrintResults(results, err) + util.PrintResults(results, err) } - if client.HasStatus(results, client.Confirmation) { + if xtracfg.HasStatus(results, xtracfg.Confirmation) { results, err = store.Handle(map[string]interface{}{"backup": strconv.FormatBool(*backup), "ignoreRedundant": strconv.FormatBool(*keepRedundant), "noConfirm": strconv.FormatBool(*noConfirm)}, "upgrade", "layout") - client.PrintResults(results, err) + util.PrintResults(results, err) } fmt.Fprint(os.Stdout, "\n") diff --git a/xtracfg/go.mod b/xtracfg/go.mod index 17bccc3..bb36a8f 100644 --- a/xtracfg/go.mod +++ b/xtracfg/go.mod @@ -1,13 +1,26 @@ module github.com/interactive-instruments/xtraplatform-cli/xtracfg -go 1.16 +go 1.23.2 require ( - github.com/AlecAivazis/survey/v2 v2.3.7 // indirect + github.com/AlecAivazis/survey/v2 v2.3.7 github.com/fatih/color v1.10.0 - github.com/gorilla/websocket v1.5.1 // indirect - github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a - github.com/julienroland/usg v0.0.0-20160918114137-cb52eabb3d84 // indirect - github.com/lunixbochs/vtclean v1.0.0 // indirect + github.com/gorilla/websocket v1.5.1 + github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go v0.0.0-00010101000000-000000000000 github.com/spf13/cobra v1.7.0 ) + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/mattn/go-colorable v0.1.8 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect +) + +replace github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go => ../libxtracfg/go diff --git a/xtracfg/go.sum b/xtracfg/go.sum index bdfcd08..c2fc8ff 100644 --- a/xtracfg/go.sum +++ b/xtracfg/go.sum @@ -1,366 +1,77 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog= github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU= -github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= -github.com/julienroland/usg v0.0.0-20160918114137-cb52eabb3d84 h1:85dnNFRw7mhd4fujbFQraFc6lgJNbvZ8ZqV7/YTOd6w= -github.com/julienroland/usg v0.0.0-20160918114137-cb52eabb3d84/go.mod h1:JbqaH26To+mLqYBTlZi6/G8W5gtrNxZ46yIbCZ3Yl1s= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lunixbochs/vtclean v1.0.0 h1:xu2sLAri4lGiovBDQKxl5mrXyESr3gUr5m5SM5+LVb8= -github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/xtracfg/jni.c b/xtracfg/jni.c deleted file mode 100644 index ec9d302..0000000 --- a/xtracfg/jni.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "de_ii_xtraplatform_cli_Cli.h" -#include "client.h" -#include "libxtracfg.h" -#include -#include -#include - -JavaVM *javaVM; -JNIEnv* jniEnv; -jobject handler; -jobject tracker; -jmethodID methodId; -progress_func progress_cb2; - -// called from go, calls exec with command -// saves go progress callback, used in Java_de_ii_xtraplatform_cli_Cli_00024NativeProgress_update -const char* handle_command_2(handle_command_func handle_command_cb, const char* command, progress_func progress_cb) { - progress_cb2 = progress_cb; - - return handle_command_cb(command); -} - -// callback indirectly called from go with the command -// calls the java CommandHandler and returns the result to go -const char* exec(const char* command) { - //printf("JNI Command: %s\n", command); - - jint res = (*javaVM)->AttachCurrentThread(javaVM, (void**)&jniEnv, NULL); - if (JNI_OK != res) { - printf("JNI no thread"); - return NULL; - } - - jstring command2 = (*jniEnv)->NewStringUTF(jniEnv, command); - - jstring result2 = (jstring)(*jniEnv)->CallObjectMethod(jniEnv, handler, methodId, command2, tracker); - - (*jniEnv)->DeleteLocalRef(jniEnv, command2); - - const char* result = (*jniEnv)->GetStringUTFChars(jniEnv, result2, NULL); - - res = (*javaVM)->DetachCurrentThread(javaVM); - if (JNI_OK != res) { - printf("JNI no thread end"); - return NULL; - } - - //printf("JNI Result: %s\n", result); - - return result; - } - -// entrypoint, called from java -JNIEXPORT void JNICALL Java_de_ii_xtraplatform_cli_Cli_execute - (JNIEnv* jni, jclass thisObject, jobject commandHandler, jobject progress) { - - jint res = (*jni)->GetJavaVM(jni, &javaVM); - if (JNI_OK != res) { - printf("JNI no vm"); - return; - } - - jniEnv = jni; - handler = (*jni)->NewGlobalRef(jni, commandHandler); - tracker = (*jni)->NewGlobalRef(jni, progress); - - // Find and save the id of the Java method to be called - jclass commandHandlerClass = (*jni)->GetObjectClass(jni, commandHandler); - methodId = (*jni)->GetMethodID(jni, commandHandlerClass, "handleCommand", "(Ljava/lang/String;Lde/ii/xtraplatform/cli/Progress;)Ljava/lang/String;"); - - handle_command_func hc = &exec; - - // switch to go, pass exec above as callback - cmd_execute(hc); - - (*jni)->DeleteGlobalRef(jni, handler); - (*jni)->DeleteGlobalRef(jni, tracker); -} - -// called from java with progress, pass to go callback -JNIEXPORT void JNICALL Java_de_ii_xtraplatform_cli_Cli_00024NativeProgress_update - (JNIEnv *, jobject, jstring update) { - const char* msg = (*jniEnv)->GetStringUTFChars(jniEnv, update, NULL); - - progress_cb2(msg); - } diff --git a/xtracfg/main.go b/xtracfg/main.go index 5c8705b..e134bcf 100644 --- a/xtracfg/main.go +++ b/xtracfg/main.go @@ -1,52 +1,9 @@ package main -/* -//pass on command line with CGO_CFLAGS -//#cgo CFLAGS: -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux" -#cgo CFLAGS: -I include - -#include "client.h" -*/ -import "C" import ( - "github.com/interactive-instruments/xtraplatform-cli/xtracfg/client" "github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd" ) -var handleC C.handle_command_func -var progress_chan chan string - func main() { cmd.Execute() } - -//export cmd_execute -func cmd_execute(handle_command C.handle_command_func) { - handleC = handle_command - progress_chan = make(chan string, 16) - - client.Init(handle, progress_chan) - - cmd.Execute() -} - -//export progress -func progress(msg *C.char) { - progress_chan <- C.GoString(msg) -} - -func handle(command string) string { - //fmt.Printf("JNI PASS: %s\n", command) - - messages := make(chan string) - - // has to run concurrently since we are being called from java and calling into java at the same time - go func() { - r := C.handle_command_2(handleC, C.CString(command), C.progress_func(C.progress)) - messages <- C.GoString(r) - }() - - msg := <-messages - - return msg -} diff --git a/xtracfg/src/main/java/de/ii/xtraplatform/cli/XtraCfg.java b/xtracfg/src/main/java/de/ii/xtraplatform/cli/XtraCfg.java index 0ff8602..c784a58 100644 --- a/xtracfg/src/main/java/de/ii/xtraplatform/cli/XtraCfg.java +++ b/xtracfg/src/main/java/de/ii/xtraplatform/cli/XtraCfg.java @@ -13,4 +13,17 @@ public static void main(String[] args) { e.printStackTrace(); } } + + public static String execute(String command) { + try { + CommandHandler commandHandler = new CommandHandler(); + Cli.NativeProgress progress = new Cli.NativeProgress(); + + return commandHandler.handleCommand(command, progress); + } catch (Throwable e) { + System.out.println("ERROR " + e.getMessage()); + e.printStackTrace(); + return ""; + } + } } diff --git a/xtracfg/src/main/resources/META-INF/native-image/jni-config.json b/xtracfg/src/main/resources/META-INF/native-image/jni-config.json index 4dea2e8..9a38494 100644 --- a/xtracfg/src/main/resources/META-INF/native-image/jni-config.json +++ b/xtracfg/src/main/resources/META-INF/native-image/jni-config.json @@ -1,14 +1,6 @@ [ { - "name":"de.ii.xtraplatform.cli.CommandHandler", - "methods":[ - { "name" : "", "parameterTypes" : [] }, - {"name":"handleCommand","parameterTypes":["java.lang.String"] }, - {"name":"handleCommand","parameterTypes":["java.lang.String", "de.ii.xtraplatform.cli.Progress"] } - ] -}, -{ - "name":"java.lang.Boolean", - "methods":[{"name":"getBoolean","parameterTypes":["java.lang.String"] }] + "name":"de.ii.xtraplatform.cli.XtraCfg", + "methods":[{"name":"execute","parameterTypes":["java.lang.String"]}] } ] \ No newline at end of file diff --git a/xtracfg/client/console.go b/xtracfg/util/console.go similarity index 80% rename from xtracfg/client/console.go rename to xtracfg/util/console.go index 9b40db2..b32b1a4 100644 --- a/xtracfg/client/console.go +++ b/xtracfg/util/console.go @@ -1,4 +1,4 @@ -package client +package util import ( "fmt" @@ -6,6 +6,7 @@ import ( "github.com/AlecAivazis/survey/v2" "github.com/fatih/color" + "github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go/xtracfg" ) var grey = color.New(color.FgHiWhite, color.Faint).SprintFunc() @@ -19,7 +20,7 @@ var cross = fmt.Sprintf("%c", '\u26CC') var danger = fmt.Sprintf("%c", '!') // PrintResults prints the results to the console -func PrintResults(results []Result, err error) { +func PrintResults(results []xtracfg.Result, err error) { fmt.Fprint(os.Stdout, "\n") if err != nil { @@ -29,15 +30,15 @@ func PrintResults(results []Result, err error) { for _, r := range results { switch r.Status { - case Error: + case xtracfg.Error: fmt.Fprint(os.Stdout, red(cross), " ", *r.Message, "\n") - case Warning: + case xtracfg.Warning: fmt.Fprint(os.Stdout, yellow(danger), " ", *r.Message, "\n") - case Success: + case xtracfg.Success: fmt.Fprint(os.Stdout, green(check), " ", *r.Message, "\n") - case Info: + case xtracfg.Info: fmt.Fprint(os.Stdout, *r.Message, "\n") - case Confirmation: + case xtracfg.Confirmation: fmt.Fprint(os.Stdout, "\n") do := false prompt := &survey.Confirm{ diff --git a/xtracfg/client/server.go b/xtracfg/util/server.go similarity index 90% rename from xtracfg/client/server.go rename to xtracfg/util/server.go index 22b40dd..a65b051 100644 --- a/xtracfg/client/server.go +++ b/xtracfg/util/server.go @@ -1,15 +1,16 @@ -package client +package util import ( "log" "net/http" "github.com/gorilla/websocket" + "github.com/interactive-instruments/xtraplatform-cli/libxtracfg/go/xtracfg" ) -var store Store +var store xtracfg.Store -func OpenWebsocket(store2 Store, port string) { +func OpenWebsocket(store2 xtracfg.Store, port string) { store = store2 handler := newLimitHandler(1, http.HandlerFunc(wsEndpoint)) @@ -46,7 +47,7 @@ func wsEndpoint(w http.ResponseWriter, r *http.Request) { // listen indefinitely for new messages coming through on our WebSocket connection reader(ws) - *store.progress <- WS_CLOSED + *store.Progress <- WS_CLOSED log.Println("done reading") } @@ -74,7 +75,7 @@ func reader(conn *websocket.Conn) { func progress_writer(conn *websocket.Conn) { go func() { for { - msg, more := <-*store.progress + msg, more := <-*store.Progress if !more || msg == WS_CLOSED { log.Println("ERR5", more, msg) return