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
* Disable file locking when DEPNOLOCK set
* Add DisableLocking bool members to Ctx and gps.SourceManagerConfig structs.
This effectively communicates DEPNOLOCK from the shell, to Ctx, to
SourceManager.
The member is named DisableLocking to make its zero-value useful.
* Add locker interface which implements TryLock(), Unlock(), and GetOwner()
which lockfile.Lockfile alredy adheres to. This interface replaces the new
type for the lf member of the SourceMgr struct.
* Add a FalseLocker type which adheres to the Locker interface which does
nothing.
* Conditionally set the lf member of SourceMgr to either an instance of
lockfile.Lockfile or FalseLocker depending on the value of
SourceManagerConfig.DisableLocking.
Signed-off-by: Ayan George <ayan@ayan.net>
* Revert stray edit.
Signed-off-by: Ayan George <ayan@ayan.net>
* Improve comment for DisableLocking
Signed-off-by: Ayan George <ayan@ayan.net>
* Fix comment type-os
* Fix comment type-os
Signed-off-by: Ayan George <ayan@ayan.net>
* Fix yet more type-os.
Signed-off-by: Ayan George <ayan@ayan.net>
- `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
- `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.
/Users/tamird/src/go/src/github.com/golang/dep/context.go:86:1: exported method Ctx.SourceManager should have comment or be unexported
/Users/tamird/src/go/src/github.com/golang/dep/internal/gps/cmd.go:75:13: should omit type *int32 from declaration of var isDone; it will be inferred from the right-hand side
/Users/tamird/src/go/src/github.com/golang/dep/internal/gps/version.go:122:1: exported method Revision.ImpliedCaretString should have comment or be unexported
/Users/tamird/src/go/src/github.com/golang/dep/internal/test/test.go:27:2: exported var ExeSuffix should have comment or be unexported
/Users/tamird/src/go/src/github.com/golang/dep/internal/test/test.go:29:15: should omit type *bool from declaration of var PrintLogs; it will be inferred from the right-hand side
/Users/tamird/src/go/src/github.com/golang/dep/internal/test/test.go:30:15: should omit type *bool from declaration of var UpdateGolden; it will be inferred from the right-hand side
/Users/tamird/src/go/src/github.com/golang/dep/internal/test/test.go:194:1: comment on exported method Helper.Run should be of the form "Run ..."
/Users/tamird/src/go/src/github.com/golang/dep/internal/test/test.go:449:1: comment on exported method Helper.GetFile should be of the form "GetFile ..."
/Users/tamird/src/go/src/github.com/golang/dep/internal/test/test.go:611:1: exported method Helper.GetCommit should have comment or be unexported
* 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>
Remove the usage of filepath.FromSlash and filepath.ToSlash in GOPATH
detection functions *Ctx.SetPaths and *Ctx.detectGOPATH.
This should ensure the GOPATH returned from *Ctx.DetectProjectGOPATH
uses the filesystem separator instead of slashes.
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>