mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
fix go vet report bugs
This commit is contained in:
@@ -94,8 +94,8 @@ func init() {
|
||||
})
|
||||
|
||||
type SnapshotCreateOptions struct {
|
||||
Disk string `help: "Id of disk to take snapshot" json:"disk" required:"true"`
|
||||
NAME string `help: "Name of snapshot" json:"name"`
|
||||
Disk string `help:"Id of disk to take snapshot" json:"disk" required:"true"`
|
||||
NAME string `help:"Name of snapshot" json:"name"`
|
||||
}
|
||||
R(&SnapshotCreateOptions{}, "snapshot-create", "Create a snapshot", func(s *mcclient.ClientSession, args *SnapshotCreateOptions) error {
|
||||
params, err := options.StructToParams(args)
|
||||
|
||||
@@ -17,7 +17,6 @@ package db
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/stringutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/consts"
|
||||
@@ -103,6 +102,4 @@ func GenerateName(manager IModelManager, ownerProjId string, hint string) (strin
|
||||
name = fmt.Sprintf(pattern, idx)
|
||||
idx += 1
|
||||
}
|
||||
log.Fatalln("here is not reachable!!!")
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ func (man *SLoadbalancerBackendGroupManager) ValidateCreateData(ctx context.Cont
|
||||
func (lbbg *SLoadbalancerBackendGroup) GetLoadbalancer() *SLoadbalancer {
|
||||
lb, err := LoadbalancerManager.FetchById(lbbg.LoadbalancerId)
|
||||
if err != nil {
|
||||
fmt.Errorf("failed to find loadbalancer for backendgroup %s", lbbg.Name)
|
||||
log.Errorf("failed to find loadbalancer for backendgroup %s", lbbg.Name)
|
||||
return nil
|
||||
}
|
||||
return lb.(*SLoadbalancer)
|
||||
|
||||
@@ -21,7 +21,7 @@ type SHostOptions struct {
|
||||
|
||||
HostType string `help:"Host server type, either hypervisor or kubelet" default:"hypervisor"`
|
||||
ListenInterface string `help:"Master address of host server"`
|
||||
BridgeDriver string `help:"Bridge driver, bridge or openvswitch" default: "openvswitch"`
|
||||
BridgeDriver string `help:"Bridge driver, bridge or openvswitch" default:"openvswitch"`
|
||||
Networks []string `help:"Network interface information"`
|
||||
Rack string `help:"Rack of host (optional)"`
|
||||
Slots string `help:"Slots of host (optional)"`
|
||||
@@ -42,7 +42,7 @@ type SHostOptions struct {
|
||||
EnableFallocateDisk bool `help:"Automatically allocate all spaces using fallocate"`
|
||||
|
||||
EnableMonitor bool `help:"Enable monitor"`
|
||||
ReportInterval int `help:"Report interval in seconds", default:"60"`
|
||||
ReportInterval int `help:"Report interval in seconds" default:"60"`
|
||||
|
||||
EnableTcBwlimit bool `help:"Enable linux tc bandwidth limit"`
|
||||
BwDownloadBandwidth int `help:"Default ingress bandwidth in mbit (0 disabled)" default:"10"`
|
||||
|
||||
@@ -271,8 +271,7 @@ func (d *SLocalDisk) CreateRaw(ctx context.Context, sizeMB int, diskFormat, fsFo
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
fmt.Errorf("create_raw: Fail to create disk")
|
||||
return nil, fmt.Errorf("create_raw: Fail to create disk: %s", err)
|
||||
}
|
||||
|
||||
if options.HostOptions.EnableFallocateDisk {
|
||||
|
||||
@@ -33,7 +33,7 @@ import (
|
||||
type SImageDesc struct {
|
||||
Name string `json:"name"`
|
||||
Format string `json:"format"`
|
||||
Id string `json:"id:`
|
||||
Id string `json:"id"`
|
||||
Chksum string `json:"chksum"`
|
||||
Path string `json:"path"`
|
||||
Size int64 `json:"size"`
|
||||
@@ -242,8 +242,6 @@ func (r *SRemoteFile) downloadInternal(getData bool, preChksum string) bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
func (r *SRemoteFile) setProperties(header http.Header) {
|
||||
|
||||
@@ -27,7 +27,7 @@ var (
|
||||
|
||||
type SNotifyMessage struct {
|
||||
Uid string `json:"uid,omitempty"`
|
||||
Gid string `json:"uid,omitempty"`
|
||||
Gid string `json:"gid,omitempty"`
|
||||
ContactType TNotifyChannel `json:"contact_type,omitempty"`
|
||||
Topic string `json:"topic,omitempty"`
|
||||
Priority TNotifyPriority `json:"priority,omitempty"`
|
||||
|
||||
@@ -77,7 +77,7 @@ type LoadbalancerAclCreateOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerAclGetOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerAclListOptions struct {
|
||||
|
||||
@@ -98,11 +98,11 @@ type LoadbalancerAgentListOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerAgentGetOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerAgentUpdateOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Name string
|
||||
|
||||
HbTimeout *int
|
||||
@@ -117,11 +117,11 @@ type LoadbalancerAgentUpdateOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerAgentDeleteOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerAgentActionHbOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
|
||||
Version string
|
||||
IP string
|
||||
@@ -129,7 +129,7 @@ type LoadbalancerAgentActionHbOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerAgentActionPatchParamsOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
|
||||
LoadbalancerAgentParamsOptions
|
||||
}
|
||||
|
||||
@@ -109,20 +109,20 @@ func (opts *LoadbalancerBackendGroupCreateOptions) Params() (*jsonutils.JSONDict
|
||||
}
|
||||
|
||||
type LoadbalancerBackendGroupGetOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerBackendGroupUpdateOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Name string
|
||||
}
|
||||
|
||||
type LoadbalancerBackendGroupDeleteOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerBackendGroupIDOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerBackendGroupListOptions struct {
|
||||
|
||||
@@ -33,7 +33,7 @@ type LoadbalancerBackendListOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerBackendUpdateOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Name string
|
||||
|
||||
Weight *int
|
||||
@@ -41,9 +41,9 @@ type LoadbalancerBackendUpdateOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerBackendGetOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerBackendDeleteOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
@@ -70,11 +70,11 @@ func (opts *LoadbalancerCertificateCreateOptions) Params() (*jsonutils.JSONDict,
|
||||
}
|
||||
|
||||
type LoadbalancerCertificateGetOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerCertificateDeleteOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerCertificateListOptions struct {
|
||||
@@ -86,7 +86,7 @@ type LoadbalancerCertificateListOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerCertificateUpdateOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Name string
|
||||
|
||||
Cert string `json:"-" help:"path to certificate file"`
|
||||
|
||||
@@ -32,21 +32,21 @@ type LoadbalancerListenerRuleListOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerListenerRuleUpdateOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Name string
|
||||
|
||||
BackendGroup string
|
||||
}
|
||||
|
||||
type LoadbalancerListenerRuleGetOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerListenerRuleDeleteOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerListenerRuleActionStatusOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Status string `choices:"enabled|disabled"`
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ type LoadbalancerListenerListOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerListenerUpdateOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Name string
|
||||
|
||||
BackendGroup string
|
||||
@@ -166,18 +166,18 @@ type LoadbalancerListenerUpdateOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerListenerGetOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerListenerDeleteOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerListenerActionStatusOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Status string `choices:"enabled|disabled"`
|
||||
}
|
||||
|
||||
type LoadbalancerListenerActionSyncStatusOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
@@ -27,22 +27,22 @@ type LoadbalancerCreateOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerGetOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerUpdateOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Name string
|
||||
|
||||
BackendGroup string
|
||||
}
|
||||
|
||||
type LoadbalancerDeleteOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerPurgeOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerListOptions struct {
|
||||
@@ -56,14 +56,14 @@ type LoadbalancerListOptions struct {
|
||||
}
|
||||
|
||||
type LoadbalancerActionStatusOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
Status string `choices:"enabled|disabled"`
|
||||
}
|
||||
|
||||
type LoadbalancerActionSyncStatusOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
type LoadbalancerIdOptions struct {
|
||||
ID string `json:-`
|
||||
ID string `json:"-"`
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ type ServerRestartOptions struct {
|
||||
type ServerMigrateOptions struct {
|
||||
ID string `help:"ID of server" json:"-"`
|
||||
PreferHost string `help:"Server migration prefer host id or name" json:"prefer_host"`
|
||||
AutoStart *bool `help: "Server auto start after migrate" json:"auto_start"`
|
||||
AutoStart *bool `help:"Server auto start after migrate" json:"auto_start"`
|
||||
RescueMode *bool `help:"Migrate server in rescue mode,
|
||||
all disk must store in shared storage;
|
||||
default false" json:"rescue_mode"`
|
||||
|
||||
@@ -145,7 +145,6 @@ var centos = SAWSImagePublisherInfo{
|
||||
} else {
|
||||
return parts[1]
|
||||
}
|
||||
return ""
|
||||
},
|
||||
GetOSBuildID: func(image SImage) string {
|
||||
build := centosDatePattern.FindString(image.ImageName)
|
||||
|
||||
@@ -296,7 +296,7 @@ func (self *SRegion) GetSecurityGroupDetails(secGroupId string) (*SSecurityGroup
|
||||
s := ret.SecurityGroups[0]
|
||||
vpc, err := self.getVpc(*s.VpcId)
|
||||
if err != nil {
|
||||
fmt.Errorf("vpc %s not found", *s.VpcId)
|
||||
return nil, fmt.Errorf("vpc %s not found", *s.VpcId)
|
||||
}
|
||||
|
||||
permissions := self.getSecRules(s.IpPermissions, s.IpPermissionsEgress)
|
||||
|
||||
@@ -507,7 +507,6 @@ func recoverFromError(client *autorest.Client, domain, subscriptionId string, az
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func jsonRequest(client *autorest.Client, method, domain, baseUrl string, subscriptionId string, body string) (jsonutils.JSONObject, error) {
|
||||
|
||||
@@ -33,7 +33,7 @@ type ResourceType struct {
|
||||
ApiVersions []string `json:"apiVersions,omitempty"`
|
||||
Capabilities string `json:"capabilities,omitempty"`
|
||||
Locations []string `json:"locations,omitempty"`
|
||||
ResourceType string `json:"locations,omitempty"`
|
||||
ResourceType string `json:"resourceType,omitempty"`
|
||||
}
|
||||
|
||||
func (self *SRegion) ListServices() ([]SService, error) {
|
||||
|
||||
@@ -106,7 +106,6 @@ func formatName(name string) string {
|
||||
}
|
||||
return name
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
func (self *SHost) GetName() string {
|
||||
|
||||
@@ -55,7 +55,7 @@ func init() {
|
||||
|
||||
type DatastoreShowOptions struct {
|
||||
DATACENTER string `help:"Datacenter"`
|
||||
DSID string `help:"Datastore ID""`
|
||||
DSID string `help:"Datastore ID"`
|
||||
}
|
||||
shellutils.R(&DatastoreShowOptions{}, "ds-show", "Show details of a datastore", func(cli *esxi.SESXiClient, args *DatastoreShowOptions) error {
|
||||
ds, err := getDatastore(cli, args.DATACENTER, args.DSID)
|
||||
@@ -92,7 +92,7 @@ func init() {
|
||||
|
||||
type DatastoreListDirOptions struct {
|
||||
DATACENTER string `help:"Datacenter"`
|
||||
DSID string `help:"Datastore ID""`
|
||||
DSID string `help:"Datastore ID"`
|
||||
DIR string `help:"directory"`
|
||||
}
|
||||
shellutils.R(&DatastoreListDirOptions{}, "ds-list-dir", "List directory of a datastore", func(cli *esxi.SESXiClient, args *DatastoreListDirOptions) error {
|
||||
@@ -195,7 +195,7 @@ func init() {
|
||||
|
||||
type DatastoreDownloadOptions struct {
|
||||
DATACENTER string `help:"Datacenter"`
|
||||
DSID string `help:"Datastore ID""`
|
||||
DSID string `help:"Datastore ID"`
|
||||
DIR string `help:"directory"`
|
||||
LOCAL string `help:"local file"`
|
||||
}
|
||||
|
||||
@@ -885,7 +885,7 @@ type ListPartsOutput struct {
|
||||
MaxParts int `xml:"MaxParts"`
|
||||
IsTruncated bool `xml:"IsTruncated"`
|
||||
StorageClass StorageClassType `xml:"StorageClass"`
|
||||
Initiator Initiator `xml:"Initiator“`
|
||||
Initiator Initiator `xml:"Initiator"`
|
||||
Owner Owner `xml:"Owner"`
|
||||
Parts []Part `xml:"Part"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user