Enable golangci-lint (#49)

## Summary:
It would be nice to have some linting beyond `go vet`!  Now we do.  I
started by copying the config from Khan/webapp.  I did remove a couple
of staticcheck checks that I didn't feel were useful.  (Note also that
exportloopref is the replacement for scopelint in newer golangci-lint.)

Included are all the needed lint fixes; most are stylistic but the
changes in the example are a (minor) bugfix.

Fixes #22.
Issue: https://github.com/Khan/genqlient/issues/22

## Test plan:
make check

Author: benjaminjkraft

Reviewers: aberkan, dnerdy, benjaminjkraft, csilvers, MiguelCastillo

Required Reviewers: 

Approved by: aberkan, dnerdy

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint

Pull request URL: https://github.com/Khan/genqlient/pull/49
This commit is contained in:
Ben Kraft
2021-08-20 10:39:12 -07:00
committed by GitHub
parent 832c0bf855
commit 700392315a
16 changed files with 1338 additions and 26 deletions
+3 -3
View File
@@ -281,8 +281,8 @@ func (builder *typeBuilder) writeType(name, namePrefix string, typ *ast.Type, fi
def := builder.schema.Types[typ.Name()]
goName, ok := builder.Config.Scalars[def.Name]
if ok {
name, err := builder.addRef(goName)
builder.WriteString(name)
newName, err := builder.addRef(goName)
builder.WriteString(newName)
return err
}
goName, ok = builtinTypes[def.Name]
@@ -303,7 +303,7 @@ func (builder *typeBuilder) writeTypedef(
typedef *ast.Definition,
pos *ast.Position,
fields []field,
options *GenqlientDirective,
options *GenqlientDirective, //nolint:unparam // it is used!
description string, // defaults to typedef.Description
) (err error) {
defer func() {