Граф коммитов

92 Коммитов

Автор SHA1 Сообщение Дата
Ayan George 3fd5bb377b Disable file locking when DEPNOLOCK set (#1206)
* 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>
2017-09-29 17:20:59 -04:00
Suhas Karanth d451fa03fc rename func, improve comments
- `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
2017-09-20 11:36:04 +05:30
Suhas Karanth afaf870131 check cfg filename case on case insensitive systems
- `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.
2017-09-20 11:35:54 +05:30
sam boyer 2c2fb85b39 ctx: improve "not under GOPATH" errors 2017-09-19 10:46:41 -04:00
Tamir Duberstein 3a25b0b519
Add golint
/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
2017-09-11 19:22:23 -04:00
Ibrahim AshShohail 3b01418823 [WIP]: internal/fs: add EquivalentPaths function (#940)
* 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>
2017-09-02 17:42:09 +03:00
Jordan Krage c986343ebc cleanup errors 2017-08-30 19:53:53 -05:00
Jordan Krage b9134b0aa4 gps: source cache: adding close() method to singleSourceCache, sourceGateway, and sourceCoordinator 2017-08-28 22:31:49 -05:00
Ibrahim AshShohail 56d790967b
cmd/dep: always ensure that gps.SolveParameters are validated
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-08-12 00:10:27 +03:00
Jordan Krage c89cb10cdc remove VersionInWorkspace in favor of Exported absoluteProjectRoot and new gps.ProjectVersion 2017-06-27 07:38:02 -05:00
sam boyer 4bfa359b53 Merge pull request #682 from jmank88/split_absolute_project_root
SplitAbsoluteProjectRoot re-name/doc
2017-06-27 00:58:48 -04:00
Sunny f16f7a875b Merge pull request #785 from jmank88/getGOPATHs
remove getGOPATHS; cleanup
2017-06-25 23:14:28 +05:30
Jordan Krage ac8ec854a9 update SetPaths doc 2017-06-25 12:21:35 -05:00
Jordan Krage 3fe03979a2 remove getGOPATHS; cleanup 2017-06-22 08:00:37 -05:00
Jordan Krage eb972b2438 SplitAbsoluteProjectRoot refactor 2017-06-22 07:21:19 -05:00
Ibrahim AshShohail 6e2930fc66
dep: remove usage of filepath.FromSlash & filepath.ToSlash
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>
2017-06-21 03:34:45 +03:00
Ibrahim AshShohail 13f512fec4
dep: cleanup TestLoadProject and TestDetectProjectGOPATH
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-17 04:32:44 +03:00
Ibrahim AshShohail a69d6aeadd
dep: update tests for dep.*Ctx.DetectProjectGOPATH
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-17 04:00:51 +03:00
Ibrahim AshShohail f4b9f497a1
dep: Fix godoc for dep.*Ctx.DetectProjectGOPATH
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-17 03:54:25 +03:00
Ibrahim AshShohail 138cebb138
dep: Update godoc to use // instead of /* ... */
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-17 03:47:22 +03:00
Ibrahim AshShohail 026038a6db
Update docs for dep.Ctx. Ctx.SetPaths and Ctx.DetectProjectGOPATH
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-16 21:25:29 +03:00
Ibrahim AshShohail 0b8edb132a
Ensure dep reads GOPATH from Config.Env
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-15 06:12:58 +03:00
Ibrahim AshShohail 5a3291a7a1
dep: small nits in context.go
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-15 02:58:25 +03:00
Ibrahim AshShohail 916603406b
dep: Add *Project.SetRoot() instead of NewProject()
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-15 02:36:01 +03:00
Ibrahim AshShohail 65950010b5
Merge branch 'master' into symlink-project-roots-changes
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-15 01:39:56 +03:00
Ibrahim AshShohail cd9bea6036
dep: add Ctx.SetPaths() ctx.DetectProjectGOPATH()
*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>
2017-06-15 01:38:02 +03:00
Ibrahim AshShohail 71a26071db
dep: Add dep.NewProject() and add ResolveAbsRoot to dep.Project
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>
2017-06-15 01:30:25 +03:00
Jordan Krage cb7df4a61c rename UnpairedVersion.Is() to Pair() 2017-06-14 09:44:59 -05:00
Ibrahim AshShohail 22cd7683f5
fix tests
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-12 22:42:23 +03:00
Ibrahim AshShohail b7048cc449
Merge remote-tracking branch 'upstream/master' into symlink-project-roots-changes
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-12 22:21:28 +03:00
Jordan Krage 2fd376301e improve godoc; replace Loggers with embeded fields; refactor Ctx api 2017-06-07 08:46:44 -05:00
Ibrahim AshShohail 9675932c44
Minor text edits
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-06 06:30:55 +03:00
Ibrahim AshShohail 6a464acbfd
dep: update letter casing to detectGOPATH() and ResolveProjectRootAndGOPATH()
Edit letter case of:

* detectGoPath() to detectGOPATH()
* ResolveProjectRootAndGoPath() to ResolveProjectRootAndGOPATH()

Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-06 06:25:42 +03:00
Ibrahim AshShohail 3be59e3477
dep: minor fixes & tweaks in context.go
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-03 22:58:11 +03:00
Ibrahim AshShohail 91ac4d2e0d
dep: update NewContext(), rename ResolveProjectRoot() to ResolveProjectRootAndGoPath() and add detectGoPath()
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-03 22:15:21 +03:00
Jordan Krage f7ce515853 simplify Ctx.LoadProject 2017-05-30 09:07:23 -05:00
Ibrahim AshShohail 0bc771f618 Merge branch 'master' into consolidate-fs-files 2017-05-12 20:24:32 +03:00
Jordan Krage cbded81ec1 move Logger into Ctx; restore logging 2017-05-11 11:16:36 -05:00
Ibrahim AshShohail 72a6ec2bcd Merge branch 'master' of github.com:golang/dep into consolidate-fs-files
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-05-11 11:47:35 +03:00
sam boyer 30cce2a3e5 Merge pull request #529 from ibrasho-forks/handle-init-in-GOPATH/src-issue
Show a clear error message when trying to 'dep init' in $GOPATH/src
2017-05-10 22:20:04 -04:00
Ibrahim AshShohail f87d614e17 consolidate fs.go, internal/fs.go and gps/internal/fs/fs/.go into internal/fs 2017-05-10 20:37:13 +03:00
Ibrahim AshShohail f81437dc2f change error wording and add ensure correct error in the test case 2017-05-10 09:03:19 +03:00
Dave Cheney 9ea8489e5e gps: move gps to internal/gps
Fixes #300
Fixes #519
2017-05-10 14:15:27 +10:00
Ibrahim AshShohail 19b4485090 remove the redundant comment 2017-05-09 09:19:01 +03:00
Ibrahim AshShohail 938475b6de reword the comment 2017-05-09 00:48:28 +03:00
Ibrahim AshShohail a11483a92b add test and cleanup 2017-05-09 00:38:37 +03:00
Ibrahim AshShohail 3e38fb2b79 Show a clear error message when trying to 'dep init' in $GOPATH/src 2017-05-08 19:16:27 +03:00
Jordan Krage c6e4b60271 fix custom getEnv: return last instance 2017-05-08 09:20:37 -05:00
Jordan Krage e50a643805 review changes 2017-05-06 08:23:31 -05:00
Jordan Krage f7a8a8c9ed go fmt 2017-05-05 19:17:26 -05:00