Last active
August 29, 2015 14:19
-
-
Save eparis/458542ddda01fa9850f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// argsMinusFirstX removes only the first x from args. Otherwise, commands that look like | |
// openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]). | |
func argsMinusFirstX(args []string, x string) []string { | |
for i, y := range args { | |
if x == y { | |
return append(args[:i], args[i+1:]...) | |
} | |
} | |
return args | |
} | |
(stolen from https://github.com/golang/go/wiki/SliceTricks) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment