Best project structure when using go 1.11 mod · Issue #18 · golang-standards/project-layout
The first thing you will run into when using go.mod, putting code outside GOPATH, and using the recommended folder structure is that your cmd/ does not have access to your internal or pkg folder. T...
Add a value hook func by camdencheek · Pull Request #183 · mitchellh/mapstructure
Overview This commit adds a third hook func type which has access to the reflect.Value representations of both the from and the to objects. This gives all the same power of the existing hook functi...
OpenWrt and PFSense - Installing and Using OpenWrt - OpenWrt Forum
I've been reading up a bit around pfSense. Both have really strong communities. The biggest delineation between the two seems to be the target hardware and hence 'meatier' packages are available for pf. That said, is there any real difference in the underlying security/performance of the two distros? Is pfSense also using IPTables on the backend? Given a dual-core x86 system with 4GB ram, and assuming that OpenWRT has all the packages and functionality you need, I would have thought (given t...
Squash embedded structs by default · Issue #42 · mitchellh/mapstructure
To be consistent with "encoding/json", an embedded struct like type Outer struct { Inner } should behave as though tagged with mapstructure:",squash", unless explicitly given a ...
// sorry for my poor english :) // I just want to use Animal inside another struct, but the remote json-string doesn't have this tag // It's only used for sharing the common attributes, oth...
Use unmashal with embedded struct · Issue #797 · spf13/viper
I try to use unmarshal to struct and It's work great. And now, I want to unmarshal yaml file to embedded struct. See example. main.go type Base struct { Foo string } type SomeStruct struct { Ba...
Consider env vars when unmarshalling · Issue #188 · spf13/viper
Is this possible? UPDATE: yes it is, see #188 (comment) type Config struct { BindPort int `mapstructure:"port" yaml:"port,omitempty"` } var c Config // ... viper.AutomaticEnv() ...
This is going to be an umbrella issue for other open issues for this problem. These are: #1236 #725 #688 #584 #212 #188 #140 Problem Currently Viper cannot unmarshal automatically loaded environmen...
Unmarshal not working with composed/embedded structs · Issue #928 · spf13/viper
Hi, I'm trying to use viper.Unmarshal to unmarshal my config into a struct, to avoid duplication, the struct is using composition, something like this: type CheckConfig struct { Name string `ma...
No support for anonymous structs · Issue #19 · mitchellh/mapstructure
Given a struct ("outer") that hosts an anonymous inner struct ("inner")... type inner struct { I1 string } type outer struct { inner O1 int } I expected mapstructure.Decode to t...
Decode fails for anonymous structures · Issue #113 · mitchellh/mapstructure
I tried to decode from map to a struct which has anonymous struct inside. This works on simple json.Marshal -> json.Unmarshal but it fails in mapstructure. package deserializer import ( "en...
How do you tag fields of embedded structs which you cannot modify?
Suppose there is an external library libA who declares NotMyType.
type NotMyType struct {
NotMyField string
}
And you would like to embed it with one of your own types, which you use with an O...
Is there something like Ruby's awesome_print in Go?
For example in Ruby you could write:
require 'ap'
x = {a:1,b:2} // also works for class
ap x
the output would be:
{
"a" => 1,
"b" =&g...