On Fri, Feb 21, 2020 at 4:35 PM 'simon place' via golang-nuts <golang-nuts@googlegroups.com> wrote: > > basically i want to save a file name in a file (with some url styling for > human readability); > > https://play.golang.org/p/sWYbyU7nuSo > > which works, but not with a space in the name; > > https://play.golang.org/p/sswqBRL8dZW > > it needs to be quoted, so i figure '%q' is for this; > > >> %q a double-quoted string safely escaped with Go syntax > > > > but it doesn't work; > > https://play.golang.org/p/2QT-2UH4TsZ > > how can the format not match, when its the same one? > > nothing else a can think of, like quotes in the format itself, does either, > so i'm stuck.
In your program the type has a scan method that ignores the rune parameter. So the %q passed to fmt.Fscanf is irrelevant. What matters is the format character used in the Scan method, which is %v. Ian -- 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/CAOyqgcUp49gTaUan%2B6zm9OVmNNEXW604q48kMyOsQRUmt4oJow%40mail.gmail.com.