Skip to content
This repository was archived by the owner on Aug 17, 2020. It is now read-only.

Conversation

@tonyredondo
Copy link
Contributor

This PR adds an additional fallback when the source root can't be detected (to improve the detection of a valid source root). This fallback is based on the path of the go.mod file, using the current folder as the starting point and going up from parent to parent folder.

According https://blog.golang.org/using-go-modules the go.mod file should be at the root of the project (in case the project is using go modules).

With this PR the source root detector has the following priorities:

  1. SCOPE_SOURCE_ROOT environment variable.
  2. CI environment variables.
  3. .git folder root path
  4. go.mod path
  5. /

Note: Each value is tested using os.Stat to validate the directory existence, in case the value is set but the directory doesn't exist, then the value is invalid and the next fallback is called.

@tonyredondo tonyredondo self-assigned this Mar 14, 2020
@tonyredondo tonyredondo force-pushed the forbid-empty-sourceroot branch from d6d3937 to 3a675da Compare March 16, 2020 17:10
@tonyredondo tonyredondo force-pushed the forbid-empty-sourceroot branch from 3a675da to bcae91a Compare March 17, 2020 13:56
@tonyredondo tonyredondo merged commit a539917 into master Mar 17, 2020
@tonyredondo tonyredondo deleted the forbid-empty-sourceroot branch March 17, 2020 15:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants