Thanks a lot, i seem to have been a bit fixated on there already being more 
direct symmetry between print and scan.

anyway, i hacked up something that is working as i wanted;

https://play.golang.org/p/BZ437rSo5DU

(when you think about it, a recursive solution was always going to need a 
buffer.)

really i was most interested in getting a general way to make a fmt.Scanner 
work symmetrically to a fmt.Stringer when used hierarchically, so without 
messing with runes/tokens directly.


On Saturday, 22 February 2020 02:26:28 UTC, Ian Lance Taylor wrote:
>
> On Fri, Feb 21, 2020 at 4:35 PM 'simon place' via golang-nuts 
> <golan...@googlegroups.com <javascript:>> 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/8d3cab1c-8a40-44ad-9d0c-5901fb399e47%40googlegroups.com.

Reply via email to