Fix: make struct un-exported

This commit is contained in:
sanposhiho 2021-09-09 07:10:37 +09:00
parent cc846c9d33
commit 24643c67d5

View File

@ -134,16 +134,16 @@ type workload struct {
// Name of the workload. // Name of the workload.
Name string Name string
// Values of parameters used in the workloadTemplate. // Values of parameters used in the workloadTemplate.
Params Params Params params
} }
type Params struct { type params struct {
params map[string]int params map[string]int
// isUsed field records whether params is used or not. // isUsed field records whether params is used or not.
isUsed map[string]bool isUsed map[string]bool
} }
// UnmarshalJSON is a custom unmarshaler for Params. // UnmarshalJSON is a custom unmarshaler for params.
// //
// from(json): // from(json):
// { // {
@ -152,7 +152,7 @@ type Params struct {
// } // }
// //
// to: // to:
// Params{ // params{
// params: map[string]int{ // params: map[string]int{
// "intNodes": 500, // "intNodes": 500,
// "initPods": 50, // "initPods": 50,
@ -160,7 +160,7 @@ type Params struct {
// isUsed: map[string]bool{}, // empty map // isUsed: map[string]bool{}, // empty map
// } // }
// //
func (p *Params) UnmarshalJSON(b []byte) error { func (p *params) UnmarshalJSON(b []byte) error {
aux := map[string]int{} aux := map[string]int{}
if err := json.Unmarshal(b, &aux); err != nil { if err := json.Unmarshal(b, &aux); err != nil {
@ -173,7 +173,7 @@ func (p *Params) UnmarshalJSON(b []byte) error {
} }
// getParam gets param with key. // getParam gets param with key.
func (p Params) getParam(key string) (int, error) { func (p params) getParam(key string) (int, error) {
p.isUsed[key] = true p.isUsed[key] = true
param, ok := p.params[key] param, ok := p.params[key]
if ok { if ok {