summaryrefslogtreecommitdiff
path: root/src/path/filepath/example_unix_test.go
Commit message (Collapse)AuthorAgeFilesLines
* all: go fmt std cmd (but revert vendor)Russ Cox2021-02-201-0/+1
| | | | | | | | | | | | | | | | 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>
* path,path/filepath: add Join examples with ".." componentsAndrew Ekstedt2020-08-191-0/+4
| | | | | | | | | | | | | | | | | | | | 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>
* path/filepath: add examples for Base, Dir and IsAbsHasan Ozgan2019-03-251-0/+71
| | | | | | | 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>
* path/filepath: add example for MatchAurélien Rainone2018-10-241-0/+15
| | | | | | | | 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>
* path/filepath: make Walk example runnable in the playgroundMostyn Bramley-Moore2018-07-171-23/+0
| | | | | | | | | | 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>
* path/filepath: change example to print the correct path on failureErwin Oegema2018-03-261-1/+2
| | | | | | | | | | 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>
* path/filepath: add example for WalkJean-Francois Cantin2017-09-271-0/+22
| | | | | | | | | | Fixes: #22052 Change-Id: Ia056871b35ecc1a8c5ac891402fc1c5702731623 Reviewed-on: https://go-review.googlesource.com/66330 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* path, path/filepath: add Join example with joined rooted pathRuss Cox2016-04-031-0/+14
| | | | | | | | | | | This makes clear that Go's path.Join and filepath.Join are different from the Python os.path.join (and perhaps others). Requested in private mail. Change-Id: Ie5dfad8a57f9baa5cca31246af1fd4dd5b1a64ee Reviewed-on: https://go-review.googlesource.com/20711 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* path/filepath: include the original paths in error messagesMohit Agarwal2015-11-171-1/+1
| | | | | | | | | | | | | | | | | On Windows, Rel emits error messages of the form `Rel: can't make \windows relative to \windows`. Rather than emitting paths after stripping volume names, emit the original paths so as to make those of the form `Rel: can't make d:\windows relative to c:\windows`. Fixed a test that expected the error message to emit clean path instead of the original. Fixes #13259 Change-Id: I3a9bd5b137205f22794ec8046b4e917ee48cf750 Reviewed-on: https://go-review.googlesource.com/16858 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
* path/filepath: add example for filepath.SplitAndrew Gerrand2015-02-201-0/+28
| | | | | | | | Fixes #9928 Change-Id: Iab37051078755a132f211ad48e756422f7c55a39 Reviewed-on: https://go-review.googlesource.com/5416 Reviewed-by: Minux Ma <minux@golang.org>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+39
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.