扫描精确的字符数

The code below prints 15 because it scans at most 2 characters in the input. Is it possible to make it fail if it does not scan successfully exactly 2 characters?

package main

import (
    "errors"
    "fmt"
    "log"
)

func main() {
    var v uint8
    n, e := fmt.Sscanf("f!", "%02x", &v)
    if e != nil {
        log.Fatal(e)
    }
    if n != 1 {
        log.Fatal(errors.New("error"))
    }
    fmt.Println(v)
}

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

I think it cannot be done with fmt.Sscanf.

But what about using strconv instead?

Here is an example:

package main

import (
    "strconv"
    "fmt"
)

// parse reads a uint8 from s on exactly size digits in base 16
func parse( s string, size int ) (uint8, error) {
    if len(s) != size {
        return 0, strconv.ErrSyntax
    }
    n,err := strconv.ParseUint(s,16,8)
    return uint8(n),err
}

func main() {
    for _,x := range []string{ "ff", "f", "", "f!", "12", "00", "fff" } {
        if v,e := parse(x,2); e == nil {
            fmt.Println("ok:",v)
        } else {
            fmt.Println("ko:",e)
        }
    }   
}

In playground: https://play.golang.org/p/PRkX0Wztz7