Explicitly ignore errors from writes to responses
Some checks failed
/ docker (push) Failing after 15m26s
Some checks failed
/ docker (push) Failing after 15m26s
This commit is contained in:
parent
ef95a0552d
commit
4a2462e24e
30 changed files with 280 additions and 237 deletions
|
@ -2,10 +2,6 @@ package shared
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -27,7 +23,7 @@ var (
|
|||
FlagDebugPort *string = flag.String(
|
||||
"debugport",
|
||||
"127.0.0.1:3305",
|
||||
"Set the address the debug server will listen on. Format: IP:Port",
|
||||
"Set the address the debug server will listen on. Format: IP:Port (irrelevant if debug server isn't enabled)",
|
||||
)
|
||||
FlagLogFile *string = flag.String(
|
||||
"logfile",
|
||||
|
@ -36,27 +32,27 @@ var (
|
|||
)
|
||||
)
|
||||
|
||||
func flagUsage() {
|
||||
executable, err := os.Executable()
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to get own path")
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "Usage of %s:\n", executable)
|
||||
fmt.Fprintln(os.Stderr, "\t-config string")
|
||||
fmt.Fprintln(os.Stderr, "\t\tLocation of the config file (default: \"config.toml\")")
|
||||
fmt.Fprintln(os.Stderr, "\t-loglevel string")
|
||||
fmt.Fprintln(
|
||||
os.Stderr,
|
||||
"\t\tSet the logging level. Options are: Trace, Debug, Info, Warning, Error and Fatal. Case insensitive (default: \"Info\")",
|
||||
)
|
||||
fmt.Fprintln(os.Stderr, "\t-validate-config")
|
||||
fmt.Fprintln(
|
||||
os.Stderr,
|
||||
"\t\tIf set, the server will only validate the config (or write the default one) and then quit",
|
||||
)
|
||||
fmt.Fprintln(os.Stderr, "\t-jsonlogs")
|
||||
fmt.Fprintln(os.Stderr, "\t\tIf set, writes logging messages as json objects instead")
|
||||
}
|
||||
// func flagUsage() {
|
||||
// executable, err := os.Executable()
|
||||
// if err != nil {
|
||||
// log.Fatal().Err(err).Msg("Failed to get own path")
|
||||
// }
|
||||
// fmt.Fprintf(os.Stderr, "Usage of %s:\n", executable)
|
||||
// fmt.Fprintln(os.Stderr, "\t-config string")
|
||||
// fmt.Fprintln(os.Stderr, "\t\tLocation of the config file (default: \"config.toml\")")
|
||||
// fmt.Fprintln(os.Stderr, "\t-loglevel string")
|
||||
// fmt.Fprintln(
|
||||
// os.Stderr,
|
||||
// "\t\tSet the logging level. Options are: Trace, Debug, Info, Warning, Error and Fatal. Case insensitive (default: \"Info\")",
|
||||
// )
|
||||
// fmt.Fprintln(os.Stderr, "\t-validate-config")
|
||||
// fmt.Fprintln(
|
||||
// os.Stderr,
|
||||
// "\t\tIf set, the server will only validate the config (or write the default one) and then quit",
|
||||
// )
|
||||
// fmt.Fprintln(os.Stderr, "\t-jsonlogs")
|
||||
// fmt.Fprintln(os.Stderr, "\t\tIf set, writes logging messages as json objects instead")
|
||||
// }
|
||||
|
||||
// func init() {
|
||||
// flag.Usage = flagUsage
|
||||
|
|
|
@ -14,7 +14,7 @@ func TestFSWrapper_Open(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("failed to open /etc/hostname: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
data, err := os.ReadFile("/etc/hostname")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read with full path: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue