aboutsummaryrefslogtreecommitdiff
path: root/src/path
AgeCommit message (Collapse)Author
2021-05-02path/filepath: fix documentation typo (was "each each")Vitaly Zdanevich
Change-Id: I8dcf6c4489e16e91b8685c31569297cfeb700f9d GitHub-Last-Rev: f6b40e029874230789a7ae2b750a42a355ae42cf GitHub-Pull-Request: golang/go#45905 Reviewed-on: https://go-review.googlesource.com/c/go/+/316009 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Kevin Burke <kev@inburke.com> Trust: Kevin Burke <kev@inburke.com>
2021-04-10path/filepath: replace os.MkdirTemp with T.TempDirManlio Perillo
Add the tempDirCanonical function, for tests that need a temporary directory that does not contain symlinks. Updates #45402 Change-Id: I3d08ef32ef911331544acce3d7d013b4c3382960 Reviewed-on: https://go-review.googlesource.com/c/go/+/308011 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-04-06path/filepath: replace os.MkdirTemp with T.TempDirianwoolf
Change-Id: I6d78e0e742cb0e7f5ea3f430e9cec0f5d1ee03e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/307652 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-04os, path/filepath: use T.Cleanup to restore the original working directoryianwoolf
Updates #45182 Change-Id: Iaf3bdcc345c72fa9669fdc99908ada4e89904edd Reviewed-on: https://go-review.googlesource.com/c/go/+/306290 Trust: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-25path/filepath: make Rel handle Windows UNC shareAman Gupta
Fixes #41230 Change-Id: Iea15e4ae6d56328333fd22de5d78dfcad78ef1bc Reviewed-on: https://go-review.googlesource.com/c/go/+/253197 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-02-20all: go fmt std cmd (but revert vendor)Russ Cox
Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-09all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox
As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-11-06io/fs: add WalkDirRuss Cox
This commit is a copy of filepath.WalkDir adapted to use fs.FS instead of the native OS file system. It is the last implementation piece of the io/fs proposal. The original io/fs proposal was to adopt filepath.Walk, but we have since introduced the more efficient filepath.WalkDir (#42027), so this CL adopts that more efficient option instead. (The changes in path/filepath bring the two copies more in line with each other. The main change is unembedding the field in statDirEntry, so that the fs.DirEntry passed to the WalkDirFunc for the root of the tree does not have any extra methods.) For #41190. Change-Id: I9359dfcc110338c0ec64535f22cafb38d0b613a6 Reviewed-on: https://go-review.googlesource.com/c/go/+/243916 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2020-11-06path/filepath: add WalkDirRuss Cox
WalkDir is like Walk but can use ReadDir to read directories, instead of Readdirnames + Lstat on every entry, which is usually a significant performance improvement. (The Lstat can still happen if the walk function calls d.Info.) Fixes #42027. [Replay of CL 266240 after it was reverted due to accidentally enabling on Windows a test that does not work on Windows. The original code only ran the test on os.Getuid() > 0. The rolled-back CL skipped the test on os.Getuid() == 0. But on Windows, os.Getuid(), it turns out, always returns -1. So what looked like a test for root was also excluding Windows. This CL revises the test to skip Windows explicitly.] Change-Id: I9b3661013d6449b7486532445d934ae91e5393ef Reviewed-on: https://go-review.googlesource.com/c/go/+/267887 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2020-11-05path/filepath: revert "add WalkDir"Dmitri Shuralyov
This reverts CL 266240. Reason for revert: tests aren't passing on windows-amd64-longtest. Change-Id: If323c6254a42aff0418e2c0a9531f3d4c829a242 Reviewed-on: https://go-review.googlesource.com/c/go/+/267798 Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-11-04path/filepath: add WalkDirRuss Cox
WalkDir is like Walk but can use ReadDir to read directories, instead of Readdirnames + Lstat on every entry, which is usually a significant performance improvement. (The Lstat can still happen if the walk function calls d.Info.) Fixes #42027. Change-Id: Ie11024b23be2656e320d41fd81ff0d8810aa729e Reviewed-on: https://go-review.googlesource.com/c/go/+/266240 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2020-10-25path/filepath: allow EvalSymlinks to work on UNC share roots on WindowsKevin Parsons
Fixes #42079 Previously, EvalSymlinks returned an error when called with the root of a UNC share (e.g. \\server\share). This was due to Windows's FindFirstFile function not supporting a share root path. To resolve this, now return early from toNorm in the case where the path after the volume name is empty. Skipping the later path component resolution shouldn't have any negative impact in this case, as if the path is empty, there aren't any path components to resolve anyways. The test case uses the localhost admin share (c$), as it should be present in most situations. This allows testing without setting up an external file share. However, this fix applies to all UNC share root paths. Change-Id: I05035bd86be93662d7bea34fab4b75fc8e918206 GitHub-Last-Rev: bd3db2cda65aae1cdf8d94b03bc7197dff68dc44 GitHub-Pull-Request: golang/go#42096 Reviewed-on: https://go-review.googlesource.com/c/go/+/263917 Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Giovanni Bajo <rasky@develer.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-10-23io/fs, path, path/filepath, testing/fstest: validate patterns in Match, GlobRuss Cox
According to #28614, proposal review agreed in December 2018 that Match should return an error for failed matches where the unmatched part of the pattern has a syntax error. (The failed match has to date caused the scan of the pattern to stop early.) This change implements that behavior: the match loop continues scanning to the end of the pattern, even after a confirmed mismatch, to check whether the pattern is even well-formed. The change applies to both path.Match and filepath.Match. Then filepath.Glob and fs.Glob make a single validity-checking call to Match before beginning their usual processing. Also update fstest.TestFS to check for correct validation in custom Glob implementations. Fixes #28614. Change-Id: Ic1d35a4bb9c3565184ae83dbefc425c5c96318e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/264397 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2020-10-20all: update references to symbols moved from os to io/fsRuss Cox
The old os references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. For #41190. Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd Reviewed-on: https://go-review.googlesource.com/c/go/+/243907 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2020-10-13path: avoid import of stringsRuss Cox
Pushing path lower in the hierarchy, to allow path < io/fs < os in the io/fs prototype. But this change is worth doing even if io/fs is not accepted. Change-Id: Id51b3a638167ca005dadfb9b730287e518ec12a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/243904 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2020-10-06all: enable more tests on macOS/ARM64Cherry Zhang
Updates #38485. Change-Id: Iac96f5ffe88521fcb11eab306d0df6463bdce046 Reviewed-on: https://go-review.googlesource.com/c/go/+/256920 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-09-23all: add GOOS=iosCherry Zhang
Introduce GOOS=ios for iOS systems. GOOS=ios matches "darwin" build tag, like GOOS=android matches "linux" and GOOS=illumos matches "solaris". Only ios/arm64 is supported (ios/amd64 is not). GOOS=ios and GOOS=darwin remain essentially the same at this point. They will diverge at later time, to differentiate macOS and iOS. Uses of GOOS=="darwin" are changed to (GOOS=="darwin" || GOOS=="ios"), except if it clearly means macOS (e.g. GOOS=="darwin" && GOARCH=="amd64"), it remains GOOS=="darwin". Updates #38485. Change-Id: I4faacdc1008f42434599efb3c3ad90763a83b67c Reviewed-on: https://go-review.googlesource.com/c/go/+/254740 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2020-08-19path,path/filepath: add Join examples with ".." componentsAndrew Ekstedt
People sometimes expect Join to trim .. components from its arguments before joining, and are surprised that it doesn't. This is bad if they were relying on that assumed behaviour to prevent directory traversal attacks. While a careful reading of the documentation for Join and Clean might dispel this notion, it is not obvious at first glance. Add a case to the examples to nudge people in the right direction. Updates #40373 Change-Id: Ib5792c12ba1000811a0c0eb77048196d0b26da60 Reviewed-on: https://go-review.googlesource.com/c/go/+/249177 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2020-07-07path/filepath: add explicit comment marking elided errorsRuss Cox
The errors on these lines are meant to be discarded. Add a comment to make that extra clear. Change-Id: I38f72af6dfbb0e86677087baf47780b3cc6e7d40 Reviewed-on: https://go-review.googlesource.com/c/go/+/241083 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-08all: remove scattered remnants of darwin/armAustin Clements
This removes all conditions and conditional code (that I could find) that depended on darwin/arm. Fixes #35439 (since that only happened on darwin/arm) Fixes #37611. Change-Id: Ia4c32a5a4368ed75231075832b0b5bfb1ad11986 Reviewed-on: https://go-review.googlesource.com/c/go/+/227198 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-11-20path: minor changes to improve documentation for JoinEric Rutherford
Reworking the comments in path to call out how leading empty elements are treated. Also updating filepath.Join since it shared much of the wording from path.Join. Updates #35655 Change-Id: I5b15c5d36e9d19831ed39e6bcc7f2fd6c1330033 Reviewed-on: https://go-review.googlesource.com/c/go/+/207797 Reviewed-by: Rob Pike <r@golang.org>
2019-10-09all: remove the nacl port (part 1)Brad Fitzpatrick
You were a useful port and you've served your purpose. Thanks for all the play. A subsequent CL will remove amd64p32 (including assembly files and toolchain bits) and remaining bits. The amd64p32 removal will be separated into its own CL in case we want to support the Linux x32 ABI in the future and want our old amd64p32 support as a starting point. Updates #30439 Change-Id: Ia3a0c7d49804adc87bf52a4dea7e3d3007f2b1cd Reviewed-on: https://go-review.googlesource.com/c/go/+/199499 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-09path: improve documentation to call out cases where Clean is calledEric Rutherford
Rewording the comments for Join to do a better job of calling out when Clean is called. Also clarifing other portions of the comment. Fixes #29875 Change-Id: Ied43983bb10a97922898d28af133de0930224496 Reviewed-on: https://go-review.googlesource.com/c/go/+/194339 Reviewed-by: Rob Pike <r@golang.org>
2019-09-01path: change the output format of ExampleSplit functionIrbe Krumina
At the moment the last output line of ExampleSplit- two empty strings- are being trimmed from the output. I have formatted the output of the function to avoid whitespace trimming and show empty strings more clearly. Fixes #23542 Change-Id: Ic2a4d98cfa06db1466c6c6d98099542df9e7c88b Reviewed-on: https://go-review.googlesource.com/c/go/+/191397 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-08-08path: fix mismatch between error message and corresponding test functionDerek Phan
Change-Id: Ib0ae6e3e678dc7ace21b891e946ffc6bc2a78835 GitHub-Last-Rev: 8c6704ea8c032072ac339dc9d1c6ec78aec15b2a GitHub-Pull-Request: golang/go#33534 Reviewed-on: https://go-review.googlesource.com/c/go/+/189378 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-25path/filepath: add examples for Base, Dir and IsAbsHasan Ozgan
Change-Id: I7a438409748f0f9d6517a7ea1cdee6512ce3ca8a Reviewed-on: https://go-review.googlesource.com/c/go/+/161678 Run-TryBot: Rob Pike <r@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2019-03-05path/filepath: don't discard .. in EvalSymlinksIan Lance Taylor
EvalSymlinks was mishandling cases like "/x/../../y" or "../../../x" where there is an extra ".." that goes past the start of the path. Fixes #30520 Change-Id: I07525575f83009032fa1a99aa270c8d42007d276 Reviewed-on: https://go-review.googlesource.com/c/go/+/164762 Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-03-01path/filepath: do not call GetFinalPathNameByHandle from EvalSymlinksAlex Brainman
EvalSymlinks is using GetFinalPathNameByHandle to handle symlinks with unusual targets like \??\Volume{ABCD}\. But since CL 164201, os.Readlink handles path like that too. So remove all that extra code that EvalSymlinks calls when os.Readlink fails - it is not needed any more. Now that windows EvalSymlinks implementation is similar to unix implementation, we can remove all slashAfterFilePathError related code too. So do that. This also makes TestIssue29372 pass even when TMP directory refers to symlinks with target like \??\Volume{ABCD}\. So remove TestIssue29372 code that helped it pass on windows-arm. TestIssue29372 should pass as is now. Fixes #29746 Change-Id: I568d142c89d3297bff8513069bceaa6be51fe7e4 Reviewed-on: https://go-review.googlesource.com/c/164202 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-20path/filepath: revert "fix Windows-specific Clean bug"Ian Lance Taylor
Revert CL 137055, which changed Clean("\\somepath\dir\") to return "\\somepath\dir" on Windows. It's not entirely clear this is correct, as this path is really "\\server\share\", and as such the trailing slash may be the path on that share, much like "C:\". In any case, the change broke existing code, so roll it back for now and rethink for 1.13. Updates #27791 Fixes #30307 Change-Id: I69200b1efe38bdb6d452b744582a2bfbb3acbcec Reviewed-on: https://go-review.googlesource.com/c/163077 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-01-27path/filepath: skip TestIssue29372 on windows, if /tmp has symilinksAlex Brainman
TestIssue29372 is broken on windows when temporary directory has symlink in its path. Adjust the test to use filepath.EvalSymlinks of temporary directory, instead of temporary directory on windows. This change is not a proper fix, but at least it makes TestIssue29372 pass on windows-arm. See issue for details. Updates #29746 Change-Id: I2af8ebb89da7cb9daf027a5e49e32ee22dbd0e3d Reviewed-on: https://go-review.googlesource.com/c/159578 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-01-15path/filepath: skip part of TestNTNamespaceSymlinkAlex Brainman
Recent CL 156398 extended TestNTNamespaceSymlink. But new code fails, if user running the test does not have sufficient privilege to create file symlink. Skip part of TestNTNamespaceSymlink, if user cannot create symlink. Fixes #29745 Change-Id: Ie4176429ba9dd98553ce9e91fd19851cc7353f42 Reviewed-on: https://go-review.googlesource.com/c/157917 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-01-10path/filepath: return special error from EvalSymlinksAlex Brainman
CL 155597 attempted to fix #29372. But it failed to make all new test cases pass. Also CL 155597 broke some existing code (see #29449 for details). Make small adjustment to CL 155597 that fixes both #29372 and #29449. Suggested by Ian. Updates #29372 Fixes #29449 Change-Id: I9777a615514d3f152af5acb65fb1239e696607b6 Reviewed-on: https://go-review.googlesource.com/c/156398 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-24path/filepath: walkSymlinks: return correct error for file with trailing slashLE Manh Cuong
Rather than return os.ErrNotExist for /path/to/existing_file/, walkSymLinks now returns syscall.ENOTDIR. This is consistent with behavior of os.Lstat. Fixes #29372 Change-Id: Id5c471d901db04b2f35d60f60a81b2a0be93cae9 Reviewed-on: https://go-review.googlesource.com/c/155597 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-02all: use "reports whether" consistently instead of "returns whether"Tobias Klauser
Follow-up for CL 147037 and after Brad noticed the "returns whether" pattern during the review of CL 150621. Go documentation style for boolean funcs is to say: // Foo reports whether ... func Foo() bool (rather than "returns whether") Created with: $ perl -i -npe 's/returns whether/reports whether/' $(git grep -l "returns whether" | grep -v vendor) Change-Id: I15fe9ff99180ad97750cd05a10eceafdb12dc0b4 Reviewed-on: https://go-review.googlesource.com/c/150918 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-02all: use "reports whether" consistently in the few places that didn'tBrad Fitzpatrick
Go documentation style for boolean funcs is to say: // Foo reports whether ... func Foo() bool (rather than "returns true if") This CL also replaces 4 uses of "iff" with the same "reports whether" wording, which doesn't lose any meaning, and will prevent people from sending typo fixes when they don't realize it's "if and only if". In the past I think we've had the typo CLs updated to just say "reports whether". So do them all at once. (Inspired by the addition of another "returns true if" in CL 146938 in fd_plan9.go) Created with: $ perl -i -npe 's/returns true if/reports whether/' $(git grep -l "returns true iff" | grep -v vendor) $ perl -i -npe 's/returns true if/reports whether/' $(git grep -l "returns true if" | grep -v vendor) Change-Id: Ided502237f5ab0d25cb625dbab12529c361a8b9f Reviewed-on: https://go-review.googlesource.com/c/147037 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-02path/filepath: change IsAbs("NUL") to return trueAlex Brainman
This CL changes IsAbs to return true for "NUL" and other Windows reserved filenames (search https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file for NUL for details). os.Open("NUL") and os.Stat("NUL") work regardless of what current directory is, and it is mistake to join "NUL" with current directory when building full path. Changing IsAbs("NUL") to return true fixes that mistake. Fixes #28035 Change-Id: Ife8f8aee48400702613ede8fc6834fd43e6e0f03 Reviewed-on: https://go-review.googlesource.com/c/145220 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-24path/filepath: add example for MatchAurélien Rainone
Change-Id: Id2df4895a95904a607e54dd9810bfe97f5e12a73 Reviewed-on: https://go-review.googlesource.com/c/144105 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-11path/filepath: add AIX operating systemClément Chigot
This commit adds AIX operating system to path/filepath package for ppc64 architecture. Updates: #25893 Change-Id: Iea551236d334705a58a446c8992b20adcfe4159b Reviewed-on: https://go-review.googlesource.com/c/138726 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-29path/filepath: fix Windows-specific Clean bugQtRoS
Fixes #27791 Change-Id: I762fa663379086c24cb4ddc8233a2c0a82b1238e Reviewed-on: https://go-review.googlesource.com/137055 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-09-26all: use strings.ReplaceAll and bytes.ReplaceAll where applicableBrad Fitzpatrick
I omitted vendor directories and anything necessary for bootstrapping. (Tested by bootstrapping with Go 1.4) Updates #27864 Change-Id: I7d9b68d0372d3a34dee22966cca323513ece7e8a Reviewed-on: https://go-review.googlesource.com/137856 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-13path/filepath: correct symlink eval for symlink at rootIan Lance Taylor
For a relative symlink in the root directory, such as /tmp -> private/tmp, we were dropping the leading slash. No test because we can't create a symlink in the root directory. The test TestGZIPFilesHaveZeroMTimes was failing on the Darwin builders. Updates #19922 Updates #20506 Change-Id: Ic83cb6d97ad0cb628fc551ac772a44fb3e20f038 Reviewed-on: https://go-review.googlesource.com/135295 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2018-09-13path/filepath: rewrite walkSymlinksIan Lance Taylor
Rather than try to work around Clean and Join on intermediate steps, which can remove ".." components unexpectedly, just do everything in walkSymlinks. Use a single loop over path components. Fixes #23444 Change-Id: I4f15e50d0df32349cc4fd55e3d224ec9ab064379 Reviewed-on: https://go-review.googlesource.com/121676 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-08-26path/filepath: fix Join with Windows drive letterYasuhiro Matsumoto
Join("C:", "", "b") must return relative path "C:b" Fixes #26953 Change-Id: I2f843ce3f9f18a1ce0e2d0f3a15233f237992776 Reviewed-on: https://go-review.googlesource.com/129758 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-07-29path: present the correct error message in TestMatchJohn Gibb
The message was hardcoded to indicate that the test wanted a nil error, even though in some cases a specific error was wanted. This patch fixes the message to print the wanted error. Change-Id: Id86ea89d6f41f25bfa164acc50142ae8ff0ec410 GitHub-Last-Rev: c220374845667942c608c02afadff95443e2ec20 GitHub-Pull-Request: golang/go#26674 Reviewed-on: https://go-review.googlesource.com/126619 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-18filepath: updates doc to give case where WalkFunc info arg may be nilJack
If a filepath.WalkFunc is called with an non-nil err argument, it's possible that the info argument will be nil. The comment above filepath.WalkFunc now reflects this. Fixes #26425 Change-Id: Ib9963b3344587d2993f1698c5a801f2d1286856b GitHub-Last-Rev: 553fc266b570d0c47efe12b3b670f88112e3b334 GitHub-Pull-Request: golang/go#26435 Reviewed-on: https://go-review.googlesource.com/124635 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-17path/filepath: make Walk example runnable in the playgroundMostyn Bramley-Moore
Relates to #9679 Change-Id: I68951f664d2a03812dae309c580c181869d8af21 Reviewed-on: https://go-review.googlesource.com/122237 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-01os: add js/wasm architectureRichard Musiol
This commit adds the js/wasm architecture to the os package. Access to the actual file system is supported through Node.js. Updates #18892 Change-Id: I6fa642fb294ca020b2c545649d4324d981aa0408 Reviewed-on: https://go-review.googlesource.com/109977 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-14path/filepath: make Abs("") return working directory on WindowsDmitri Shuralyov
The current Abs docs say: // If the path is not absolute it will be joined with the current // working directory to turn it into an absolute path. The empty string is not an absolute path, so the docs suggest that the empty string should be joined with the current working directory to turn it into an absolute path. This was already the case on all platforms other than Windows. Per the decision in issue #24441, this change makes it work on Windows too. Since the empty string is not a valid path for the purposes of calling os.Stat on it, we can't simply add the empty string test case to absTests, which TestAbs uses. It would error when trying to do: info, err := os.Stat(path) I didn't find a good way to modify TestAbs to handle this situation without significantly complicating its code and compromising the test. So, a separate test is created for testing Abs on empty string input. Fixes #24441. Change-Id: I11d8ae2f6e6e358f3e996372ee2a0449093898d2 Reviewed-on: https://go-review.googlesource.com/112935 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-26path/filepath: fix Win32 tests missing 'chcp'Lubomir I. Ivanov (VMware)
'%SystemRoot%/System32/chcp.com' is a tool on Windows that is used to change the active code page in the console. 'go test path/filepath' can fail with: "'chcp' is not recognized as an internal or external command" The test uses a custom PATH variable but does not include '%SystemRoot%/System32'. Always append that to PATH. Updates #24709 Change-Id: Ib4c83ffdcc5dd6eb7bb34c07386cf2ab61dcae57 GitHub-Last-Rev: fac92613cce0d60f6794ad850618ed64d04c76fd GitHub-Pull-Request: golang/go#25089 Reviewed-on: https://go-review.googlesource.com/109362 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-26path/filepath: change example to print the correct path on failureErwin Oegema
This change makes errors in the example code a bit better, as it's no use to show the root dir when an error occurs walking a subdirectory or file. Change-Id: I546276e9b151fabba5357258f03bfbd47a508201 GitHub-Last-Rev: 398c1eeb6164a7edc6fdee8cb8c17c3bd0b649ef GitHub-Pull-Request: golang/go#24536 Reviewed-on: https://go-review.googlesource.com/102535 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>