From 247ab62b5e3a8a8f7fd87519f341fffc8e2627bf Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Tue, 17 Dec 2019 11:00:05 +0000 Subject: [PATCH] Add comments to public structs Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- schema/image.go | 10 +++++----- schema/metadata.go | 2 +- stack/schema.go | 7 ++++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/schema/image.go b/schema/image.go index 5208b24d6..4fd3b018d 100644 --- a/schema/image.go +++ b/schema/image.go @@ -46,16 +46,16 @@ func (i *BuildFormat) String() string { } // Set implements pflag.Value -func (l *BuildFormat) Set(value string) error { +func (i *BuildFormat) Set(value string) error { switch strings.ToLower(value) { case "", "default", "latest": - *l = DefaultFormat + *i = DefaultFormat case "sha": - *l = SHAFormat + *i = SHAFormat case "branch": - *l = BranchAndSHAFormat + *i = BranchAndSHAFormat case "describe": - *l = DescribeFormat + *i = DescribeFormat default: return fmt.Errorf("unknown image tag format: '%s'", value) } diff --git a/schema/metadata.go b/schema/metadata.go index 548a78562..d8d797d4b 100644 --- a/schema/metadata.go +++ b/schema/metadata.go @@ -3,7 +3,7 @@ package schema -//Metadata metadata of the object +// Metadata metadata of the object type Metadata struct { Name string `yaml:"name"` Namespace string `yaml:"namespace,omitempty"` diff --git a/stack/schema.go b/stack/schema.go index 953681135..18acede08 100644 --- a/stack/schema.go +++ b/stack/schema.go @@ -13,7 +13,8 @@ type Provider struct { // Function as deployed or built on FaaS type Function struct { // Name of deployed function - Name string `yaml:"-"` + Name string `yaml:"-"` + Language string `yaml:"lang"` // Handler Local folder to use for function @@ -61,14 +62,17 @@ type Function struct { Namespace string `yaml:"namespace,omitempty"` } +// Configuration for the stack.yml file type Configuration struct { StackConfig StackConfiguration `yaml:"configuration"` } +// StackConfiguration for the overall stack.yml type StackConfiguration struct { TemplateConfigs []TemplateSource `yaml:"templates"` } +// TemplateSource for build templates type TemplateSource struct { Name string `yaml:"name"` Source string `yaml:"source,omitempty"` @@ -102,6 +106,7 @@ type LanguageTemplate struct { WelcomeMessage string `yaml:"welcome_message"` } +// BuildOption a named build option for one or more packages type BuildOption struct { Name string `yaml:"name"` Packages []string `yaml:"packages"`