Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(237)

Side by Side Diff: environs/tools/validation.go

Issue 81570045: cleanup: fixing go vet warnings
Patch Set: cleanup: fixing go vet warnings Created 10 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « environs/imagemetadata/validation.go ('k') | juju/arch/arch.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 Canonical Ltd. 1 // Copyright 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package tools 4 package tools
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 8
9 "launchpad.net/juju-core/environs/simplestreams" 9 "launchpad.net/juju-core/environs/simplestreams"
10 "launchpad.net/juju-core/version" 10 "launchpad.net/juju-core/version"
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 if len(params.Sources) == 0 { 27 if len(params.Sources) == 0 {
28 return nil, nil, fmt.Errorf("required parameter sources not spec ified") 28 return nil, nil, fmt.Errorf("required parameter sources not spec ified")
29 } 29 }
30 if params.Version == "" && params.Major == 0 { 30 if params.Version == "" && params.Major == 0 {
31 params.Version = version.Current.Number.String() 31 params.Version = version.Current.Number.String()
32 } 32 }
33 var toolsConstraint *ToolsConstraint 33 var toolsConstraint *ToolsConstraint
34 if params.Version == "" { 34 if params.Version == "" {
35 toolsConstraint = NewGeneralToolsConstraint(params.Major, params .Minor, false, simplestreams.LookupParams{ 35 toolsConstraint = NewGeneralToolsConstraint(params.Major, params .Minor, false, simplestreams.LookupParams{
36 » » » CloudSpec: simplestreams.CloudSpec{params.Region, params .Endpoint}, 36 » » » CloudSpec: simplestreams.CloudSpec{
37 » » » Series: []string{params.Series}, 37 » » » » Region: params.Region,
38 » » » Arches: params.Architectures, 38 » » » » Endpoint: params.Endpoint,
39 » » » },
40 » » » Series: []string{params.Series},
41 » » » Arches: params.Architectures,
39 }) 42 })
40 } else { 43 } else {
41 versNum, err := version.Parse(params.Version) 44 versNum, err := version.Parse(params.Version)
42 if err != nil { 45 if err != nil {
43 return nil, nil, err 46 return nil, nil, err
44 } 47 }
45 toolsConstraint = NewVersionedToolsConstraint(versNum, simplestr eams.LookupParams{ 48 toolsConstraint = NewVersionedToolsConstraint(versNum, simplestr eams.LookupParams{
46 » » » CloudSpec: simplestreams.CloudSpec{params.Region, params .Endpoint}, 49 » » » CloudSpec: simplestreams.CloudSpec{
47 » » » Series: []string{params.Series}, 50 » » » » Region: params.Region,
48 » » » Arches: params.Architectures, 51 » » » » Endpoint: params.Endpoint,
52 » » » },
53 » » » Series: []string{params.Series},
54 » » » Arches: params.Architectures,
49 }) 55 })
50 } 56 }
51 matchingTools, resolveInfo, err := Fetch(params.Sources, simplestreams.D efaultIndexPath, toolsConstraint, false) 57 matchingTools, resolveInfo, err := Fetch(params.Sources, simplestreams.D efaultIndexPath, toolsConstraint, false)
52 if err != nil { 58 if err != nil {
53 return nil, resolveInfo, err 59 return nil, resolveInfo, err
54 } 60 }
55 if len(matchingTools) == 0 { 61 if len(matchingTools) == 0 {
56 return nil, resolveInfo, fmt.Errorf("no matching tools found for constraint %+v", toolsConstraint) 62 return nil, resolveInfo, fmt.Errorf("no matching tools found for constraint %+v", toolsConstraint)
57 } 63 }
58 versions := make([]string, len(matchingTools)) 64 versions := make([]string, len(matchingTools))
59 for i, tm := range matchingTools { 65 for i, tm := range matchingTools {
60 » » vers := version.Binary{version.MustParse(tm.Version), tm.Release , tm.Arch} 66 » » vers := version.Binary{
67 » » » Number: version.MustParse(tm.Version),
68 » » » Series: tm.Release,
69 » » » Arch: tm.Arch,
70 » » }
61 versions[i] = vers.String() 71 versions[i] = vers.String()
62 } 72 }
63 return versions, resolveInfo, nil 73 return versions, resolveInfo, nil
64 } 74 }
OLDNEW
« no previous file with comments | « environs/imagemetadata/validation.go ('k') | juju/arch/arch.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b