From 5059f0bee6d65e6f73b0593fec5f22a3c149ceb1 Mon Sep 17 00:00:00 2001 From: Kirill Muratov Date: Fri, 22 Mar 2019 23:05:19 +0300 Subject: [PATCH] Fixes for govet --- .golangci.yml | 1 - source/github/github.go | 10 +++++----- source/gitlab/gitlab.go | 10 +++++----- source/go_bindata/go-bindata.go | 10 +++++----- source/godoc_vfs/vfs.go | 10 +++++----- source/stub/stub.go | 10 +++++----- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a856e64..0373972 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,5 +8,4 @@ output: linters: disable: - errcheck - - govet - staticcheck diff --git a/source/github/github.go b/source/github/github.go index 8a8bc0d..0ff3eba 100644 --- a/source/github/github.go +++ b/source/github/github.go @@ -126,7 +126,7 @@ func (g *Github) Close() error { func (g *Github) First() (version uint, er error) { if v, ok := g.migrations.First(); !ok { - return 0, &os.PathError{"first", g.path, os.ErrNotExist} + return 0, &os.PathError{Op: "first", Path: g.path, Err: os.ErrNotExist} } else { return v, nil } @@ -134,7 +134,7 @@ func (g *Github) First() (version uint, er error) { func (g *Github) Prev(version uint) (prevVersion uint, err error) { if v, ok := g.migrations.Prev(version); !ok { - return 0, &os.PathError{fmt.Sprintf("prev for version %v", version), g.path, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("prev for version %v", version), Path: g.path, Err: os.ErrNotExist} } else { return v, nil } @@ -142,7 +142,7 @@ func (g *Github) Prev(version uint) (prevVersion uint, err error) { func (g *Github) Next(version uint) (nextVersion uint, err error) { if v, ok := g.migrations.Next(version); !ok { - return 0, &os.PathError{fmt.Sprintf("next for version %v", version), g.path, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("next for version %v", version), Path: g.path, Err: os.ErrNotExist} } else { return v, nil } @@ -162,7 +162,7 @@ func (g *Github) ReadUp(version uint) (r io.ReadCloser, identifier string, err e return ioutil.NopCloser(strings.NewReader(r)), m.Identifier, nil } } - return nil, "", &os.PathError{fmt.Sprintf("read version %v", version), g.path, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: g.path, Err: os.ErrNotExist} } func (g *Github) ReadDown(version uint) (r io.ReadCloser, identifier string, err error) { @@ -179,5 +179,5 @@ func (g *Github) ReadDown(version uint) (r io.ReadCloser, identifier string, err return ioutil.NopCloser(strings.NewReader(r)), m.Identifier, nil } } - return nil, "", &os.PathError{fmt.Sprintf("read version %v", version), g.path, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: g.path, Err: os.ErrNotExist} } diff --git a/source/gitlab/gitlab.go b/source/gitlab/gitlab.go index c158bcc..5dd20c9 100644 --- a/source/gitlab/gitlab.go +++ b/source/gitlab/gitlab.go @@ -159,7 +159,7 @@ func (g *Gitlab) Close() error { func (g *Gitlab) First() (version uint, er error) { if v, ok := g.migrations.First(); !ok { - return 0, &os.PathError{"first", g.path, os.ErrNotExist} + return 0, &os.PathError{Op: "first", Path: g.path, Err: os.ErrNotExist} } else { return v, nil } @@ -167,7 +167,7 @@ func (g *Gitlab) First() (version uint, er error) { func (g *Gitlab) Prev(version uint) (prevVersion uint, err error) { if v, ok := g.migrations.Prev(version); !ok { - return 0, &os.PathError{fmt.Sprintf("prev for version %v", version), g.path, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("prev for version %v", version), Path: g.path, Err: os.ErrNotExist} } else { return v, nil } @@ -175,7 +175,7 @@ func (g *Gitlab) Prev(version uint) (prevVersion uint, err error) { func (g *Gitlab) Next(version uint) (nextVersion uint, err error) { if v, ok := g.migrations.Next(version); !ok { - return 0, &os.PathError{fmt.Sprintf("next for version %v", version), g.path, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("next for version %v", version), Path: g.path, Err: os.ErrNotExist} } else { return v, nil } @@ -200,7 +200,7 @@ func (g *Gitlab) ReadUp(version uint) (r io.ReadCloser, identifier string, err e return ioutil.NopCloser(strings.NewReader(string(content))), m.Identifier, nil } - return nil, "", &os.PathError{fmt.Sprintf("read version %v", version), g.path, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: g.path, Err: os.ErrNotExist} } func (g *Gitlab) ReadDown(version uint) (r io.ReadCloser, identifier string, err error) { @@ -222,5 +222,5 @@ func (g *Gitlab) ReadDown(version uint) (r io.ReadCloser, identifier string, err return ioutil.NopCloser(strings.NewReader(string(content))), m.Identifier, nil } - return nil, "", &os.PathError{fmt.Sprintf("read version %v", version), g.path, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: g.path, Err: os.ErrNotExist} } diff --git a/source/go_bindata/go-bindata.go b/source/go_bindata/go-bindata.go index d94758e..5bd7bd8 100644 --- a/source/go_bindata/go-bindata.go +++ b/source/go_bindata/go-bindata.go @@ -74,7 +74,7 @@ func (b *Bindata) Close() error { func (b *Bindata) First() (version uint, err error) { if v, ok := b.migrations.First(); !ok { - return 0, &os.PathError{"first", b.path, os.ErrNotExist} + return 0, &os.PathError{Op: "first", Path: b.path, Err: os.ErrNotExist} } else { return v, nil } @@ -82,7 +82,7 @@ func (b *Bindata) First() (version uint, err error) { func (b *Bindata) Prev(version uint) (prevVersion uint, err error) { if v, ok := b.migrations.Prev(version); !ok { - return 0, &os.PathError{fmt.Sprintf("prev for version %v", version), b.path, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("prev for version %v", version), Path: b.path, Err: os.ErrNotExist} } else { return v, nil } @@ -90,7 +90,7 @@ func (b *Bindata) Prev(version uint) (prevVersion uint, err error) { func (b *Bindata) Next(version uint) (nextVersion uint, err error) { if v, ok := b.migrations.Next(version); !ok { - return 0, &os.PathError{fmt.Sprintf("next for version %v", version), b.path, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("next for version %v", version), Path: b.path, Err: os.ErrNotExist} } else { return v, nil } @@ -104,7 +104,7 @@ func (b *Bindata) ReadUp(version uint) (r io.ReadCloser, identifier string, err } return ioutil.NopCloser(bytes.NewReader(body)), m.Identifier, nil } - return nil, "", &os.PathError{fmt.Sprintf("read version %v", version), b.path, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: b.path, Err: os.ErrNotExist} } func (b *Bindata) ReadDown(version uint) (r io.ReadCloser, identifier string, err error) { @@ -115,5 +115,5 @@ func (b *Bindata) ReadDown(version uint) (r io.ReadCloser, identifier string, er } return ioutil.NopCloser(bytes.NewReader(body)), m.Identifier, nil } - return nil, "", &os.PathError{fmt.Sprintf("read version %v", version), b.path, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: b.path, Err: os.ErrNotExist} } diff --git a/source/godoc_vfs/vfs.go b/source/godoc_vfs/vfs.go index 03e5898..478c230 100644 --- a/source/godoc_vfs/vfs.go +++ b/source/godoc_vfs/vfs.go @@ -83,7 +83,7 @@ func (b *VFS) Close() error { func (b *VFS) First() (version uint, err error) { v, ok := b.migrations.First() if !ok { - return 0, &os.PathError{"first", "://" + b.path, os.ErrNotExist} + return 0, &os.PathError{Op: "first", Path: "://" + b.path, Err: os.ErrNotExist} } return v, nil } @@ -93,7 +93,7 @@ func (b *VFS) First() (version uint, err error) { func (b *VFS) Prev(version uint) (prevVersion uint, err error) { v, ok := b.migrations.Prev(version) if !ok { - return 0, &os.PathError{fmt.Sprintf("prev for version %v", version), "://" + b.path, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("prev for version %v", version), Path: "://" + b.path, Err: os.ErrNotExist} } return v, nil } @@ -103,7 +103,7 @@ func (b *VFS) Prev(version uint) (prevVersion uint, err error) { func (b *VFS) Next(version uint) (nextVersion uint, err error) { v, ok := b.migrations.Next(version) if !ok { - return 0, &os.PathError{fmt.Sprintf("next for version %v", version), "://" + b.path, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("next for version %v", version), Path: "://" + b.path, Err: os.ErrNotExist} } return v, nil } @@ -120,7 +120,7 @@ func (b *VFS) ReadUp(version uint) (r io.ReadCloser, identifier string, err erro } return ioutil.NopCloser(bytes.NewReader(body)), m.Identifier, nil } - return nil, "", &os.PathError{fmt.Sprintf("read version %v", version), "://" + b.path, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: "://" + b.path, Err: os.ErrNotExist} } // ReadDown returns the down migration body and an identifier that helps with @@ -133,5 +133,5 @@ func (b *VFS) ReadDown(version uint) (r io.ReadCloser, identifier string, err er } return ioutil.NopCloser(bytes.NewReader(body)), m.Identifier, nil } - return nil, "", &os.PathError{fmt.Sprintf("read version %v", version), "://" + b.path, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: "://" + b.path, Err: os.ErrNotExist} } diff --git a/source/stub/stub.go b/source/stub/stub.go index 839a686..a777609 100644 --- a/source/stub/stub.go +++ b/source/stub/stub.go @@ -48,7 +48,7 @@ func (s *Stub) Close() error { func (s *Stub) First() (version uint, err error) { if v, ok := s.Migrations.First(); !ok { - return 0, &os.PathError{"first", s.Url, os.ErrNotExist} // TODO: s.Url can be empty when called with WithInstance + return 0, &os.PathError{Op: "first", Path: s.Url, Err: os.ErrNotExist} // TODO: s.Url can be empty when called with WithInstance } else { return v, nil } @@ -56,7 +56,7 @@ func (s *Stub) First() (version uint, err error) { func (s *Stub) Prev(version uint) (prevVersion uint, err error) { if v, ok := s.Migrations.Prev(version); !ok { - return 0, &os.PathError{fmt.Sprintf("prev for version %v", version), s.Url, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("prev for version %v", version), Path: s.Url, Err: os.ErrNotExist} } else { return v, nil } @@ -64,7 +64,7 @@ func (s *Stub) Prev(version uint) (prevVersion uint, err error) { func (s *Stub) Next(version uint) (nextVersion uint, err error) { if v, ok := s.Migrations.Next(version); !ok { - return 0, &os.PathError{fmt.Sprintf("next for version %v", version), s.Url, os.ErrNotExist} + return 0, &os.PathError{Op: fmt.Sprintf("next for version %v", version), Path: s.Url, Err: os.ErrNotExist} } else { return v, nil } @@ -74,12 +74,12 @@ func (s *Stub) ReadUp(version uint) (r io.ReadCloser, identifier string, err err if m, ok := s.Migrations.Up(version); ok { return ioutil.NopCloser(bytes.NewBufferString(m.Identifier)), fmt.Sprintf("%v.up.stub", version), nil } - return nil, "", &os.PathError{fmt.Sprintf("read up version %v", version), s.Url, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read up version %v", version), Path: s.Url, Err: os.ErrNotExist} } func (s *Stub) ReadDown(version uint) (r io.ReadCloser, identifier string, err error) { if m, ok := s.Migrations.Down(version); ok { return ioutil.NopCloser(bytes.NewBufferString(m.Identifier)), fmt.Sprintf("%v.down.stub", version), nil } - return nil, "", &os.PathError{fmt.Sprintf("read down version %v", version), s.Url, os.ErrNotExist} + return nil, "", &os.PathError{Op: fmt.Sprintf("read down version %v", version), Path: s.Url, Err: os.ErrNotExist} }