correcting some behaviors for $DOCKER_HOST, now uses container's private IP instead of localhost

This commit is contained in:
yusing
2024-10-11 09:13:38 +08:00
parent d91b66ae87
commit 7184c9cfe9
68 changed files with 925 additions and 570 deletions

View File

@@ -21,7 +21,7 @@ func NewBuilder(format string, args ...any) Builder {
}
// adding nil / nil is no-op,
// you may safely pass expressions returning error to it
// you may safely pass expressions returning error to it.
func (b Builder) Add(err NestedError) Builder {
if err != nil {
b.Lock()
@@ -39,6 +39,13 @@ func (b Builder) Addf(format string, args ...any) Builder {
return b.Add(errorf(format, args...))
}
func (b Builder) AddRangeE(errs ...error) Builder {
for _, err := range errs {
b.AddE(err)
}
return b
}
// Build builds a NestedError based on the errors collected in the Builder.
//
// If there are no errors in the Builder, it returns a Nil() NestedError.
@@ -56,12 +63,13 @@ func (b Builder) Build() NestedError {
}
func (b Builder) To(ptr *NestedError) {
if ptr == nil {
switch {
case ptr == nil:
return
} else if *ptr == nil {
case *ptr == nil:
*ptr = b.Build()
} else {
(*ptr).With(b.Build())
default:
(*ptr).extras = append((*ptr).extras, *b.Build())
}
}