Git Product home page Git Product logo

Comments (18)

ascandella avatar ascandella commented on May 14, 2024

cc @breerly @anuptalwalkar

from fx.

HelloGrayson avatar HelloGrayson commented on May 14, 2024

FWIW, YARPC needs to support - in keys that populate a map[string]*.

For example, see some-service below:

rpc:
  outbounds:
    some-service:
      tchannel:
        with: yohoho

from fx.

dmcaulay avatar dmcaulay commented on May 14, 2024

i'm pro underscore. we also ran into issues with dashes (-) in service names.

from fx.

HelloGrayson avatar HelloGrayson commented on May 14, 2024

YARPC doesn't allow capitals in service names, read: yarpc/yarpc-go#313

from fx.

ascandella avatar ascandella commented on May 14, 2024

this isn't about underscores though. this is camelCase versus snake_case? my vote, as a gopher, is snakeCase, since underscore_case is basically a python-ism

from fx.

dmcaulay avatar dmcaulay commented on May 14, 2024

I've been writing too much snake_case. It looks more natural in a YAML file. I'm fine with camel though. I think it's worth picking one and sticking to it.

Did we already settle on camelCase for metric tags and values?

from fx.

bufdev avatar bufdev commented on May 14, 2024

from fx.

dmcaulay avatar dmcaulay commented on May 14, 2024

I see UberFx engdocs with snake_case 😄

from fx.

ascandella avatar ascandella commented on May 14, 2024

Ok, let's do snake_case then. However, we'll need to make sure that any existing structs we're populating (e.g. from internal libraries) don't have yaml annotations that force camelCase. Sound good?

from fx.

bufdev avatar bufdev commented on May 14, 2024

from fx.

ascandella avatar ascandella commented on May 14, 2024

from fx.

dmcaulay avatar dmcaulay commented on May 14, 2024

I agree. Mixing is annoying. If using snake is going against most go packages, then it's not worth it.

from fx.

akshayjshah avatar akshayjshah commented on May 14, 2024

We had a long-ish discussion about this in the relevant zap PR. Seems like most companies end up porting the convention of their primary language to their JSON casing; in general, though, large companies do both. By way of data points:

  • Twitter's API is snake cased.
  • Facebook's API is snake cased.
  • AWS is inconsistent.
  • Google is mostly camel cased, and their JSON style guide recommends camel.

I don't have a strong opinion, by my slight preference is to make Go packages use Go's case convention. These aren't cross-language APIs.

from fx.

bufdev avatar bufdev commented on May 14, 2024

Note that protobuf (out of google) uses underscore for their json tags https://github.com/peter-edge/protoeasy-go/blob/master/protoeasy.pb.go#L84

I know they are using camel case for kubernetes but I just like underscore more.

from fx.

dmcaulay avatar dmcaulay commented on May 14, 2024

@akshayjshah did you guys resolve it for zap? if so what did you decide? might as well go with that.

from fx.

akshayjshah avatar akshayjshah commented on May 14, 2024

Yep, we went with camel-casing.

from fx.

bufdev avatar bufdev commented on May 14, 2024

from fx.

bufdev avatar bufdev commented on May 14, 2024

I think camel casing wins now, closing this.

from fx.

Related Issues (20)

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.