The main reason is the possibility of implementing interfaces that define specific methods with specific parameters, even if you do not use them all in your implementation. This is described in detail in @Jsor's answer.
Another good reason is that unused (local) variables are often the result of an error or the use of a language function (for example, using a short declaration of the variable := in a block, inadvertently obscuring the "external" variable), while unused function parameters never (or very rarely) are not the result of an error.
Another reason may be to ensure advanced compatibility. If you release the library, you cannot change or expand the list of parameters without breaking backward compatibility (and there is no function overload in Go: if you want 2 options with different parameters, their names must also be different).
You can provide an exported function or method and add additional - not yet used - or additional parameters (for example, hints) to it in the spirit that you can use in a future version / release of your library.
Doing this very early will give you the advantage that other users using your library should not change anything in their code.
Let's look at an example:
You want to create a formatting function:
// FormatSize formats the specified size (bytes) to a string. func FormatSize(size int) string { return fmt.Sprintf("%d bytes", size) }
You can also add an additional parameter:
// FormatSize formats the specified size (bytes) to a string. // flags can be used to alter the output format. Not yet used. func FormatSize(size int, flags int) string { return fmt.Sprintf("%d bytes", size) }
Then you can improve your library and your FormatSize() function to support the following formatting flags:
const ( FlagAutoUnit = 1 << iota // Automatically format as KB, MB, GB etc. FlagSI // Use SI conversion (1000 instead of 1024) FlagGroupDecimals // Format number using decimal grouping ) // FormatSize formats the specified size (bytes) to a string. // flags can be used to alter the output format. func FormatSize(size int, flags int) string { var s string // Check flags and format accordingly // ... return s }