Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving resources from subfolders to parent #16

Open
KalleDK opened this issue Mar 25, 2022 · 2 comments
Open

Moving resources from subfolders to parent #16

KalleDK opened this issue Mar 25, 2022 · 2 comments

Comments

@KalleDK
Copy link

KalleDK commented Mar 25, 2022

I'm writing a telegraf plugin to pull data from ADC's and SDX's, and I'm experiences som difficulty importing the different resources, as they are in subdirs, but named the same as their config partner. So if I import both the config and the stat resource, then I have to rename one of them.

import (
        lbconfig "github.com/citrix/adc-nitro-go/resource/config/lb"
        lbstats "github.com/citrix/adc-nitro-go/resource/stat/lb"
        networkconfig "github.com/citrix/adc-nitro-go/resource/config/network"
        networkstats "github.com/citrix/adc-nitro-go/resource/stat/network"

)

var lbs lbstats.Lbvserverstats
var lbc lbconfig.Lbvserver
var rnats networkstats.Rnatstats
var rnatc networkconfig.Rnat

What I would suggest is

import (
        res_stat "github.com/citrix/adc-nitro-go/resource/config"
        res_conf "github.com/citrix/adc-nitro-go/resource/stat"
)

var lbs res_stat.Lbvserverstats
var lbc res_conf.Lbvserver
var rnats res_stat.Rnatstats
var rnatc res_conf.Rnat

It's easy to see how this expands very exponential with imports and aliases.

I've tried to implement the move at https://github.com/KalleDK/adc-nitro-go/commits/main
Also I'm cleaning up the resource structs by tagging the json with string, where the json value is a string encoded int

@jantytgat
Copy link

Hi KalleDK is there a way I can get in touch with you on this?

@KalleDK
Copy link
Author

KalleDK commented Mar 25, 2022

Ofcourse - I send you a mail with contact info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants