You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bigger logic of Cap (implicitly) allows for the user to leave the --names flag empty and specify only --default-name:
If names happens to be an empty slice, then numNames is 0. The first half of the predicate is true, but if defaultName is not empty then Cap doesn't error-out:
And I would like this behavior: if I have a headerless CSV with any number of columns that I want to feed into another GoCSV command I want to easily cap it with --default-name=Col.
But, prior to that, Cap tries to create the slice of strings, names, based on the assumption that the --names flag is not an empty string:
The bigger logic of Cap (implicitly) allows for the user to leave the --names flag empty and specify only --default-name:
If names happens to be an empty slice, then numNames is 0. The first half of the predicate is true, but if defaultName is not empty then Cap doesn't error-out:
gocsv/cmd/cap.go
Lines 49 to 52 in f9d4372
Then... with nunNames being 0, the code flows through the else statement and builds the header exclusively off of defaultName:
gocsv/cmd/cap.go
Lines 60 to 71 in f9d4372
And I would like this behavior: if I have a headerless CSV with any number of columns that I want to feed into another GoCSV command I want to easily cap it with
--default-name=Col
.But, prior to that, Cap tries to create the slice of strings, names, based on the assumption that the --names flag is not an empty string:
gocsv/cmd/cap.go
Lines 37 to 40 in f9d4372
The call to
GetArrayFromCsvString(...)
will panic if the passed string is empty.I propose:
The text was updated successfully, but these errors were encountered: