Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v2.4.0
version: v2.7.2

dev:
name: Developer environment
Expand Down
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ linters:
- ineffassign
- makezero
- misspell
- modernize
- nakedret
- nilerr
- noctx
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif

# Dependency versions
GOTESTSUM_VERSION = 1.9.0
GOLANGCI_VERSION = 1.53.3
GOLANGCI_VERSION = 2.7.2

# Add the ability to override some variables
# Use with care
Expand Down
2 changes: 1 addition & 1 deletion internal/encoding/json/codec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package json
package json //revive:disable-line:var-naming

import (
"encoding/json"
Expand Down
10 changes: 6 additions & 4 deletions internal/encoding/json/codec_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package json
package json_test
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could be hushed with a linter disable, but using a separate test package is considered a good practice, see the testpackage linter (not currently enabled, but anyway).


import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/spf13/viper/internal/encoding/json"
)

// encoded form of the data.
Expand Down Expand Up @@ -54,7 +56,7 @@ var data = map[string]any{
}

func TestCodec_Encode(t *testing.T) {
codec := Codec{}
codec := json.Codec{}

b, err := codec.Encode(data)
require.NoError(t, err)
Expand All @@ -64,7 +66,7 @@ func TestCodec_Encode(t *testing.T) {

func TestCodec_Decode(t *testing.T) {
t.Run("OK", func(t *testing.T) {
codec := Codec{}
codec := json.Codec{}

v := map[string]any{}

Expand All @@ -75,7 +77,7 @@ func TestCodec_Decode(t *testing.T) {
})

t.Run("InvalidData", func(t *testing.T) {
codec := Codec{}
codec := json.Codec{}

v := map[string]any{}

Expand Down
6 changes: 3 additions & 3 deletions viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ func (v *Viper) isPathShadowedInDeepMap(path []string, m map[string]any) string
// "foo.bar.baz" in a lower-priority map
func (v *Viper) isPathShadowedInFlatMap(path []string, mi any) string {
// unify input map
var m map[string]interface{}
var m map[string]any
switch miv := mi.(type) {
case map[string]string:
m = castMapStringToMapInterface(miv)
Expand Down Expand Up @@ -1030,8 +1030,8 @@ func stringToWeakSliceHookFunc(sep string) mapstructure.DecodeHookFunc {
return func(
f reflect.Type,
t reflect.Type,
data interface{},
) (interface{}, error) {
data any,
) (any, error) {
if f.Kind() != reflect.String || t.Kind() != reflect.Slice {
return data, nil
}
Expand Down
Loading