Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Configuration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Go
Application
Configuration
Compare revisions
v1.0.0 to v1.0.1
"source/utils/strings_test.go" did not exist on "66318fe6da723e3ccd5dc85ae852b94e82be8823"
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
oss/libraries/go/application/configuration
Select target project
No results found
v1.0.1
Select Git revision
Swap
Target
oss/libraries/go/application/configuration
Select target project
oss/libraries/go/application/configuration
1 result
v1.0.0
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
documentation
· 98adb543
Volker Schukai
authored
2 years ago
98adb543
bugfix wrong return value of function newUnsupportedReflectKindError
· 72e20bd3
Volker Schukai
authored
2 years ago
72e20bd3
Bump version to 1.0.1
· b4f686d3
Volker Schukai
authored
2 years ago
b4f686d3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+9
-11
9 additions, 11 deletions
README.md
error.go
+2
-2
2 additions, 2 deletions
error.go
error_test.go
+73
-0
73 additions, 0 deletions
error_test.go
release.json
+1
-1
1 addition, 1 deletion
release.json
with
85 additions
and
14 deletions
README.md
View file @
b4f686d3
## Configuration
## Installation
```
shell
go get gitlab.schukai.com/oss/libraries/go/application/configuration
```
**Note:**
This library uses
[
Go Modules
](
https://github.com/golang/go/wiki/Modules
)
to manage dependencies.
## What do this library?
This library provides a simple way to load configuration from different sources.
...
...
@@ -23,6 +15,15 @@ It supports:
*
[x] Properties
*
[x] Configuration from a struct
*
[x] HTTP API (get and set configuration)
*
[x] Monitor File changes
## Installation
```
shell
go get gitlab.schukai.com/oss/libraries/go/application/configuration
```
**Note:**
This library uses
[
Go Modules
](
https://github.com/golang/go/wiki/Modules
)
to manage dependencies.
## Usage
...
...
@@ -228,9 +229,6 @@ returns a bool channel on which the status of the watch is reported.
If the watch has ended, a true is sent over the channel. If an error occurs, a false is sent.
```
go
#### Streams
The configuration can also be loaded from a stream. This is useful if you want to
...
...
This diff is collapsed.
Click to expand it.
error.go
View file @
b4f686d3
...
...
@@ -28,7 +28,7 @@ func newPathAlreadyExistsError(path string) PathAlreadyExistsError {
return
PathAlreadyExistsError
(
errors
.
New
(
"files "
+
path
+
" already exists"
))
}
// PathDoesNotExistError is returned when a files do
es
not exist
// PathDoesNotExistError is returned when a files do not exist
type
PathDoesNotExistError
error
func
newPathDoesNotExistError
(
path
string
)
PathDoesNotExistError
{
...
...
@@ -59,7 +59,7 @@ func (s *setting[C]) ResetErrors() *setting[C] {
// At the reflect level, some types are not supported
type
UnsupportedReflectKindError
error
func
newUnsupportedReflectKindError
(
t
reflect
.
Type
)
Unsupported
Type
Error
{
func
newUnsupportedReflectKindError
(
t
reflect
.
Type
)
Unsupported
ReflectKind
Error
{
return
UnsupportedReflectKindError
(
errors
.
New
(
"type "
+
t
.
String
()
+
" is not supported"
))
}
...
...
This diff is collapsed.
Click to expand it.
error_test.go
0 → 100644
View file @
b4f686d3
package
configuration
import
(
"github.com/stretchr/testify/assert"
"reflect"
"testing"
)
func
TestResetErrors
(
t
*
testing
.
T
)
{
defaults
:=
ConfigStruct2
{
A
:
"Hello!"
,
}
c
:=
New
(
defaults
)
assert
.
False
(
t
,
c
.
HasError
())
c
.
SetDefaultDirectories
()
assert
.
True
(
t
,
c
.
HasError
())
c
.
ResetErrors
()
assert
.
False
(
t
,
c
.
HasError
())
}
func
TestNewFlagDoesNotExistError
(
t
*
testing
.
T
)
{
err
:=
newFlagDoesNotExistError
(
"flag"
)
_
,
ok
:=
err
.
(
FlagDoesNotExistError
)
assert
.
True
(
t
,
ok
)
}
func
TestNewPathAlreadyExistsError
(
t
*
testing
.
T
)
{
err
:=
newPathAlreadyExistsError
(
"flag"
)
_
,
ok
:=
err
.
(
PathAlreadyExistsError
)
assert
.
True
(
t
,
ok
)
}
func
TestNewPathDoesNotExistError
(
t
*
testing
.
T
)
{
err
:=
newPathDoesNotExistError
(
"flag"
)
_
,
ok
:=
err
.
(
PathDoesNotExistError
)
assert
.
True
(
t
,
ok
)
}
func
TestNewFormatNotSupportedError
(
t
*
testing
.
T
)
{
err
:=
newFormatNotSupportedError
(
Yaml
)
_
,
ok
:=
err
.
(
FormatNotSupportedError
)
assert
.
True
(
t
,
ok
)
}
func
TestNewUnsupportedTypeError
(
t
*
testing
.
T
)
{
x
:=
reflect
.
TypeOf
(
"string"
)
err
:=
newUnsupportedTypeError
(
x
)
_
,
ok
:=
err
.
(
UnsupportedTypeError
)
assert
.
True
(
t
,
ok
)
}
func
TestNewUnsupportedReflectKindError
(
t
*
testing
.
T
)
{
x
:=
reflect
.
TypeOf
(
"string"
)
err
:=
newUnsupportedReflectKindError
(
x
)
_
,
ok
:=
err
.
(
UnsupportedReflectKindError
)
assert
.
True
(
t
,
ok
)
}
func
TestNewFlagNotFoundError
(
t
*
testing
.
T
)
{
err
:=
newFlagNotFoundError
(
"flag"
)
_
,
ok
:=
err
.
(
FlagNotFoundError
)
assert
.
True
(
t
,
ok
)
}
func
TestNewMismatchedTypeError
(
t
*
testing
.
T
)
{
x
:=
reflect
.
TypeOf
(
"string"
)
err
:=
newMismatchedTypeError
(
x
,
x
)
_
,
ok
:=
err
.
(
MismatchedTypeError
)
assert
.
True
(
t
,
ok
)
}
This diff is collapsed.
Click to expand it.
release.json
View file @
b4f686d3
{
"version"
:
"1.0.
0
"
}
{
"version"
:
"1.0.
1
"
}
This diff is collapsed.
Click to expand it.