<p dir="auto">It was okay in previous Go versions.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="package main

import &quot;fmt&quot;

func main() {
    var c rune
    n, e := fmt.Sscanf(&quot;\n&quot;, &quot;%c&quot;, &amp;c)
    fmt.Println(n, e)
    // Go 1.5: 0 unexpected newline
    // Go 1.2, 1.3, 1.4: 1 &lt;nil&gt;
}"><pre class="notranslate"><code class="notranslate">package main

import "fmt"

func main() {
    var c rune
    n, e := fmt.Sscanf("\n", "%c", &amp;c)
    fmt.Println(n, e)
    // Go 1.5: 0 unexpected newline
    // Go 1.2, 1.3, 1.4: 1 &lt;nil&gt;
}
</code></pre></div>
<h3 dir="auto">What version of Go are you using (go version)?</h3>
<p dir="auto">I found this when upgrading from Go 1.3.3 to Go 1.5</p>
<h3 dir="auto">What operating system and processor architecture are you using?</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="GOARCH=&quot;amd64&quot;
GOOS=&quot;linux&quot;"><pre class="notranslate"><code class="notranslate">GOARCH="amd64"
GOOS="linux"
</code></pre></div>
<h3 dir="auto">What did you do?</h3>
<p dir="auto">$ cat scango.go</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="package main

import &quot;fmt&quot;

func main() {
    var x int

    n, err := fmt.Sscanf(&quot;A&quot;, &quot;%c&quot;, &amp;x)
    println(&quot;n=&quot;, n, &quot;x=&quot;, x, &quot;err=&quot;, err)

    n, err = fmt.Sscanf(&quot; A&quot;, &quot;%c&quot;, &amp;x)
    println(&quot;n=&quot;, n, &quot;x=&quot;, x, &quot;err=&quot;, err)

    n, err = fmt.Sscanf(&quot; &quot;, &quot;%c&quot;, &amp;x)
    println(&quot;n=&quot;, n, &quot;x=&quot;, x, &quot;err=&quot;, err)
}"><pre class="notranslate"><code class="notranslate">package main

import "fmt"

func main() {
    var x int

    n, err := fmt.Sscanf("A", "%c", &amp;x)
    println("n=", n, "x=", x, "err=", err)

    n, err = fmt.Sscanf(" A", "%c", &amp;x)
    println("n=", n, "x=", x, "err=", err)

    n, err = fmt.Sscanf(" ", "%c", &amp;x)
    println("n=", n, "x=", x, "err=", err)
}
</code></pre></div>
<h3 dir="auto">What did you expect to see?</h3>
<p dir="auto">I expected what Go 1.3.3 did:  it always gets the first character in the scanned string, either "A" or " ":<br>
$ go run scango.go<br>
n= 1 x= 65 err= (0x0,0x0)<br>
n= 1 x= 32 err= (0x0,0x0)<br>
n= 1 x= 32 err= (0x0,0x0)</p>
<p dir="auto">That's also what my C compiler does<br>
/* gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04) */<br>
$ cat scanc.c</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#include &lt;stdio.h&gt;

main() {
  char x[33];
  int n = sscanf(&quot;A&quot;, &quot;%c&quot;, x);
  printf(&quot;n=%d &lt;%d&gt;\n&quot;, n, *x);
  n = sscanf(&quot; A&quot;, &quot;%c&quot;, x);
  printf(&quot;n=%d &lt;%d&gt;\n&quot;, n, *x);
  n = sscanf(&quot; &quot;, &quot;%c&quot;, x);
  printf(&quot;n=%d &lt;%d&gt;\n&quot;, n, *x);
}"><pre class="notranslate"><code class="notranslate">#include &lt;stdio.h&gt;

main() {
  char x[33];
  int n = sscanf("A", "%c", x);
  printf("n=%d &lt;%d&gt;\n", n, *x);
  n = sscanf(" A", "%c", x);
  printf("n=%d &lt;%d&gt;\n", n, *x);
  n = sscanf(" ", "%c", x);
  printf("n=%d &lt;%d&gt;\n", n, *x);
}
</code></pre></div>
<p dir="auto">$ gcc scanc.c<br>
$ ./a.out<br>
n=1 &lt;65&gt;<br>
n=1 &lt;32&gt;<br>
n=1 &lt;32&gt;</p>
<h3 dir="auto">What did you see instead?</h3>
<p dir="auto">Under Go 1.5, it skips the blank, and advances to the "A" (in the second clause) or EOF (in the third clause):<br>
$ go run scango.go<br>
n= 1 x= 65 err= (0x0,0x0)<br>
n= 1 x= 65 err= (0x0,0x0)<br>
n= 0 x= 65 err= (0x7f555757b028,0xc82000a1d0)</p>