1
0
mirror of https://github.com/golang/go synced 2024-11-17 21:44:43 -07:00

internal/safefilepath: fix TestFromFS on Plan 9

CL 455716 added TestFromFS. This test was failing on Plan 9
because fromFS didn't return an empty string in case of error.

This change fixes TestFromFS by returning an empty string
in case of error.

Fixes #57142.

Change-Id: Ie50dfba5e70154d641f762fa43f1c26c3d12b6f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/455835
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
This commit is contained in:
David du Colombier 2022-12-07 15:20:25 +01:00
parent 7c7cd56870
commit 9431237d77

View File

@ -11,7 +11,7 @@ import "runtime"
func fromFS(path string) (string, error) {
if runtime.GOOS == "plan9" {
if len(path) > 0 && path[0] == '#' {
return path, errInvalidPath
return "", errInvalidPath
}
}
for i := range path {