lib9p

Go 9P library.
Log | Files | Refs | LICENSE

commit 117743d2947f42b2d699e359d5c2a9fcdd8f654f
parent 470d538d28ab3c257fb4230933a9306cb4031a19
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Mon, 21 Oct 2024 08:33:03 +0900

gofmt

Diffstat:
Mclient/client_test.go | 8++++----
Mclient/fs_test.go | 2+-
Mcmd/diskfs/main.go | 4+++-
Mdiskfs/fs.go | 4++--
Mfactotum.go | 10+++++-----
Mfid.go | 4++--
Mfs_test.go | 2+-
Mserver_test.go | 16++++++++--------
8 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/client/client_test.go b/client/client_test.go @@ -69,17 +69,17 @@ func newClientForTest(ctx context.Context, msize uint32, uname string) (*Client, } func TestMux(t *testing.T) { - tests := []struct{ + tests := []struct { tmsg, rmsg lib9p.Msg }{ {&lib9p.TVersion{}, &lib9p.RVersion{}}, - {&lib9p.TCreate{}, &lib9p.RError{Ename:errors.New("e")}}, + {&lib9p.TCreate{}, &lib9p.RError{Ename: errors.New("e")}}, } ctx, cancel := context.WithCancel(context.Background()) defer cancel() c, r, w := newClientForTest(ctx, 1024, "glenda") - for i, test := range tests{ + for i, test := range tests { tag := uint16(rand.Uint32()) test.tmsg.SetTag(tag) test.rmsg.SetTag(tag) @@ -108,7 +108,7 @@ func TestMux(t *testing.T) { t.Error(err) continue } - rq = <- rq.rxc + rq = <-rq.rxc if !reflect.DeepEqual(test.rmsg, rq.rmsg) { t.Errorf("%d: mux modified tmsg:\n\twant: %v\n\tgot: %v", i, test.tmsg, gottmsg) diff --git a/client/fs_test.go b/client/fs_test.go @@ -27,7 +27,7 @@ type testFile struct { // r is used if this testFile is not a directory and // when this testFile is read. // It contains content. - r *bytes.Reader + r *bytes.Reader offset int64 // stat is the Stat of this testFile. stat lib9p.Stat diff --git a/cmd/diskfs/main.go b/cmd/diskfs/main.go @@ -1,7 +1,9 @@ // Diskfs exports the file system on the disk. // // Usage: -// diskfs [-D] [-P profport] [-a addr] [-p port] root +// +// diskfs [-D] [-P profport] [-a addr] [-p port] root +// // Diskfs exports file system on the disk rooted at root. // By default it listens to 127.0.0.1:5640. // You can change the address and port number with -a and -p flags. diff --git a/diskfs/fs.go b/diskfs/fs.go @@ -15,7 +15,7 @@ import ( // FS is a file system to export OS's file system via 9P protocol. type FS struct { - rootPath string // slash-separated. + rootPath string // slash-separated. qidPool *QidPool } @@ -80,7 +80,7 @@ func (fsys *FS) Create(name string, uid string, omode lib9p.OpenMode, perm lib9p return nil, &fs.PathError{ Op: "create", Path: name, - Err: fmt.Errorf("file creation by a user other than the server's " + + Err: fmt.Errorf("file creation by a user other than the server's " + "uid is not implemented"), } } diff --git a/factotum.go b/factotum.go @@ -9,11 +9,11 @@ import ( ) type AuthInfo struct { - cuid string // caller id - suid string // server id - cap string // capability - nsecret int // length of secret - secret string + cuid string // caller id + suid string // server id + cap string // capability + nsecret int // length of secret + secret string } func SetFactotum(s *Server, rpcpath string) error { diff --git a/fid.go b/fid.go @@ -69,8 +69,8 @@ func FlagToMode(f int) OpenMode { // and does not change between 9P sessions. type fid struct { fid uint32 - omode OpenMode /* -1 = not open */ - path string // The path from the root of the FS. + omode OpenMode /* -1 = not open */ + path string // The path from the root of the FS. qidpath uint64 fs FS // The associated FS. file File // The associated File. diff --git a/fs_test.go b/fs_test.go @@ -42,7 +42,7 @@ type testFile struct { // r is used if this testFile is not a directory and // when this testFile is read. // It contains content. - r *bytes.Reader + r *bytes.Reader offset int64 // stat is the Stat of this testFile. stat Stat diff --git a/server_test.go b/server_test.go @@ -236,10 +236,10 @@ func TestSAuth(t *testing.T) { // It also sets c.fsmap["fs"] to test a Tattach message with Aname other than "". func TestSAttach(t *testing.T) { tests := []struct { - input *TAttach - needAuth bool - authOK bool - want Msg + input *TAttach + needAuth bool + authOK bool + want Msg }{ {&TAttach{Fid: 0, Afid: NOFID, Uname: "kenji", Aname: ""}, false, false, @@ -619,9 +619,9 @@ func testSRead(t *testing.T, pathname string, c *conn, tc, rc chan *request) { func TestSWrite(t *testing.T) { tests := []struct { - omode OpenMode - data []byte - err error + omode OpenMode + data []byte + err error }{ {ORDWR, []byte("hoge"), nil}, {OREAD, []byte("hoge"), errors.New("omode")}, @@ -792,7 +792,7 @@ func TestSRemove(t *testing.T) { defer c.fPool.delete(test.fid) fid.omode = -1 fid.path = test.pathname - fid.file = &testFile{stat: Stat{Name:path.Base(test.pathname)}} + fid.file = &testFile{stat: Stat{Name: path.Base(test.pathname)}} fid.uid = test.ruid fid.fs = testfs dir, err := testfs.walkPath(path.Dir(test.pathname))