Kurtis,

This is what I'm trying to accomplish:

Start delve (dlv) with os/exec passing a set of []string os.Args as
--build-flags

Let's say I have this build arguments set: []string{"-gcflags", "-N -l"}

 - How can I pass this to --build-flags in Delve? strings.Join(flags,
" ") is wrong.
 - How can I pass this to "go" with os/exec correctly? The quotes are
not put properly.

There are some cross-platform cases where the shell quoting is used,
and the general "quote something" mechanics are similar on Windows and
Linux.

Thanks,
Christian

On Sun, Nov 6, 2022 at 9:11 PM Kurtis Rader <kra...@skepticism.us> wrote:
>
> On Sun, Nov 6, 2022 at 8:48 PM 'Christian Stewart' via golang-nuts 
> <golang-nuts@googlegroups.com> wrote:
>>
>> There have been several discussions about shellquote in go-nuts in the past:
>>
>> https://github.com/kballard/go-shellquote
>> https://github.com/gonuts/go-shellquote
>>
>> I've found it necessary to use both Split and Join in some cases when 
>> working with exec.Command.
>>
>> This seems like the type of thing that ought to be part of the stdlib, has 
>> there been any consideration towards including it or a similar 
>> implementation?
>>
>> This is useful for processing os.Args especially in CLI or emulated shell 
>> environments.
>
>
> No, IMHO, because such quoting is OS specific. For example, the quoting for 
> UNIX and Windows in this context are different. Furthermore, given the 
> vagaries of the POSIX shell standard I am skeptical that either of the 
> projects you linked to correctly manipulates such strings in every case.
>
> It would help if you provided a concrete example of the problem you need help 
> with.
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2Bh8R2pNLqaM2%3DK4%3DYdKhmWTAEAEna3k7KkQHqRVed%3D3RemKQQ%40mail.gmail.com.

Reply via email to