From dd76f22eb79cb097f9ae1f62a1c95cc4c35df4d0 Mon Sep 17 00:00:00 2001 From: Mikkel Krautz Date: Sun, 18 Nov 2012 17:59:07 +0100 Subject: [PATCH] grumble, pkg/*: go fmt. --- acl.go | 1 + args.go | 2 +- freeze.go | 6 +-- grumble.go | 2 +- murmurdb.go | 4 +- pkg/blobstore/blobstore.go | 12 ++--- pkg/cryptstate/cryptstate.go | 2 +- pkg/freezer/walker.go | 2 +- pkg/packetdatastream/packetdatastream_test.go | 4 +- pkg/replacefile/doc.go | 12 ++--- pkg/replacefile/flags.go | 24 +++++----- pkg/replacefile/replacefile_stub.go | 44 +++++++++---------- server.go | 4 +- version.go | 4 +- 14 files changed, 62 insertions(+), 61 deletions(-) diff --git a/acl.go b/acl.go index e432964..6a15547 100644 --- a/acl.go +++ b/acl.go @@ -55,6 +55,7 @@ func (perm Permission) ClearCacheBit() { // A channel-to-permission mapping used in the ACLCache type ChannelCache map[int]Permission + // The ACLCache maps a user id to a ChannelCache map. // The ChannelCache map maps a channel to its permissions. type ACLCache map[uint32]ChannelCache diff --git a/args.go b/args.go index 1b85f24..1faa64f 100644 --- a/args.go +++ b/args.go @@ -72,7 +72,7 @@ func defaultLogPath() string { func Usage() { t, err := template.New("usage").Parse(usageTmpl) if err != nil { - panic("unable to parse usage template") + panic("unable to parse usage template") } err = t.Execute(os.Stdout, UsageArgs{ diff --git a/freeze.go b/freeze.go index fd08ef3..c3523b2 100644 --- a/freeze.go +++ b/freeze.go @@ -7,13 +7,13 @@ package main import ( "code.google.com/p/goprotobuf/proto" "errors" + "io" + "io/ioutil" + "log" "mumbleapp.com/grumble/pkg/ban" "mumbleapp.com/grumble/pkg/freezer" "mumbleapp.com/grumble/pkg/mumbleproto" "mumbleapp.com/grumble/pkg/serverconf" - "io" - "io/ioutil" - "log" "os" "path/filepath" "strconv" diff --git a/grumble.go b/grumble.go index 378ff92..cee433e 100644 --- a/grumble.go +++ b/grumble.go @@ -7,9 +7,9 @@ package main import ( "flag" "fmt" + "log" "mumbleapp.com/grumble/pkg/blobstore" "mumbleapp.com/grumble/pkg/logtarget" - "log" "os" "path/filepath" "regexp" diff --git a/murmurdb.go b/murmurdb.go index 86f90be..dcf8e7f 100644 --- a/murmurdb.go +++ b/murmurdb.go @@ -10,11 +10,11 @@ package main // SQLite datbase into a format that Grumble can understand. import ( + "database/sql" "errors" + "log" "mumbleapp.com/grumble/pkg/ban" "mumbleapp.com/grumble/pkg/blobstore" - "database/sql" - "log" "net" "os" "path/filepath" diff --git a/pkg/blobstore/blobstore.go b/pkg/blobstore/blobstore.go index 5796d50..f7bf0f4 100644 --- a/pkg/blobstore/blobstore.go +++ b/pkg/blobstore/blobstore.go @@ -17,13 +17,13 @@ import ( ) type BlobStore struct { - dir string + dir string } var ( - ErrBadFile = errors.New("a bad file exists in the blobstore directory. unable to create container directores.") - ErrNoSuchKey = errors.New("no such key") - ErrInvalidKey = errors.New("invalid key") + ErrBadFile = errors.New("a bad file exists in the blobstore directory. unable to create container directores.") + ErrNoSuchKey = errors.New("no such key") + ErrInvalidKey = errors.New("invalid key") ) var ( @@ -143,7 +143,7 @@ func NewBlobStore(path string) (bs *BlobStore, err error) { } bs = &BlobStore{ - dir: path, + dir: path, } return bs, nil } @@ -281,4 +281,4 @@ func (bs *BlobStore) Put(buf []byte) (key string, err error) { } return key, nil -} \ No newline at end of file +} diff --git a/pkg/cryptstate/cryptstate.go b/pkg/cryptstate/cryptstate.go index 97f4b74..d3c0d0f 100644 --- a/pkg/cryptstate/cryptstate.go +++ b/pkg/cryptstate/cryptstate.go @@ -32,7 +32,7 @@ type CryptState struct { RemoteLost uint32 RemoteResync uint32 - cipher cipher.Block + cipher cipher.Block } func New() (cs *CryptState, err error) { diff --git a/pkg/freezer/walker.go b/pkg/freezer/walker.go index 54c47dc..a7d15cd 100644 --- a/pkg/freezer/walker.go +++ b/pkg/freezer/walker.go @@ -5,8 +5,8 @@ package freezer import ( - "encoding/binary" "code.google.com/p/goprotobuf/proto" + "encoding/binary" "hash" "hash/crc32" "io" diff --git a/pkg/packetdatastream/packetdatastream_test.go b/pkg/packetdatastream/packetdatastream_test.go index ebd5d23..fddffe0 100644 --- a/pkg/packetdatastream/packetdatastream_test.go +++ b/pkg/packetdatastream/packetdatastream_test.go @@ -1,9 +1,9 @@ package packetdatastream import ( - "testing" - "math" "crypto/rand" + "math" + "testing" ) func TestSelfUint8(t *testing.T) { diff --git a/pkg/replacefile/doc.go b/pkg/replacefile/doc.go index acf1839..f58f17f 100644 --- a/pkg/replacefile/doc.go +++ b/pkg/replacefile/doc.go @@ -1,6 +1,6 @@ -// Copyright (c) 2012 The Grumble Authors -// The use of this source code is goverened by a BSD-style -// license that can be found in the LICENSE-file. - -// Package replacefile implements access to the ReplaceFile Win32 API. -package replacefile \ No newline at end of file +// Copyright (c) 2012 The Grumble Authors +// The use of this source code is goverened by a BSD-style +// license that can be found in the LICENSE-file. + +// Package replacefile implements access to the ReplaceFile Win32 API. +package replacefile diff --git a/pkg/replacefile/flags.go b/pkg/replacefile/flags.go index 9ab9542..d09f856 100644 --- a/pkg/replacefile/flags.go +++ b/pkg/replacefile/flags.go @@ -1,12 +1,12 @@ -// Copyright (c) 2012 The Grumble Authors -// The use of this source code is goverened by a BSD-style -// license that can be found in the LICENSE-file. - -package replacefile - -type Flag uint32 - -const ( - IgnoreMergeErrors Flag = 0x2 - IgnoreACLErrors Flag = 0x4 -) \ No newline at end of file +// Copyright (c) 2012 The Grumble Authors +// The use of this source code is goverened by a BSD-style +// license that can be found in the LICENSE-file. + +package replacefile + +type Flag uint32 + +const ( + IgnoreMergeErrors Flag = 0x2 + IgnoreACLErrors Flag = 0x4 +) diff --git a/pkg/replacefile/replacefile_stub.go b/pkg/replacefile/replacefile_stub.go index da0b9e3..8e23f16 100644 --- a/pkg/replacefile/replacefile_stub.go +++ b/pkg/replacefile/replacefile_stub.go @@ -1,22 +1,22 @@ -// Copyright (c) 2012 The Grumble Authors -// The use of this source code is goverened by a BSD-style -// license that can be found in the LICENSE-file. - -// +build !windows - -package replacefile - -import ( - "errors" -) - -var ( - errOnlyWindows = errors.New("replacefile: only implemented on Windows") - ErrUnableToMoveReplacement error = errOnlyWindows - ErrUnableToMoveReplacement2 error = errOnlyOnWindows - ErrUnableToRemoveReplaced error = errOnlyWindows -) - -func ReplaceFile(replaced string, replacement string, backup string, flags Flag) error { - return errOnlyWindows -} \ No newline at end of file +// Copyright (c) 2012 The Grumble Authors +// The use of this source code is goverened by a BSD-style +// license that can be found in the LICENSE-file. + +// +build !windows + +package replacefile + +import ( + "errors" +) + +var ( + errOnlyWindows = errors.New("replacefile: only implemented on Windows") + ErrUnableToMoveReplacement error = errOnlyWindows + ErrUnableToMoveReplacement2 error = errOnlyOnWindows + ErrUnableToRemoveReplaced error = errOnlyWindows +) + +func ReplaceFile(replaced string, replacement string, backup string, flags Flag) error { + return errOnlyWindows +} diff --git a/server.go b/server.go index a8f1e1f..9862b87 100644 --- a/server.go +++ b/server.go @@ -15,6 +15,8 @@ import ( "encoding/hex" "errors" "fmt" + "hash" + "log" "mumbleapp.com/grumble/pkg/ban" "mumbleapp.com/grumble/pkg/blobstore" "mumbleapp.com/grumble/pkg/cryptstate" @@ -24,8 +26,6 @@ import ( "mumbleapp.com/grumble/pkg/mumbleproto" "mumbleapp.com/grumble/pkg/serverconf" "mumbleapp.com/grumble/pkg/sessionpool" - "hash" - "log" "net" "path/filepath" "strings" diff --git a/version.go b/version.go index 9dd491e..b4c5f2c 100644 --- a/version.go +++ b/version.go @@ -1,6 +1,6 @@ package main var ( - version = "1.0~devel" - buildDate = "unknown" + version = "1.0~devel" + buildDate = "unknown" )