From: Tobias Klauser Date: Thu, 16 Mar 2023 12:12:10 +0000 (+0100) Subject: cmd/go/internal/lockedfile/internal/filelock: re-use filelock_other.go for plan9 X-Git-Tag: go1.21rc1~1247 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ab28b834c4a38bd2295ee43eca4f9e38c28d54a2;p=gostls13.git cmd/go/internal/lockedfile/internal/filelock: re-use filelock_other.go for plan9 The implementation for lockType, lock, unlock and isNotSupported is the same on plan9 as on other platforms where filelocks are unsupported. Change-Id: I8b9c0bdc429e23346ab9145ec3814622319427fa Reviewed-on: https://go-review.googlesource.com/c/go/+/476915 TryBot-Result: Gopher Robot Run-TryBot: Tobias Klauser Reviewed-by: Bryan Mills Reviewed-by: Cherry Mui --- diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go index c18dbdf850..7bdd62bd9b 100644 --- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go +++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !unix && !plan9 && !windows +//go:build !unix && !windows package filelock diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_plan9.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_plan9.go deleted file mode 100644 index 54b2c946e0..0000000000 --- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_plan9.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build plan9 - -package filelock - -import "io/fs" - -type lockType int8 - -const ( - readLock = iota + 1 - writeLock -) - -func lock(f File, lt lockType) error { - return &fs.PathError{ - Op: lt.String(), - Path: f.Name(), - Err: ErrNotSupported, - } -} - -func unlock(f File) error { - return &fs.PathError{ - Op: "Unlock", - Path: f.Name(), - Err: ErrNotSupported, - } -} - -func isNotSupported(err error) bool { - return err == ErrNotSupported -}