mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-19 03:21:11 +02:00
This PR only touches `Version` method, but I will expand it to other methods in the next PR. When proxying to many upstreams, errors are wrapped as responses as we can't return error and response from grpc call. Reflect-based function was introduced to filter out responses which contain errors as multierror. Reflection was used, as each response is a different Go type, and we can't write a generic function for it. osctl was updated to support having both resp & err not nil. One failed response shouldn't result in error. Re-enabled integration test for multiple targets and version consistency, need e2e validation. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
31 lines
708 B
Go
31 lines
708 B
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package helpers
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// Fatalf prints formatted message to stderr and aborts execution
|
|
func Fatalf(message string, args ...interface{}) {
|
|
if !strings.HasSuffix(message, "\n") {
|
|
message += "\n"
|
|
}
|
|
|
|
fmt.Fprintf(os.Stderr, message, args...)
|
|
os.Exit(1)
|
|
}
|
|
|
|
// Warning prints formatted message to stderr
|
|
func Warning(message string, args ...interface{}) {
|
|
if !strings.HasSuffix(message, "\n") {
|
|
message += "\n"
|
|
}
|
|
|
|
fmt.Fprintf(os.Stderr, "WARNING: "+message, args...)
|
|
}
|