Skip to content

Commit

Permalink
rename lint to po-lint
Browse files Browse the repository at this point in the history
As discussed in #2938
the binary name `lint` is too generic if used outside of the docker
image. So it's been renamed to `po-lint`.
  • Loading branch information
elisiano committed Jan 17, 2020
1 parent a382ba5 commit 6449c04
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,5 +1,5 @@
/operator
/lint
/po-lint
/prometheus-config-reloader
.build/
*~
Expand Down
10 changes: 5 additions & 5 deletions Documentation/user-guides/linting.md
Expand Up @@ -4,15 +4,15 @@ This document describes how to use the standalone linting tool to validate your

## Getting linter

To use the linter either get it with `go get -u github.com/coreos/prometheus-operator/cmd/lint` and executable is `$GOPATH/bin/lint`, or use the container image from `quay.io/coreos/prometheus-operator-lint` and executable is `/bin/lint`.
To use the linter either get it with `go get -u github.com/coreos/prometheus-operator/cmd/po-lint` and executable is `$GOPATH/bin/po-lint`, or use the container image from `quay.io/coreos/prometheus-operator-lint` and executable is `/bin/po-lint`.

## Using linter

The `lint` executable takes a list of yaml files to check as command arguments. It will output any errors to stderr and returns with exit code `1` on errors, `0` otherwise.
The `po-lint` executable takes a list of yaml files to check as command arguments. It will output any errors to stderr and returns with exit code `1` on errors, `0` otherwise.

## Example

Here is an example script to lint a `src` sub-directory full of Prometheus Operator CRD files with ether local `lint` or Dockerized version:
Here is an example script to lint a `src` sub-directory full of Prometheus Operator CRD files with ether local `po-lint` or Dockerized version:

```sh
#!/bin/sh
Expand All @@ -21,12 +21,12 @@ LINTER="quay.io/coreos/prometheus-operator-lint"
SCRIPT=$(basename "$0")

lint_files() {
if [ -x "$(command -v lint)" ]; then
if [ -x "$(command -v po-lint)" ]; then
echo "Linting '${2}' files in directory '${1}'..."
had_errors=0
for file in $(find "${1}" -name "${2}"); do
echo "${file}"
lint "${file}"
po-lint "${file}"
retval=$?
if [ $retval -ne 0 ]; then
had_errors=1
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Expand Up @@ -62,7 +62,7 @@ clean:
############

.PHONY: build
build: $(BINDATA_TARGET) operator prometheus-config-reloader k8s-gen lint
build: $(BINDATA_TARGET) operator prometheus-config-reloader k8s-gen po-lint

.PHONY: operator
operator:
Expand All @@ -72,9 +72,9 @@ operator:
prometheus-config-reloader:
$(GO_BUILD_RECIPE) -o $@ cmd/$@/main.go

.PHONY: lint
lint:
$(GO_BUILD_RECIPE) -o lint cmd/lint/main.go
.PHONY: po-lint
po-lint:
$(GO_BUILD_RECIPE) -o po-lint cmd/po-lint/main.go

DEEPCOPY_TARGET := pkg/apis/monitoring/v1/zz_generated.deepcopy.go
$(DEEPCOPY_TARGET): $(CONTROLLER_GEN_BINARY)
Expand Down Expand Up @@ -138,11 +138,11 @@ image: .hack-operator-image .hack-prometheus-config-reloader-image .hack-lint-im
docker build -t $(REPO_PROMETHEUS_CONFIG_RELOADER):$(TAG) -f cmd/prometheus-config-reloader/Dockerfile .
touch $@

.hack-lint-image: cmd/lint/Dockerfile lint
.hack-lint-image: cmd/po-lint/Dockerfile po-lint
# Create empty target file, for the sole purpose of recording when this target
# was last executed via the last-modification timestamp on the file. See
# https://www.gnu.org/software/make/manual/make.html#Empty-Targets
docker build -t $(REPO_PROMETHEUS_OPERATOR_LINT):$(TAG) -f cmd/lint/Dockerfile .
docker build -t $(REPO_PROMETHEUS_OPERATOR_LINT):$(TAG) -f cmd/po-lint/Dockerfile .
touch $@

##############
Expand Down
4 changes: 2 additions & 2 deletions cmd/lint/Dockerfile → cmd/po-lint/Dockerfile
@@ -1,7 +1,7 @@
FROM quay.io/prometheus/busybox:latest

ADD lint /bin/lint
ADD po-lint /bin/po-lint

USER nobody

ENTRYPOINT ["/bin/lint"]
ENTRYPOINT ["/bin/po-lint"]
File renamed without changes.

0 comments on commit 6449c04

Please sign in to comment.