SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
Go

Go static code analysis

Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your GO code

  • All rules 94
  • Vulnerability21
  • Bug13
  • Security Hotspot14
  • Code Smell46
Filtered: 3 rules found
style
    Impact
      Clean code attribute
        1. Consecutive function parameters with the same type should be grouped

           Code Smell
        2. Semicolons should not be used unnecessarily

           Code Smell
        3. Import statements should be factored into a single block

           Code Smell

        Semicolons should not be used unnecessarily

        consistency - conventional
        maintainability
        Code Smell
        • convention
        • style

        This rule raises an issue when semicolons are used to terminate statements in Go code where they are not required by the language specification.

        Why is this an issue?

        How can I fix it?

        More Info

        Go has automatic semicolon insertion rules that make explicit semicolons unnecessary in most cases. The Go language specification defines that semicolons are automatically inserted after a line’s final token if that token is an identifier, literal, or one of the keywords break, continue, fallthrough, or return, or one of the operators ++, --, ), ], or }.

        Using unnecessary semicolons goes against Go’s design philosophy of clean, readable code. It can make code look cluttered and may confuse developers who are learning Go’s syntax rules. The automatic semicolon insertion mechanism is a deliberate language feature that allows Go code to be more concise and readable.

        Additionally, unnecessary semicolons can indicate that a developer is applying conventions from other programming languages (like C, Java, or JavaScript) rather than following Go’s idiomatic style. This can lead to inconsistent code style within a Go project.

        What is the potential impact?

        While unnecessary semicolons do not cause runtime errors or compilation failures, they impact code quality and maintainability:

        • Readability: Code becomes more cluttered and less idiomatic
        • Consistency: Mixed usage of semicolons creates inconsistent code style
        • Learning curve: New Go developers may be confused about when semicolons are actually required
        • Code reviews: Unnecessary semicolons can distract from more important issues during code reviews
          Available In:
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories

        © 2025 SonarSource Sàrl. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use