Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

TO Go: inconsistencies between related structs #2893

@dangogh

Description

@dangogh

in lib/go-tc, there exist Nullable versions of most Traffic Ops structs. There are inconsistencies between these structs that should be addressed. I've written a test that should be run with unit tests to ensure that these are correct. I'll create a PR shortly with that test with instructions on how to run it.

The following is the output from the test showing these inconsistencies:

go test -tags nullable
--- FAIL: TestNullStructs (0.00s)
    nullable_test.go:97: tc.ASN.LastUpdated (string) and tc.ASNNullable.LastUpdated (*tc.TimeNoMod) have mismatched types
    nullable_test.go:72: tc.DeliveryServiceV11 has 54 fields, but tc.DeliveryServiceNullableV11 has 56
    nullable_test.go:85: field DeepCachingType found on tc.DeliveryServiceV11 but not tc.DeliveryServiceNullableV11
    nullable_test.go:85: field DNSBypassCname found on tc.DeliveryServiceV11 but not tc.DeliveryServiceNullableV11
    nullable_test.go:97: tc.DeliveryServiceV11.InitialDispersion (float32) and tc.DeliveryServiceNullableV11.InitialDispersion (*int) have mismatched types
    nullable_test.go:85: field TRResponseHeaders found on tc.DeliveryServiceV11 but not tc.DeliveryServiceNullableV11
    nullable_test.go:113: field DNSBypassCNAME found on tc.DeliveryServiceV11 but not tc.DeliveryServiceNullableV11
    nullable_test.go:113: field GeoLimitCountries found on tc.DeliveryServiceV11 but not tc.DeliveryServiceNullableV11
    nullable_test.go:113: field GeoLimitRedirectURL found on tc.DeliveryServiceV11 but not tc.DeliveryServiceNullableV11
    nullable_test.go:113: field OriginShield found on tc.DeliveryServiceV11 but not tc.DeliveryServiceNullableV11
    nullable_test.go:113: field SSLKeyVersion found on tc.DeliveryServiceV11 but not tc.DeliveryServiceNullableV11
    nullable_test.go:72: tc.Profile has 10 fields, but tc.ProfileNullable has 9
    nullable_test.go:85: field Parameter found on tc.Profile but not tc.ProfileNullable
    nullable_test.go:97: tc.SteeringTarget.DeliveryServiceID (int) and tc.SteeringTargetNullable.DeliveryServiceID (*uint64) have mismatched types
    nullable_test.go:97: tc.SteeringTarget.TargetID (int) and tc.SteeringTargetNullable.TargetID (*uint64) have mismatched types
    nullable_test.go:97: tc.SteeringTarget.Value (int) and tc.SteeringTargetNullable.Value (*uint64) have mismatched types
FAIL
exit status 1
FAIL	github.com/apache/trafficcontrol/lib/go-tc	0.045s

Metadata

Metadata

Assignees

No one assigned

    Labels

    Traffic Opsrelated to Traffic Opstech debtrework due to choosing easy/limited solution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions