Skip to content
Merged
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
13 changes: 2 additions & 11 deletions .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,15 @@ steps:
plugins:
- docker#v5.13.0:
image: "registry.hub.docker.com/golangci/golangci-lint:v2.4.0"
command:
[
"golangci-lint",
"run",
"-v",
"--config",
".golangci.yaml",
"--concurrency",
"0",
]
command: ["golangci-lint", "run", "-v", "--config", ".golangci.yaml", "--concurrency", "0"]
environment:
- "GOTOOLCHAIN=auto"
- label: ":golang: go test"
key: "go_test"
cancel_on_build_failing: true
plugins:
- docker#v5.13.0:
image: golang:1.25.1
image: golang:1.25.4
always-pull: true
command: ["go", "test", "-coverprofile=coverage.out", "./..."]
artifact_paths: ["coverage.out"]
Expand Down
7 changes: 6 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ linters:
- revive
- staticcheck
- whitespace
- wsl
- wsl_v5
settings:
wsl_v5:
allow-first-in-block: true
allow-whole-block: false
branch-max-lines: 2
exclusions:
generated: lax
presets:
Expand Down
14 changes: 7 additions & 7 deletions cache/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@ type Config struct {
// DB to be selected after connecting to the server, 0 uses the default
DB int `json:"db" koanf:"db" default:"0"`
// Dial timeout for establishing new connections, defaults to 5s
DialTimeout time.Duration `json:"dialTimeout" koanf:"dialTimeout" default:"5s"`
DialTimeout time.Duration `json:"dialtimeout" koanf:"dialtimeout" default:"5s"`
// Timeout for socket reads. If reached, commands will fail
// with a timeout instead of blocking. Supported values:
// - `0` - default timeout (3 seconds).
// - `-1` - no timeout (block indefinitely).
// - `-2` - disables SetReadDeadline calls completely.
ReadTimeout time.Duration `json:"readTimeout" koanf:"readTimeout" default:"0"`
ReadTimeout time.Duration `json:"readtimeout" koanf:"readtimeout" default:"0"`
// Timeout for socket writes. If reached, commands will fail
// with a timeout instead of blocking. Supported values:
// - `0` - default timeout (3 seconds).
// - `-1` - no timeout (block indefinitely).
// - `-2` - disables SetWriteDeadline calls completely.
WriteTimeout time.Duration `json:"writeTimeout" koanf:"writeTimeout" default:"0"`
WriteTimeout time.Duration `json:"writetimeout" koanf:"writetimeout" default:"0"`
// MaxRetries before giving up.
// Default is 3 retries; -1 (not 0) disables retries.
MaxRetries int `json:"maxRetries" koanf:"maxRetries" default:"3"`
MaxRetries int `json:"maxretries" koanf:"maxretries" default:"3"`
// MinIdleConns is useful when establishing new connection is slow.
// Default is 0. the idle connections are not closed by default.
MinIdleConns int `json:"minIdleConns" koanf:"minIdleConns" default:"0"`
MinIdleConns int `json:"minidleconns" koanf:"minidleconns" default:"0"`
// Maximum number of idle connections.
// Default is 0. the idle connections are not closed by default.
MaxIdleConns int `json:"maxIdleConns" koanf:"maxIdleConns" default:"0"`
MaxIdleConns int `json:"maxidleconns" koanf:"maxidleconns" default:"0"`
// Maximum number of connections allocated by the pool at a given time.
// When zero, there is no limit on the number of connections in the pool.
MaxActiveConns int `json:"maxActiveConns" koanf:"maxActiveConns" default:"0"`
MaxActiveConns int `json:"maxactiveconns" koanf:"maxactiveconns" default:"0"`
}

// New returns a new redis client based on the configuration settings
Expand Down
1 change: 1 addition & 0 deletions contextx/contextx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func TestFromOrFunc(t *testing.T) {

func TestStringHelpers(t *testing.T) {
type OrganizationID string

type TraceID string

ctx := context.Background()
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/theopenlane/utils

go 1.25.1
go 1.25.4

require (
entgo.io/ent v0.14.5
Expand All @@ -16,6 +16,8 @@ require (
golang.org/x/crypto v0.42.0
)

require github.com/opencontainers/runc v1.2.8 // indirect

require (
al.essio.dev/pkg/shellescape v1.5.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
Expand All @@ -37,11 +39,11 @@ require (
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/moby/sys/user v0.3.0 // indirect
github.com/olekukonko/errors v1.1.0 // indirect
github.com/olekukonko/ll v0.0.9 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.14 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo=
github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/ulid/v2 v2.1.1 h1:suPZ4ARWLOJLegGFiZZ1dFAkqzhMjL3J1TzI+5wHz8s=
Expand All @@ -67,8 +69,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w=
github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA=
github.com/opencontainers/runc v1.2.8 h1:RnEICeDReapbZ5lZEgHvj7E9Q3Eex9toYmaGBsbvU5Q=
github.com/opencontainers/runc v1.2.8/go.mod h1:cC0YkmZcuvr+rtBZ6T7NBoVbMGNAdLa/21vIElJDOzI=
github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA=
github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs=
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
Expand Down
2 changes: 2 additions & 0 deletions rout/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func ErrorResponse(err interface{}) Reply {
}

rep := Reply{Success: false}

switch err := err.(type) {
case error:
rep.Error = err.Error()
Expand Down Expand Up @@ -249,6 +250,7 @@ func HTTPErrorResponse(err interface{}) *echo.HTTPError {
}

rep := echo.HTTPError{Code: http.StatusBadRequest}

switch err := err.(type) {
case error:
rep.Message = err.Error()
Expand Down
4 changes: 2 additions & 2 deletions ulids/ulids.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func IsZero(uid ulid.ULID) bool {
// this method panics rather than returning an error
func New() ulid.ULID {
ms := ulid.Timestamp(time.Now())
uid, err := ulid.New(ms, entropy)

uid, err := ulid.New(ms, entropy)
if err != nil {
panic(err)
}
Expand All @@ -52,8 +52,8 @@ func New() ulid.ULID {
// FromTime creates a ULID with the specified timestamp
func FromTime(ts time.Time) ulid.ULID {
ms := ulid.Timestamp(ts)
uid, err := ulid.New(ms, entropy)

uid, err := ulid.New(ms, entropy)
if err != nil {
panic(err)
}
Expand Down
Loading