Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GOLANGCI_LINT_CACHE to docker make targets #383

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

elezar
Copy link
Member

@elezar elezar commented Feb 28, 2024

Before the change:

docker run \
        --rm \
        -ti \
        -e GOCACHE=/tmp/.cache/go \
        -e GOMODCACHE=/tmp/.cache/gomod \
        -v /Users/elezar/src/container-toolkit:/work \
        -w /work \
        --user $(id -u):$(id -g) \
        ghcr.io/nvidia/k8s-test-infra:devel-go1.20.5
I have no name!@bf871339fa93:/work$ make check
golangci-lint run ./...
2024/03/15 06:48:53 failed to initialize build cache at /.cache/golangci-lint: mkdir /.cache: permission denied
make: *** [Makefile:91: golangci-lint] Error 1
I have no name!@bf871339fa93:/work$```

After the change:

➜  container-toolkit git:(fix-golangci-lint-in-shell) ✗ make .shell
docker run \
        --rm \
        -ti \
        -e GOCACHE=/tmp/.cache/go \
        -e GOMODCACHE=/tmp/.cache/gomod \
        -e GOLANGCI_LINT_CACHE=/tmp/.cache/golangci-lint \
        -v /Users/elezar/src/container-toolkit:/work \
        -w /work \
        --user $(id -u):$(id -g) \
        ghcr.io/nvidia/k8s-test-infra:devel-go1.20.5
I have no name!@b30a2c81c75a:/work$ make check
golangci-lint run ./...
I have no name!@b30a2c81c75a:/work$

@elezar elezar self-assigned this Feb 28, 2024
@elezar elezar force-pushed the fix-golangci-lint-in-shell branch from 3f843e1 to 50bbf32 Compare March 1, 2024 20:34
@@ -110,6 +110,7 @@ $(DOCKER_TARGETS): docker-%:
--rm \
-e GOCACHE=/tmp/.cache/go \
-e GOMODCACHE=/tmp/.cache/gomod \
-e GOLANGCI_LINT_CACHE=/tmp/.cache/golangci-lint \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious, are you running into any issues by running this? if so which one?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using native golangci-lint action, so I guess this is only for local devel, right? https://github.com/NVIDIA/nvidia-container-toolkit/blob/main/.github/workflows/golang.yaml#L33

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker run \
        --rm \
        -ti \
        -e GOCACHE=/tmp/.cache/go \
        -e GOMODCACHE=/tmp/.cache/gomod \
        -v /Users/elezar/src/container-toolkit:/work \
        -w /work \
        --user $(id -u):$(id -g) \
        ghcr.io/nvidia/k8s-test-infra:devel-go1.20.5
I have no name!@bf871339fa93:/work$ make check
golangci-lint run ./...
2024/03/15 06:48:53 failed to initialize build cache at /.cache/golangci-lint: mkdir /.cache: permission denied
make: *** [Makefile:91: golangci-lint] Error 1
I have no name!@bf871339fa93:/work$```

@elezar elezar merged commit 2733661 into NVIDIA:main Mar 15, 2024
8 checks passed
@elezar elezar deleted the fix-golangci-lint-in-shell branch March 15, 2024 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants