Skip to content

Backport config type fixes to 1.20.x#2005

Merged
sagikazarmark merged 2 commits intov1.20.xfrom
fix-config-type-backport
Mar 26, 2025
Merged

Backport config type fixes to 1.20.x#2005
sagikazarmark merged 2 commits intov1.20.xfrom
fix-config-type-backport

Conversation

@sagikazarmark
Copy link
Copy Markdown
Collaborator

@sagikazarmark sagikazarmark commented Mar 26, 2025

See #2003
See #2007

@sagikazarmark sagikazarmark added the kind/bug Something isn't working label Mar 26, 2025
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
@sagikazarmark sagikazarmark marked this pull request as ready for review March 26, 2025 17:26
@sagikazarmark sagikazarmark requested a review from Copilot March 26, 2025 17:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR backports config type fixes to the 1.20.x branch by changing how the configuration type is determined and how configurations are read and merged. Key changes include:

  • Removing explicit checks for config type in ReadConfig and MergeConfig and deferring this to unmarshalReader.
  • Replacing direct assignment of a new map with reading into a temporary config map.
  • Introducing new tests that set a dummy config file to infer configuration type from its file extension.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
viper.go Refactors ReadConfig, MergeConfig, and unmarshalReader to improve config type handling.
viper_test.go Adds tests for ReadConfig and MergeConfig when a config file is set to derive config type.
Comments suppressed due to low confidence (1)

viper.go:1673

  • Consider checking the error returned by buf.ReadFrom(in) to handle potential read failures.
buf.ReadFrom(in)

@sagikazarmark sagikazarmark merged commit 9568cfc into v1.20.x Mar 26, 2025
43 checks passed
@sagikazarmark sagikazarmark deleted the fix-config-type-backport branch March 26, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants