Closed kuritka closed 8 months ago
Hi @kuritka !
We just released v6
. Can you try with that? Thanks!
Also, your golint-ci invocation is different from the one that super-linter uses. Can you try running golint-ci locally with the same command? Thanks!
Hi @ferrarimarco, I think it doesn't copy files into workspace. (I did for both v6.0.0
+ slim-v6.0.0
)
2024-01-31 18:16:34 [WARN] No files were found in the GITHUB_WORKSPACE:[/tmp/lint] to lint!
2024-01-31 18:16:39 [NOTICE] All files and directories linted successfully
SUPER_LINTER_VERSION=slim-v6.0.0
lint:
@echo -e "\n$(YELLOW)Running the linters$(NC)"
docker pull ghcr.io/super-linter/super-linter:$(SUPER_LINTER_VERSION)
docker run \
-e ACTIONS_RUNNER_DEBUG=false \
-e DEFAULT_BRANCH=main \
-e LOG_LEVEL=NOTICE\
-e RUN_LOCAL=true \
-e VALIDATE_ALL_CODEBASE=false \
-e VALIDATE_GO=true \
-v $(PWD):/tmp/lint \
ghcr.io/super-linter/super-linter:$(SUPER_LINTER_VERSION)
Here is what I'm running locally:
❯ golangci-lint --version
golangci-lint has version v1.51.2 built from (unknown, mod sum: "h1:yIcsT1X9ZYHdSpeWXRT1ORC/FPGSqDHbHsu9uk4FK7M=") on (unknown)
# ./.golangci.yml is copied from super-linter
golangci-lint run --fast -c ./.golangci.yml
What is your current working directory (the value of PWD
)?
sorry, I can't expose internal information
/Users/<user>/GolandProjects/github.com/<owner>/<test_project>
I hardcoded path instead of PWD
but see same result:
2024-01-31 18:33:28 [WARN] No files were found in the GITHUB_WORKSPACE:[/tmp/lint] to lint!
2024-01-31 18:33:34 [NOTICE] All files and directories linted successfully
Are you running this on an ARM-based Mac by any chance? I'm not sure how compatible that would be because we don't publish an arm64 image. Anyway, it looks like the mounted directory is either empty, or it doesn't contain any .go
files.
I think the command you're running might not be mounting what you expect. To check this, I would try opening a shell in the super-linter
container by adding the --entrypoint /bin/bash
option to the docker run
command, and then checking if the content of /tmp/lint
is what you expect. It should match with /Users/<user>/GolandProjects/github.com/<owner>/<test_project>
.
Also, there something interesting in the log you posted:
2024-01-31 16:05:27 [DEBUG] File:[/tmp/lint/internal/controller/aws.go], File_type:[go], Base_file:[aws.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/controller/aws.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/controller/controller.go], File_type:[go], Base_file:[controller.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/controller/controller.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/entities.go], File_type:[go], Base_file:[entities.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/entities.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/acounts.go], File_type:[go], Base_file:[acounts.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/acounts.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/aws.go], File_type:[go], Base_file:[aws.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/aws.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/check.go], File_type:[go], Base_file:[check.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/check.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/nacl.go], File_type:[go], Base_file:[nacl.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/nacl.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/parser/policy.go], File_type:[go], Base_file:[policy.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/parser/policy.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/parser/regex.go], File_type:[go], Base_file:[regex.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/parser/regex.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/parser/tags.go], File_type:[go], Base_file:[tags.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/parser/tags.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/roles.go], File_type:[go], Base_file:[roles.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/roles.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/route53.go], File_type:[go], Base_file:[route53.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/route53.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/users.go], File_type:[go], Base_file:[users.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/users.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/validator-dns.go], File_type:[go], Base_file:[validator-dns.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/validator-dns.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/validator-iam.go], File_type:[go], Base_file:[validator-iam.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/validator-iam.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/validator-identity.go], File_type:[go], Base_file:[validator-identity.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/validator-identity.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/validator-networking.go], File_type:[go], Base_file:[validator-networking.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/validator-networking.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/validator-unknown.go], File_type:[go], Base_file:[validator-unknown.go]
2024-01-31 16:05:28 [WARN] File:{/tmp/lint/internal/model/maws/validator-unknown.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:28 [DEBUG] File:[/tmp/lint/internal/model/maws/vpc.go], File_type:[go], Base_file:[vpc.go]
2024-01-31 16:05:29 [WARN] File:{/tmp/lint/internal/model/maws/vpc.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:29 [DEBUG] File:[/tmp/lint/internal/model/provider.go], File_type:[go], Base_file:[provider.go]
2024-01-31 16:05:29 [WARN] File:{/tmp/lint/internal/model/provider.go} existed in commit data, but not found on file system, skipping...
2024-01-31 16:05:29 [DEBUG] File:[/tmp/lint/main.go], File_type:[go], Base_file:[main.go]
That check is here:
Could it be that those files are not accessible somehow?
those are files I deleted to keep the binary to a minimum and provide an example.
I'm pretty sure, that the problem is that to lint GO, I have to have the downloaded files including all GO dependencies. That's why it is necessary to call go mod tidy
before calling golangci-lint
within container.
Hi @kuritka ! I was able to reproduce the issue with the example you provided. I added it as a (failing, for now) test case. That's the first step into finding a solution :)
By the way, running go mod tidy
will also generate a go.mod
file, or add any missing modules to the go.mod
file. That would require modifying the source code, and it's something that super-linter currently tries to avoid.
If you're trying to lint a Go module (i.e. you have a go.mod
file), you should set VALIDATE_GO=false
, and set VALIDATE_GO_MODULES=true
(the default for all VALIDATE_XXXX
is true
).
Can you try that?
Is there an existing issue for this?
Current Behavior
I am not able to get the validations for GO to work, although golangci-lint runs locally without problems.
for
main.go
I'm running local super-linter:This constantly generates a very strange error, which varies in the package
I tried to run it on different architectures. The name of the package is often changed, probably depending on how the linter takes it. My go.mod has GO version v1.21.
I'm not able to identify where the bug came from, but I find it strange that the
golangci-lint run
always ran without problems locally and as a GitHub action.Expected Behavior
linter pass, or help identify issue
Super-Linter version
Relevant log output
Steps To Reproduce
Anything else?
No response