No Return Values Expected

too many return values have (int) want ()

Quick Answer

Your function does not declare any return type but has a return statement with a value. Either add a return type or remove the return value.

Why This Happens

In Go, a function without return types in its signature cannot return any values. If you add a return statement with a value, the compiler rejects it. You must add the return type to the signature or remove the returned value.

The Problem

func process(data string) {
    result := len(data)
    return result // too many return values
}

The Fix

func process(data string) int {
    result := len(data)
    return result
}

Step-by-Step Fix

  1. 1

    Identify the function

    Find the function that is returning a value without declaring a return type.

  2. 2

    Decide on the design

    Determine if the function should return a value or if the return should be removed.

  3. 3

    Update the signature

    Add the appropriate return type to the function signature or remove the return value.

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