Skip to content

Commit 2766c36

Browse files
committed
Fix fmt with go1.19
1 parent 8572863 commit 2766c36

File tree

8 files changed

+30
-29
lines changed

8 files changed

+30
-29
lines changed

pkg/devfile/parser/data/v2/header.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ import (
1919
devfilepkg "github.com/devfile/api/v2/pkg/devfile"
2020
)
2121

22-
//GetSchemaVersion gets devfile schema version
22+
// GetSchemaVersion gets devfile schema version
2323
func (d *DevfileV2) GetSchemaVersion() string {
2424
return d.SchemaVersion
2525
}
2626

27-
//SetSchemaVersion sets devfile schema version
27+
// SetSchemaVersion sets devfile schema version
2828
func (d *DevfileV2) SetSchemaVersion(version string) {
2929
d.SchemaVersion = version
3030
}

pkg/devfile/parser/data/v2/projects.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (d *DevfileV2) DeleteProject(name string) error {
108108
}
109109
}
110110

111-
//GetStarterProjects returns the DevfileStarterProject parsed from devfile
111+
// GetStarterProjects returns the DevfileStarterProject parsed from devfile
112112
func (d *DevfileV2) GetStarterProjects(options common.DevfileOptions) ([]v1.StarterProject, error) {
113113

114114
if reflect.DeepEqual(options, common.DevfileOptions{}) {

pkg/devfile/parser/parse.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ func convertDevWorskapceTemplateToDevObj(dwTemplate v1.DevWorkspaceTemplate) (d
608608

609609
}
610610

611-
//setDefaults sets the default values for nil boolean properties after the merging of devWorkspaceTemplateSpec is complete
611+
// setDefaults sets the default values for nil boolean properties after the merging of devWorkspaceTemplateSpec is complete
612612
func setDefaults(d DevfileObj) (err error) {
613613

614614
var devfileVersion string
@@ -709,21 +709,21 @@ func setDefaults(d DevfileObj) (err error) {
709709
return nil
710710
}
711711

712-
///setIsDefault sets the default value of CommandGroup.IsDefault if nil
712+
// setIsDefault sets the default value of CommandGroup.IsDefault if nil
713713
func setIsDefault(cmdGroup *v1.CommandGroup) {
714714
val := cmdGroup.GetIsDefault()
715715
cmdGroup.IsDefault = &val
716716
}
717717

718-
//setEndpoints sets the default value of Endpoint.Secure if nil
718+
// setEndpoints sets the default value of Endpoint.Secure if nil
719719
func setEndpoints(endpoints []v1.Endpoint) {
720720
for i := range endpoints {
721721
val := endpoints[i].GetSecure()
722722
endpoints[i].Secure = &val
723723
}
724724
}
725725

726-
//parseKubeResourceFromURI iterate through all kubernetes & openshift components, and parse from uri and update the content to inlined field in devfileObj
726+
// parseKubeResourceFromURI iterate through all kubernetes & openshift components, and parse from uri and update the content to inlined field in devfileObj
727727
func parseKubeResourceFromURI(devObj DevfileObj) error {
728728
getKubeCompOptions := common.DevfileOptions{
729729
ComponentOptions: common.ComponentOptions{
@@ -772,7 +772,7 @@ func parseKubeResourceFromURI(devObj DevfileObj) error {
772772
return nil
773773
}
774774

775-
//convertK8sLikeCompUriToInlined read in kubernetes resources definition from uri and converts to kubernetest inlined field
775+
// convertK8sLikeCompUriToInlined read in kubernetes resources definition from uri and converts to kubernetest inlined field
776776
func convertK8sLikeCompUriToInlined(component *v1.Component, d devfileCtx.DevfileCtx) error {
777777
var uri string
778778
if component.Kubernetes != nil {
@@ -799,7 +799,7 @@ func convertK8sLikeCompUriToInlined(component *v1.Component, d devfileCtx.Devfil
799799
return nil
800800
}
801801

802-
//getKubernetesDefinitionFromUri read in kubernetes resources definition from uri and returns the raw content
802+
// getKubernetesDefinitionFromUri read in kubernetes resources definition from uri and returns the raw content
803803
func getKubernetesDefinitionFromUri(uri string, d devfileCtx.DevfileCtx) ([]byte, error) {
804804
// validate URI
805805
err := validation.ValidateURI(uri)

pkg/devfile/parser/sourceAttribute.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package parser
1717

1818
import (
1919
"fmt"
20+
2021
v1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
2122
"github.com/devfile/api/v2/pkg/attributes"
2223
"github.com/devfile/api/v2/pkg/validation"
@@ -29,7 +30,7 @@ const (
2930
)
3031

3132
// addSourceAttributesForParentOverride adds an attribute 'api.devfile.io/imported-from=<source reference>'
32-
// to all elements of template spec content that support attributes.
33+
// to all elements of template spec content that support attributes.
3334
func addSourceAttributesForTemplateSpecContent(sourceImportReference v1.ImportReference, template *v1.DevWorkspaceTemplateSpecContent) {
3435
for idx, component := range template.Components {
3536
if component.Attributes == nil {
@@ -58,7 +59,7 @@ func addSourceAttributesForTemplateSpecContent(sourceImportReference v1.ImportRe
5859
}
5960

6061
// addSourceAttributesForParentOverride adds an attribute 'api.devfile.io/parent-override-from=<source reference>'
61-
// to all elements of parent override that support attributes.
62+
// to all elements of parent override that support attributes.
6263
func addSourceAttributesForParentOverride(sourceImportReference v1.ImportReference, parentOverrides *v1.ParentOverrides) {
6364
for idx, component := range parentOverrides.Components {
6465
if component.Attributes == nil {
@@ -88,7 +89,7 @@ func addSourceAttributesForParentOverride(sourceImportReference v1.ImportReferen
8889
}
8990

9091
// addSourceAttributesForPluginOverride adds an attribute 'api.devfile.io/plugin-override-from=<source reference>'
91-
// to all elements of plugin override that support attributes.
92+
// to all elements of plugin override that support attributes.
9293
func addSourceAttributesForPluginOverride(sourceImportReference v1.ImportReference, pluginOverrides *v1.PluginOverrides) {
9394
for idx, component := range pluginOverrides.Components {
9495
if component.Attributes == nil {

pkg/testingutil/devfile.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func GenerateDummyContainerComponent(name string, volMounts []v1.VolumeMount, en
127127
}}}
128128
}
129129

130-
//DockerImageValues struct can be used to set override or main component struct values
130+
// DockerImageValues struct can be used to set override or main component struct values
131131
type DockerImageValues struct {
132132
//maps to Image.ImageName
133133
ImageName string
@@ -139,8 +139,8 @@ type DockerImageValues struct {
139139
RootRequired *bool
140140
}
141141

142-
//GetDockerImageTestComponent returns a docker image component that is used for testing.
143-
//The parameters allow customization of the content. If they are set to nil, then the properties will not be set
142+
// GetDockerImageTestComponent returns a docker image component that is used for testing.
143+
// The parameters allow customization of the content. If they are set to nil, then the properties will not be set
144144
func GetDockerImageTestComponent(div DockerImageValues, autobuild *bool, attr attributes.Attributes) v1.Component {
145145
comp := v1.Component{
146146
Name: "image",
@@ -175,8 +175,8 @@ func GetDockerImageTestComponent(div DockerImageValues, autobuild *bool, attr at
175175
return comp
176176
}
177177

178-
//GetDockerImageTestComponentParentOverride returns a docker image parent override component that is used for testing.
179-
//The parameters allow customization of the content. If they are set to nil, then the properties will not be set
178+
// GetDockerImageTestComponentParentOverride returns a docker image parent override component that is used for testing.
179+
// The parameters allow customization of the content. If they are set to nil, then the properties will not be set
180180
func GetDockerImageTestComponentParentOverride(div DockerImageValues) v1.ComponentParentOverride {
181181
comp := v1.ComponentParentOverride{
182182
Name: "image",
@@ -206,8 +206,8 @@ func GetDockerImageTestComponentParentOverride(div DockerImageValues) v1.Compone
206206
return comp
207207
}
208208

209-
//GetDockerImageTestComponentPluginOverride returns a docker image parent override component that is used for testing.
210-
//The parameters allow customization of the content. If they are set to nil, then the properties will not be set
209+
// GetDockerImageTestComponentPluginOverride returns a docker image parent override component that is used for testing.
210+
// The parameters allow customization of the content. If they are set to nil, then the properties will not be set
211211
func GetDockerImageTestComponentPluginOverride(div DockerImageValues) v1.ComponentPluginOverride {
212212
comp := v1.ComponentPluginOverride{
213213
Name: "image",

pkg/util/util.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ func GetAbsPath(path string) (string, error) {
302302
// existList: List to verify that the returned name does not already exist
303303
// retries: number of retries to try generating a unique name
304304
// Returns:
305-
// 1. randomname: is prefix-suffix, where:
306-
// prefix: string passed as prefix or fetched current directory of length same as the passed prefixMaxLen
307-
// suffix: 4 char random string
308-
// 2. error: if requested number of retries also failed to generate unique name
305+
// 1. randomname: is prefix-suffix, where:
306+
// prefix: string passed as prefix or fetched current directory of length same as the passed prefixMaxLen
307+
// suffix: 4 char random string
308+
// 2. error: if requested number of retries also failed to generate unique name
309309
func GetRandomName(prefix string, prefixMaxLen int, existList []string, retries int) (string, error) {
310310
prefix = TruncateString(GetDNS1123Name(strings.ToLower(prefix)), prefixMaxLen)
311311
name := fmt.Sprintf("%s-%s", prefix, GenerateRandomString(4))
@@ -458,7 +458,7 @@ func checkPathExistsOnFS(path string, fs filesystem.Filesystem) bool {
458458
// host:port even if port was not specifically specified in the origin url.
459459
// If port is not specified, standart port corresponding to url schema is provided.
460460
// example: for url https://example.com function will return "example.com:443"
461-
// for url https://example.com:8443 function will return "example:8443"
461+
// for url https://example.com:8443 function will return "example:8443"
462462
func GetHostWithPort(inputURL string) (string, error) {
463463
u, err := url.Parse(inputURL)
464464
if err != nil {

tests/v2/libraryTest/library_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func Test_v220_Devfile(t *testing.T) {
268268

269269
}
270270

271-
//Create kube client and context and set as ParserArgs for Parent Kubernetes reference test. Corresponding main devfile is ../devfile/samples/TestParent_KubeCRD.yaml
271+
// Create kube client and context and set as ParserArgs for Parent Kubernetes reference test. Corresponding main devfile is ../devfile/samples/TestParent_KubeCRD.yaml
272272
func setClientAndContextParserArgs() *parser.ParserArgs {
273273
isTrue := true
274274
name := "testkubeparent1"

tests/v2/utils/library/test_utils.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type DevfileValidator struct{}
5050

5151
var parserArgs = parser.ParserArgs{}
5252

53-
//directory where test devfiles are generated and/or copied
53+
// directory where test devfiles are generated and/or copied
5454
const destDir = "tmp/library_test/"
5555

5656
// WriteAndValidate implements DevfileValidator interface.
@@ -305,8 +305,8 @@ func CopyDevfileSamples(t *testing.T, testDevfiles []string) {
305305
}
306306
}
307307

308-
//duplicateDevfileSample: Makes a copy of the parent devfile test artifact that is expected to exist in the tmp/library_test directory.
309-
//This is used in the multi-threaded parent test scenarios
308+
// duplicateDevfileSample: Makes a copy of the parent devfile test artifact that is expected to exist in the tmp/library_test directory.
309+
// This is used in the multi-threaded parent test scenarios
310310
func duplicateDevfileSample(t *testing.T, src string, dst string) {
311311
srcPath := destDir + src
312312
destPath := destDir + dst
@@ -376,7 +376,7 @@ func RunTest(testContent commonUtils.TestContent, t *testing.T) {
376376
}
377377
}
378378

379-
//RunStaticTest : Runs fixed tests based on pre-existing artifacts
379+
// RunStaticTest : Runs fixed tests based on pre-existing artifacts
380380
func RunStaticTest(testContent commonUtils.TestContent, t *testing.T) {
381381
commonUtils.LogMessage(fmt.Sprintf("Start test for %s", testContent.FileName))
382382
follower := DevfileFollower{}

0 commit comments

Comments
 (0)