Fscan() eats 1st char in scanning values if the values aren't a first value 
in a line.

The documentation tells: "Fscanln is similar to Fscan 
<https://pkg.go.dev/fmt@go1.23.5#Fscan>, but stops scanning at a newline 
and after the final item there must be a newline or EOF."

 

The test discovers a bug in Fscanln() - https://go.dev/play/p/Jem2lWVn3H5

 Result of the test you can see below.

                 The string for scanning (2 lines below)

Go version go1.22.11 windows/amd64
Build simple, secure, scalable systems with Go

--------------------------------------------------------
| Fscan()           | Fscanln()         | Equal        |
--------------------------------------------------------
| Go                | Go                | true         |
| version           | ersion            | false   - !? |
| go1.22.11         | o1.22.11          | false   - !? |
| windows/amd64     | indows/amd64      | false   - !? |
| Build             | Build             | true         |
| simple,           | imple,            | false   - !? |
| secure,           | ecure,            | false   - !? |
| scalable          | calable           | false   - !? |
| systems           | ystems            | false   - !? |
| with              | ith               | false   - !? |
| Go                | o                 | false   - !? |
--------------------------------------------------------

   First words in the beginning of every line are equal for Fscan() and 
Fscanln()

   Fscanln() eats a first char in every 2nd, 3rd and other words in any line

 

Thanks
Ivan

-- 
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 visit 
https://groups.google.com/d/msgid/golang-nuts/b9bd47b7-3302-4563-a97b-a50c7a2a1ce6n%40googlegroups.com.

Reply via email to