commit 845a25ee47c56da214affd6ea1478056813260c2
parent bdedd3ea2a8a5beb1c22f46ddfb63267f0a1b96a
Author: Matsuda Kenji <info@mtkn.jp>
Date: Fri, 5 Jan 2024 09:49:45 +0900
gofmt
Diffstat:
3 files changed, 81 insertions(+), 82 deletions(-)
diff --git a/client/client_test.go b/client/client_test.go
@@ -77,9 +77,9 @@ func newClientForTest(msize uint32, uname string) (*Client, <-chan lib9p.Msg, ch
func TestVersion(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TVersion
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TVersion
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TVersion{Tag: lib9p.NOTAG, Msize: 1024, Version: "9P2000"},
@@ -143,16 +143,16 @@ func TestVersion(t *testing.T) {
func TestAuth(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TAuth
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TAuth
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TAuth{Tag: 0, Afid: lib9p.NOFID, Uname: "glenda", Aname: ""},
&lib9p.RError{Tag: 0, Ename: errors.New("authentication not required.")}},
{"1",
&lib9p.TAuth{Tag: 0, Afid: 0, Uname: "glenda", Aname: ""},
- &lib9p.RAuth{Tag: 0, Aqid: lib9p.Qid{Path:1}}},
+ &lib9p.RAuth{Tag: 0, Aqid: lib9p.Qid{Path: 1}}},
}
for _, test := range tests {
func() {
@@ -161,9 +161,9 @@ func TestAuth(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- gotaqid lib9p.Qid
- goterr error
- done = make(chan struct{})
+ gotaqid lib9p.Qid
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -207,13 +207,13 @@ func TestAuth(t *testing.T) {
func TestAttach(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TAttach
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TAttach
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TAttach{Fid: 0, Afid: lib9p.NOFID, Uname: "glenda", Aname: ""},
- &lib9p.RAttach{Qid: lib9p.Qid{Path:2}}},
+ &lib9p.RAttach{Qid: lib9p.Qid{Path: 2}}},
{"1",
&lib9p.TAttach{Fid: 0, Afid: lib9p.NOFID, Uname: "glenda", Aname: ""},
&lib9p.RError{Ename: errors.New("authentication required")}},
@@ -225,9 +225,9 @@ func TestAttach(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- gotqid lib9p.Qid
- goterr error
- done = make(chan struct{})
+ gotqid lib9p.Qid
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -271,9 +271,9 @@ func TestAttach(t *testing.T) {
func TestFlush(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TFlush
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TFlush
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TFlush{Oldtag: 1},
@@ -286,8 +286,8 @@ func TestFlush(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- goterr error
- done = make(chan struct{})
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -327,13 +327,13 @@ func TestFlush(t *testing.T) {
func TestWalk(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TWalk
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TWalk
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TWalk{Fid: 0, Newfid: 1, Wnames: []string{"a", "b", "c"}},
- &lib9p.RWalk{Qids: []lib9p.Qid{lib9p.Qid{Path:0}, lib9p.Qid{Path:1}, lib9p.Qid{Path:2}}}},
+ &lib9p.RWalk{Qids: []lib9p.Qid{lib9p.Qid{Path: 0}, lib9p.Qid{Path: 1}, lib9p.Qid{Path: 2}}}},
{"1",
&lib9p.TWalk{Fid: 0, Newfid: 2, Wnames: []string{"a", "b", "c"}},
&lib9p.RError{Ename: errors.New("not found")}},
@@ -345,9 +345,9 @@ func TestWalk(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- gotqids []lib9p.Qid
- goterr error
- done = make(chan struct{})
+ gotqids []lib9p.Qid
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -391,13 +391,13 @@ func TestWalk(t *testing.T) {
func TestOpen(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TOpen
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TOpen
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TOpen{Fid: 0, Mode: lib9p.OREAD},
- &lib9p.ROpen{Qid: lib9p.Qid{Path:1}, Iounit: 1000}},
+ &lib9p.ROpen{Qid: lib9p.Qid{Path: 1}, Iounit: 1000}},
{"1",
&lib9p.TOpen{Fid: 0, Mode: lib9p.OWRITE},
&lib9p.RError{Ename: errors.New("permission denied")}},
@@ -409,10 +409,10 @@ func TestOpen(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- gotqid lib9p.Qid
- gotiounit uint32
- goterr error
- done = make(chan struct{})
+ gotqid lib9p.Qid
+ gotiounit uint32
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -456,13 +456,13 @@ func TestOpen(t *testing.T) {
func TestCreate(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TCreate
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TCreate
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TCreate{Fid: 0, Name: "file", Perm: 0666, Mode: lib9p.OREAD},
- &lib9p.RCreate{Qid: lib9p.Qid{Path:0}, Iounit: 1000}},
+ &lib9p.RCreate{Qid: lib9p.Qid{Path: 0}, Iounit: 1000}},
{"1",
&lib9p.TCreate{Fid: 0, Name: "file", Perm: 0777, Mode: lib9p.OWRITE},
&lib9p.RError{Ename: errors.New("permission denied")}},
@@ -474,10 +474,10 @@ func TestCreate(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- gotqid lib9p.Qid
- gotiounit uint32
- goterr error
- done = make(chan struct{})
+ gotqid lib9p.Qid
+ gotiounit uint32
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -521,9 +521,9 @@ func TestCreate(t *testing.T) {
func TestRead(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TRead
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TRead
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TRead{Fid: 0, Offset: 0, Count: 1000},
@@ -539,9 +539,9 @@ func TestRead(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- gotdata []byte
- goterr error
- done = make(chan struct{})
+ gotdata []byte
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -585,9 +585,9 @@ func TestRead(t *testing.T) {
func TestWrite(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TWrite
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TWrite
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TWrite{Fid: 0, Offset: 0, Count: 4, Data: []byte("unko")},
@@ -603,9 +603,9 @@ func TestWrite(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- gotcount uint32
- goterr error
- done = make(chan struct{})
+ gotcount uint32
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -649,9 +649,9 @@ func TestWrite(t *testing.T) {
func TestClunk(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TClunk
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TClunk
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TClunk{Fid: 0},
@@ -667,8 +667,8 @@ func TestClunk(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- goterr error
- done = make(chan struct{})
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -708,9 +708,9 @@ func TestClunk(t *testing.T) {
func TestRemove(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TRemove
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TRemove
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TRemove{Fid: 0},
@@ -726,8 +726,8 @@ func TestRemove(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- goterr error
- done = make(chan struct{})
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -767,9 +767,9 @@ func TestRemove(t *testing.T) {
func TestStat(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TStat
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TStat
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TStat{Fid: 0},
@@ -782,9 +782,9 @@ func TestStat(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- gotstat *lib9p.Stat
- goterr error
- done = make(chan struct{})
+ gotstat *lib9p.Stat
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
@@ -828,9 +828,9 @@ func TestStat(t *testing.T) {
func TestWstat(t *testing.T) {
tests := []struct {
- name string
- tmsg *lib9p.TWstat
- rmsg lib9p.Msg
+ name string
+ tmsg *lib9p.TWstat
+ rmsg lib9p.Msg
}{
{"0",
&lib9p.TWstat{Fid: 0, Stat: &lib9p.Stat{Name: "file", Gid: "ken"}},
@@ -846,8 +846,8 @@ func TestWstat(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var (
- goterr error
- done = make(chan struct{})
+ goterr error
+ done = make(chan struct{})
)
go func() {
ifcall := test.tmsg
diff --git a/client/fs_test.go b/client/fs_test.go
@@ -92,13 +92,12 @@ type testFS struct {
root *testFile
// If slow is true, each function on files of this testFS waits for
// something arrives on waitc.
- slow bool
+ slow bool
nextQid uint64
// waitc is used to wait some timing to emulate slow response.
waitc chan struct{}
// groups holds the information of groups and it leader and members.
groups map[string]group
-
}
type group struct {
@@ -197,7 +196,7 @@ func init() {
testfs.groups = make(map[string]group)
for _, g := range testdata.Groups {
testfs.groups[g.Name] = group{
- leader: g.Leader,
+ leader: g.Leader,
members: make(map[string]bool),
}
for _, u := range g.Members {
diff --git a/fs_test.go b/fs_test.go
@@ -260,7 +260,7 @@ func init() {
testfs.groups = make(map[string]group)
for _, g := range testdata.Groups {
testfs.groups[g.Name] = group{
- leader: g.Leader,
+ leader: g.Leader,
members: make(map[string]bool),
}
for _, u := range g.Members {