aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-05-03 20:16:14 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-05-03 20:16:14 +0200
commit80e08e6aee59ef32355fe5a376f295f1fd7dec1c (patch)
treeb49c2f974a9898caa3dd9cb094101a1b236c0e32
parent9fd5ae1214c3f4af53dfa5c45adee68769981b18 (diff)
downloadgo-gg-80e08e6aee59ef32355fe5a376f295f1fd7dec1c.tar.gz
change module path to go.xyrillian.de/gg
Also, some other small adjustments for the documentation to make it fit with the overall vibe of the new home.
-rw-r--r--.golangci.yaml2
-rw-r--r--CHANGELOG.md6
-rw-r--r--CONTRIBUTING.md12
-rw-r--r--README.md15
-rw-r--r--assetembed/assetembed.go4
-rw-r--r--assetembed/assetembed_test.go6
-rw-r--r--description2
-rw-r--r--go.mod2
-rw-r--r--is/doc.go4
-rw-r--r--is/is_test.go6
-rw-r--r--jsonmatch/diff_test.go6
-rw-r--r--jsonmatch/interface.go4
-rw-r--r--jsonmatch/machinery.go2
-rw-r--r--option/option.go8
-rw-r--r--option/option_test.go2
-rw-r--r--options/options.go4
-rw-r--r--options/options_test.go4
17 files changed, 51 insertions, 38 deletions
diff --git a/.golangci.yaml b/.golangci.yaml
index 4b9fb44..3a37237 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -74,7 +74,7 @@ linters:
require-specific: true
staticcheck:
dot-import-whitelist:
- - github.com/majewsky/gg/option
+ - go.xyrillian.de/gg/option
exclusions:
generated: lax
presets:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd9b691..aa281f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,12 @@ SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net>
SPDX-License-Identifier: Apache-2.0
-->
+# v1.7.0 (TBD)
+
+Changes:
+
+- The library must now be imported from the new module path `go.xyrillian.de/gg`.
+
# v1.6.0 (2026-04-01)
Changes:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 8f45d7b..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,12 +0,0 @@
-<!--
-SPDX-FileCopyrightText: 2025 Stefan Majewsky <majewsky@gmx.net>
-SPDX-License-Identifier: Apache-2.0
--->
-
-# Notes for contributors
-
-This repository accepts contributions as follows:
-
-- For new methods and functions, feel free to submit a PR right away.
-- For entirely new types, or when adding library dependencies, please open an issue first to discuss the design.
-- Generally, we dislike library dependencies in this house because every dependency means extra work from Dependabot.
diff --git a/README.md b/README.md
index 90ae517..0a07bec 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0
# gg (Generic Generics)
-My personal extension of the standard library, mostly containing foundational generic types.
+My personal extension of the standard library, with foundational generic types and `net/http` addons.
## List of packages
@@ -21,3 +21,16 @@ I may add additional types (e.g. `Result`, `Either` or `Pair`) if:
- there is a compelling usecase for myself, and
- I find an API that is ergonomic in practice (this is the biggest reason why `Result` might never happen).
+
+## How to contribute
+
+This repository accepts contributions as follows:
+
+- For new methods and functions, feel free to submit a PR right away.
+- For entirely new types, or when adding library dependencies, please open an issue first to discuss the design.
+- Generally, we dislike library dependencies in this house because every dependency means extra work managing dependency upgrades.
+
+Before sending a patch, please ensure that `make check` does not report any problems, and run `make benchmark` to check the performance impact of your changes.
+
+To contribute to the primary repository at <https://git.xyrillian.de/go-gg>, please use `git format-patch` in the usual manner and send patches to the maintainer's mail address (which can be found in the copyright notice headers on each file).
+Alternatively, if you are still using GitHub, you can submit issues and pull requests at the mirror repository <https://github.com/majewsky/gg>.
diff --git a/assetembed/assetembed.go b/assetembed/assetembed.go
index 29bbe8e..f8dcaf8 100644
--- a/assetembed/assetembed.go
+++ b/assetembed/assetembed.go
@@ -10,7 +10,7 @@
// User agents will immediately know when to update assets served by the HTTP server
// because links to those assets will change to refer to a new filename (that includes the hash of the updated file contents).
// This allows the HTTP handler to serve files with the very efficient "Cache-Control: immutable" caching method.
-package assetembed
+package assetembed // import "go.xyrillian.de/gg/assetembed"
import (
"crypto/sha512"
@@ -24,7 +24,7 @@ import (
"strings"
"time"
- . "github.com/majewsky/gg/option"
+ . "go.xyrillian.de/gg/option"
)
// Handler serves static asset files, as described in the package documentation.
diff --git a/assetembed/assetembed_test.go b/assetembed/assetembed_test.go
index d652ac5..916d4dc 100644
--- a/assetembed/assetembed_test.go
+++ b/assetembed/assetembed_test.go
@@ -13,9 +13,9 @@ import (
"testing/fstest"
"time"
- "github.com/majewsky/gg/assetembed"
- . "github.com/majewsky/gg/internal/test"
- . "github.com/majewsky/gg/option"
+ "go.xyrillian.de/gg/assetembed"
+ . "go.xyrillian.de/gg/internal/test"
+ . "go.xyrillian.de/gg/option"
)
func TestAssetembed(t *testing.T) {
diff --git a/description b/description
index 94c763d..b7040e2 100644
--- a/description
+++ b/description
@@ -1 +1 @@
-Generic Generics: My personal extension of std, mostly containing foundational generic types
+Generic Generics: My personal extension of std, with foundational generic types and net/http addons
diff --git a/go.mod b/go.mod
index c5890e3..d2dc1a5 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,3 @@
-module github.com/majewsky/gg
+module go.xyrillian.de/gg
go 1.24
diff --git a/is/doc.go b/is/doc.go
index 42af01e..fa59b34 100644
--- a/is/doc.go
+++ b/is/doc.go
@@ -7,7 +7,7 @@
// This is not useful on its own, but may significantly improve readability
// when replacing function literals. Consider the following example:
//
-// import . "github.com/majewsky/gg/option"
+// import . "go.xyrillian.de/gg/option"
//
// func checkNewVolumeSize(size, usage uint64, maxSize Option[uint64]) error {
// switch {
@@ -25,4 +25,4 @@
// case maxSize.IsSomeAnd(func(value uint64) bool { return maxSize < size }):
// // rewritten
// case maxSize.IsSomeAnd(is.LessThan(size)):
-package is
+package is // import "go.xyrillian.de/gg/is"
diff --git a/is/is_test.go b/is/is_test.go
index 3c6c7db..854fd48 100644
--- a/is/is_test.go
+++ b/is/is_test.go
@@ -7,9 +7,9 @@ import (
"testing"
"time"
- . "github.com/majewsky/gg/internal/test"
- "github.com/majewsky/gg/is"
- . "github.com/majewsky/gg/option"
+ . "go.xyrillian.de/gg/internal/test"
+ "go.xyrillian.de/gg/is"
+ . "go.xyrillian.de/gg/option"
)
func TestComparable(t *testing.T) {
diff --git a/jsonmatch/diff_test.go b/jsonmatch/diff_test.go
index 74a976f..1a49010 100644
--- a/jsonmatch/diff_test.go
+++ b/jsonmatch/diff_test.go
@@ -10,9 +10,9 @@ import (
"strings"
"testing"
- . "github.com/majewsky/gg/internal/test"
- "github.com/majewsky/gg/jsonmatch"
- . "github.com/majewsky/gg/option"
+ . "go.xyrillian.de/gg/internal/test"
+ "go.xyrillian.de/gg/jsonmatch"
+ . "go.xyrillian.de/gg/option"
)
// assert that types implement the expected interfaces
diff --git a/jsonmatch/interface.go b/jsonmatch/interface.go
index 047a4b7..69319cb 100644
--- a/jsonmatch/interface.go
+++ b/jsonmatch/interface.go
@@ -12,7 +12,7 @@
// "net/http"
// "net/http/httptest"
//
-// "github.com/majewsky/gg/jsonmatch"
+// "go.xyrillian.de/gg/jsonmatch"
// )
//
// func TestJSONMatchOfResponseBody(t*testing.T) {
@@ -128,7 +128,7 @@
// },
// }.DiffAgainst(resp2.Body.Bytes())
// // ...
-package jsonmatch
+package jsonmatch // import "go.xyrillian.de/gg/jsonmatch"
import (
"encoding/json"
diff --git a/jsonmatch/machinery.go b/jsonmatch/machinery.go
index 32930b6..ae0c254 100644
--- a/jsonmatch/machinery.go
+++ b/jsonmatch/machinery.go
@@ -11,7 +11,7 @@ import (
"strconv"
"strings"
- . "github.com/majewsky/gg/option"
+ . "go.xyrillian.de/gg/option"
)
func marshalExpectedForDiff(value any) string {
diff --git a/option/option.go b/option/option.go
index a96e87d..8bd614c 100644
--- a/option/option.go
+++ b/option/option.go
@@ -106,7 +106,7 @@
//
// dbURL := GetDatabaseURLFromEnvironment().UnwrapOrPanic("no DB connection found")
// // ^ This is a much clearer phrasing.
-package option
+package option // import "go.xyrillian.de/gg/option"
import (
"database/sql"
@@ -173,6 +173,8 @@ func (o Option[T]) AsSlice() []T {
}
// Filter removes the contained value (if any) from the Option if it does not match the predicate.
+//
+// See package go.xyrillian.de/gg/is for pre-made predicates.
func (o Option[T]) Filter(predicate func(T) bool) Option[T] {
if o.isSome && predicate(o.value) {
return o
@@ -194,6 +196,8 @@ func (o Option[T]) IsSome() bool {
}
// IsSomeAnd returns whether the Option contains a value that matches the given predicate.
+//
+// See package go.xyrillian.de/gg/is for pre-made predicates.
func (o Option[T]) IsSomeAnd(predicate func(T) bool) bool {
return o.isSome && predicate(o.value)
}
@@ -201,6 +205,8 @@ func (o Option[T]) IsSomeAnd(predicate func(T) bool) bool {
// IsNoneOr returns whether the Option is either empty, or contains a value that matches the given predicate.
//
// If the predicate compares against the zero value, use options.IsNoneOrZero() instead.
+//
+// See package go.xyrillian.de/gg/is for pre-made predicates.
func (o Option[T]) IsNoneOr(predicate func(T) bool) bool {
return !o.isSome || predicate(o.value)
}
diff --git a/option/option_test.go b/option/option_test.go
index cc1396f..a5eb3ff 100644
--- a/option/option_test.go
+++ b/option/option_test.go
@@ -9,7 +9,7 @@ import (
"slices"
"testing"
- . "github.com/majewsky/gg/internal/test"
+ . "go.xyrillian.de/gg/internal/test"
)
func TestZeroValue(t *testing.T) {
diff --git a/options/options.go b/options/options.go
index 22d645d..429f31a 100644
--- a/options/options.go
+++ b/options/options.go
@@ -3,12 +3,12 @@
// Package options provides additional functions for type option.Option
// that cannot be expressed as methods on the Option type itself.
-package options
+package options // import "go.xyrillian.de/gg/options"
import (
"cmp"
- . "github.com/majewsky/gg/option"
+ . "go.xyrillian.de/gg/option"
)
// NOTE: Keep functions sorted by name.
diff --git a/options/options_test.go b/options/options_test.go
index fc9861f..b80d550 100644
--- a/options/options_test.go
+++ b/options/options_test.go
@@ -7,8 +7,8 @@ import (
"strconv"
"testing"
- . "github.com/majewsky/gg/internal/test"
- . "github.com/majewsky/gg/option"
+ . "go.xyrillian.de/gg/internal/test"
+ . "go.xyrillian.de/gg/option"
)
func TestFromPointer(t *testing.T) {