New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String Slices from pflags are not handled correctly by viper. #200
Comments
cc @bep Hi, just wondering whats the status of this issue? Is this the recommended workaround? |
r2d4
added a commit
to r2d4/minikube
that referenced
this issue
Aug 12, 2016
This allows most flags for the minikube start command to be configurable by viper as well. If a flag is present, it will take precedence over the value supplied in viper. Viper doesn't handle string slices correctly (see spf13/viper#200) so the string slices that we pass in as flags such as docker-env and insecure-registry are still only handled by flags
r2d4
added a commit
to r2d4/minikube
that referenced
this issue
Aug 24, 2016
This allows most flags for the minikube start command to be configurable by viper as well. If a flag is present, it will take precedence over the value supplied in viper. Viper doesn't handle string slices correctly (see spf13/viper#200) so the string slices that we pass in as flags such as docker-env and insecure-registry are still only handled by flags
r2d4
added a commit
to r2d4/minikube
that referenced
this issue
Aug 24, 2016
This allows most flags for the minikube start command to be configurable by viper as well. If a flag is present, it will take precedence over the value supplied in viper. Viper doesn't handle string slices correctly (see spf13/viper#200) so the string slices that we pass in as flags such as docker-env and insecure-registry are still only handled by flags Delete custom flag for human readable disk size Since the value can now be passed in multiple ways (environment variable, flag, or config file), moving the conversion out of the flag and straight into cmd/minikube/cmd/start.go This changes the helptext for gendocs
jimmidyson
pushed a commit
to minishift/minishift
that referenced
this issue
Sep 5, 2016
This allows most flags for the minikube start command to be configurable by viper as well. If a flag is present, it will take precedence over the value supplied in viper. Viper doesn't handle string slices correctly (see spf13/viper#200) so the string slices that we pass in as flags such as docker-env and insecure-registry are still only handled by flags Delete custom flag for human readable disk size Since the value can now be passed in multiple ways (environment variable, flag, or config file), moving the conversion out of the flag and straight into cmd/minikube/cmd/start.go This changes the helptext for gendocs
r2d4
added a commit
to r2d4/minikube
that referenced
this issue
Sep 19, 2016
This allows most flags for the minikube start command to be configurable by viper as well. If a flag is present, it will take precedence over the value supplied in viper. Viper doesn't handle string slices correctly (see spf13/viper#200) so the string slices that we pass in as flags such as docker-env and insecure-registry are still only handled by flags Delete custom flag for human readable disk size Since the value can now be passed in multiple ways (environment variable, flag, or config file), moving the conversion out of the flag and straight into cmd/minikube/cmd/start.go This changes the helptext for gendocs
PR #244 submitted:
|
#240 might fix this, will check. |
The latest master still seems to have this problem:
|
I have this issue as well. I am also using the latest version. |
@dansteen The issue is there. In my pull request I've added a test and fix. |
concaf
added a commit
to concaf/opencompose
that referenced
this issue
Jun 13, 2017
This commit updates the vendor directory using the `make update-vendor` command. This is required as an effort to resolve redhat-developer#167, but this is not the complete resolution. This takes us a step forward by updating github.com/spf13/viper, which resolves the issue as mentioned in spf13/viper#200.
aduffeck
added a commit
to cloudfoundry-incubator/fissile
that referenced
this issue
Apr 23, 2018
See spf13/viper#200 for more details on the issue.
aduffeck
added a commit
to cloudfoundry-incubator/fissile
that referenced
this issue
Apr 23, 2018
See spf13/viper#200 for more details on the issue.
This was referenced Apr 8, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The slice of strings just contains one element that is the stringified version of the string
ie:
[]string{"[firstarg,secondarg]"}
or in the case of nil/empty:
[]string{"[]"}
It appears that this is coming from the Pflag libraries
ValueString()
function. I've included a patch that "helps" the issue but I suspect it's a little bit more deep-seated as the cast package also doesn't seem to handle this case well at all hence I'm not making trying to make a PR for this.For others hitting this issue the workaround is to simply use pflags directly for string slices until this is fixed.
Example program that shows the the failure:
Output (annotated for clarity) of
go run main.go
Output (annotated for clarity) of
go run main.go -t thing1 -t thing2
The text was updated successfully, but these errors were encountered: