Yep, works like a charm. thx! On Mon, Nov 13, 2023 at 4:34 AM Michel Levieux <michel.levi...@doctolib.com> wrote:
> Hi! > > Not an expert at all, but it seems the format is > "package-qualified.identifier=value", with value being able to just contain > spaces out of the box, so running: > > go run -ldflags="-X 'main.MyVar=this is a string'" main.go > > works for me. Note that for parsing the whole thing correctly, the whole > equality should be surrounded by quotes (i.e. including the main.MyVar part) > > Hope that helps! > > On Thu, Nov 9, 2023 at 10:26 PM Tong Sun <suntong...@gmail.com> wrote: > >> go run command-line-arguments >> >> -X definition >> add string value definition of the form importpath.name=value >> >> I used to use this to override my variable values, in the form of >> >> go run -ldflags="-X main.var1=val1 main.var2=val2" >> >> Now, the new problem is that I need to have space in the string value >> definition. How can I do that please? >> >> I've tried both the following cases: >> >> go run -ldflags="-X main.var1='val 1' main.var2=\"val 2\"" >> >> but neither is working. >> Please help >> >> >> -- >> 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/7d1e2b06-dce9-4e46-b20b-fe5a3663038en%40googlegroups.com >> <https://groups.google.com/d/msgid/golang-nuts/7d1e2b06-dce9-4e46-b20b-fe5a3663038en%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > *Évènement en ligne : inscription ici > <https://info.doctolib.fr/events/bienvenue-dans-le-nouveau-doctolib/?utm_campaign=nurt_FR_Generic_email_signature_20231030&utm_source=automation&utm_medium=email>* > *The information transmitted, including attachments, is intended only for * > *the **person(s) or **entity to which it is addressed and may contain > **confidential > and/or privileged material. Any **review, retransmission, **dissemination > or other use of, or taking of any action in reliance **upon **this > information by persons or entities other than the intended recipient **is > prohibited. If **you received this in error, please contact the sender > and **destroy any copies of this **information.* > -- 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/CAMmz1Ofy1fkOqK_wWaTSXDQKeoADO7uEMiV6HB2Qvr91qLM%3DFQ%40mail.gmail.com.