The most crucial piece is fixing the hasher to make its prefix checks
without the wildcard suffix for the purpose of determining whether the
ignore affects the root project; otherwise, wildcards on the root of the
current project (why would you do this?) would be erroneously included
in hash inputs.
Adds test for createIgnorePrefixTree() which verifies the global
ignore skip.
Also, unifies createIgnorePrefixTree() of solver and pkgtree, moving it
to pkgtree package.
Previously, errors like the following could occur:
v0.4.2: Could not introduce github.com/sirupsen/logrus due to a case-only variation: it depends on "github.com/Sirupsen/logrus", but "github.com/evalphobia/logrus_sentry@v0.4.2" was already established as the case variant for that project root by the following other dependers:
(root)
github.com/docker/docker@8510adf8c856d6f0871650216a0e1d7e6ece46ee
This fix matches the correct behavior when there is only one depender earlier in
the function.
* 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>
Instead, we use the existing `waitDone` channel to wait for the
command to return and then clean up the timer unconditionally. This
may hold the goroutine open for longer than strictly necessary, but
that seems harmless.
Closes#1194.
- `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.
But, still preserve the rule that we record the canonical folded URL in
memory, so that we can have non-canonical inputs come in first and still
converge with subsequent canonical, or other-case-variant forms later.
Keeping track of what maps to what in the sourceGateway setup can be
really tricky with all the combinations; in the event of failures in
this test, this will show the mapping tables, which helps a lot with
understanding the actual final state.
to expose the deduced possible source URLs for a given import path.
This information is useful for importing configuration from other tools
that support vendoring forks
...instead of custom code that does the same thing. Return
informative errors rather than logging directly (into the abyss).
Also remove sourceFailure{,s} while I'm here, which are unnecessary.
Also `dep prune` real quick.
/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
cmd/dep/ensure.go:138:2: field overrides is unused (U1000)
cmd/dep/ensure.go:702:6: type stringSlice is unused (U1000)
internal/gps/bridge.go:60:2: field crp is unused (U1000)
internal/gps/pkgtree/pkgtree_test.go:36:3: field Internal is unused (U1000)
internal/gps/pkgtree/pkgtree_test.go:36:13: field External is unused (U1000)
internal/gps/selection.go:76:21: func (*selection).setDependenciesOn is unused (U1000)
internal/gps/selection.go:99:21: func (*selection).getSelectedPackagesIn is unused (U1000)
internal/gps/solve_basic_test.go:1356:33: func (*depspecSourceManager).ExternalReach is unused (U1000)
internal/gps/solve_basic_test.go:1571:16: func fixLock.SolverVersion is unused (U1000)
internal/gps/solve_basic_test.go:1588:18: func dummyLock.SolverVersion is unused (U1000)
internal/gps/solve_failures.go:20:2: const warning is unused (U1000)
internal/gps/solve_failures.go:21:2: const mustResolve is unused (U1000)
internal/gps/solve_failures.go:22:2: const cannotResolve is unused (U1000)
internal/gps/source_manager.go:217:4: func Temporary is unused (U1000)
internal/gps/source_manager.go:712:2: const ctCheckoutVersion is unused (U1000)
internal/gps/typed_radix.go:34:23: func (*deducerTrie).Delete is unused (U1000)
internal/gps/vcs_repo.go:201:6: type svnRepo is unused (U1000)
internal/gps/vcs_repo_test.go:122:6: func testSvnRepo is unused (U1000)
internal/gps/vcs_source.go:573:6: type repo is unused (U1000)
internal/gps/version_queue_test.go:30:23: func (*fakeBridge).ListVersions is unused (U1000)
internal/gps/version_queue_test.go:45:27: func (*fakeFailBridge).ListVersions is unused (U1000)
internal/test/integration/testproj.go:34:2: field h is unused (U1000)
May or may not end up using this right away, but it'll be in place for
when we have the slightly stronger failure case of a project being
addressed with an incorrect case, as indicated by the project's way
of referencing its own packages.
This lifts the exact folding algorithm and use pattern followed by the
toolchain up into gps. Not only does it solve the strings.ToLower()
inadequacy, but it means we're using the exact same logic the
go compiler does to decide this same question.
It was previously possible for the following to occur:
```
$ dep ensure
ensure Solve(): remote repository at https://code.googlesource.com/gocloud does not exist, or is inaccessible
```
This patch exposes the underlying error:
```
chdir /Users/tamird/src/go/pkg/dep/sources/https---code.googlesource.com-gocloud: no such file or directory
```
Which is easily fixed:
```
$ rm -r /Users/tamird/src/go/pkg/dep
```