Skip to content

all: golanglint-ci clean except errcheck

Warren Gifford requested to merge core/lint-clean into master

Created by: keegancsmith

This commit fixes all golanglint-ci errors, except for those reported by errcheck.

golangci-lint run -D errcheck ./...

Interesting problems it found:

  • cmd/frontend/docsite is an unused package
  • conf.configurationServerFrontendOnly is only every written to, never read
  • packages.LoadFile is deprecated. Got to use a more efficient Mode.

Here is the complete report:

  cmd/frontend/graphqlbackend/textsearch_test.go:739:11: copylocks: assignment copies lock value to rev: github.com/sourcegraph/sourcegraph/cmd/frontend/internal/pkg/search.RepositoryRevisions contains sync.Mutex (govet)
  			rev := *r
  			       ^
  cmd/frontend/internal/cli/http.go:86:19: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
  			fmt.Fprintf(w, version.Version())
  			               ^
  cmd/frontend/internal/app/templates/data.go:15:52: SA1019: packages.LoadFiles is deprecated: LoadFiles exists for historical compatibility and should not be used. Please directly specify the needed fields using the Need values.  (staticcheck)
  	pkgs, err := packages.Load(&packages.Config{Mode: packages.LoadFiles}, importPath)
  	                                                  ^
  enterprise/cmd/frontend/internal/authz/bitbucketserver/store.go:378:2: SA4006: this value of `ctx` is never used (staticcheck)
  	ctx, save := s.observe(ctx, "update", "")
  	^
  internal/vcs/git/refs_test.go:91:4: SA9003: empty branch (staticcheck)
  			if !reflect.DeepEqual(branches, mergedInto) {
  			^
  internal/rcache/rcache_test.go:14:3: `ttl` is unused (structcheck)
  		ttl int
  		^
  cmd/frontend/auth/user_test.go:465:2: `getByUsernameErr` is unused (structcheck)
  	getByUsernameErr        error
  	^
  cmd/repo-updater/repoupdater/server_test.go:1135:2: `queue` is unused (structcheck)
  	queue repos.Repos
  	^
  cmd/frontend/docsite/data_dev.go:8:5: `content` is unused (varcheck)
  var content = http.Dir("doc") // top-level doc dir
      ^
  cmd/gitserver/server/cleanup_test.go:23:2: `testRepoB` is unused (varcheck)
  	testRepoB = "testrepo-B"
  	^
  internal/conf/conf.go:63:2: var `configurationServerFrontendOnly` is unused (unused)
  	configurationServerFrontendOnly            *Server
  	^
  enterprise/cmd/frontend/internal/authz/github/github.go:360:20: func `(*Provider).fetchUserRepo` is unused (unused)
  func (p *Provider) fetchUserRepo(ctx context.Context, userAccount *extsvc.ExternalAccount, repoID string) (canAccess bool, isPublic bool, err error) {

Merge request reports

Loading