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

        Consecutive function parameters with the same type should be grouped

        consistency - conventional
        maintainability
        Code Smell
        • idiom
        • style

        This is an issue when two or more consecutive function parameters have the same type but are declared with separate type annotations.

        Why is this an issue?

        How can I fix it?

        More Info

        Go provides a convenient syntax feature that allows you to group consecutive parameters of the same type together. Instead of repeating the type for each parameter, you can omit the type from all but the last parameter in the group.

        This feature serves multiple purposes:

        • Reduces visual clutter: Eliminating redundant type declarations makes function signatures cleaner and easier to read.
        • Follows Go idioms: The Go community and official documentation consistently use this syntax pattern, making it the expected style.
        • Improves maintainability: When you need to change the type of grouped parameters, you only need to update it in one place.

        The Go language designers included this feature specifically to make code more concise while maintaining clarity. Using the grouped syntax demonstrates familiarity with Go conventions and produces code that feels natural to other Go developers.

        What is the potential impact?

        This issue affects code readability and consistency. While it doesn’t impact functionality, using non-idiomatic Go syntax can make code appear less professional and may slow down code reviews as developers notice the style inconsistency.

          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