github.com/go-viper/mapstructure/v2
go
pkg:golang/github.com/go-viper/mapstructure/v2
4,208 Dependabot PRs
about 4 hours ago
2,692 repositories
1,573 repositories
Recent PRs (filtered by: Open )
Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0

Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0
smartcontractkit/chainlink-aptos #293

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in /examples/custom-controller
googleforgames/agones #4261

chore(deps): bump the gomod-tools group across 1 directory with 42 updates
fredrikaverpil/dependabot-generate #21

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
HewlettPackard/hpe-morpheus-go-sdk #60

build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
luno/luno-mcp #62

Bump the misc-dependencies group across 3 directories with 31 updates
kubernetes-sigs/aws-iam-authenticator #909

Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0
GlueOps/autoglue #32

chore(deps): Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
rancher/cluster-api-provider-rke2 #737

[Go]: Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in /dtm

build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in /litrpc
lightninglabs/lightning-terminal #1140

chore: bump the go_modules group with 4 updates
rancher-sandbox/sbombastic #410

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in the go_modules group across 1 directory

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
Codes-Exe/github-mcp-server #1

build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
foks-proj/go-foks #200

build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
flexprice/flexprice #469

chore(deps): bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0 in /src in the go_modules group across 1 directory

gomod: bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
prolific-oss/cli #191

build(deps): bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in the go_modules group
JaclynCodes/Pretend-telegram #5

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in /core/scripts/cre/environment/examples/workflows/v2/http_simple
mikeyhodl/chainlink #1153

chore(deps): bump the go_modules group across 1 directory with 2 updates

Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0

Bump the misc-dependencies group across 3 directories with 28 updates
kubernetes-sigs/aws-iam-authenticator #907

chore(deps): bump the go_modules group across 1 directory with 2 updates

Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0 in /integration-test
wego/pkg #185

Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0 in /opa_fig_autocomplete
open-policy-agent/contrib #271

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
RainbowScientist5/github-mcp-server #1

Bump the go_modules group across 2 directories with 1 update

Bump the go_modules group across 1 directory with 9 updates
NethermindEth/dydx-v4-chain-fork #1

build(deps): bump the go_modules group with 2 updates
crypto-org-chain/ethermint #716

chore(deps): bump the go_modules group across 3 directories with 6 updates

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
chat-roulettte/chat-roulette #101

chore(deps): Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
redhat-et/GKM #45

Bump the golang-dependencies group across 1 directory with 73 updates
openshift/configuration-anomaly-detection #557

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
ciazhar/go-zhar #12

Bump the golang-dependencies group across 1 directory with 68 updates
openshift/configuration-anomaly-detection #556

build(deps): bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0 in /config

Bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0 in /go-client

build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
Ensono/eirctl #52

Bump the go_modules group across 1 directory with 10 updates

chore(deps): bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.4.0
gotofu-com/mochi #24

Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
NatLibFi/ekirjasto-webreader #8

deps(deps): bump the go_modules group with 7 updates
SwissOpenEM/Ingestor #181

gomod(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in the go_modules group
kyma-project/cli #2558

Bump the golang-dependencies group across 1 directory with 69 updates
openshift/configuration-anomaly-detection #555

Build(deps): Bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
StackExchange/dnscontrol #3743

Package Details
Name: | github.com/go-viper/mapstructure/v2 |
Ecosystem: | go |
PURL Type: | golang |
Package URL: | pkg:golang/github.com/go-viper/mapstructure/v2 |
JSON API: | View JSON |
Security Advisories
Package Information
Package mapstructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure. The Go structure can be arbitrarily complex, containing slices, other structs, etc. and the decoder will properly decode nested maps and so on into the proper structures in the native Go struct. See the examples to see what the decoder is capable of. The simplest function to start with is Decode. When decoding to a struct, mapstructure will use the field name by default to perform the mapping. For example, if a struct has a field "Username" then mapstructure will look for a key in the source value of "username" (case insensitive). You can change the behavior of mapstructure by using struct tags. The default struct tag that mapstructure looks for is "mapstructure" but you can customize it using DecoderConfig. To rename the key that mapstructure looks for, use the "mapstructure" tag and set a value directly. For example, to change the "username" example above to "user": Embedded structs are treated as if they're another field with that name. By default, the two structs below are equivalent when decoding with mapstructure: This would require an input that looks like below: If your "person" value is NOT nested, then you can append ",squash" to your tag value and mapstructure will treat it as if the embedded struct were part of the struct directly. Example: Now the following input would be accepted: When decoding from a struct to a map, the squash tag squashes the struct fields into a single map. Using the example structs from above: Will be decoded into a map: DecoderConfig has a field that changes the behavior of mapstructure to always squash embedded structs. If there are any unmapped keys in the source value, mapstructure by default will silently ignore them. You can error by setting ErrorUnused in DecoderConfig. If you're using Metadata you can also maintain a slice of the unused keys. You can also use the ",remain" suffix on your tag to collect all unused values in a map. The field with this tag MUST be a map type and should probably be a "map[string]interface{}" or "map[interface{}]interface{}". See example below: Given the input below, Other would be populated with the other values that weren't used (everything but "name"): When decoding from a struct to any other value, you may use the ",omitempty" suffix on your tag to omit that value if it equates to the zero value. The zero value of all types is specified in the Go specification. For example, the zero type of a numeric type is zero ("0"). If the struct field value is zero and a numeric type, the field is empty, and it won't be encoded into the destination type. Since unexported (private) struct fields cannot be set outside the package where they are defined, the decoder will simply skip them. For this output type definition: Using this map as input: The following struct will be decoded: mapstructure is highly configurable. See the DecoderConfig struct for other features and options that are supported.
Repository: | https://github.com/go-viper/mapstructure |
Homepage: | https://github.com/go-viper/mapstructure |
Latest Release: |
v2.2.1
12 months ago |
Dependent Repos: | 0 |
Dependent Packages: | 0 |
Ranking: | Top 10.7353% by dependent repos Top 9.5205% by dependent pkgs |