graphql-engine/cli/util
Kali Vara Purushotham Santhati b75ab7233e cli: fix data-race warnings
#### Issue: https://github.com/hasura/graphql-engine-mono/issues/2179

### Problem:

1. There are few warnings when tests are executed with cli if it is built with `race` flag
It is because of a race condition between stdin in migrate_delete for the prompt and stdout for other commands.

2. The integration test of the console used to behave as follows:
    ```
     - Initially there won't be any wg.adds in wait-group so the second go-routine created in console-test (integration-test)
     - It will send the interrupt signal to the channel before the server has been started
     - So practically the server won't start
    ```
3. The read and write for consoleopts.WG has been happening in different go-routines without control or lock system(reading and writing into same memory location without lock system). So there is a chance of data-race(warning for data-race while integration tests are executed)
4. Data-race errors from `promptui` package

### Solution:

1. Use `--force` flag to avoid getting the input from the prompt in `migrate_delete_test.go`
2. Introduced two fields in server and console opts to let know other go-routines whether the server has been started or not
3. To avoid data-race above which are shared b/w go-routines to know the status of servers has been operated atomically.
4. using new package https://github.com/AlecAivazis/survey

https://github.com/hasura/graphql-engine-mono/pull/2231

GitOrigin-RevId: 387eb1be74f24dda34bb3588314b5a909adac227
2021-09-07 13:34:54 +00:00
..
copy.go cli: support datasources 2021-01-18 17:12:09 +00:00
filesystem.go cli: allow managing actions (#3859) 2020-02-24 21:44:46 +05:30
flags.go cli: add support for multiple versions of plugin (close #4105) (#4135) 2020-04-07 19:42:14 +05:30
git.go cli: force update local plugin index (close #6219) (#70) 2020-11-20 07:59:58 +00:00
printer.go cli: update tests (#47) 2018-07-06 10:36:27 +05:30
prompt.go cli: fix data-race warnings 2021-09-07 13:34:54 +00:00
server.go cli: refactor metadata object interface 2021-07-23 09:50:36 +00:00
tablewriter.go cli: enhance e2e tests 2021-07-28 06:45:03 +00:00
util.go [cli] add comments (#4) 2018-06-28 14:06:25 +05:30
viper.go cli: show env vars for the flags in command help (close #4263) (#4326) 2020-04-08 17:25:42 +05:30
zip.go [cli] add comments (#4) 2018-06-28 14:06:25 +05:30