# Go CodeQL queries for Code Quality

Explore the queries that CodeQL uses to analyze code quality for code written in Go.

Code Quality uses the following CodeQL queries to analyze Go code and detect code quality issues on:

* Your **default branch**, with results shown on the repository's "Standard findings" dashboard
* **Pull requests**, with findings shown as comments made by `github-code-quality[bot]`

Copilot Autofix suggestions are provided for findings where possible.

<div class="ghd-tool rowheaders">

| Query name | Category | Severity |
| --- | --- | --- |
| [Useless assignment to field](https://codeql.github.com/codeql-query-help/go/go-useless-assignment-to-field/) | Maintainability | Warning |
| [Useless assignment to local variable](https://codeql.github.com/codeql-query-help/go/go-useless-assignment-to-local/) | Maintainability | Warning |
| [Bitwise exclusive-or used like exponentiation](https://codeql.github.com/codeql-query-help/go/go-mistyped-exponentiation/) | Reliability | Warning |
| [Comparison of identical values](https://codeql.github.com/codeql-query-help/go/go-comparison-of-identical-expressions/) | Reliability | Warning |
| [Constant length comparison](https://codeql.github.com/codeql-query-help/go/go-constant-length-comparison/) | Reliability | Warning |
| [Duplicate 'if' branches](https://codeql.github.com/codeql-query-help/go/go-duplicate-branches/) | Reliability | Warning |
| [Duplicate 'if' condition](https://codeql.github.com/codeql-query-help/go/go-duplicate-condition/) | Reliability | Error |
| [Duplicate switch case](https://codeql.github.com/codeql-query-help/go/go-duplicate-switch-case/) | Reliability | Error |
| [Expression has no effect](https://codeql.github.com/codeql-query-help/go/go-useless-expression/) | Reliability | Warning |
| [Identical operands](https://codeql.github.com/codeql-query-help/go/go-redundant-operation/) | Reliability | Warning |
| [Impossible interface nil check](https://codeql.github.com/codeql-query-help/go/go-impossible-interface-nil-check/) | Reliability | Warning |
| [Inconsistent direction of for loop](https://codeql.github.com/codeql-query-help/go/go-inconsistent-loop-direction/) | Reliability | Error |
| [Missing error check](https://codeql.github.com/codeql-query-help/go/go-missing-error-check/) | Reliability | Warning |
| [Off-by-one comparison against length](https://codeql.github.com/codeql-query-help/go/go-index-out-of-bounds/) | Reliability | Error |
| [Redundant call to recover](https://codeql.github.com/codeql-query-help/go/go-redundant-recover/) | Reliability | Warning |
| [Redundant check for negative value](https://codeql.github.com/codeql-query-help/go/go-negative-length-check/) | Reliability | Warning |
| [Self assignment](https://codeql.github.com/codeql-query-help/go/go-redundant-assignment/) | Reliability | Warning |
| [Shift out of range](https://codeql.github.com/codeql-query-help/go/go-shift-out-of-range/) | Reliability | Warning |
| [Unreachable statement](https://codeql.github.com/codeql-query-help/go/go-unreachable-statement/) | Reliability | Warning |
| [Whitespace contradicts operator precedence](https://codeql.github.com/codeql-query-help/go/go-whitespace-contradicts-precedence/) | Reliability | Warning |
| [Wrapped error is always nil](https://codeql.github.com/codeql-query-help/go/go-unexpected-nil-value/) | Reliability | Warning |
| [Writable file handle closed without error handling](https://codeql.github.com/codeql-query-help/go/go-unhandled-writable-file-close/) | Reliability | Warning |

</div>