在Python中相当于decode('hex')

I'm working on converting an existing Python library to Go and am getting hung up on a piece.

Is there a go equivalent to the following Python code?

test = "ec033aa702"
test.decode('hex')

I've been doing some reading but can't seem to find what I'm looking for.

Does this work for you?

package main

import (
  "encoding/hex"
  "fmt"
  "log"
)

func main() {
  const s = "ec033aa702"
  decoded, err := hex.DecodeString(s)
  if err != nil {
    log.Fatal(err)
  }

  fmt.Printf("%s
", decoded)
}

DecodeString

Try it online!