The enhancements and fixes to the user experience are as follows:
* Rename active and inactive commands to the actions set-active and
set-inactive respectively to clarify their behavior
To set a token to active:
```
influx v1 auth set-active
```
To set a token to inactive, preventing its use:
```
influx v1 auth set-inactive
```
* allow `--id` or `--username` anywhere a single authentication token is
required
* use separate vars to store the flag state of each command
* factor out the behavior to find a single authentication token into
a shared function, `v1FindOneAuthorization`
Currently, unsafeBytesToString function violates the 6th rule of unsafe
pointer usage. That is, reflect.SliceHeader/String header should never
be used as plain struct. This misuse can make to silent memory
corruption, which can be difficult to track down when problem occurred.
Instead, use the more (right) idiom to convert slice of byte to string
without heap allocation.
goos: linux
goarch: amd64
cpu: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
BenchmarkInvalid-8 1000000000 0.497 ns/op 0 B/op 0 allocs/op
BenchmarkValid-8 1000000000 0.239 ns/op 0 B/op 0 allocs/op
PASS
ok command-line-arguments 0.815s
A static initialization is not desirable in the main binaries, as it forces all
paths of code to init, but it is still useful in tests. It allows static
intialization to be performed once for all tests and eliminates the need to
always add the FluxInit call. Added a fluxinit/static package that calls
fluxinit.FluxInit() to replace the builtin package. This hides the nature of
the initialization and makes it clear that it is mandatory initialization code
getting called.
feat(dashboard): add owner ID to dashboard model
This adds the explicit OwnerID field to Dashboard and also adds a
migration which populates dashboard owners IDs based on dashboard owner
URMs.
feat(dashboards): isolate service in own package
This change isolates the dashboards service into its own package. It
also updates the API to no longer interface with user resource mappings.
Instead it defines new handlers which rely on the newly populated owner
ID field.
chore(dashboards): port tests from http package into new service transport package
chore(launcher): use dashboard transport package client in launcher tests
chore(kv): remove now defunkt dashboard service implementations
* fix: use fluxinit package to init flux library instead of builtin
The builtin package performs costly initialization work in the go init()
function, which causes the work to be performed for all paths of the main
executables that need it, including help screens. This patch uses the fluxinit
package, which requires a call to do the costly work. It allows help screens
and other code paths to execute quickly.
* fix: need to draw in the influxdb-specific standard library in fluxinit