Skip to content

Moving resources from subfolders to parent #16

@KalleDK

Description

@KalleDK

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions