source
- main.go: Try to ensure directory for given `cachedir` path.
- context.go: Create the default cache directory, `$GOPATH/pkg/dep`, if the
user did not override it.
- source_manager.go: Use `fs.EnsureDir` instead of `os.MkdirAll` for creating
sources folder in cache directory.
- fs.go:
- Add func `EnsureDir` to create a directory if it does not exist.
- Remove func `IsValidPath`.
test
- integration_test.go: Improve tests for invalid cache directory.
- fs_test.go: Add test for `EnsureDir`, remove test for `IsValidPath`.
- manager_test.go: fix TestSourceManagerInit
- Re-create cache directory before trying to call `NewSourceManager` the 2nd
time and defer it's removal.
- If `NewSourceManager` fails the 2nd time, exit the error using `t.Fatal` to
avoid panic in `sm.Release`
misc
- language - {fallback => default} for cachedir
source
- main.go: Read and use env var `DEPCACHEDIR` for instantiating dep context.
- context.go:
- Add field `Cachedir` to struct `Ctx`. This holds the value of env var
`DEPCACHEDIR`.
- Use `Ctx.Cachedir` while instantiating `gps.SourceMgr` if present, fallback
to `$GOPATH/pkg/dep` otherwise.
- source_manager.go: Add a getter func `Cachedir` to facilitate testing in
`context_test.go`.
test
- context_test.go Add test to check `gps.SourceMgr` is instantiated with
appropriate `cachedir`.
- integration_test.go: Add test to check environment variable `DEPCACHEDIR` is
loaded and used if present.
misc
- update changelog
- `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>