-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.go
50 lines (40 loc) · 913 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package dpkg
import (
"fmt"
"os"
)
var Debug = false
func DebugPrintf(fmtStr string, args ...interface{}) {
if Debug {
fmt.Fprintf(os.Stderr, fmtStr, args...)
}
}
func DebugPrintln(args ...interface{}) {
if Debug {
fmt.Fprintln(os.Stderr, args...)
}
}
var Strict = true
const ScanBufferSize = 512 * 1024
const ReleaseFileName = "Release"
type NotFoundError struct {
resource string
}
func (e NotFoundError) Error() string { return "Not Found resource of " + e.resource }
type FormatError struct {
t string
raw string
chain error
}
func (e FormatError) Error() string {
if e.chain != nil {
ef, ok := e.chain.(FormatError)
if ok {
return fmt.Sprintf("Parsing %q to %q failed at %q", e.raw, e.t+"."+ef.t, ef.raw)
} else {
return fmt.Sprintf("Parsing %q to %q failed: %q", e.raw, e.t, e.chain)
}
} else {
return fmt.Sprintf("Parsing %q to %q failed.", e.raw, e.t)
}
}