Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
3620d3d
Support `.env` format files (#528)
mexisme Jun 11, 2019
33688bf
Fix typo on README.md (#710)
Fedalto Jun 11, 2019
a527959
fixed marshal (#647)
0xflotus Jun 11, 2019
0da4d41
Add WriteConfig documentation (#649)
EmilLuta Jun 11, 2019
ad5ed02
Add support for int slice flags (#637)
sagikazarmark Jun 11, 2019
0c777cf
Fix indentation for yamlStringSettings (#651)
pawanrawal Jun 11, 2019
fde59dd
ADD: installation method (#604)
AlphaWong Jun 11, 2019
b235f72
fix(leak): fix leak in dependency magiconair/properities
liubog2008 Jun 4, 2019
3b4aca7
Fix example code
okazu-dm Aug 12, 2018
3349bd9
Improve Unmarshal docs (#713)
sagikazarmark Jun 14, 2019
2b4f7d3
Add dotenv documentation in README.md
victor23d Jun 22, 2019
96441b4
BindEnv details specified. Now less confusion.
BruceWangNo1 Jun 20, 2019
d34be8d
Improve BindEnv details
sagikazarmark Jul 13, 2019
5ae3a07
Add documentation for no config file found
lucperkins Jun 22, 2019
72cbe34
Improve travis
sagikazarmark Jul 13, 2019
b8221cf
Add GetIntSlice helper method
zer0tonin Jun 19, 2019
7fdad02
Fix typo
sagikazarmark Jul 13, 2019
275a36d
Fix function comments based on best practices from Effective Go
CodeLingoBot Feb 13, 2019
e6d1c6b
Improve godoc
sagikazarmark Jul 13, 2019
e325492
Add missing call to initWF.Done()
cocorambo Jan 3, 2019
e02bc9e
Fixed missing f.Close() in writeConfig()
bpizzi Jul 27, 2018
cdccc81
Fix SafeWriteConfig
Jan 30, 2018
d65fa76
Fixed typo
muesli Jul 19, 2019
1b33e82
Add error handling
muesli Jul 19, 2019
33bf76a
Simplify code
muesli Jul 19, 2019
e697d55
Fix small typo
TwiN Aug 16, 2019
bd1db6b
Run go mod tidy
sagikazarmark Aug 29, 2019
99520c8
Implemented ability to unmarshal keys containing dots to structs.
inkychris Mar 16, 2019
583f79b
remote: fix two dropped errors
alrs Sep 18, 2019
c171232
Add go version to the mod file
sagikazarmark Sep 27, 2019
371f39c
Add Go 1.13 to travis
sagikazarmark Sep 27, 2019
398adc5
Add breaking test that requires reverting #673
sagikazarmark Sep 27, 2019
71509d2
Revert the effective changes of #673
sagikazarmark Sep 27, 2019
40e41dd
Updates YAML to v2.2.4
navidshaikh Oct 16, 2019
72b022e
Added capacity to slice creation
vivekv96 Oct 9, 2019
d1c60d9
Support config files with no extensions (#722)
pedromss Nov 6, 2019
01d7d76
Add Mercure in the list of projects using Viper
dunglas Nov 8, 2019
4e1ebbd
Added tests to TestIsSet()
benoitmasson Apr 11, 2017
9e353e3
find() looks for flag's default values only when requested.
benoitmasson Apr 11, 2017
a708479
Updating SafeWriteConfig and SafeWriteConfigAs to match documented be…
javaducky Sep 13, 2019
3a19b6e
Review updates to utilize afero for file checks and updated checks on…
javaducky Dec 4, 2019
351bfe9
loop through ini sections
techknowlogick Dec 3, 2019
8feab54
Tidy dependencies
sagikazarmark Dec 6, 2019
abdeaff
Add golangci config
sagikazarmark Dec 6, 2019
d52c544
Add Makefile
sagikazarmark Dec 6, 2019
fae3a81
Add ide integration
sagikazarmark Dec 6, 2019
78a0e37
Add github actions workflow
sagikazarmark Dec 6, 2019
e316012
Fix gofmt
sagikazarmark Dec 6, 2019
cea8b9d
Fix goimports
sagikazarmark Dec 6, 2019
7b5adba
Fix whitespace
sagikazarmark Dec 6, 2019
29bb3ee
Fix deadcode
sagikazarmark Dec 6, 2019
8b7fbca
Fix golint
sagikazarmark Dec 6, 2019
2fd264d
Fix misspell
sagikazarmark Dec 6, 2019
c4fedd1
Fix check target
sagikazarmark Dec 6, 2019
6895c08
INI is supported
sagikazarmark Dec 6, 2019
52836e6
Improve badges
sagikazarmark Dec 6, 2019
b6ced70
Generic improvements
sagikazarmark Dec 6, 2019
a73303e
Add key delimiter setter
sagikazarmark Nov 6, 2019
9a405be
Add SetKeyDelimiter to the README
sagikazarmark Nov 6, 2019
a842b8f
Replace SetKeyDelimiter with functional options
sagikazarmark Nov 8, 2019
bdf2db0
Fix goimports
sagikazarmark Dec 6, 2019
6fcf985
Fix readme
sagikazarmark Dec 6, 2019
4ad4c8d
Add string replacer interface and env key replacer option
sagikazarmark Dec 6, 2019
bcb420b
Add global UnmarshalExact method
greghaynes Jun 8, 2018
5ad4bc0
Add decoder opts to unmarshal exact
sagikazarmark Dec 6, 2019
eabbc68
Fix file path lookup
sagikazarmark Dec 6, 2019
06ab5a4
Add documentation about unmarshaling into embedded structs
sagikazarmark Jan 8, 2020
9cd5712
Extensionless files only allowed when config type is set (#827)
pedromss Jan 16, 2020
4525543
Improve CI
sagikazarmark Jan 16, 2020
16fb4b9
Add editorconfig
sagikazarmark Jan 16, 2020
1b7d3e0
Improve golangci config
sagikazarmark Jan 16, 2020
df9f4af
Remove travis config
sagikazarmark Jan 16, 2020
f2cbaea
Fix copy-paste error in documentation
sagikazarmark Jan 16, 2020
7ddaa61
Remove .idea directory
aeneasr Feb 19, 2020
502400c
changed github.com/xordataexchange/crypt to github.com/bketelsen/crypt.
alxmsl Jan 16, 2020
9c81997
added firestore support.
alxmsl Jan 16, 2020
b31a492
updated docs in README.
alxmsl Jan 31, 2020
97ee7ad
Add support to save file with no extension (#813)
gssbzn Feb 19, 2020
9b03d15
Ignore idea
sagikazarmark Apr 9, 2020
aa8e4d4
Update badges and logo
sagikazarmark Apr 9, 2020
7eea371
Remove go version badge
sagikazarmark Apr 9, 2020
e34fb51
Add mentioned in awesome badge
sagikazarmark Apr 9, 2020
c42a305
Update gorilla dependency (#899)
jpmcb Apr 21, 2020
c6ee980
fix_ini_save_error
deep-bugs Mar 15, 2020
3856c05
Fix: Getting the value of a StringToString pflag (#874)
terev May 9, 2020
13df721
Add Go 1.14 to build targets
sagikazarmark May 9, 2020
13494e8
Skipping error != nil checks in favor of the fast return.
butuzov May 21, 2020
ce53404
Fix environment variable expansion in absPathify
biochimia May 6, 2018
3826be3
Simplify $HOME prefix check
qjcg Jul 31, 2020
9c7144e
Build on both linux and macos
sagikazarmark Sep 5, 2020
f26928c
Add Go 1.15 to the build matrix
sagikazarmark Sep 9, 2020
387404d
Add log for remote config errors
sagikazarmark Sep 9, 2020
ae12c84
Upgrade linter
sagikazarmark Sep 11, 2020
a515209
Improve lint rules
sagikazarmark Sep 11, 2020
d9d7dcd
Increase lint timeout
sagikazarmark Sep 11, 2020
a028516
ensure BindPFlag() detects a nil flag parameter before wrapping in pf…
bhamail Aug 11, 2020
406ea27
Add feedback form to the readme
sagikazarmark Sep 26, 2020
6d4eb76
Add feedback form to the readme
sagikazarmark Sep 26, 2020
29c3027
docs: rewrite sub documentation
sagikazarmark Sep 27, 2020
bed424f
Add feedback bot to issue
sagikazarmark Sep 30, 2020
dd2e0fa
Add feedback bot to pull request
sagikazarmark Sep 30, 2020
f3c0954
Add some emojis to feedback bot
sagikazarmark Sep 30, 2020
b534983
Add some emojis to feedback bot
sagikazarmark Sep 30, 2020
b655224
Allow BindEnv to register multiple environment variables.
gbbr Sep 10, 2020
ea89028
Update docs
gbbr Sep 30, 2020
cfcfed5
refactor: add setenv helper for tests
sagikazarmark Sep 30, 2020
d2df377
ci: drop tests for Go 1.11-1.13
sagikazarmark Sep 30, 2020
f67a901
docs: add go version badge and update pkg.go.dev badge
sagikazarmark Sep 30, 2020
16dc0f7
chore(deps): update mapstructure dependency
sagikazarmark Sep 30, 2020
82c2ddf
Fix tests broken by mapstructure update
sagikazarmark Sep 30, 2020
0a45372
Remove pull request feedback
sagikazarmark Oct 1, 2020
656b877
Revert "Remove pull request feedback"
sagikazarmark Oct 3, 2020
44e6ee8
Use pull_request_target event in PR feedback
sagikazarmark Oct 3, 2020
33bcdc9
Added support for accessing slices (#861)
dylandreimerink Oct 4, 2020
8c89438
docs: improve AutomaticEnv documentation
sagikazarmark Oct 8, 2020
4938331
fix typo
meysampg Oct 12, 2020
f415025
Fix a minor typo in README.md
scorphus Oct 30, 2020
493643f
Update README.md
sagikazarmark Nov 3, 2020
6ddd354
Always quote $@
bltb Nov 27, 2020
bba82cf
docs: add run on repl.it badge with example
sagikazarmark Dec 3, 2020
811f0e6
Add issue and PR templates
sagikazarmark Dec 11, 2020
99da8b2
Add labels to issue templates
sagikazarmark Dec 11, 2020
da70fee
Add troubleshooting about unmarshaling
sagikazarmark Dec 17, 2020
d10c856
Add discussions to issue links
sagikazarmark Jan 11, 2021
e66f940
docs: add troubleshooting guide about package not being found
sagikazarmark Feb 15, 2021
a86148e
docs: add note about go modules to the readme
sagikazarmark Feb 15, 2021
4613c4a
docs: move troubleshooting to a new document
sagikazarmark Feb 15, 2021
3c7b44f
Update afero version (CVE-2020-14040) (#1090)
bridgetbarnes Mar 10, 2021
fb4eafd
fix INI saving panics (#1075)
r-stepanenko Mar 10, 2021
5253694
ci: add Go 1.16 to build matrix
sagikazarmark Mar 15, 2021
7fdb267
chore: update dependencies
sagikazarmark Apr 15, 2021
cb41ae0
doc: discuss concurrency in README
whereswaldon Apr 13, 2021
727a41c
doc: add a note about concurent Get/Set to godoc
whereswaldon Apr 13, 2021
b84f0be
Resolve conflicts merging upstream v1.7.1
gbunt Apr 19, 2021
b687322
Additional merge fixes
gbunt Apr 19, 2021
c44d72e
Merge branch 'master' into viper-update
sjohnson-cloudian Apr 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.go]
indent_style = tab

[{Makefile, *.mk}]
indent_style = tab
2 changes: 2 additions & 0 deletions .github/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.yml]
indent_size = 2
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: 🐛 Bug report
about: Report a bug to help us improve Viper
labels: kind/bug
---
<!--
Thank you for sending a bug report! Here are some tips:

1. Please fill out the template below to make it easier to debug your problem.
2. If you are not sure if it is a bug or not, you can ask in the Gophers slack channel `#viper`.
-->

**Expected behavior (what you expected to happen)**:

**Actual behavior (what actually happened)**:

**Repl.it link**:
<!-- you can use the following example: https://repl.it/@sagikazarmark/Viper-example -->

**Code reproducing the issue**:
<!-- just to make sure the content of the repl doesn't get lost -->

```go

```

<!-- include configuration file example if necessary -->

**Environment**:
- Viper version:
- Config source: <!-- flag, env, file, etc -->
- File format: <!-- JSON, YAML, TOML, etc -->

**Anything else we should know?**:
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
blank_issues_enabled: false
contact_links:
- name: ❓ Ask a question
url: https://github.com/spf13/viper/discussions/new?category=q-a
about: Ask and discuss questions with other Viper community members

- name: 📓 Reference
url: https://pkg.go.dev/mod/github.com/spf13/viper
about: Check the Go code reference

- name: 💬 Slack channel
url: https://gophers.slack.com/messages/viper
about: Please ask and answer questions here
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: 🚀 Feature request
about: Suggest an idea for Viper
labels: kind/enhancement
---
<!--
Thank you for sending a feature request!
Please describe what you would like to change/add and why in detail by filling out the template below.
-->

**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like to see**
<!-- A clear and concise description of what would you like to happen. -->

**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Thank you for sending a pull request! Here some tips for contributors:

1. Fill the description template below.
2. Include appropriate tests (if necessary). Make sure that all CI checks passed.
3. If the Pull Request is a work in progress, make use of GitHub's "Draft PR" feature and mark it as such.
-->

**Overview**:
<!-- Describe your changes briefly here. -->

**What problem does it solve?**:
<!--
- Please state in detail why we need this PR and what it solves.
- If your PR closes some of the existing issues, please add links to them here.
Mentioned issues will be automatically closed.
Usage: "Closes #<issue number>", or "Closes (paste link of issue)"
-->

**Special notes for a reviewer**:
Binary file added .github/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go: ['1.14', '1.15', '1.16']
env:
VERBOSE: 1
GOFLAGS: -mod=readonly
GOPROXY: https://proxy.golang.org

steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Checkout code
uses: actions/checkout@v2

- name: Lint
run: make lint

- name: Test
run: make test
32 changes: 32 additions & 0 deletions .github/workflows/feedback_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
issues:
types: [opened]

jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for reporting!

A maintainer will take a look at your issue shortly. 👀

In the meantime: We are working on **Viper v2** and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues.

⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9

📣 If you've already given us your feedback, you can still help by spreading the news,
either by sharing the above link or telling people about this on Twitter:

https://twitter.com/sagikazarmark/status/1306904078967074816

**Thank you!** ❤️
`,
})
32 changes: 32 additions & 0 deletions .github/workflows/feedback_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
pull_request_target:
types: [opened]

jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `👋 Thanks for contributing to Viper! You are awesome! 🎉

A maintainer will take a look at your pull request shortly. 👀

In the meantime: We are working on **Viper v2** and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues.

⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9

📣 If you've already given us your feedback, you can still help by spreading the news,
either by sharing the above link or telling people about this on Twitter:

https://twitter.com/sagikazarmark/status/1306904078967074816

**Thank you!** ❤️
`,
})
34 changes: 5 additions & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.test
*.bench

.vscode

# exclude dependencies in the `/vendor` folder
vendor
/.idea/
/bin/
/build/
/var/
/vendor/
76 changes: 76 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
run:
timeout: 5m

linters-settings:
gci:
local-prefixes: github.com/spf13/viper
golint:
min-confidence: 0
goimports:
local-prefixes: github.com/spf13/viper

linters:
disable-all: true
enable:
- bodyclose
- deadcode
- dogsled
- dupl
- exhaustive
- exportloopref
- gci
- goconst
- gofmt
- gofumpt
- goimports
- golint
- goprintffuncname
- govet
- ineffassign
- misspell
- nakedret
- noctx
- nolintlint
- prealloc
- rowserrcheck
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

# fixme
# - errcheck
# - gochecknoglobals
# - gochecknoinits
# - gocognit
# - gocritic
# - gocyclo
# - godot
# - gosec
# - gosimple
# - lll
# - nlreturn
# - scopelint

# unused
# - depguard
# - goheader
# - gomodguard

# don't enable:
# - asciicheck
# - funlen
# - godox
# - goerr113
# - gomnd
# - interfacer
# - maligned
# - nestif
# - testpackage
# - wsl
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

Loading
Loading