Fix Golangci-lint configuration

This commit is contained in:
Maximilian Paß
2024-05-07 12:11:25 +02:00
parent 8c5e0e11f7
commit ec3b2a93db
6 changed files with 42 additions and 33 deletions

View File

@ -20,12 +20,18 @@ import (
"strings"
)
const (
defaultPoseidonPort = 7200
defaultNomadPort = 4646
defaultMemoryUsageAlertThreshold = 1_000
)
// Config contains the default configuration of Poseidon.
var (
Config = &configuration{
Server: server{
Address: "127.0.0.1",
Port: 7200,
Port: defaultPoseidonPort,
SystemdSocketActivation: false,
Token: "",
TLS: TLS{
@ -45,7 +51,7 @@ var (
Nomad: Nomad{
Enabled: true,
Address: "127.0.0.1",
Port: 4646,
Port: defaultNomadPort,
Token: "",
TLS: TLS{
Active: false,
@ -70,7 +76,7 @@ var (
Formatter: dto.FormatterText,
},
Profiling: Profiling{
MemoryThreshold: 1_000,
MemoryThreshold: defaultMemoryUsageAlertThreshold,
},
Sentry: sentry.ClientOptions{
AttachStacktrace: true,

View File

@ -435,17 +435,21 @@ func fileDeletionCommand(pathsToDelete []dto.FilePath) string {
}
func tarHeader(file dto.File) *tar.Header {
// See #236. Sticky bit is to allow creating files next to write-protected files.
const directoryPermission int64 = 0o1777
const filePermission int64 = 0o744
if file.IsDirectory() {
return &tar.Header{
Typeflag: tar.TypeDir,
Name: file.CleanedPath(),
Mode: 0o1777, // See #236. Sticky bit is to allow creating files next to write-protected files.
Mode: directoryPermission,
}
} else {
return &tar.Header{
Typeflag: tar.TypeReg,
Name: file.CleanedPath(),
Mode: 0o744,
Mode: filePermission,
Size: int64(len(file.Content)),
}
}