Skip to content

1.18.0 Unmarshal() Breaking Our Tests With: '' expected a map, got 'interface' #1706

@jcburley

Description

@jcburley

Preflight Checklist

  • I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • I am not looking for support or already pursued the available support channels without success.
  • I have checked the troubleshooting guide for my problem, without success.

Viper Version

1.18.0

Go Version

1.21.5

Config Source

Manual set

Format

Other (specify below)

Repl.it link

No response

Code reproducing the issue

No response

Expected Behavior

For now, due to the urgency of this new release having come out only yesterday and limited time (until maybe this weekend?), I can just say that our unit tests (for two modules, within a package we have to wrap/provide common Golang functions) have been running fine for awhile, and with this v1.18.0 release we're getting these errors from Viper.Unmarshal().

Actual Behavior

Sample error:

    config_test.go:146: 
        	Error Trace:	/Users/c/go/src/github.com/namely/go-common/config/config_test.go:146
        	Error:      	Received unexpected error:
        	            	Viper.Unmarshal returned: '' expected a map, got 'interface'
        	Test:       	TestConfigTestSuite/TestBind

Steps To Reproduce

No response

Additional Information

I checked the release notes and didn't see anything obvious, but the code diffs between 1.17.0 and 1.18.0 do show changes in the decoding code that seems to be involved here.

I'm hoping this limited (information-poor) Issue submission might help someone quickly figure out what's wrong, if anything is indeed wrong with the new release (versus, say, a latent bug in our code, or at least test code).

If not, I'll endeavor to reduce our layers of wrapping to a simple test case showing the issue, and perhaps "get lucky", find the bug, and submit a fix as well.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions