Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: fix golangci lint errors in the codebase #478

Merged
merged 1 commit into from
Dec 13, 2021

Commits on Dec 10, 2021

  1. all: fix golangci lint errors in the codebase

    Added a base golangci-config to the codebase to get
    started. Some more changes are pending, and those
    checks are commented out in the config.
    
    Once this gets merged, we can work on enabling those
    gradually.
    
    For full reference, here are the errors which were fixed:
    
    ```
    example/scalar_map/types/map.go:5: File is not `gofmt`-ed with `-s` (gofmt)
    type Map map[string]interface {}
    internal/common/lexer_test.go:97: File is not `gofmt`-ed with `-s` (gofmt)
    var multilineStringTests = []consumeTestCase {
    internal/schema/schema_test.go:472: File is not `gofmt`-ed with `-s` (gofmt)
                                            "Coloured": struct{}{},
                                            "Named":    struct{}{},
                                            "Numbered": struct{}{},
    relay/relay.go:43:30: unnecessary conversion (unconvert)
            return json.Unmarshal([]byte(s[i+1:]), v)
                                        ^
    internal/exec/resolvable/meta.go:45:15: S1039: unnecessary use of fmt.Sprintf (gosimple)
                    TraceLabel: fmt.Sprintf("GraphQL field: __typename"),
                                ^
    internal/exec/resolvable/meta.go:53:15: S1039: unnecessary use of fmt.Sprintf (gosimple)
                    TraceLabel: fmt.Sprintf("GraphQL field: __schema"),
                                ^
    internal/exec/resolvable/meta.go:61:15: S1039: unnecessary use of fmt.Sprintf (gosimple)
                    TraceLabel: fmt.Sprintf("GraphQL field: __type"),
                                ^
    internal/exec/selected/selected.go:179:7: shadow: declaration of "ok" shadows declaration at line 177 (govet)
                            a, ok := e.TypeAssertions[frag.On.Name]
                               ^
    internal/schema/schema_test.go:864:8: shadow: declaration of "err" shadows declaration at line 859 (govet)
                                    if err := test.validateError(err); err != nil {
                                       ^
    graphql.go:135:30: SA1019: trace.ValidationTracer is deprecated: use ValidationTracerContext. (staticcheck)
    func ValidationTracer(tracer trace.ValidationTracer) SchemaOpt {
                                 ^
    graphql.go:300:9: SA1019: trace.ValidationTracer is deprecated: use ValidationTracerContext. (staticcheck)
            tracer trace.ValidationTracer
                   ^
    internal/query/query.go:13:2: SA9004: only the first constant in this group has an explicit type (staticcheck)
            Query        types.OperationType = "QUERY"
    ```
    agnivade committed Dec 10, 2021
    Configuration menu
    Copy the full SHA
    a02ef02 View commit details
    Browse the repository at this point in the history