Git Product home page Git Product logo

Comments (5)

fatih avatar fatih commented on June 6, 2024

Hi @braindev

Is there a use case for anon structs? Usually it's just for quick mocking and people don't use this a lot. The reason I've didn't implemented it back then was because I've didn't see any use case for it. I know you can add tags for this as well. I'll leave this open for now, if I have time I'll tackle it (or if someone else wants to tackle this please let me know)

from gomodifytags.

braindev avatar braindev commented on June 6, 2024

@fatih my case for anonymous structs is when I'm using a library like (like sqlx for example) and I want to serialize a result from a database query to JSON in a way that won't be used anywhere else in the app I'm working on.

something like this:

cars := []struct {
  Year int     `json:"year"`
  Make string  `json:"make"`
  Model string `json: "model"`
}{}
err = db.Select(&cars, `select year, make, model from cars where ...`)

It's not the common case but when I upgraded my vim-go which uses gomodifytags I noticed I couldn't just add tags so that's why I asked.

Thanks for your awesome open source software!

from gomodifytags.

fatih avatar fatih commented on June 6, 2024

Hm, seems like my latest push already fixed it :) What a great side effect. Can you just rebuild gomodifytags and try again? Because it works for me perfectly

from gomodifytags.

braindev avatar braindev commented on June 6, 2024

Works perfectly. Thanks!

from gomodifytags.

fatih avatar fatih commented on June 6, 2024

Great, thanks @braindev for the feedback :)

from gomodifytags.

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.