Allow explicit returns of built-in status codes.

This commit is contained in:
Nigel Tao committed 2017-10-06 17:34:58 +11:00
1 parent 2e883fcc23
commit 010c4db54f
7 files changed
+43 -12

No files matched your search

+13
View File
@@ -97,6 +97,12 @@ var builtInStatuses = [...]string{
"suspension limited write",
}
var builtInStatusSuffixes = map[string]string{
// TODO: fill in the rest of the built in statuses.
"short read": "SUSPENSION_SHORT_READ",
"short write": "SUSPENSION_SHORT_WRITE",
}
func init() {
// The +1 is for the error bit (the sign bit).
if statusCodeNamespaceShift+base38.MaxBits+1 != 32 {
@@ -107,6 +113,13 @@ func init() {
}
}
func trimQuotes(s string) string {
if len(s) >= 2 && s[0] == '"' && s[len(s)-1] == '"' {
return s[1 : len(s)-1]
}
return s
}
type replacementPolicy bool
const (