Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2019-01-08 21:15:20 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2019-01-08 21:15:20 +0300
commitc2a5981b5deadc714970273441d6bda3e6db93f6 (patch)
tree152d8f7ac32a7c9cc7cd8d364cf574cfb1f98448
parent08830f194499786ef0c1a59351d70042932c3b4b (diff)
parent2d68536305ee0de06a53824dc1743bd04d562da2 (diff)
Merge branch 'megacheck-staticcheck' into 'master'
Switch from honnef.co/go/tools/megacheck to staticcheck See merge request gitlab-org/gitaly!1021
-rw-r--r--_support/makegen.go18
-rw-r--r--changelogs/unreleased/megacheck-staticcheck.yml5
-rw-r--r--internal/archive/tar_builder.go2
-rw-r--r--internal/git/lstree/last_commits.go2
-rw-r--r--internal/service/repository/create_from_snapshot_test.go2
-rw-r--r--internal/service/repository/write_ref.go8
-rw-r--r--internal/testhelper/testhelper.go10
7 files changed, 26 insertions, 21 deletions
diff --git a/_support/makegen.go b/_support/makegen.go
index 2a6a83380..3bd410f81 100644
--- a/_support/makegen.go
+++ b/_support/makegen.go
@@ -74,7 +74,7 @@ func (gm *gitalyMake) GoImports() string { return "bin/goimports" }
func (gm *gitalyMake) GoCovMerge() string { return "bin/gocovmerge" }
func (gm *gitalyMake) GoLint() string { return "bin/golint" }
func (gm *gitalyMake) GoVendor() string { return "bin/govendor" }
-func (gm *gitalyMake) MegaCheck() string { return "bin/megacheck" }
+func (gm *gitalyMake) StaticCheck() string { return filepath.Join(gm.BuildDir(), "bin/staticcheck") }
func (gm *gitalyMake) CoverageDir() string { return filepath.Join(gm.BuildDir(), "cover") }
func (gm *gitalyMake) GitalyRubyDir() string { return filepath.Join(gm.SourceDir(), "ruby") }
func (gm *gitalyMake) GitlabShellRelDir() string { return "ruby/vendor/gitlab-shell" }
@@ -325,7 +325,7 @@ rspec: assemble-go prepare-tests
cd {{ .GitalyRubyDir }} && bundle exec rspec
.PHONY: verify
-verify: lint check-formatting megacheck govendor-status notice-up-to-date govendor-tagged rubocop
+verify: lint check-formatting staticcheck govendor-status notice-up-to-date govendor-tagged rubocop
.PHONY: lint
lint: {{ .GoLint }}
@@ -349,14 +349,14 @@ format: {{ .GoImports }}
# so it can be used as a replacement.
@cd {{ .SourceDir }} && goimports -w -l {{ join .GoFiles " " }}
-.PHONY: megacheck
-megacheck: {{ .MegaCheck }}
- # megacheck
- @{{ .MegaCheck }} {{ join .AllPackages " " }}
+.PHONY: staticcheck
+staticcheck: {{ .StaticCheck }}
+ # staticcheck
+ @cd {{ .SourceDir }} && {{ .StaticCheck }} {{ join .AllPackages " " }}
-# Install megacheck
-{{ .MegaCheck }}:
- go get honnef.co/go/tools/cmd/megacheck
+# Install staticcheck
+{{ .StaticCheck }}:
+ go get honnef.co/go/tools/cmd/staticcheck
.PHONY: govendor-status
govendor-status: {{ .GoVendor }}
diff --git a/changelogs/unreleased/megacheck-staticcheck.yml b/changelogs/unreleased/megacheck-staticcheck.yml
new file mode 100644
index 000000000..4bb45552c
--- /dev/null
+++ b/changelogs/unreleased/megacheck-staticcheck.yml
@@ -0,0 +1,5 @@
+---
+title: Switch from honnef.co/go/tools/megacheck to staticcheck
+merge_request: 1021
+author:
+type: other
diff --git a/internal/archive/tar_builder.go b/internal/archive/tar_builder.go
index a8bd06e26..cccd13c23 100644
--- a/internal/archive/tar_builder.go
+++ b/internal/archive/tar_builder.go
@@ -47,7 +47,7 @@ func (t *TarBuilder) setErr(err error) error {
func (t *TarBuilder) entry(fi os.FileInfo, filename string, r io.Reader) error {
if !fi.Mode().IsRegular() && !fi.Mode().IsDir() {
- return fmt.Errorf("Unsupported mode for %v: %v", filename, fi.Mode())
+ return fmt.Errorf("unsupported mode for %v: %v", filename, fi.Mode())
}
hdr, err := tar.FileInfoHeader(fi, "")
diff --git a/internal/git/lstree/last_commits.go b/internal/git/lstree/last_commits.go
index fd75596d5..d0ef06dc5 100644
--- a/internal/git/lstree/last_commits.go
+++ b/internal/git/lstree/last_commits.go
@@ -35,7 +35,7 @@ const (
)
// ErrParse is returned when the parse of an entry was unsuccessful
-var ErrParse = errors.New("Failed to parse git ls-tree response")
+var ErrParse = errors.New("failed to parse git ls-tree response")
func (e Entries) Len() int {
return len(e)
diff --git a/internal/service/repository/create_from_snapshot_test.go b/internal/service/repository/create_from_snapshot_test.go
index a308e0e9f..bfbb2258c 100644
--- a/internal/service/repository/create_from_snapshot_test.go
+++ b/internal/service/repository/create_from_snapshot_test.go
@@ -29,7 +29,7 @@ type testhandler struct {
func (h *testhandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("Authorization") != secret {
- http.Error(w, "Unuthorized", 401)
+ http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
diff --git a/internal/service/repository/write_ref.go b/internal/service/repository/write_ref.go
index f9b193bac..600646eb8 100644
--- a/internal/service/repository/write_ref.go
+++ b/internal/service/repository/write_ref.go
@@ -57,19 +57,19 @@ func updateRef(ctx context.Context, req *gitalypb.WriteRefRequest) error {
func validateWriteRefRequest(req *gitalypb.WriteRefRequest) error {
if err := git.ValidateRevision(req.Ref); err != nil {
- return fmt.Errorf("Validate Ref: %v", err)
+ return fmt.Errorf("invalid ref: %v", err)
}
if err := git.ValidateRevision(req.Revision); err != nil {
- return fmt.Errorf("Validate Revision: %v", err)
+ return fmt.Errorf("invalid revision: %v", err)
}
if len(req.OldRevision) > 0 {
if err := git.ValidateRevision(req.OldRevision); err != nil {
- return fmt.Errorf("Validate OldRevision: %v", err)
+ return fmt.Errorf("invalid OldRevision: %v", err)
}
}
if !bytes.Equal(req.Ref, []byte("HEAD")) && !bytes.HasPrefix(req.Ref, []byte("refs/")) {
- return fmt.Errorf("Ref has to be a full reference")
+ return fmt.Errorf("ref has to be a full reference")
}
return nil
}
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go
index b79bfa709..2492ee833 100644
--- a/internal/testhelper/testhelper.go
+++ b/internal/testhelper/testhelper.go
@@ -189,19 +189,19 @@ func AuthorsEqual(a *gitalypb.CommitAuthor, b *gitalypb.CommitAuthor) bool {
// GitCommitEqual tests if two `GitCommit`s are equal
func GitCommitEqual(a, b *gitalypb.GitCommit) error {
if !authorSortofEqual(a.GetAuthor(), b.GetAuthor()) {
- return fmt.Errorf("Author does not match: %v != %v", a.GetAuthor(), b.GetAuthor())
+ return fmt.Errorf("author does not match: %v != %v", a.GetAuthor(), b.GetAuthor())
}
if !authorSortofEqual(a.GetCommitter(), b.GetCommitter()) {
- return fmt.Errorf("Commiter does not match: %v != %v", a.GetCommitter(), b.GetCommitter())
+ return fmt.Errorf("commiter does not match: %v != %v", a.GetCommitter(), b.GetCommitter())
}
if !bytes.Equal(a.GetBody(), b.GetBody()) {
- return fmt.Errorf("Body differs: %q != %q", a.GetBody(), b.GetBody())
+ return fmt.Errorf("body differs: %q != %q", a.GetBody(), b.GetBody())
}
if !bytes.Equal(a.GetSubject(), b.GetSubject()) {
- return fmt.Errorf("Subject differs: %q != %q", a.GetSubject(), b.GetSubject())
+ return fmt.Errorf("subject differs: %q != %q", a.GetSubject(), b.GetSubject())
}
if strings.Compare(a.GetId(), b.GetId()) != 0 {
- return fmt.Errorf("Id does not match: %q != %q", a.GetId(), b.GetId())
+ return fmt.Errorf("id does not match: %q != %q", a.GetId(), b.GetId())
}
if len(a.GetParentIds()) != len(b.GetParentIds()) {
return fmt.Errorf("ParentId does not match: %v != %v", a.GetParentIds(), b.GetParentIds())