Skip to content

Commit

Permalink
Merge branch 'main' into renovate/gopkg.in-yaml.v2-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
l50 authored Jun 9, 2024
2 parents b1a6ceb + 95e3873 commit 3fc503d
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 126 deletions.
15 changes: 15 additions & 0 deletions .hooks/run-go-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ run_tests() {
echo "tail -f ${LOGFILE}" | tee -a "$LOGFILE"
echo "Running tests..." | tee -a "$LOGFILE"

# Check if go.mod and go.sum exist
if [[ -f "go.mod" && -f "go.sum" ]]; then
# Check if `go mod tidy` is necessary
MOD_TMP=$(mktemp)
SUM_TMP=$(mktemp)
cp go.mod "$MOD_TMP"
cp go.sum "$SUM_TMP"
go mod tidy
if ! cmp -s go.mod "$MOD_TMP" || ! cmp -s go.sum "$SUM_TMP"; then
echo "Running 'go mod tidy' to clean up module dependencies..." | tee -a "$LOGFILE"
go mod tidy 2>&1 | tee -a "$LOGFILE"
fi
rm "$MOD_TMP" "$SUM_TMP"
fi

if [[ "${TESTS_TO_RUN}" == 'coverage' ]]; then
go test -v -race -failfast -tags=integration -coverprofile="${coverage_file}" ./... 2>&1 | tee -a "$LOGFILE"
elif [[ "${TESTS_TO_RUN}" == 'all' ]]; then
Expand Down
14 changes: 7 additions & 7 deletions collection/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# goutils/v2/slices
# goutils/v2/collection

The `slices` package is a collection of utility functions
designed to simplify common slices tasks.
The `collection` package is a collection of utility functions
designed to simplify common collection tasks.

---

Expand Down Expand Up @@ -39,11 +39,11 @@ bool: true if the value is present in the slice, false otherwise.

## Installation

To use the goutils/v2/slices package, you first need to install it.
To use the goutils/v2/collection package, you first need to install it.
Follow the steps below to install via go get.

```bash
go get github.com/l50/goutils/v2/slices
go get github.com/l50/goutils/v2/collection
```

---
Expand All @@ -54,15 +54,15 @@ After installation, you can import the package in your Go project
using the following import statement:

```go
import "github.com/l50/goutils/v2/slices"
import "github.com/l50/goutils/v2/collection"
```

---

## Tests

To ensure the package is working correctly, run the following
command to execute the tests for `goutils/v2/slices`:
command to execute the tests for `goutils/v2/collection`:

```bash
go test -v
Expand Down
2 changes: 1 addition & 1 deletion collection/slices.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package slices
package collection

// Contains checks if a value is present in a slice.
//
Expand Down
7 changes: 4 additions & 3 deletions collection/slices_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package slices_test
package collection_test

import (
"slices"
"testing"

"github.com/l50/goutils/v2/collection"
)

func TestContains(t *testing.T) {
Expand Down Expand Up @@ -46,7 +47,7 @@ func TestContains(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
got := slices.Contains(tc.slice, tc.value)
got := collection.Contains(tc.slice, tc.value)
if got != tc.want {
t.Errorf("Contains(%v, %v) = %v; want %v", tc.slice,
tc.value, got, tc.want)
Expand Down
17 changes: 8 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ require (
require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/MakeNowJust/heredoc/v2 v2.0.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/hcsshim v0.12.3 // indirect
github.com/Microsoft/hcsshim v0.12.4 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/chai2010/gettext-go v1.0.3 // indirect
github.com/containerd/containerd v1.7.17 // indirect
github.com/containerd/containerd v1.7.18 // indirect
github.com/containerd/errdefs v0.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
Expand All @@ -48,12 +48,12 @@ require (
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gorilla/websocket v1.5.2 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/jmoiron/sqlx v1.4.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
Expand All @@ -75,7 +75,6 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.starlark.net v0.0.0-20240411212711-9b43f0afd521 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/evanphx/json-patch.v5 v5.9.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -102,9 +101,9 @@ require (
github.com/cloudflare/circl v1.3.8 // indirect
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/cli v26.1.3+incompatible // indirect
github.com/docker/cli v26.1.4+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v26.1.3+incompatible // indirect
github.com/docker/docker v26.1.4+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.2 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
Expand Down Expand Up @@ -174,7 +173,7 @@ require (
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
Expand Down
Loading

0 comments on commit 3fc503d

Please sign in to comment.