Resolving Missing Dependency Error When Building Promtail with Journal Support

I’m encountering a specific error while trying to build Promtail with Journal support using the command: go build --tags=promtail_journal_enabled ./clients/cmd/promtail. The error message I’m facing is as follows:

../../../../pkg/mod/k8s.io/client-go@v0.21.0/rest/request.go:42:2: no required module provides package k8s.io/apimachinery/pkg/util/clock; to add it:
        go get k8s.io/apimachinery/pkg/util/clock

@usman.ahmad

Thank you!

@tonyswumac any suggestions here if possible? :slight_smile:

Just tried to build it myself, seems to be working.

OS version (running from Vagrant):

[root@node0 loki]# cat /etc/*release
Fedora release 36 (Thirty Six)
NAME="Fedora Linux"
VERSION="36 (Thirty Six)"
ID=fedora
VERSION_ID=36
VERSION_CODENAME=""
PLATFORM_ID="platform:f36"
PRETTY_NAME="Fedora Linux 36 (Thirty Six)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:36"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f36/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=36
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=36
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
SUPPORT_END=2023-05-16
Fedora release 36 (Thirty Six)
Fedora release 36 (Thirty Six)

Go version:

[root@node0 loki]# go version
go version go1.19.8 linux/amd64

Install dependencies and build command:

[root@node0 loki]# yum install -y systemd-devel
Last metadata expiration check: 0:03:08 ago on Thu 16 Nov 2023 04:51:52 PM UTC.
Dependencies resolved.
========================================================================================================================
 Package                        Architecture            Version                          Repository                Size
========================================================================================================================
Installing:
 systemd-devel                  x86_64                  250.10-2.fc36                    updates                  446 k

Transaction Summary
========================================================================================================================
Install  1 Package

Total download size: 446 k
Installed size: 448 k
Downloading Packages:
systemd-devel-250.10-2.fc36.x86_64.rpm                                                  776 kB/s | 446 kB     00:00    
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   491 kB/s | 446 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                1/1 
  Installing       : systemd-devel-250.10-2.fc36.x86_64                                                             1/1 
  Running scriptlet: systemd-devel-250.10-2.fc36.x86_64                                                             1/1 
  Verifying        : systemd-devel-250.10-2.fc36.x86_64                                                             1/1 

Installed:
  systemd-devel-250.10-2.fc36.x86_64                                                                                    

Complete!
[root@node0 loki]#
[root@node0 loki]# go build --tags=promtail_journal_enabled ./clients/cmd/promtail

Result:

[root@node0 loki]# ./promtail --version
promtail, version  (branch: , revision: 258a8b31080d919278064e56a121e744973806a5)
  build user:       
  build date:       
  go version:       go1.19.8
  platform:         linux/amd64
  tags:             promtail_journal_enabled