Compare commits

3 Commits

Author SHA1 Message Date
cuddle-please
ca1c5813aa chore(release): 0.0.2
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-22 06:37:21 +00:00
5682503665 feat: rename tag
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-22 08:36:00 +02:00
1191a6d559 chore(release): v0.0.1 (#1)
All checks were successful
continuous-integration/drone/tag Build is passing
chore(release): 0.0.1

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: https://git.front.kjuulh.io/kjuulh/yourconfig/pulls/1
2025-07-21 21:13:49 +02:00
3 changed files with 37 additions and 12 deletions

25
CHANGELOG.md Normal file
View File

@@ -0,0 +1,25 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.0.2] - 2025-07-22
### Added
- rename tag
## [0.0.1] - 2025-07-21
### Added
- remove .cuddle
- add cuddle please
- add cuddle
- remove fluff
- add readme
- add basic config loader
### Other
- fmt

View File

@@ -31,7 +31,7 @@ func Load[T any]() (T, error) {
OUTER:
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
tagStr := field.Tag.Get("conf")
tagStr := field.Tag.Get("cfg")
if tagStr == "" {
continue
}

View File

@@ -24,7 +24,7 @@ func TestLoad(t *testing.T) {
t.Run("default tag, nothing set, no env set", func(t *testing.T) {
type Config struct {
SomeItem string `conf:""`
SomeItem string `cfg:""`
someOtherItem string
someBool bool
}
@@ -37,7 +37,7 @@ func TestLoad(t *testing.T) {
t.Run("default tag (required=true), nothing set, no env set, err", func(t *testing.T) {
type Config struct {
SomeItem string `conf:"required:true"`
SomeItem string `cfg:"required:true"`
someOtherItem string
someBool bool
}
@@ -51,7 +51,7 @@ func TestLoad(t *testing.T) {
t.Run("default tag (required=false), nothing set, no env set no error", func(t *testing.T) {
type Config struct {
SomeItem string `conf:"required:false"`
SomeItem string `cfg:"required:false"`
someOtherItem string
someBool bool
}
@@ -64,7 +64,7 @@ func TestLoad(t *testing.T) {
t.Run("env tag nothing set, no env set, no error", func(t *testing.T) {
type Config struct {
SomeItem string `conf:"SOME_ITEM"`
SomeItem string `cfg:"SOME_ITEM"`
someOtherItem string
someBool bool
}
@@ -77,7 +77,7 @@ func TestLoad(t *testing.T) {
t.Run("default tag (required=true), nothing set, no env set, err", func(t *testing.T) {
type Config struct {
SomeItem string `conf:"SOME_ITEM,required:true"`
SomeItem string `cfg:"SOME_ITEM,required:true"`
someOtherItem string
someBool bool
}
@@ -91,7 +91,7 @@ func TestLoad(t *testing.T) {
t.Run("default tag (required), nothing set, no env set, err", func(t *testing.T) {
type Config struct {
SomeItem string `conf:"SOME_ITEM,required"`
SomeItem string `cfg:"SOME_ITEM,required"`
someOtherItem string
someBool bool
}
@@ -106,7 +106,7 @@ func TestLoad(t *testing.T) {
t.Run("default tag private, trying to set, err", func(t *testing.T) {
type Config struct {
SomeItem string
someOtherItem string `conf:"required:true"`
someOtherItem string `cfg:"required:true"`
someBool bool
}
@@ -121,7 +121,7 @@ func TestLoad(t *testing.T) {
t.Run("env tag and env set, no error", func(t *testing.T) {
type Config struct {
SomeItem string `conf:"required:true"`
SomeItem string `cfg:"required:true"`
someOtherItem string
someBool bool
}
@@ -136,7 +136,7 @@ func TestLoad(t *testing.T) {
t.Run("env tag (different name) and env set, no error", func(t *testing.T) {
type Config struct {
SomeItem string `conf:"DIFFERENT_NAME,required:true"`
SomeItem string `cfg:"DIFFERENT_NAME,required:true"`
someOtherItem string
someBool bool
}
@@ -151,8 +151,8 @@ func TestLoad(t *testing.T) {
t.Run("multiple env tag and env set, no error", func(t *testing.T) {
type Config struct {
SomeItem string `conf:"required:true"`
SomeOtherItem string `conf:"required:true"`
SomeItem string `cfg:"required:true"`
SomeOtherItem string `cfg:"required:true"`
someBool bool
}