isHex reports whether s is non-empty lowercase hex, the shape of a git abbreviated commit hash.
(s string)
| 144 | // isHex reports whether s is non-empty lowercase hex, the shape of a git |
| 145 | // abbreviated commit hash. |
| 146 | func isHex(s string) bool { |
| 147 | if s == "" { |
| 148 | return false |
| 149 | } |
| 150 | for _, r := range s { |
| 151 | if (r < '0' || r > '9') && (r < 'a' || r > 'f') { |
| 152 | return false |
| 153 | } |
| 154 | } |
| 155 | return true |
| 156 | } |
| 157 | |
| 158 | // maybeSelfUpdate runs the pre-launch auto-update. No-op for local builds, |
| 159 | // an already-current hash, an unsupported platform (see update.assetName), |