golangci-lint: add systemd build tag

Lint the systemd code and fix the reported problems.
The remoteclient tag is no longer used so I just removed it.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2022-06-13 13:36:20 +02:00
parent 9fac1b335f
commit 1b62e45438
3 changed files with 7 additions and 8 deletions

View File

@ -4,10 +4,9 @@
set -e set -e
declare -A BUILD_TAGS declare -A BUILD_TAGS
# TODO: add systemd tag
BUILD_TAGS[default]="apparmor,seccomp,selinux,linter" BUILD_TAGS[default]="apparmor,seccomp,selinux,linter"
BUILD_TAGS[abi]="${BUILD_TAGS[default]},!remoteclient" BUILD_TAGS[abi]="${BUILD_TAGS[default]},systemd"
BUILD_TAGS[tunnel]="${BUILD_TAGS[default]},remote,remoteclient" BUILD_TAGS[tunnel]="${BUILD_TAGS[default]},remote"
declare -A SKIP_DIRS declare -A SKIP_DIRS
SKIP_DIRS[abi]="pkg/machine/e2e" SKIP_DIRS[abi]="pkg/machine/e2e"

View File

@ -292,11 +292,12 @@ func formatterPrefix(entry *sdjournal.JournalEntry) (string, error) {
if !ok { if !ok {
return "", errors.Errorf("no PRIORITY field present in journal entry") return "", errors.Errorf("no PRIORITY field present in journal entry")
} }
if priority == journaldLogOut { switch priority {
case journaldLogOut:
output += "stdout " output += "stdout "
} else if priority == journaldLogErr { case journaldLogErr:
output += "stderr " output += "stderr "
} else { default:
return "", errors.Errorf("unexpected PRIORITY field in journal entry") return "", errors.Errorf("unexpected PRIORITY field in journal entry")
} }

View File

@ -64,7 +64,7 @@ func (e EventJournalD) Write(ee Event) error {
case Volume: case Volume:
m["PODMAN_NAME"] = ee.Name m["PODMAN_NAME"] = ee.Name
} }
return journal.Send(string(ee.ToHumanReadable(false)), journal.PriInfo, m) return journal.Send(ee.ToHumanReadable(false), journal.PriInfo, m)
} }
// Read reads events from the journal and sends qualified events to the event channel // Read reads events from the journal and sends qualified events to the event channel
@ -167,7 +167,6 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error {
} }
} }
return nil return nil
} }
func newEventFromJournalEntry(entry *sdjournal.JournalEntry) (*Event, error) { //nolint func newEventFromJournalEntry(entry *sdjournal.JournalEntry) (*Event, error) { //nolint