LinthelmIntroductions to linters, static analysis and code-quality tools

Static analysis

What is Gosec? An introduction to securego's Go security checker

By the Linthelm editorial team · Published · Updated

Gosec is an open-source Go security checker that inspects source code for security problems. It works by scanning the Go AST and SSA representation of your code. It is a static analysis tool aimed at Go developers.

Tool
Gosec
Made by
securego
Official site
github.com/securego/gosec
Category
Static analysis

Who makes Gosec

Gosec is developed under the securego name. The project's official website is the securego/gosec repository on GitHub, linked below.

The project is open source and is licensed under Apache 2.0.

Official website: github.com/securego/gosec

What Gosec is for

Gosec is for finding security problems in Go source code before that code ships. Rather than running your program, it reads the code and analyzes two representations of it: the Go AST and the SSA form.

Combining those two views lets Gosec apply simple pattern checks for common security issues in Go and deeper analyses that follow how data and types move through a program.

Who Gosec is for

The vendor states Gosec's audience as Go developers. It suits anyone writing Go who wants security-focused checks as part of their normal workflow.

Teams that maintain large repositories are also covered by the feature set: rules can be suppressed for specific paths, and generated Go files can be ignored, which helps keep results focused on code people actually write. Gosec requires a recent Go version.

Notable capabilities

Gosec combines pattern-based rules with SSA-based analyzers and taint analysis, and it offers several ways to plug into existing pipelines and workflows.

  • Pattern-based rules: a set of rules targets common security issues in Go and works from the code's AST.
  • SSA-based analyzers: dedicated analyzers cover type conversions, slice bounds and crypto issues.
  • Taint analysis: Gosec tracks tainted data to detect many injection and related vulnerability classes.
  • CWE mapping: every finding is mapped to a CWE, so results can be tied to a standard weakness identifier.
  • Rule selection: rules are grouped into categories, including file and path handling risks, and can be selected or excluded with command-line flags.
  • GitHub integration: Gosec can run as a GitHub Action and integrates with GitHub code scanning through SARIF output.
  • Analysis interface support: a goanalysis package allows integration with tools that use the standard Go analysis interface, such as Bazel's nogo.
  • AI-suggested fixes: Gosec can suggest fixes using an AI API.

How Gosec fits static analysis

Within static analysis tools, Gosec is specialized: it focuses on security problems in Go rather than on general style or formatting. It analyzes source code without executing it, using the Go AST and SSA representation as its inputs.

In the wider world of linters, static analysis and code quality that Linthelm covers, Gosec is the kind of tool you add alongside general-purpose linters when you want security-specific checks for a Go codebase. Its SARIF output, GitHub Action and goanalysis package let it sit in automated review and build setups, while path-level suppression and generated-file handling help it scale to larger repositories.

Frequently asked questions

What is Gosec used for?

Gosec is used to find security problems in Go source code. It scans the Go AST and SSA representation and applies pattern-based rules, SSA-based analyzers and taint analysis.

Who develops Gosec?

Gosec is developed under the securego name, and its official website is the securego/gosec repository on GitHub. It is open source under the Apache 2.0 license.

Does Gosec work with GitHub code scanning?

Yes. Gosec integrates with GitHub code scanning through SARIF output, and it can also be run as a GitHub Action.

Can Gosec ignore generated files or specific paths?

Yes. Gosec can ignore generated Go files, and rules can be suppressed for specific paths in large repositories.

Does Gosec map findings to CWEs?

Yes. Every Gosec finding is mapped to a CWE.

Sources. This introduction is based on the vendor's official pages, checked on 21 November 2026 (Asia/Dhaka):

Linthelm is independent and is not affiliated with securego. Product names belong to their owners. Features change; confirm details on the official website.