Skip to content

Commit

Permalink
chore: bump caarlos0/env/v10 -> caarlos0/env/v11 (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
shini4i authored Dec 3, 2024
1 parent fa9bc35 commit 39f1781
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
11 changes: 4 additions & 7 deletions cmd/argo-watcher/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"net/url"

envConfig "github.com/caarlos0/env/v10"
envConfig "github.com/caarlos0/env/v11"
"github.com/go-playground/validator/v10"
)

Expand Down Expand Up @@ -65,13 +65,10 @@ type ServerConfig struct {
// If the StateType is empty or not one of the allowed types ("postgres" or "in-memory"), it returns an error.
// Otherwise, it returns the parsed server configuration and any error encountered during the parsing process.
func NewServerConfig() (*ServerConfig, error) {
// parse config
var (
err error
config ServerConfig
)
var err error
var config ServerConfig

if err := envConfig.Parse(&config); err != nil {
if config, err = envConfig.ParseAs[ServerConfig](); err != nil {
return nil, err
}

Expand Down
7 changes: 4 additions & 3 deletions cmd/argo-watcher/state/postgres_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

envConfig "github.com/caarlos0/env/v10"
envConfig "github.com/caarlos0/env/v11"

"github.com/stretchr/testify/assert"

Expand Down Expand Up @@ -58,9 +58,10 @@ var (
)

func TestPostgresState_Add(t *testing.T) {
databaseConfig := config.DatabaseConfig{}
var err error
var databaseConfig config.DatabaseConfig

err := envConfig.Parse(&databaseConfig)
databaseConfig, err = envConfig.ParseAs[config.DatabaseConfig]()
assert.NoError(t, err)

testConfig := &config.ServerConfig{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.23.3

require (
github.com/avast/retry-go/v4 v4.6.0
github.com/caarlos0/env/v10 v10.0.0
github.com/caarlos0/env/v11 v11.2.2
github.com/gin-gonic/contrib v0.0.0-20240508051311-c1c6bf0061b0
github.com/gin-gonic/gin v1.10.0
github.com/go-git/go-billy/v5 v5.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/caarlos0/env/v10 v10.0.0 h1:yIHUBZGsyqCnpTkbjk8asUlx6RFhhEs+h7TOBdgdzXA=
github.com/caarlos0/env/v10 v10.0.0/go.mod h1:ZfulV76NvVPw3tm591U4SwL3Xx9ldzBP9aGxzeN7G18=
github.com/caarlos0/env/v11 v11.2.2 h1:95fApNrUyueipoZN/EhA8mMxiNxrBwDa+oAZrMWl3Kg=
github.com/caarlos0/env/v11 v11.2.2/go.mod h1:JBfcdeQiBoI3Zh1QRAWfe+tpiNTmDtcCj/hHHHMx0vc=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
Expand Down
5 changes: 3 additions & 2 deletions pkg/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"time"

envConfig "github.com/caarlos0/env/v10"
envConfig "github.com/caarlos0/env/v11"
)

type Config struct {
Expand All @@ -25,9 +25,10 @@ type Config struct {
// NewClientConfig parses the environment variables to fill a Config struct
// and returns the new instance or an error.
func NewClientConfig() (*Config, error) {
var err error
var config Config

if err := envConfig.Parse(&config); err != nil {
if config, err = envConfig.ParseAs[Config](); err != nil {
return nil, err
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/updater/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package updater

import (
envConfig "github.com/caarlos0/env/v10"
envConfig "github.com/caarlos0/env/v11"
)

type GitConfig struct {
Expand All @@ -13,9 +13,10 @@ type GitConfig struct {
}

func NewGitConfig() (*GitConfig, error) {
var err error
var config GitConfig

if err := envConfig.Parse(&config); err != nil {
if config, err = envConfig.ParseAs[GitConfig](); err != nil {
return nil, err
}

Expand Down

0 comments on commit 39f1781

Please sign in to comment.