Skip to content

Commit 9b641d6

Browse files
Fix env vars with yaml (#112)
* fix: env vars + yaml config match Signed-off-by: Sarah Funkhouser <[email protected]> * sec patch, go update Signed-off-by: Sarah Funkhouser <[email protected]> * linter Signed-off-by: Sarah Funkhouser <[email protected]> * save Signed-off-by: Sarah Funkhouser <[email protected]> --------- Signed-off-by: Sarah Funkhouser <[email protected]>
1 parent ef1ca4b commit 9b641d6

File tree

8 files changed

+28
-25
lines changed

8 files changed

+28
-25
lines changed

.buildkite/pipeline.yaml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,15 @@ steps:
1111
plugins:
1212
- docker#v5.13.0:
1313
image: "registry.hub.docker.com/golangci/golangci-lint:v2.4.0"
14-
command:
15-
[
16-
"golangci-lint",
17-
"run",
18-
"-v",
19-
"--config",
20-
".golangci.yaml",
21-
"--concurrency",
22-
"0",
23-
]
14+
command: ["golangci-lint", "run", "-v", "--config", ".golangci.yaml", "--concurrency", "0"]
2415
environment:
2516
- "GOTOOLCHAIN=auto"
2617
- label: ":golang: go test"
2718
key: "go_test"
2819
cancel_on_build_failing: true
2920
plugins:
3021
- docker#v5.13.0:
31-
image: golang:1.25.1
22+
image: golang:1.25.4
3223
always-pull: true
3324
command: ["go", "test", "-coverprofile=coverage.out", "./..."]
3425
artifact_paths: ["coverage.out"]

.golangci.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ linters:
1414
- revive
1515
- staticcheck
1616
- whitespace
17-
- wsl
17+
- wsl_v5
18+
settings:
19+
wsl_v5:
20+
allow-first-in-block: true
21+
allow-whole-block: false
22+
branch-max-lines: 2
1823
exclusions:
1924
generated: lax
2025
presets:

cache/client.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@ type Config struct {
2222
// DB to be selected after connecting to the server, 0 uses the default
2323
DB int `json:"db" koanf:"db" default:"0"`
2424
// Dial timeout for establishing new connections, defaults to 5s
25-
DialTimeout time.Duration `json:"dialTimeout" koanf:"dialTimeout" default:"5s"`
25+
DialTimeout time.Duration `json:"dialtimeout" koanf:"dialtimeout" default:"5s"`
2626
// Timeout for socket reads. If reached, commands will fail
2727
// with a timeout instead of blocking. Supported values:
2828
// - `0` - default timeout (3 seconds).
2929
// - `-1` - no timeout (block indefinitely).
3030
// - `-2` - disables SetReadDeadline calls completely.
31-
ReadTimeout time.Duration `json:"readTimeout" koanf:"readTimeout" default:"0"`
31+
ReadTimeout time.Duration `json:"readtimeout" koanf:"readtimeout" default:"0"`
3232
// Timeout for socket writes. If reached, commands will fail
3333
// with a timeout instead of blocking. Supported values:
3434
// - `0` - default timeout (3 seconds).
3535
// - `-1` - no timeout (block indefinitely).
3636
// - `-2` - disables SetWriteDeadline calls completely.
37-
WriteTimeout time.Duration `json:"writeTimeout" koanf:"writeTimeout" default:"0"`
37+
WriteTimeout time.Duration `json:"writetimeout" koanf:"writetimeout" default:"0"`
3838
// MaxRetries before giving up.
3939
// Default is 3 retries; -1 (not 0) disables retries.
40-
MaxRetries int `json:"maxRetries" koanf:"maxRetries" default:"3"`
40+
MaxRetries int `json:"maxretries" koanf:"maxretries" default:"3"`
4141
// MinIdleConns is useful when establishing new connection is slow.
4242
// Default is 0. the idle connections are not closed by default.
43-
MinIdleConns int `json:"minIdleConns" koanf:"minIdleConns" default:"0"`
43+
MinIdleConns int `json:"minidleconns" koanf:"minidleconns" default:"0"`
4444
// Maximum number of idle connections.
4545
// Default is 0. the idle connections are not closed by default.
46-
MaxIdleConns int `json:"maxIdleConns" koanf:"maxIdleConns" default:"0"`
46+
MaxIdleConns int `json:"maxidleconns" koanf:"maxidleconns" default:"0"`
4747
// Maximum number of connections allocated by the pool at a given time.
4848
// When zero, there is no limit on the number of connections in the pool.
49-
MaxActiveConns int `json:"maxActiveConns" koanf:"maxActiveConns" default:"0"`
49+
MaxActiveConns int `json:"maxactiveconns" koanf:"maxactiveconns" default:"0"`
5050
}
5151

5252
// New returns a new redis client based on the configuration settings

contextx/contextx_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func TestFromOrFunc(t *testing.T) {
103103

104104
func TestStringHelpers(t *testing.T) {
105105
type OrganizationID string
106+
106107
type TraceID string
107108

108109
ctx := context.Background()

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/theopenlane/utils
22

3-
go 1.25.1
3+
go 1.25.4
44

55
require (
66
entgo.io/ent v0.14.5
@@ -16,6 +16,8 @@ require (
1616
golang.org/x/crypto v0.42.0
1717
)
1818

19+
require github.com/opencontainers/runc v1.2.8 // indirect
20+
1921
require (
2022
al.essio.dev/pkg/shellescape v1.5.1 // indirect
2123
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
@@ -37,11 +39,11 @@ require (
3739
github.com/mattn/go-colorable v0.1.14 // indirect
3840
github.com/mattn/go-isatty v0.0.20 // indirect
3941
github.com/mattn/go-runewidth v0.0.16 // indirect
42+
github.com/moby/sys/user v0.3.0 // indirect
4043
github.com/olekukonko/errors v1.1.0 // indirect
4144
github.com/olekukonko/ll v0.0.9 // indirect
4245
github.com/opencontainers/go-digest v1.0.0 // indirect
4346
github.com/opencontainers/image-spec v1.1.0 // indirect
44-
github.com/opencontainers/runc v1.1.14 // indirect
4547
github.com/pkg/errors v0.9.1 // indirect
4648
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
4749
github.com/rivo/uniseg v0.4.7 // indirect

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
5353
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
5454
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
5555
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
56+
github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo=
57+
github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs=
5658
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
5759
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
5860
github.com/oklog/ulid/v2 v2.1.1 h1:suPZ4ARWLOJLegGFiZZ1dFAkqzhMjL3J1TzI+5wHz8s=
@@ -67,8 +69,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
6769
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
6870
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
6971
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
70-
github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w=
71-
github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA=
72+
github.com/opencontainers/runc v1.2.8 h1:RnEICeDReapbZ5lZEgHvj7E9Q3Eex9toYmaGBsbvU5Q=
73+
github.com/opencontainers/runc v1.2.8/go.mod h1:cC0YkmZcuvr+rtBZ6T7NBoVbMGNAdLa/21vIElJDOzI=
7274
github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA=
7375
github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs=
7476
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=

rout/errors.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ func ErrorResponse(err interface{}) Reply {
206206
}
207207

208208
rep := Reply{Success: false}
209+
209210
switch err := err.(type) {
210211
case error:
211212
rep.Error = err.Error()
@@ -249,6 +250,7 @@ func HTTPErrorResponse(err interface{}) *echo.HTTPError {
249250
}
250251

251252
rep := echo.HTTPError{Code: http.StatusBadRequest}
253+
252254
switch err := err.(type) {
253255
case error:
254256
rep.Message = err.Error()

ulids/ulids.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ func IsZero(uid ulid.ULID) bool {
4040
// this method panics rather than returning an error
4141
func New() ulid.ULID {
4242
ms := ulid.Timestamp(time.Now())
43-
uid, err := ulid.New(ms, entropy)
4443

44+
uid, err := ulid.New(ms, entropy)
4545
if err != nil {
4646
panic(err)
4747
}
@@ -52,8 +52,8 @@ func New() ulid.ULID {
5252
// FromTime creates a ULID with the specified timestamp
5353
func FromTime(ts time.Time) ulid.ULID {
5454
ms := ulid.Timestamp(ts)
55-
uid, err := ulid.New(ms, entropy)
5655

56+
uid, err := ulid.New(ms, entropy)
5757
if err != nil {
5858
panic(err)
5959
}

0 commit comments

Comments
 (0)