From 5990aeb7198a4961a363eeb422a3faa57c8dc029 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Tue, 6 Dec 2016 23:17:16 +0100 Subject: revision based on goreportcard.com --- examples/remotes/main.go | 2 +- file_test.go | 1 + plumbing/format/packfile/scanner.go | 2 +- plumbing/format/pktline/scanner.go | 2 +- plumbing/protocol/packp/advrefs.go | 2 +- plumbing/protocol/packp/advrefs_decode.go | 4 ++-- plumbing/protocol/packp/advrefs_encode.go | 4 ++-- plumbing/protocol/packp/sideband/demux.go | 6 +++--- plumbing/protocol/packp/sideband/muxer.go | 2 +- plumbing/protocol/packp/ulreq_test.go | 4 ++-- plumbing/storer/object.go | 2 +- plumbing/transport/common.go | 4 ++-- plumbing/transport/internal/common/common.go | 1 - repository_test.go | 2 +- storage/filesystem/internal/dotgit/dotgit_test.go | 1 + storage/test/storage_suite.go | 1 + tree_diff_test.go | 2 +- utils/fs/os/os_test.go | 2 +- 18 files changed, 23 insertions(+), 21 deletions(-) diff --git a/examples/remotes/main.go b/examples/remotes/main.go index 3ccecd7..976c56d 100644 --- a/examples/remotes/main.go +++ b/examples/remotes/main.go @@ -47,7 +47,7 @@ func main() { refs, _ := r.Refs() refs.ForEach(func(ref *plumbing.Reference) error { - // The HEAD is ommitted in a `git show-ref` so we ignore the symbolic + // The HEAD is omitted in a `git show-ref` so we ignore the symbolic // references, the HEAD if ref.Type() == plumbing.SymbolicReference { return nil diff --git a/file_test.go b/file_test.go index a7067f3..507dbc4 100644 --- a/file_test.go +++ b/file_test.go @@ -203,6 +203,7 @@ func (s *FileSuite) TestFileIter(c *C) { c.Assert(err, IsNil) tree, err := commit.Tree() + c.Assert(err, IsNil) expected := []string{ ".gitignore", diff --git a/plumbing/format/packfile/scanner.go b/plumbing/format/packfile/scanner.go index 3adc26a..1a85639 100644 --- a/plumbing/format/packfile/scanner.go +++ b/plumbing/format/packfile/scanner.go @@ -292,7 +292,7 @@ func (s *Scanner) copyObject(w io.Writer) (int64, error) { // Seek sets a new offset from start, returns the old position before the change func (s *Scanner) Seek(offset int64) (previous int64, err error) { - // if seeking we asume that you are not interested on the header + // if seeking we assume that you are not interested on the header if s.version == 0 { s.version = VersionSupported } diff --git a/plumbing/format/pktline/scanner.go b/plumbing/format/pktline/scanner.go index 4eec18c..4af254f 100644 --- a/plumbing/format/pktline/scanner.go +++ b/plumbing/format/pktline/scanner.go @@ -77,7 +77,7 @@ func (s *Scanner) Bytes() []byte { } // Method readPayloadLen returns the payload length by reading the -// pkt-len and substracting the pkt-len size. +// pkt-len and subtracting the pkt-len size. func (s *Scanner) readPayloadLen() (int, error) { if _, err := io.ReadFull(s.r, s.len[:]); err != nil { if err == io.ErrUnexpectedEOF { diff --git a/plumbing/protocol/packp/advrefs.go b/plumbing/protocol/packp/advrefs.go index 4e031fb..7d644bc 100644 --- a/plumbing/protocol/packp/advrefs.go +++ b/plumbing/protocol/packp/advrefs.go @@ -24,7 +24,7 @@ type AdvRefs struct { // Moreover, some (all) git HTTP smart servers will send a flush-pkt // just after the first pkt-line. // - // To accomodate both situations, the Prefix field allow you to store + // To accommodate both situations, the Prefix field allow you to store // any data you want to send before the actual pktlines. It will also // be filled up with whatever is found on the line. Prefix [][]byte diff --git a/plumbing/protocol/packp/advrefs_decode.go b/plumbing/protocol/packp/advrefs_decode.go index c42c589..fddd69b 100644 --- a/plumbing/protocol/packp/advrefs_decode.go +++ b/plumbing/protocol/packp/advrefs_decode.go @@ -119,8 +119,8 @@ func isPrefix(payload []byte) bool { return len(payload) > 0 && payload[0] == '#' } -// If the first hash is zero, then a no-refs is comming. Otherwise, a -// list-of-refs is comming, and the hash will be followed by the first +// If the first hash is zero, then a no-refs is coming. Otherwise, a +// list-of-refs is coming, and the hash will be followed by the first // advertised ref. func decodeFirstHash(p *advRefsDecoder) decoderStateFn { // If the repository is empty, we receive a flush here (HTTP). diff --git a/plumbing/protocol/packp/advrefs_encode.go b/plumbing/protocol/packp/advrefs_encode.go index 05a9c8e..e981120 100644 --- a/plumbing/protocol/packp/advrefs_encode.go +++ b/plumbing/protocol/packp/advrefs_encode.go @@ -12,8 +12,8 @@ import ( // Encode writes the AdvRefs encoding to a writer. // -// All the payloads will end with a newline character. Capabilities, -// references and shallows are writen in alphabetical order, except for +// All the payloads will end with a newline character. Capabilities, +// references and shallows are written in alphabetical order, except for // peeled references that always follow their corresponding references. func (a *AdvRefs) Encode(w io.Writer) error { e := newAdvRefsEncoder(w) diff --git a/plumbing/protocol/packp/sideband/demux.go b/plumbing/protocol/packp/sideband/demux.go index 09fe57d..1669ed4 100644 --- a/plumbing/protocol/packp/sideband/demux.go +++ b/plumbing/protocol/packp/sideband/demux.go @@ -20,17 +20,17 @@ type Progress interface { // Demuxer demultiplex the progress reports and error info interleaved with the // packfile itself. // -// A sideband has three diferent channels the main one call PackData contains +// A sideband has three different channels the main one call PackData contains // the packfile data, the ErrorMessage channel, that contains server errors and // the last one ProgressMessage channel containing information about the ongoing -// tast happening in the server (optinal, can be suppressed sending NoProgress +// task happening in the server (optinal, can be suppressed sending NoProgress // or Quiet capabilities to the server) // // In order to demultiplex the data stream, method `Read` should be called to // retrieve the PackData channel, the incoming data from the ProgressMessage is // stored and can be read from `Progress` field, if any message is retrieved // from the ErrorMessage channel an error is returned and we can assume that the -// conection has been closed. +// connection has been closed. type Demuxer struct { t Type r io.Reader diff --git a/plumbing/protocol/packp/sideband/muxer.go b/plumbing/protocol/packp/sideband/muxer.go index 2ab7da8..45fecc2 100644 --- a/plumbing/protocol/packp/sideband/muxer.go +++ b/plumbing/protocol/packp/sideband/muxer.go @@ -19,7 +19,7 @@ const chLen = 1 // // If t is equal to `Sideband` the max pack size is set to MaxPackedSize, in any // other value is given, max pack is set to MaxPackedSize64k, that is the -// maximum lenght of a line in pktline format. +// maximum length of a line in pktline format. func NewMuxer(t Type, w io.Writer) *Muxer { max := MaxPackedSize64k if t == Sideband { diff --git a/plumbing/protocol/packp/ulreq_test.go b/plumbing/protocol/packp/ulreq_test.go index 53626ee..177cf0e 100644 --- a/plumbing/protocol/packp/ulreq_test.go +++ b/plumbing/protocol/packp/ulreq_test.go @@ -112,7 +112,7 @@ func (s *UlReqSuite) TestValidateConflictMultiACK(c *C) { c.Assert(err, NotNil) } -func ExampleUlReqEncoder_Encode() { +func ExampleUploadRequest_Encode() { // Create an empty UlReq with the contents you want... ur := NewUploadRequest() @@ -147,7 +147,7 @@ func ExampleUlReqEncoder_Encode() { // 0000 } -func ExampleUlReqDecoder_Decode() { +func ExampleUploadRequest_Decode() { // Here is a raw advertised-ref message. raw := "" + "005bwant 1111111111111111111111111111111111111111 ofs-delta symref=HEAD:/refs/heads/master\n" + diff --git a/plumbing/storer/object.go b/plumbing/storer/object.go index c7841b6..60b9171 100644 --- a/plumbing/storer/object.go +++ b/plumbing/storer/object.go @@ -45,7 +45,7 @@ type Transactioner interface { // PackfileWriter is a optional method for ObjectStorer, it enable direct write // of packfile to the storage type PackfileWriter interface { - // PackfileWriter retuns a writer for writing a packfile to the storage + // PackfileWriter returns a writer for writing a packfile to the storage // // If the Storer not implements PackfileWriter the objects should be written // using the Set method. diff --git a/plumbing/transport/common.go b/plumbing/transport/common.go index 2379422..73b7d27 100644 --- a/plumbing/transport/common.go +++ b/plumbing/transport/common.go @@ -3,9 +3,9 @@ // // `Client` can be used to fetch and send packfiles to a git server. // The `client` package provides higher level functions to instantiate the -// appropiate `Client` based on the repository URL. +// appropriate `Client` based on the repository URL. // -// Go-git supports HTTP and SSH (see `Protocols`), but you can also install +// go-git supports HTTP and SSH (see `Protocols`), but you can also install // your own protocols (see the `client` package). // // Each protocol has its own implementation of `Client`, but you should diff --git a/plumbing/transport/internal/common/common.go b/plumbing/transport/internal/common/common.go index f6aa204..11c86ef 100644 --- a/plumbing/transport/internal/common/common.go +++ b/plumbing/transport/internal/common/common.go @@ -277,7 +277,6 @@ func (s *session) checkNotFoundError() error { return fmt.Errorf("unknown error: %s", line) } - return nil } var ( diff --git a/repository_test.go b/repository_test.go index a0c79a3..adc722c 100644 --- a/repository_test.go +++ b/repository_test.go @@ -461,7 +461,7 @@ func executeOnPath(path, cmd string) error { c.Stderr = buf c.Stdout = buf - defer func() { fmt.Println(buf.String()) }() + //defer func() { fmt.Println(buf.String()) }() return c.Run() } diff --git a/storage/filesystem/internal/dotgit/dotgit_test.go b/storage/filesystem/internal/dotgit/dotgit_test.go index bcd8d96..3a1f194 100644 --- a/storage/filesystem/internal/dotgit/dotgit_test.go +++ b/storage/filesystem/internal/dotgit/dotgit_test.go @@ -181,6 +181,7 @@ func (s *SuiteDotGit) TestObjectPackNotFound(c *C) { c.Assert(pack, IsNil) idx, err := dir.ObjectPackIdx(plumbing.ZeroHash) + c.Assert(err, Equals, ErrPackfileNotFound) c.Assert(idx, IsNil) } diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go index d5e1464..22225a5 100644 --- a/storage/test/storage_suite.go +++ b/storage/test/storage_suite.go @@ -184,6 +184,7 @@ func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndGetObject(c *C) { c.Assert(h.String(), Equals, expected.Hash) o, err := tx.Object(expected.Type, plumbing.NewHash(expected.Hash)) + c.Assert(err, IsNil) c.Assert(o.Hash().String(), DeepEquals, expected.Hash) } } diff --git a/tree_diff_test.go b/tree_diff_test.go index e7e41c7..e78fbf1 100644 --- a/tree_diff_test.go +++ b/tree_diff_test.go @@ -32,7 +32,7 @@ func (s *DiffTreeSuite) TestActionString(c *C) { c.Assert(obtained, Equals, expected) action = 37 - c.Assert(func() { action.String() }, + c.Assert(func() { _ = action.String() }, PanicMatches, "unsupported action: 37") } diff --git a/utils/fs/os/os_test.go b/utils/fs/os/os_test.go index 2bb9391..5e8f5c1 100644 --- a/utils/fs/os/os_test.go +++ b/utils/fs/os/os_test.go @@ -30,7 +30,7 @@ func (s *OSSuite) TearDownTest(c *C) { } func (s *OSSuite) TestOpenDoesNotCreateDir(c *C) { - _, err := s.Fs.Open("dir/non-existant") + _, err := s.Fs.Open("dir/non-existent") c.Assert(err, NotNil) _, err = stdos.Stat(filepath.Join(s.path, "dir")) c.Assert(stdos.IsNotExist(err), Equals, true) -- cgit