Skip to content

Autobuild Go detects go.work files in vendored directories #17893

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

Closed
freeformz opened this issue Nov 1, 2024 · 3 comments
Closed

Autobuild Go detects go.work files in vendored directories #17893

freeformz opened this issue Nov 1, 2024 · 3 comments
Assignees
Labels
Go question Further information is requested

Comments

@freeformz
Copy link

freeformz commented Nov 1, 2024

Description of the issue

For some reason autobuild-go is picking up go.work files in vendored directories....

 [2024-11-01 19:11:45] [build-stderr] 2024/11/01 19:11:45 Found go.work file(s) in: xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/go.work.
  [2024-11-01 19:11:45] [build-stderr] 2024/11/01 19:11:45 Loading xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/go.work...
  [2024-11-01 19:11:45] [build-stderr] 2024/11/01 19:11:45 xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/go.work uses the following Go modules:
  [2024-11-01 19:11:45] [build-stderr] xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/go.mod
  [2024-11-01 19:11:45] [build-stderr] xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/cmd/jv/go.mod
  [2024-11-01 19:11:45] [build-stderr] 2024/11/01 19:11:45 Unable to read xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/go.mod: open xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/go.mod: no such file or directory.
  [2024-11-01 19:11:45] [build-stderr] 2024/11/01 19:11:45 Unable to read xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/cmd/jv/go.mod: open xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/cmd/jv/go.mod: no such file or directory.
...
  [2024-11-01 19:14:21] [build-stderr] 2024/11/01 19:14:21 Failed to stat xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/go.sum after running `go mod tidy -e`: stat xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/go.sum: no such file or directory
  [2024-11-01 19:14:21] [build-stderr] 2024/11/01 19:14:21 Failed to stat xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/cmd/jv/go.mod before running `go mod tidy -e`
  [2024-11-01 19:14:21] [build-stderr] 2024/11/01 19:14:21 Running /home/runner/work/_temp/codeql-action-go-tracing/bin/go [go mod tidy -e] failed, continuing anyway: chdir xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/cmd/jv: no such file or directory
  [2024-11-01 19:14:21] [build-stderr] 2024/11/01 19:14:21 Failed to run `go mod tidy -e` in xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6/cmd/jv
  ...
   [2024-11-01 19:19:56] [build-stderr] 2024/11/01 19:19:56 Running extractor command '/opt/hostedtoolcache/CodeQL/2.19.2/x64/codeql/go/tools/linux64/go-extractor [-mod=readonly ./... ./cmd/jv/...]' from directory 'xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6'.
  [2024-11-01 19:19:56] [build-stderr] 2024/11/01 19:19:56 Build flags: '-mod=readonly'; patterns: './... ./cmd/jv/...'
  [2024-11-01 19:19:56] [build-stderr] 2024/11/01 19:19:56 Running packages.Load.
  [2024-11-01 19:19:56] [build-stderr] 2024/11/01 19:19:56 Error running go tooling: err: exit status 1: stderr: go: cannot load module . listed in go.work file: open go.mod: no such file or directory
  [2024-11-01 19:19:56] [build-stderr] go: cannot load module cmd/jv listed in go.work file: open cmd/jv/go.mod: no such file or directory
  [2024-11-01 19:19:56] [build-stderr] 2024/11/01 19:19:56 Extraction failed for xyz/vendor/github.com/santhosh-tekuri/jsonschema/v6: exit status 1

``

This then causes (at least IMO) extra, un-needed evaluations.
@freeformz freeformz added the question Further information is requested label Nov 1, 2024
@mbg
Copy link
Member

mbg commented Nov 4, 2024

Hi @freeformz 👋🏻

Thanks for reporting this. The autobuilder should be excluding go.work files from vendor directories, so this does look like a bug. We will look at getting this fixed for an upcoming release.

Other than resulting in unnecessary work being done, does this cause you any other issues?

@mbg
Copy link
Member

mbg commented Feb 24, 2025

Hi again @freeformz and apologies for the delay. We have now merged a fix for this, and would expect this to land in the next release. I will close this issue now, but feel free to re-open / open a new one if the issue isn't resolved once the next release is out.

@mbg mbg closed this as completed Feb 24, 2025
@freeformz
Copy link
Author

TY!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Go question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants