- `project.go`
- Rename method {checkCfgFilenames => checkGopkgFilenames}
- Improve funciton comment as suggested by @sdboyer
- Fix ambigious comment explaining rationale behind early return.
- Add comment explaining why we do not use `fs.IsCaseSensitiveFilesystem` for
skipping following tests:
- context_test.go#TestLoadProjectGopkgFilenames
- project_test.go#TestCheckGopkgFilenames
- fs_test.go#TestReadActualFilenames
- `project`
- `checkCfgFilenames`
- Improve function and code comments
- Use boolean value indicating whether value was found in actual filenames.
If manifest file was not found, return `errProjectNotFound`. Use boolean
to determine if lock file was not found instead of length check.
- `TestCheckCfgFilenames` - Add code comments for test cases explaining the
expected behavior
- `fs`
- `ReadActualFilenames`
- Use cleaner check(`<=` ➡ `==`) to see if `names` parameter for
`ReadActualFilenames` actually has any values.
- Use `Readdirnames` instead of `Readdir`. This is expected to perform
better in most cases.
- `TestReadActualFilenames` - Add code comments for test cases explaining the
expected behavior
- general
- Make line length for code comments consistent(90), add periods where
appropriate.
- String formatting, use %q instead of '%s'
- `fs`
- Export `IsCaseSensitiveFilesystem`. Add and run test on windows, linux and
macOS.
- Add function `ReadActualFilenames` to read actual file names of given
string slice. Add tests to be run on windows and macOS.
- `project`
- Add function `checkCfgFilenames` to check the filenames for manifest
and lock have the expected case. Use `fs#IsCaseSensitiveFilesystem`
for an early return as the check is costly. Add test to be run on windows
and macOS.
- `context`
- Call `project.go#checkCfgFilenames` after resolving project root. Add test
for invalid manifest file name to be run on windows and macOS.
* internal/fs: add EquivalentPaths
* internal/fs: fix isCaseSensitiveFilesystem bug
isCaseSensitiveFilesystem returns true when os.Stat fails on the dir
passed. This caused HasFilepathPrefix to always treat *nix systems as
case-sensitive, since it passed a relative path (missing the root) to
isCaseSensitiveFilesystem.
This commit updates isCaseSensitiveFilesystem to return an error in
addtion to the boolean check. Also, HasFilepathPrefix now passes absolute
paths to isCaseSensitiveFilesystem.
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
*Ctx.SetPaths() takes the working directory and any number of strings
representing GOPATHs. If no GOPATHs are passed, it will read the
environment variables to detect the GOPATH. Otherwise, it will fallback
to defaultGOPATH().
*Ctx.DetectProjectGOPATH() take a *dep.Project and attempts to detect
the containing GOPATH for the project from Ctx.GOPATHs.
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
dep.NewProject() will check if the passed root is a symlink and set
ResolveAbsRoot to the resolved path. Otherwise, ResolvedAbsRoot will
have the same value as AbsRoot.
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
Edit letter case of:
* detectGoPath() to detectGOPATH()
* ResolveProjectRootAndGoPath() to ResolveProjectRootAndGOPATH()
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>