Skip to content

Commit 05d214e

Browse files
Fix golint / go fmt errors
1 parent 0693dbe commit 05d214e

File tree

5 files changed

+35
-32
lines changed

5 files changed

+35
-32
lines changed

internal/qmp-gen/main.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ func Generate() error {
7474
ioutil.WriteFile(*outputGo, bs, 0640)
7575
return err
7676
}
77-
if err = ioutil.WriteFile(*outputGo, formatted, 0640); err != nil {
78-
return err
79-
}
8077

81-
return nil
78+
return ioutil.WriteFile(*outputGo, formatted, 0640)
8279
}

internal/qmp-gen/templates/alternate

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ type {{ $basename }} interface {
2525
{{ $subname := printf "%s%s" $basename $suffix.Go }}
2626

2727
{{- if $type.NullType }}
28-
// Special case handling of JSON null type
28+
// {{ $subname }} is a JSON null type, so it must
29+
// also implement the isNullable interface.
2930
type {{ $subname }} struct {}
3031
func ({{ $subname }}) isNull() bool { return true }
3132
{{- else }}

internal/qmp-gen/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ var upperWords = map[string]bool{
518518
"fd": true,
519519
"ftp": true,
520520
"ftps": true,
521+
"guid": true,
521522
"http": true,
522523
"https": true,
523524
"id": true,
@@ -534,11 +535,13 @@ var upperWords = map[string]bool{
534535
"qmp": true,
535536
"ram": true,
536537
"sparc": true,
538+
"ssh": true,
537539
"tcp": true,
538540
"tls": true,
539541
"tpm": true,
540542
"ttl": true,
541543
"udp": true,
544+
"uri": true,
542545
"uuid": true,
543546
"vm": true,
544547
"vmdk": true,

qemu/domain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (d *Domain) Commands() ([]string, error) {
6666
if err != nil {
6767
return nil, err
6868
}
69-
69+
7070
// flatten response
7171
cmds := make([]string, 0, len(commands))
7272
for _, c := range commands {

qmp/raw/autogen.go

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ const (
12131213
BlockdevDriverRbd
12141214
BlockdevDriverReplication
12151215
BlockdevDriverSheepdog
1216-
BlockdevDriverSsh
1216+
BlockdevDriverSSH
12171217
BlockdevDriverThrottle
12181218
BlockdevDriverVdi
12191219
BlockdevDriverVhdx
@@ -1282,7 +1282,7 @@ func (e BlockdevDriver) String() string {
12821282
return "replication"
12831283
case BlockdevDriverSheepdog:
12841284
return "sheepdog"
1285-
case BlockdevDriverSsh:
1285+
case BlockdevDriverSSH:
12861286
return "ssh"
12871287
case BlockdevDriverThrottle:
12881288
return "throttle"
@@ -1362,7 +1362,7 @@ func (e BlockdevDriver) MarshalJSON() ([]byte, error) {
13621362
return json.Marshal("replication")
13631363
case BlockdevDriverSheepdog:
13641364
return json.Marshal("sheepdog")
1365-
case BlockdevDriverSsh:
1365+
case BlockdevDriverSSH:
13661366
return json.Marshal("ssh")
13671367
case BlockdevDriverThrottle:
13681368
return json.Marshal("throttle")
@@ -1447,7 +1447,7 @@ func (e *BlockdevDriver) UnmarshalJSON(bs []byte) error {
14471447
case "sheepdog":
14481448
*e = BlockdevDriverSheepdog
14491449
case "ssh":
1450-
*e = BlockdevDriverSsh
1450+
*e = BlockdevDriverSSH
14511451
case "throttle":
14521452
*e = BlockdevDriverThrottle
14531453
case "vdi":
@@ -1574,7 +1574,7 @@ func (e *BlockdevOnError) UnmarshalJSON(bs []byte) error {
15741574
// - BlockdevOptionsRbd
15751575
// - BlockdevOptionsReplication
15761576
// - BlockdevOptionsSheepdog
1577-
// - BlockdevOptionsSsh
1577+
// - BlockdevOptionsSSH
15781578
// - BlockdevOptionsThrottle
15791579
// - BlockdevOptionsVdi
15801580
// - BlockdevOptionsVhdx
@@ -2353,8 +2353,8 @@ func (s BlockdevOptionsSheepdog) MarshalJSON() ([]byte, error) {
23532353
return json.Marshal(v)
23542354
}
23552355

2356-
// BlockdevOptionsSsh is an implementation of BlockdevOptions.
2357-
type BlockdevOptionsSsh struct {
2356+
// BlockdevOptionsSSH is an implementation of BlockdevOptions.
2357+
type BlockdevOptionsSSH struct {
23582358
NodeName *string `json:"node-name,omitempty"`
23592359
Discard *BlockdevDiscardOptions `json:"discard,omitempty"`
23602360
Cache *BlockdevCacheOptions `json:"cache,omitempty"`
@@ -2366,15 +2366,15 @@ type BlockdevOptionsSsh struct {
23662366
User *string `json:"user,omitempty"`
23672367
}
23682368

2369-
func (BlockdevOptionsSsh) isBlockdevOptions() {}
2369+
func (BlockdevOptionsSSH) isBlockdevOptions() {}
23702370

23712371
// MarshalJSON implements json.Marshaler.
2372-
func (s BlockdevOptionsSsh) MarshalJSON() ([]byte, error) {
2372+
func (s BlockdevOptionsSSH) MarshalJSON() ([]byte, error) {
23732373
v := struct {
23742374
Driver BlockdevDriver `json:"driver"`
2375-
BlockdevOptionsSsh
2375+
BlockdevOptionsSSH
23762376
}{
2377-
BlockdevDriverSsh,
2377+
BlockdevDriverSSH,
23782378
s,
23792379
}
23802380
return json.Marshal(v)
@@ -2682,8 +2682,8 @@ func decodeBlockdevOptions(bs json.RawMessage) (BlockdevOptions, error) {
26822682
var ret BlockdevOptionsSheepdog
26832683
err := json.Unmarshal([]byte(bs), &ret)
26842684
return ret, err
2685-
case BlockdevDriverSsh:
2686-
var ret BlockdevOptionsSsh
2685+
case BlockdevDriverSSH:
2686+
var ret BlockdevOptionsSSH
26872687
err := json.Unmarshal([]byte(bs), &ret)
26882688
return ret, err
26892689
case BlockdevDriverThrottle:
@@ -2974,7 +2974,7 @@ func (BlockdevOptionsRaw) isBlockdevRef() {}
29742974
func (BlockdevOptionsRbd) isBlockdevRef() {}
29752975
func (BlockdevOptionsReplication) isBlockdevRef() {}
29762976
func (BlockdevOptionsSheepdog) isBlockdevRef() {}
2977-
func (BlockdevOptionsSsh) isBlockdevRef() {}
2977+
func (BlockdevOptionsSSH) isBlockdevRef() {}
29782978
func (BlockdevOptionsThrottle) isBlockdevRef() {}
29792979
func (BlockdevOptionsVdi) isBlockdevRef() {}
29802980
func (BlockdevOptionsVhdx) isBlockdevRef() {}
@@ -3053,7 +3053,7 @@ func decodeBlockdevRef(bs json.RawMessage) (BlockdevRef, error) {
30533053
return impl, nil
30543054
case BlockdevOptionsSheepdog:
30553055
return impl, nil
3056-
case BlockdevOptionsSsh:
3056+
case BlockdevOptionsSSH:
30573057
return impl, nil
30583058
case BlockdevOptionsThrottle:
30593059
return impl, nil
@@ -3117,7 +3117,7 @@ func (BlockdevOptionsRaw) isBlockdevRefOrNull() {}
31173117
func (BlockdevOptionsRbd) isBlockdevRefOrNull() {}
31183118
func (BlockdevOptionsReplication) isBlockdevRefOrNull() {}
31193119
func (BlockdevOptionsSheepdog) isBlockdevRefOrNull() {}
3120-
func (BlockdevOptionsSsh) isBlockdevRefOrNull() {}
3120+
func (BlockdevOptionsSSH) isBlockdevRefOrNull() {}
31213121
func (BlockdevOptionsThrottle) isBlockdevRefOrNull() {}
31223122
func (BlockdevOptionsVdi) isBlockdevRefOrNull() {}
31233123
func (BlockdevOptionsVhdx) isBlockdevRefOrNull() {}
@@ -3126,7 +3126,8 @@ func (BlockdevOptionsVpc) isBlockdevRefOrNull() {}
31263126
func (BlockdevOptionsVvfat) isBlockdevRefOrNull() {}
31273127
func (BlockdevOptionsVxhs) isBlockdevRefOrNull() {}
31283128

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

31323133
func (BlockdevRefOrNullNull) isNull() bool { return true }
@@ -3211,7 +3212,7 @@ func decodeBlockdevRefOrNull(bs json.RawMessage) (BlockdevRefOrNull, error) {
32113212
return impl, nil
32123213
case BlockdevOptionsSheepdog:
32133214
return impl, nil
3214-
case BlockdevOptionsSsh:
3215+
case BlockdevOptionsSSH:
32153216
return impl, nil
32163217
case BlockdevOptionsThrottle:
32173218
return impl, nil
@@ -4936,11 +4937,11 @@ func (e *GuestPanicInformationType) UnmarshalJSON(bs []byte) error {
49364937
return nil
49374938
}
49384939

4939-
// GuidInfo -> GuidInfo (struct)
4940+
// GuidInfo -> GUIDInfo (struct)
49404941

4941-
// GuidInfo implements the "GuidInfo" QMP API type.
4942-
type GuidInfo struct {
4943-
Guid string `json:"guid"`
4942+
// GUIDInfo implements the "GuidInfo" QMP API type.
4943+
type GUIDInfo struct {
4944+
GUID string `json:"guid"`
49444945
}
49454946

49464947
// HostMemPolicy -> HostMemPolicy (enum)
@@ -9725,7 +9726,8 @@ type StrOrNull interface {
97259726
isStrOrNull()
97269727
}
97279728

9728-
// Special case handling of JSON null type
9729+
// StrOrNullN is a JSON null type, so it must
9730+
// also implement the isNullable interface.
97299731
type StrOrNullN struct{}
97309732

97319733
func (StrOrNullN) isNull() bool { return true }
@@ -12059,7 +12061,7 @@ func (m *Monitor) Memsave(val int64, size int64, filename string, cpuIndex *int6
1205912061
// Migrate implements the "migrate" QMP API call.
1206012062
func (m *Monitor) Migrate(uri string, blk *bool, inc *bool, detach *bool) (err error) {
1206112063
cmd := struct {
12062-
Uri string `json:"uri"`
12064+
URI string `json:"uri"`
1206312065
Blk *bool `json:"blk,omitempty"`
1206412066
Inc *bool `json:"inc,omitempty"`
1206512067
Detach *bool `json:"detach,omitempty"`
@@ -12088,7 +12090,7 @@ func (m *Monitor) Migrate(uri string, blk *bool, inc *bool, detach *bool) (err e
1208812090
// MigrateIncoming implements the "migrate-incoming" QMP API call.
1208912091
func (m *Monitor) MigrateIncoming(uri string) (err error) {
1209012092
cmd := struct {
12091-
Uri string `json:"uri"`
12093+
URI string `json:"uri"`
1209212094
}{
1209312095
uri,
1209412096
}
@@ -14057,7 +14059,7 @@ func (m *Monitor) QueryVersion() (ret VersionInfo, err error) {
1405714059
// query-vm-generation-id -> QueryVMGenerationID (command)
1405814060

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

0 commit comments

Comments
 (0)