diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-06-13 13:36:20 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-06-14 15:28:45 +0200 |
commit | 1b62e4543845907ffba61086a79883751abca819 (patch) | |
tree | 72059e447976aa1fcc7935193cf405c174e34d82 | |
parent | 9fac1b335f681400a029e9d8014f45fa5634ec40 (diff) | |
download | podman-1b62e4543845907ffba61086a79883751abca819.tar.gz podman-1b62e4543845907ffba61086a79883751abca819.tar.bz2 podman-1b62e4543845907ffba61086a79883751abca819.zip |
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>
-rwxr-xr-x | hack/golangci-lint.sh | 5 | ||||
-rw-r--r-- | libpod/container_log_linux.go | 7 | ||||
-rw-r--r-- | libpod/events/journal_linux.go | 3 |
3 files changed, 7 insertions, 8 deletions
diff --git a/hack/golangci-lint.sh b/hack/golangci-lint.sh index 8b80bd9c9..2eaf206d7 100755 --- a/hack/golangci-lint.sh +++ b/hack/golangci-lint.sh @@ -4,10 +4,9 @@ set -e declare -A BUILD_TAGS -# TODO: add systemd tag BUILD_TAGS[default]="apparmor,seccomp,selinux,linter" -BUILD_TAGS[abi]="${BUILD_TAGS[default]},!remoteclient" -BUILD_TAGS[tunnel]="${BUILD_TAGS[default]},remote,remoteclient" +BUILD_TAGS[abi]="${BUILD_TAGS[default]},systemd" +BUILD_TAGS[tunnel]="${BUILD_TAGS[default]},remote" declare -A SKIP_DIRS SKIP_DIRS[abi]="pkg/machine/e2e" diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go index deb726526..7f90332c7 100644 --- a/libpod/container_log_linux.go +++ b/libpod/container_log_linux.go @@ -292,11 +292,12 @@ func formatterPrefix(entry *sdjournal.JournalEntry) (string, error) { if !ok { return "", errors.Errorf("no PRIORITY field present in journal entry") } - if priority == journaldLogOut { + switch priority { + case journaldLogOut: output += "stdout " - } else if priority == journaldLogErr { + case journaldLogErr: output += "stderr " - } else { + default: return "", errors.Errorf("unexpected PRIORITY field in journal entry") } diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go index 866042a4c..4db87c14d 100644 --- a/libpod/events/journal_linux.go +++ b/libpod/events/journal_linux.go @@ -64,7 +64,7 @@ func (e EventJournalD) Write(ee Event) error { case Volume: 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 @@ -167,7 +167,6 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error { } } return nil - } func newEventFromJournalEntry(entry *sdjournal.JournalEntry) (*Event, error) { //nolint |