Q:

How to validate an etherum address (go)?

I'm looping through various addresses and I need to know which ones are BTC addresses and which are ETH addresses. So far I just check if the address is hex encoded. Is this function safe to use? 
package main

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

func main() {
    key := "1DfjCuWDKRWpv1vGP9UNsb4ooArWnXfqnr"
    fmt.Println(isEther(key)) 
}

func isEther(s string) bool {
    s = strings.TrimPrefix(s, "0x")
    _, err := hex.DecodeString(s)
    if err == nil {
        return true
    }
    return false
}

A:

From types.go:
// IsHexAddress verifies whether a string can represent a valid hex-encoded
// Ethereum address or not.
func IsHexAddress(s string) bool {
    if hasHexPrefix(s) {
        s = s[2:]
    }
    return len(s) == 2*AddressLength && isHex(s)
}

You'll need to pull in the other called functions and variables, or redefine them in your own file.
There are other address-related utility functions in that file that might also be of use.

