// GetArgValue traverses an argument slice backwards and returns the value // of the given argument name and the index where it was found. // If the argument does not exist an empty string and -1 are returned. // startIdx defines where the iteration starts. If startIdx is a negative // value or larger than the size of the argument slice the iteration // will start from the last element. func GetArgValue(args []Arg, name string, startIdx int) (string, int) { … } // SetArgValues updates the value of one or more arguments or adds a new // one if missing. The function works backwards in the argument list. // nArgs holds how many existing arguments with this name should be set. // If nArgs is less than 1, all of them will be updated. func SetArgValues(args []Arg, name, value string, nArgs int) []Arg { … }