Coder Social home page Coder Social logo

mapdecode's People

Contributors

abhinav avatar willhug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapdecode's Issues

Set up CI

.travis.yml is already in place so we just need to enable Travis for this repo

Prototype internally first?

Rather than farming out bits and pieces of these projects as public micro-repos, can we get all the bits working fully and vetted in production internally?

Field Hooks are not applied to embedded struct fields

Field Hooks allow interpolation on struct fields (most commonly used to add environment variables to strings). So if I have a struct:

type Config struct {
   MyField: `config:"field,interpolate"`
}

I can specify the config field as config: hello${MYENVVAR:backup} which will use the environment variable if it is available or fallback to "backup".

The issue happens if I embed structs. So if I have:

type Config struct {
  SubConfig
}
type SubConfig struct {
  MyField: `config:"field,interpolate"`
}

The code for Field Hooks does not properly interpolate the MyField struct field (i.e. we don't interpolate env vars).

I've narrowed this down to this for loop when determining to interpolate fields:
https://github.com/uber-go/mapdecode/blob/master/hooks.go#L233

This for loop does not account for embedded structs.

We can compare this to the decodeStruct method that iterates over embedded structs here:
https://github.com/uber-go/mapdecode/blob/master/internal/mapstructure/mapstructure.go#L701

Proposal: We should update the FieldHook function to iterate over the embedded structs similar to the decodeStruct method

Thoughts: @prashantv @abhinav @breerly @akshayjshah
(Mostly wondering if this was a conscious choice before implementing)

Cut v0.1.0

Let's cut a v0.1.0 so that libs can start evaluating whether we've gotten the shape of this problem right or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.