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

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

Open
freeformz opened this issue Nov 1, 2024 · 1 comment
Open

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

freeformz opened this issue Nov 1, 2024 · 1 comment
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?

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