good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gun
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
open
gun
Commits
911d54f0
Commit
911d54f0
authored
Jun 28, 2022
by
a
Browse files
Options
Downloads
Patches
Plain Diff
better example
parent
e7d586b3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
readme.md
+9
-4
9 additions, 4 deletions
readme.md
with
9 additions
and
4 deletions
readme.md
+
9
−
4
View file @
911d54f0
...
...
@@ -2,8 +2,6 @@
gun, short for go config, is a very opinionated and simple config library
it's meant to be incredibly simple.
## how to use
simply create a struct that is json encodable into what you need
...
...
@@ -17,7 +15,12 @@ does NOT work with nested variables.
env vars ONLY works with integer types, float types, and string. all other types will PANIC!!!
what you can do is this
```
package main
var Config struct {
Field string `yaml:"some_field"`
Crack int
...
...
@@ -33,6 +36,10 @@ var Config struct {
func init() {
gun.Load(&Config)
}
func main() {
_ = Config.Field
}
```
It will look for the config file in the following places.
...
...
@@ -46,8 +53,6 @@ It will look for the config file in the following places.
6.
/config.json
## important
gun will read config file only once, when you ask it to read.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment