quay / clair

Vulnerability Static Analysis for Containers

Home Page:https://quay.github.io/clair/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Local installation of clairctl fails with "go get" as well as "go install"

nichoio opened this issue · comments

Description of Problem / Feature Request

I'm trying to install clairctl on my local machine (go1.19.2 linux/amd64).
I have tried doing so following the docs:

The command will be in the Clair container, but can also be installed locally by running the following command:
GO111MODULE=on go get github.com/quay/clair/v4/cmd/clairctl@latest

Expected Outcome

I would expect a successful installation of clairctl.

Actual Outcome

When executing GO111MODULE=on go get github.com/quay/clair/v4/cmd/clairctl@latest, I get the following:

go: go.mod file not found in current directory or any parent directory.
	'go get' is no longer supported outside a module.
	To build and install a command, use 'go install' with a version,
	like 'go install example.com/cmd@latest'

However, docs state

Ensure you run the above command outside of any Go directory with a go.mod file.

When executing GO111MODULE=on go install github.com/quay/clair/v4/cmd/clairctl@latest, I get the following:

go: github.com/quay/clair/v4/cmd/clairctl@latest (in github.com/quay/clair/v4@v4.4.4):
	The go.mod file for the module providing named packages contains one or
	more replace directives. It must not contain directives that would cause
	it to be interpreted differently than if it were the main module.

I am not a Go developer but I assume this to be related to this Golang issue.
I don't know how to proceed from here to install clairctl successfully.

On a side note, I'd be fine with using clairctl shipped with an image. However, when spinning up the Docker Compose setup, I'm not sure on which of those containers clairctl can be found as it doesn't seem to be in the PATH of any of those containers.

Environment

  • Clair version/image: v4.4.4
  • Clair client name/version: v4.4.4
  • Host OS: Ubuntu 22.04
  • Kernel (e.g. uname -a): 5.15.0-50-generic
  • Kubernetes version (use kubectl version): not applicable
  • Network/Firewall setup: not applicable

Currently one needs to use the main or v4.5.0-rc.0 version specifiers.

The release container has clairctl on PATH; the development setup that docker-compose sets up has the source mounted at /src/cmd/clairctl.