Mixed Named and Unnamed Parameters

mixed named and unnamed parameters

Quick Answer

Function parameters must either all have names or all be unnamed. Add names to all parameters or remove all names.

Why This Happens

Go requires consistency in function parameter declarations. You cannot have some parameters named and others unnamed in the same parameter list. This commonly occurs when quickly editing a function signature.

The Problem

func process(name string, int, bool) { // mixed named and unnamed
}

The Fix

func process(name string, count int, verbose bool) {
}

Step-by-Step Fix

  1. 1

    Identify the mixed parameters

    Find the function signature that has some named and some unnamed parameters.

  2. 2

    Decide on naming

    Give all parameters descriptive names for clarity.

  3. 3

    Update the signature

    Ensure all parameters are consistently named.

Bugsly catches this automatically

Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.

Try Bugsly free