Skip to content

Commit

Permalink
Fix golint / go fmt errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JenniGriesmann committed Oct 10, 2017
1 parent 0693dbe commit e961743
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 28 deletions.
3 changes: 2 additions & 1 deletion internal/qmp-gen/templates/alternate
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ type {{ $basename }} interface {
{{ $subname := printf "%s%s" $basename $suffix.Go }}

{{- if $type.NullType }}
// Special case handling of JSON null type
// {{ $subname }} is a JSON null type, so it must
// also implement the isNullable interface.
type {{ $subname }} struct {}
func ({{ $subname }}) isNull() bool { return true }
{{- else }}
Expand Down
3 changes: 3 additions & 0 deletions internal/qmp-gen/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ var upperWords = map[string]bool{
"fd": true,
"ftp": true,
"ftps": true,
"guid": true,
"http": true,
"https": true,
"id": true,
Expand All @@ -534,11 +535,13 @@ var upperWords = map[string]bool{
"qmp": true,
"ram": true,
"sparc": true,
"ssh": true,
"tcp": true,
"tls": true,
"tpm": true,
"ttl": true,
"udp": true,
"uri": true,
"uuid": true,
"vm": true,
"vmdk": true,
Expand Down
2 changes: 1 addition & 1 deletion qemu/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (d *Domain) Commands() ([]string, error) {
if err != nil {
return nil, err
}

// flatten response
cmds := make([]string, 0, len(commands))
for _, c := range commands {
Expand Down
54 changes: 28 additions & 26 deletions qmp/raw/autogen.go
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ const (
BlockdevDriverRbd
BlockdevDriverReplication
BlockdevDriverSheepdog
BlockdevDriverSsh
BlockdevDriverSSH
BlockdevDriverThrottle
BlockdevDriverVdi
BlockdevDriverVhdx
Expand Down Expand Up @@ -1282,7 +1282,7 @@ func (e BlockdevDriver) String() string {
return "replication"
case BlockdevDriverSheepdog:
return "sheepdog"
case BlockdevDriverSsh:
case BlockdevDriverSSH:
return "ssh"
case BlockdevDriverThrottle:
return "throttle"
Expand Down Expand Up @@ -1362,7 +1362,7 @@ func (e BlockdevDriver) MarshalJSON() ([]byte, error) {
return json.Marshal("replication")
case BlockdevDriverSheepdog:
return json.Marshal("sheepdog")
case BlockdevDriverSsh:
case BlockdevDriverSSH:
return json.Marshal("ssh")
case BlockdevDriverThrottle:
return json.Marshal("throttle")
Expand Down Expand Up @@ -1447,7 +1447,7 @@ func (e *BlockdevDriver) UnmarshalJSON(bs []byte) error {
case "sheepdog":
*e = BlockdevDriverSheepdog
case "ssh":
*e = BlockdevDriverSsh
*e = BlockdevDriverSSH
case "throttle":
*e = BlockdevDriverThrottle
case "vdi":
Expand Down Expand Up @@ -1574,7 +1574,7 @@ func (e *BlockdevOnError) UnmarshalJSON(bs []byte) error {
// - BlockdevOptionsRbd
// - BlockdevOptionsReplication
// - BlockdevOptionsSheepdog
// - BlockdevOptionsSsh
// - BlockdevOptionsSSH
// - BlockdevOptionsThrottle
// - BlockdevOptionsVdi
// - BlockdevOptionsVhdx
Expand Down Expand Up @@ -2353,8 +2353,8 @@ func (s BlockdevOptionsSheepdog) MarshalJSON() ([]byte, error) {
return json.Marshal(v)
}

// BlockdevOptionsSsh is an implementation of BlockdevOptions.
type BlockdevOptionsSsh struct {
// BlockdevOptionsSSH is an implementation of BlockdevOptions.
type BlockdevOptionsSSH struct {
NodeName *string `json:"node-name,omitempty"`
Discard *BlockdevDiscardOptions `json:"discard,omitempty"`
Cache *BlockdevCacheOptions `json:"cache,omitempty"`
Expand All @@ -2366,15 +2366,15 @@ type BlockdevOptionsSsh struct {
User *string `json:"user,omitempty"`
}

func (BlockdevOptionsSsh) isBlockdevOptions() {}
func (BlockdevOptionsSSH) isBlockdevOptions() {}

// MarshalJSON implements json.Marshaler.
func (s BlockdevOptionsSsh) MarshalJSON() ([]byte, error) {
func (s BlockdevOptionsSSH) MarshalJSON() ([]byte, error) {
v := struct {
Driver BlockdevDriver `json:"driver"`
BlockdevOptionsSsh
BlockdevOptionsSSH
}{
BlockdevDriverSsh,
BlockdevDriverSSH,
s,
}
return json.Marshal(v)
Expand Down Expand Up @@ -2682,8 +2682,8 @@ func decodeBlockdevOptions(bs json.RawMessage) (BlockdevOptions, error) {
var ret BlockdevOptionsSheepdog
err := json.Unmarshal([]byte(bs), &ret)
return ret, err
case BlockdevDriverSsh:
var ret BlockdevOptionsSsh
case BlockdevDriverSSH:
var ret BlockdevOptionsSSH
err := json.Unmarshal([]byte(bs), &ret)
return ret, err
case BlockdevDriverThrottle:
Expand Down Expand Up @@ -2974,7 +2974,7 @@ func (BlockdevOptionsRaw) isBlockdevRef() {}
func (BlockdevOptionsRbd) isBlockdevRef() {}
func (BlockdevOptionsReplication) isBlockdevRef() {}
func (BlockdevOptionsSheepdog) isBlockdevRef() {}
func (BlockdevOptionsSsh) isBlockdevRef() {}
func (BlockdevOptionsSSH) isBlockdevRef() {}
func (BlockdevOptionsThrottle) isBlockdevRef() {}
func (BlockdevOptionsVdi) isBlockdevRef() {}
func (BlockdevOptionsVhdx) isBlockdevRef() {}
Expand Down Expand Up @@ -3053,7 +3053,7 @@ func decodeBlockdevRef(bs json.RawMessage) (BlockdevRef, error) {
return impl, nil
case BlockdevOptionsSheepdog:
return impl, nil
case BlockdevOptionsSsh:
case BlockdevOptionsSSH:
return impl, nil
case BlockdevOptionsThrottle:
return impl, nil
Expand Down Expand Up @@ -3117,7 +3117,7 @@ func (BlockdevOptionsRaw) isBlockdevRefOrNull() {}
func (BlockdevOptionsRbd) isBlockdevRefOrNull() {}
func (BlockdevOptionsReplication) isBlockdevRefOrNull() {}
func (BlockdevOptionsSheepdog) isBlockdevRefOrNull() {}
func (BlockdevOptionsSsh) isBlockdevRefOrNull() {}
func (BlockdevOptionsSSH) isBlockdevRefOrNull() {}
func (BlockdevOptionsThrottle) isBlockdevRefOrNull() {}
func (BlockdevOptionsVdi) isBlockdevRefOrNull() {}
func (BlockdevOptionsVhdx) isBlockdevRefOrNull() {}
Expand All @@ -3126,7 +3126,8 @@ func (BlockdevOptionsVpc) isBlockdevRefOrNull() {}
func (BlockdevOptionsVvfat) isBlockdevRefOrNull() {}
func (BlockdevOptionsVxhs) isBlockdevRefOrNull() {}

// Special case handling of JSON null type
// BlockdevRefOrNullNull is a JSON null type, so it must
// also implement the isNullable interface.
type BlockdevRefOrNullNull struct{}

func (BlockdevRefOrNullNull) isNull() bool { return true }
Expand Down Expand Up @@ -3211,7 +3212,7 @@ func decodeBlockdevRefOrNull(bs json.RawMessage) (BlockdevRefOrNull, error) {
return impl, nil
case BlockdevOptionsSheepdog:
return impl, nil
case BlockdevOptionsSsh:
case BlockdevOptionsSSH:
return impl, nil
case BlockdevOptionsThrottle:
return impl, nil
Expand Down Expand Up @@ -4936,11 +4937,11 @@ func (e *GuestPanicInformationType) UnmarshalJSON(bs []byte) error {
return nil
}

// GuidInfo -> GuidInfo (struct)
// GuidInfo -> GUIDInfo (struct)

// GuidInfo implements the "GuidInfo" QMP API type.
type GuidInfo struct {
Guid string `json:"guid"`
// GUIDInfo implements the "GuidInfo" QMP API type.
type GUIDInfo struct {
GUID string `json:"guid"`
}

// HostMemPolicy -> HostMemPolicy (enum)
Expand Down Expand Up @@ -9725,7 +9726,8 @@ type StrOrNull interface {
isStrOrNull()
}

// Special case handling of JSON null type
// StrOrNullN is a JSON null type, so it must
// also implement the isNullable interface.
type StrOrNullN struct{}

func (StrOrNullN) isNull() bool { return true }
Expand Down Expand Up @@ -12059,7 +12061,7 @@ func (m *Monitor) Memsave(val int64, size int64, filename string, cpuIndex *int6
// Migrate implements the "migrate" QMP API call.
func (m *Monitor) Migrate(uri string, blk *bool, inc *bool, detach *bool) (err error) {
cmd := struct {
Uri string `json:"uri"`
URI string `json:"uri"`
Blk *bool `json:"blk,omitempty"`
Inc *bool `json:"inc,omitempty"`
Detach *bool `json:"detach,omitempty"`
Expand Down Expand Up @@ -12088,7 +12090,7 @@ func (m *Monitor) Migrate(uri string, blk *bool, inc *bool, detach *bool) (err e
// MigrateIncoming implements the "migrate-incoming" QMP API call.
func (m *Monitor) MigrateIncoming(uri string) (err error) {
cmd := struct {
Uri string `json:"uri"`
URI string `json:"uri"`
}{
uri,
}
Expand Down Expand Up @@ -14057,7 +14059,7 @@ func (m *Monitor) QueryVersion() (ret VersionInfo, err error) {
// query-vm-generation-id -> QueryVMGenerationID (command)

// QueryVMGenerationID implements the "query-vm-generation-id" QMP API call.
func (m *Monitor) QueryVMGenerationID() (ret GuidInfo, err error) {
func (m *Monitor) QueryVMGenerationID() (ret GUIDInfo, err error) {
cmd := struct {
}{}
bs, err := json.Marshal(map[string]interface{}{
Expand Down

0 comments on commit e961743

Please sign in to comment.