Preflight Checklist

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

Viper Version

1.20.0

Go Version

1.24

Config Source

Files

Format

No response

Repl.it link

No response

Code reproducing the issue


Expected Behavior

PR #1723 changed mapstructure imports. This is a breaking change compared to v1.19.0.

I had code like that, which will not compile anymore. Import needs to be changed at my side.

import (
//...
    "github.com/mitchellh/mapstructure"
//...
)

    err := viper.Unmarshal(&appConfig, func(config *mapstructure.DecoderConfig) {
        config.TagName = "yaml"
    })

This is not documented in release notes: https://github.com/spf13/viper/blob/master/UPGRADE.md#v120x

Actual Behavior

x

Steps To Reproduce

No response

Additional Information

No response

Comment From: sagikazarmark

Good catch! Would you mind opening a PR?

Comment From: sieveLau

Based on the changes in stackrox/kube-linter#935, it seems that we have to change "github.com/mitchellh/mapstructure" to "github.com/go-viper/mapstructure/v2". I applied that change to my repo, and it worked.

Comment From: github-actions[bot]

Issues with no activity for 30 days are marked stale and subject to being closed.